1 | --------------------------------------------------------------- {{{1 ---------- |
---|---|
2 | --: Copyright © 2007 … 2023 Martin Krischik «krischik@users.sourceforge.net» |
3 | ------------------------------------------------------------------------------- |
4 | --: Ada_Demo is free software: you can redistribute it and/or modify it under |
5 | --: the terms of the GNU General Public License as published by the Free |
6 | --: Software Foundation, either version 3 of the License, or (at your option) |
7 | --: any later version. |
8 | --: |
9 | --: Ada_Demo is distributed in the hope that it will be useful, but WITHOUT |
10 | --: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | --: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
12 | --: more details. |
13 | --: |
14 | --: You should have received a copy of the GNU General Public License along |
15 | --: with Ada_Demo. If not, see <http://www.gnu.org/licenses/>. |
16 | --------------------------------------------------------------- }}}1 ---------- |
17 | |
18 | pragma License (Modified_Gpl); |
19 | pragma Ada_2022; |
20 | |
21 | with GNAT.Source_Info; |
22 | |
23 | --- |
24 | -- @summary |
25 | -- Assertions for discreete values |
26 | -- |
27 | -- @description |
28 | -- Additional Asserts which produce more detailed diagnostic messages Diagnostics will be reported via the |
29 | -- Report_Assertion function. The Report function is passed as a generic ot avoid dependence to AUnit. |
30 | -- |
31 | generic |
32 | |
33 | type Float_Type is digits <>; |
34 | Epsilon : Float_Type; |
35 | |
36 | package AdaCL.Assert.Float is |
37 | --- |
38 | -- Assert that a Float value is equal a given value |
39 | -- |
40 | --: @param Actual Actual value |
41 | --: @param Expected Expected value |
42 | --: @param Name Name of variable or function restlt. |
43 | --: @param Source Source code |
44 | --: @param Line Line number |
45 | procedure Equal |
46 | (Actual : Float_Type; |
47 | Expected : Float_Type; |
48 | Name : String; |
49 | Source : String := GNAT.Source_Info.File; |
50 | Line : Natural := GNAT.Source_Info.Line); |
51 | |
52 | --- |
53 | -- Assert that a Float value is not equal a given value |
54 | -- |
55 | --: @param Actual Actual value |
56 | --: @param Expected Expected value |
57 | --: @param Name Name of variable or function restlt. |
58 | --: @param Source Source code |
59 | --: @param Line Line number |
60 | procedure Not_Equal |
61 | (Actual : Float_Type; |
62 | Expected : Float_Type; |
63 | Name : String; |
64 | Source : String := GNAT.Source_Info.File; |
65 | Line : Natural := GNAT.Source_Info.Line); |
66 | |
67 | --- |
68 | -- Assert that a Float value is greater a given value |
69 | -- |
70 | --: @param Actual Actual value |
71 | --: @param Expected Expected value |
72 | --: @param Name Name of variable or function restlt. |
73 | --: @param Source Source code |
74 | --: @param Line Line number |
75 | procedure Greater |
76 | (Actual : Float_Type; |
77 | Expected : Float_Type; |
78 | Name : String; |
79 | Source : String := GNAT.Source_Info.File; |
80 | Line : Natural := GNAT.Source_Info.Line); |
81 | |
82 | --- |
83 | -- Assert that a Float value is greater or equal a given value |
84 | -- |
85 | --: @param Actual Actual value |
86 | --: @param Expected Expected value |
87 | --: @param Name Name of variable or function restlt. |
88 | --: @param Source Source code |
89 | --: @param Line Line number |
90 | procedure Greater_Equal |
91 | (Actual : Float_Type; |
92 | Expected : Float_Type; |
93 | Name : String; |
94 | Source : String := GNAT.Source_Info.File; |
95 | Line : Natural := GNAT.Source_Info.Line); |
96 | |
97 | --- |
98 | -- Assert that a Float value is less a given value |
99 | -- |
100 | --: @param Actual Actual value |
101 | --: @param Expected Expected value |
102 | --: @param Name Name of variable or function restlt. |
103 | --: @param Source Source code |
104 | --: @param Line Line number |
105 | procedure Less |
106 | (Actual : Float_Type; |
107 | Expected : Float_Type; |
108 | Name : String; |
109 | Source : String := GNAT.Source_Info.File; |
110 | Line : Natural := GNAT.Source_Info.Line); |
111 | |
112 | --- |
113 | -- Assert that a Float value is less or equal a given value |
114 | -- |
115 | --: @param Actual Actual value |
116 | --: @param Expected Expected value |
117 | --: @param Name Name of variable or function restlt. |
118 | --: @param Source Source code |
119 | --: @param Line Line number |
120 | procedure Less_Equal |
121 | (Actual : Float_Type; |
122 | Expected : Float_Type; |
123 | Name : String; |
124 | Source : String := GNAT.Source_Info.File; |
125 | Line : Natural := GNAT.Source_Info.Line); |
126 | |
127 | --- |
128 | -- Assert that an Float value is inside range |
129 | -- |
130 | --: @param Actual Actual value |
131 | --: @param First Expected minimum value |
132 | --: @param Last Expected maximum value |
133 | --: @param Name Name of variable or function restlt. |
134 | --: @param Source Source code |
135 | --: @param Line Line number |
136 | procedure In_Range |
137 | (Actual : Float_Type; |
138 | First : Float_Type; |
139 | Last : Float_Type; |
140 | Name : String; |
141 | Source : String := GNAT.Source_Info.File; |
142 | Line : Natural := GNAT.Source_Info.Line); |
143 | |
144 | end AdaCL.Assert.Float; |
145 | |
146 | ---------------------------------------------------------------- {{{ ---------- |
147 | --: vim: set textwidth=0 nowrap tabstop=8 shiftwidth=3 softtabstop=3 expandtab : |
148 | --: vim: set filetype=ada fileencoding=utf-8 fileformat=unix foldmethod=marker : |
149 | --: vim: set spell spelllang=en_gb |