Natools

Check-in [ef36376c9f]
Login
Overview
Comment:s_expressions-cache_tests: test the new Move functions
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ef36376c9fbf1262c3204071dbc4149b22d2bbe6
User & Date: nat on 2014-09-12 21:41:27
Other Links: manifest | tags
Context
2014-09-13
14:03
s_expressions-printers: make level-checked Transfer go beyond the first list check-in: 7568f1efd7 user: nat tags: trunk
2014-09-12
21:41
s_expressions-cache_tests: test the new Move functions check-in: ef36376c9f user: nat tags: trunk
2014-09-11
19:19
s_expressions-generic_caches: add Move functions to build a cache directly from a descriptor check-in: 86680251f9 user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-cache_tests.adb from [8372577f83] to [a1517afdd4].

75
76
77
78
79
80
81

82
83
84
85
86
87
88
   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Default_Instantiation (Report);
      Debug_Instantiation (Report);
      Descriptor_Interface (Report);
      Lockable_Interface (Report);
      Replayable_Interface (Report);

   end All_Tests;


   -----------------------
   -- Inidividual Tests --
   -----------------------








>







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
   procedure All_Tests (Report : in out NT.Reporter'Class) is
   begin
      Default_Instantiation (Report);
      Debug_Instantiation (Report);
      Descriptor_Interface (Report);
      Lockable_Interface (Report);
      Replayable_Interface (Report);
      Duplication (Report);
   end All_Tests;


   -----------------------
   -- Inidividual Tests --
   -----------------------

307
308
309
310
311
312
313



























































314
315
316
317
318
319
320
         Test_Tools.Next_And_Check (Test, First, Events.End_Of_Input, 0);
         Test_Tools.Next_And_Check (Test, Second, Events.End_Of_Input, 0);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Descriptor_Interface;





























































   procedure Lockable_Interface (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Lockable.Descriptor insterface");
   begin
      declare
         Cache : Caches.Reference;
      begin







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
         Test_Tools.Next_And_Check (Test, First, Events.End_Of_Input, 0);
         Test_Tools.Next_And_Check (Test, Second, Events.End_Of_Input, 0);
      end;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Descriptor_Interface;


   procedure Duplication (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Duplication of general descriptor");
   begin
      Full_Duplication :
      declare
         Input : aliased Test_Tools.Memory_Stream;
         Parser : Parsers.Stream_Parser (Input'Access);
      begin
         Input.Set_Data (Lockable.Tests.Test_Expression);
         Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);

         declare
            Image : Caches.Cursor := Caches.Move (Parser);
         begin
            Lockable.Tests.Test_Interface (Test, Image);
         end;
      end Full_Duplication;

      Partial_Duplication :
      declare
         Input : aliased Test_Tools.Memory_Stream;
         Parser : Parsers.Stream_Parser (Input'Access);
         Copy : Caches.Cursor;
      begin
         Input.Set_Data (To_Atom
           ("(first_part (command-1) (command-2 arg-1 arg-2) end)"
            & "(second_part (command-3 arg-3) final)"));
         Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
         Test_Tools.Next_And_Check (Test, Parser, To_Atom ("first_part"), 1);

         Copy := Caches.Move (Parser);

         Test_Tools.Test_Atom_Accessors
           (Test, Copy, To_Atom ("first_part"), 0);
         Test_Tools.Next_And_Check (Test, Copy, Events.Open_List, 1);
         Test_Tools.Next_And_Check (Test, Copy, To_Atom ("command-1"), 1);
         Test_Tools.Next_And_Check (Test, Copy, Events.Close_List, 0);
         Test_Tools.Next_And_Check (Test, Copy, Events.Open_List, 1);
         Test_Tools.Next_And_Check (Test, Copy, To_Atom ("command-2"), 1);
         Test_Tools.Next_And_Check (Test, Copy, To_Atom ("arg-1"), 1);
         Test_Tools.Next_And_Check (Test, Copy, To_Atom ("arg-2"), 1);
         Test_Tools.Next_And_Check (Test, Copy, Events.Close_List, 0);
         Test_Tools.Next_And_Check (Test, Copy, To_Atom ("end"), 0);
         Test_Tools.Next_And_Check (Test, Copy, Events.End_Of_Input, 0);

         Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
         Test_Tools.Next_And_Check (Test, Parser, To_Atom ("second_part"), 1);
         Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 2);
         Test_Tools.Next_And_Check (Test, Parser, To_Atom ("command-3"), 2);
         Test_Tools.Next_And_Check (Test, Parser, To_Atom ("arg-3"), 2);
         Test_Tools.Next_And_Check (Test, Parser, Events.Close_List, 1);
         Test_Tools.Next_And_Check (Test, Parser, To_Atom ("final"), 1);
         Test_Tools.Next_And_Check (Test, Parser, Events.Close_List, 0);
      end Partial_Duplication;
   exception
      when Error : others => Test.Report_Exception (Error);
   end Duplication;


   procedure Lockable_Interface (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Lockable.Descriptor insterface");
   begin
      declare
         Cache : Caches.Reference;
      begin

Modified tests/natools-s_expressions-cache_tests.ads from [793d6401a2] to [392a65dc27].

27
28
29
30
31
32
33

34
35
36
37
   package NT renames Natools.Tests;

   procedure All_Tests (Report : in out NT.Reporter'Class);

   procedure Debug_Instantiation (Report : in out NT.Reporter'Class);
   procedure Default_Instantiation (Report : in out NT.Reporter'Class);
   procedure Descriptor_Interface (Report : in out NT.Reporter'Class);

   procedure Lockable_Interface (Report : in out NT.Reporter'Class);
   procedure Replayable_Interface (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Cache_Tests;







>




27
28
29
30
31
32
33
34
35
36
37
38
   package NT renames Natools.Tests;

   procedure All_Tests (Report : in out NT.Reporter'Class);

   procedure Debug_Instantiation (Report : in out NT.Reporter'Class);
   procedure Default_Instantiation (Report : in out NT.Reporter'Class);
   procedure Descriptor_Interface (Report : in out NT.Reporter'Class);
   procedure Duplication (Report : in out NT.Reporter'Class);
   procedure Lockable_Interface (Report : in out NT.Reporter'Class);
   procedure Replayable_Interface (Report : in out NT.Reporter'Class);

end Natools.S_Expressions.Cache_Tests;