1
2
3
4
5
6
7
8
9
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
|
|
1
2
3
4
5
6
7
8
9
|
------------------------------------------------------------------------------
-- Copyright (c) 2014-2015, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
Stream : aliased Test_Tools.Memory_Stream;
Printer : Canonical (Stream'Access);
begin
Stream.Set_Expected (To_Atom
("3:The(5:quick((5:brown3:fox)()))"
& "(5:jumps)9:over3:the()4:lazy0:3:dog"));
Printer.Append_Atom (To_Atom ("The"));
Printer.Open_List;
Printer.Append_Atom (To_Atom ("quick"));
Printer.Open_List;
Printer.Open_List;
Printer.Append_Atom (To_Atom ("brown"));
Printer.Append_Atom (To_Atom ("fox"));
Printer.Close_List;
Printer.Open_List;
Printer.Close_List;
Printer.Close_List;
Printer.Close_List;
Printer.Open_List;
Printer.Append_Atom (To_Atom ("jumps"));
Printer.Close_List;
Printer.Append_Atom (To_Atom ("over3:the"));
Printer.Open_List;
Printer.Close_List;
Printer.Append_Atom (To_Atom ("lazy"));
Printer.Append_Atom (Null_Atom);
Printer.Append_Atom (To_Atom ("dog"));
if Stream.Has_Mismatch
or else Stream.Unread_Expected /= Null_Atom
then
Report.Item (Name, NT.Fail);
Report.Info ("Mismatch at position"
& Count'Image (Stream.Mismatch_Index));
|
|
|
|
|
|
|
|
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
Stream : aliased Test_Tools.Memory_Stream;
Printer : Canonical (Stream'Access);
begin
Stream.Set_Expected (To_Atom
("3:The(5:quick((5:brown3:fox)()))"
& "(5:jumps)9:over3:the()4:lazy0:3:dog"));
Printer.Append_String ("The");
Printer.Open_List;
Printer.Append_String ("quick");
Printer.Open_List;
Printer.Open_List;
Printer.Append_String ("brown");
Printer.Append_String ("fox");
Printer.Close_List;
Printer.Open_List;
Printer.Close_List;
Printer.Close_List;
Printer.Close_List;
Printer.Open_List;
Printer.Append_String ("jumps");
Printer.Close_List;
Printer.Append_String ("over3:the");
Printer.Open_List;
Printer.Close_List;
Printer.Append_String ("lazy");
Printer.Append_Atom (Null_Atom);
Printer.Append_String ("dog");
if Stream.Has_Mismatch
or else Stream.Unread_Expected /= Null_Atom
then
Report.Item (Name, NT.Fail);
Report.Info ("Mismatch at position"
& Count'Image (Stream.Mismatch_Index));
|