adacl-assert-arrays.ads

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
18pragma License (Modified_Gpl);
19pragma Ada_2022;
20
21with 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--
31generic
32 type Element_Type is limited private;
33 type Index_Type is (<>);
34 type Array_Type is
35 array (Index_Type range <>)
36 of Element_Type;
37 with function "=" (X, Y : Array_Type) return Boolean is <>;
38package AdaCL.Assert.Arrays is
39
40 ---
41 -- Assert that a array is equal a given value
42 --
43 --: @param Actual Actual value
44 --: @param Expected Expected value
45 --: @param Name Name of variable or function restlt.
46 --: @param Source Source code
47 --: @param Line Line number
48 procedure Equal
49 (Actual : Array_Type;
50 Expected : Array_Type;
51 Name : String;
52 Source : String := GNAT.Source_Info.File;
53 Line : Natural := GNAT.Source_Info.Line);
54
55 ---
56 -- Assert that a array is of given length
57 --
58 --: @param Actual Actual value
59 --: @param Expected Expected value
60 --: @param Name Name of variable or function restlt.
61 --: @param Source Source code
62 --: @param Line Line number
63 procedure Length
64 (Actual : Array_Type;
65 Expected : Natural;
66 Name : String;
67 Source : String := GNAT.Source_Info.File;
68 Line : Natural := GNAT.Source_Info.Line);
69end AdaCL.Assert.Arrays;
70
71---------------------------------------------------------------- {{{ ----------
72--: vim: set textwidth=0 nowrap tabstop=8 shiftwidth=3 softtabstop=3 expandtab :
73--: vim: set filetype=ada fileencoding=utf-8 fileformat=unix foldmethod=marker :
74--: vim: set spell spelllang=en_gb