27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Basic_Usage (Report);
end All_Tests;
----------------------
-- Individual Tests --
----------------------
|
>
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Basic_Usage (Report);
Invalid_Atom (Report);
end All_Tests;
----------------------
-- Individual Tests --
----------------------
|
60
61
62
63
64
65
66
67
|
& Stream_IO.File_Mode'Image (Expected));
end if;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Basic_Usage;
end Natools.S_Expressions.Enumeration_IO.Tests;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
& Stream_IO.File_Mode'Image (Expected));
end if;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Basic_Usage;
procedure Invalid_Atom (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Value on invalid atoms");
use type Stream_IO.File_Mode;
begin
Without_Fallback :
declare
Found : Stream_IO.File_Mode;
begin
Found := Test_IO.Value (To_Atom ("invalid-atom"));
Test.Fail ("Exception expected, but Value returned "
& Stream_IO.File_Mode'Image (Found));
exception
when Constraint_Error => null;
end Without_Fallback;
With_Fallback :
declare
Expected : constant Stream_IO.File_Mode := Stream_IO.Out_File;
Found : constant Stream_IO.File_Mode
:= Test_IO.Value (To_Atom ("invalid-atom"), Expected);
begin
if Expected /= Found then
Test.Fail ("Test_IO.Value returned "
& Stream_IO.File_Mode'Image (Found)
& ", expected "
& Stream_IO.File_Mode'Image (Expected));
end if;
end With_Fallback;
exception
when Error : others => Test.Report_Exception (Error);
end Invalid_Atom;
end Natools.S_Expressions.Enumeration_IO.Tests;
|