114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
(Name => "Canonical encoding",
Source => To_Atom (Sample_Image),
Expected => To_Atom (Sample_Image));
begin
Test (Report);
end Canonical_Encoding;
procedure Close_Current_List (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Close_Current_List primitive");
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
begin
Input.Set_Data (To_Atom ("3:The(5:quick((5:brown3:fox)5:jumps))"
& "(4:over()3:the)4:lazy(0:3:dog)3:the3:end"));
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("The"), 0);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("quick"), 1);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 2);
Parser.Close_Current_List;
Test_Tools.Next_And_Check (Test, Parser, Events.Close_List, 0);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("over"), 1);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 2);
Test_Tools.Next_And_Check (Test, Parser, Events.Close_List, 1);
Parser.Close_Current_List;
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("lazy"), 0);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Test_Tools.Next_And_Check (Test, Parser, To_Atom (""), 1);
Parser.Close_Current_List;
Test_Tools.Next_And_Check (Test, Parser, To_Atom ("the"), 0);
Parser.Close_Current_List;
Check_Last_Event :
declare
Last_Event : constant Events.Event := Parser.Current_Event;
begin
if Last_Event /= Events.End_Of_Input then
Test.Fail ("Unexpected last event "
& Events.Event'Image (Last_Event));
end if;
end Check_Last_Event;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Close_Current_List;
procedure Lockable_Interface (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Lockable.Descriptor interface");
begin
declare
Input : aliased Test_Tools.Memory_Stream;
Parser : Parsers.Stream_Parser (Input'Access);
|