Index: tests/natools-s_expressions-test_tools.adb ================================================================== --- tests/natools-s_expressions-test_tools.adb +++ tests/natools-s_expressions-test_tools.adb @@ -375,10 +375,54 @@ Test.Fail ("Wrong exception raised in Read_Atom"); Test.Report_Exception (Error, NT.Fail); end Read_Atom_Test; end Test_Atom_Accessor_Exceptions; + + procedure Next_And_Check + (Test : in out NT.Test; + Tested : in out Descriptor'Class; + Expected : in Events.Event; + Level : in Natural) + is + Event : Events.Event; + begin + Tested.Next (Event); + if Event /= Expected then + Test.Fail ("Found event " + & Events.Event'Image (Event) + & ", expected " + & Events.Event'Image (Expected)); + elsif Tested.Current_Level /= Level then + Test.Fail ("Found event " + & Events.Event'Image (Event) + & " at level" + & Integer'Image (Tested.Current_Level) + & ", expected" + & Integer'Image (Level)); + end if; + end Next_And_Check; + + + procedure Next_And_Check + (Test : in out NT.Test; + Tested : in out Descriptor'Class; + Expected : in Atom; + Level : in Natural) + is + Event : Events.Event; + begin + Tested.Next (Event); + if Event /= Events.Add_Atom then + Test.Fail ("Found event " + & Events.Event'Image (Event) + & ", expected Add_Atom"); + else + Test_Tools.Test_Atom_Accessors (Test, Tested, Expected, Level); + end if; + end Next_And_Check; + ------------------- -- Memory Stream -- ------------------- Index: tests/natools-s_expressions-test_tools.ads ================================================================== --- tests/natools-s_expressions-test_tools.ads +++ tests/natools-s_expressions-test_tools.ads @@ -66,10 +66,25 @@ procedure Test_Atom_Accessor_Exceptions (Test : in out NT.Test; Tested : in Descriptor'Class); -- Check that all atom accessors raise Program_Error + procedure Next_And_Check + (Test : in out NT.Test; + Tested : in out Descriptor'Class; + Expected : in Events.Event; + Level : in Natural); + -- Call Tested.Next and check the current event and level + + procedure Next_And_Check + (Test : in out NT.Test; + Tested : in out Descriptor'Class; + Expected : in Atom; + Level : in Natural); + -- Call Tested.Next and check current event is Add_Atom with Expected, + -- using Test_Atom_Accessors. + type Memory_Stream is new Ada.Streams.Root_Stream_Type with private; overriding procedure Read (Stream : in out Memory_Stream;