Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | s_expressions-parsers-tests: adapt the test suite to the new Parsers packet |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
b02835bdfa4273439e1816d3eb2b7a6e |
| User & Date: | nat 2014-03-27 21:24:09.498 |
Context
|
2014-03-28
| ||
| 20:20 | s_expressions-parsers: return End_Of_Input on locked objects, to behave like genuine S-expression end check-in: 9f0aaf857d user: nat tags: trunk | |
|
2014-03-27
| ||
| 21:24 | s_expressions-parsers-tests: adapt the test suite to the new Parsers packet check-in: b02835bdfa user: nat tags: trunk | |
|
2014-03-26
| ||
| 19:10 | Migrate from Subpraser to Stream_Parser in the whole code base check-in: 9f0014f72d user: nat tags: trunk | |
Changes
Changes to tests/natools-s_expressions-parsers-tests.adb.
| ︙ | ︙ | |||
16 17 18 19 20 21 22 | with Natools.S_Expressions.Lockable.Tests; with Natools.S_Expressions.Printers; with Natools.S_Expressions.Test_Tools; package body Natools.S_Expressions.Parsers.Tests is | < < < < < < < < < | < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < | | < | < < | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 66 67 68 69 70 71 72 73 74 75 |
with Natools.S_Expressions.Lockable.Tests;
with Natools.S_Expressions.Printers;
with Natools.S_Expressions.Test_Tools;
package body Natools.S_Expressions.Parsers.Tests is
generic
Name : String;
Source, Expected : Atom;
procedure Blackbox_Test (Report : in out NT.Reporter'Class);
-- Perform a simple blackbox test, feeding Source to a new parser
-- plugged on a canonical printer and comparing with Expected.
------------------------------
-- Local Helper Subprograms --
------------------------------
procedure Blackbox_Test (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item (Name);
begin
declare
Input, Output : aliased Test_Tools.Memory_Stream;
Printer : Printers.Canonical (Output'Access);
Parser : Parsers.Stream_Parser (Input'Access);
begin
Output.Set_Expected (Expected);
Input.Set_Data (Source);
Parser.Next;
Printers.Transfer (Parser, Printer);
Output.Check_Stream (Test);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Blackbox_Test;
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Canonical_Encoding (Report);
Atom_Encodings (Report);
Base64_Subexpression (Report);
Special_Subexpression (Report);
Nested_Subpexression (Report);
Number_Prefixes (Report);
Quoted_Escapes (Report);
Lockable_Interface (Report);
end All_Tests;
-----------------------
-- Inidividual Tests --
|
| ︙ | ︙ | |||
173 174 175 176 177 178 179 |
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;
| < | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
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);
begin
Input.Set_Data (Lockable.Tests.Test_Expression);
Test_Tools.Next_And_Check (Test, Parser, Events.Open_List, 1);
Lockable.Tests.Test_Interface (Test, Parser);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Lockable_Interface;
procedure Nested_Subpexression (Report : in out NT.Reporter'Class) is
|
| ︙ | ︙ | |||
216 217 218 219 220 221 222 |
& "(5:valid6:quoted11:hexadecimal7:base-647:expr-64)"
& "(9:undefined2:423:10%3:123()2:10)"
& "(7:invalid6:quoted11:hexadecimal7:base-647:expr-64)"));
begin
Test (Report);
end Number_Prefixes;
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
& "(5:valid6:quoted11:hexadecimal7:base-647:expr-64)"
& "(9:undefined2:423:10%3:123()2:10)"
& "(7:invalid6:quoted11:hexadecimal7:base-647:expr-64)"));
begin
Test (Report);
end Number_Prefixes;
procedure Quoted_Escapes (Report : in out NT.Reporter'Class) is
CR : constant Character := Character'Val (13);
LF : constant Character := Character'Val (10);
procedure Test is new Blackbox_Test
(Name => "Escapes in quoted encoding",
|
| ︙ | ︙ | |||
427 428 429 430 431 432 433 |
& "10:hidden-end)(12:hidden-begin"
& "3:end)"
& "(16:overflowing atom)"));
begin
Test (Report);
end Special_Subexpression;
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 201 202 203 204 205 206 207 208 |
& "10:hidden-end)(12:hidden-begin"
& "3:end)"
& "(16:overflowing atom)"));
begin
Test (Report);
end Special_Subexpression;
end Natools.S_Expressions.Parsers.Tests;
|
Changes to tests/natools-s_expressions-parsers-tests.ads.
| ︙ | ︙ | |||
30 31 32 33 34 35 36 | procedure Atom_Encodings (Report : in out NT.Reporter'Class); procedure Base64_Subexpression (Report : in out NT.Reporter'Class); procedure Canonical_Encoding (Report : in out NT.Reporter'Class); procedure Lockable_Interface (Report : in out NT.Reporter'Class); procedure Nested_Subpexression (Report : in out NT.Reporter'Class); procedure Number_Prefixes (Report : in out NT.Reporter'Class); | < < | 30 31 32 33 34 35 36 37 38 39 40 | procedure Atom_Encodings (Report : in out NT.Reporter'Class); procedure Base64_Subexpression (Report : in out NT.Reporter'Class); procedure Canonical_Encoding (Report : in out NT.Reporter'Class); procedure Lockable_Interface (Report : in out NT.Reporter'Class); procedure Nested_Subpexression (Report : in out NT.Reporter'Class); procedure Number_Prefixes (Report : in out NT.Reporter'Class); procedure Quoted_Escapes (Report : in out NT.Reporter'Class); procedure Special_Subexpression (Report : in out NT.Reporter'Class); end Natools.S_Expressions.Parsers.Tests; |
Changes to tests/test_all.adb.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 | with Natools.Getopt_Long_Tests; with Natools.Reference_Tests; with Natools.S_Expressions.Atom_Buffers.Tests; with Natools.S_Expressions.Cache_Tests; with Natools.S_Expressions.Encodings.Tests; with Natools.S_Expressions.Interpreter_Tests; with Natools.S_Expressions.Lockable.Tests; | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | with Natools.Getopt_Long_Tests; with Natools.Reference_Tests; with Natools.S_Expressions.Atom_Buffers.Tests; with Natools.S_Expressions.Cache_Tests; with Natools.S_Expressions.Encodings.Tests; with Natools.S_Expressions.Interpreter_Tests; with Natools.S_Expressions.Lockable.Tests; with Natools.S_Expressions.Parsers.Tests; with Natools.S_Expressions.Printers.Tests; with Natools.S_Expressions.Printers.Pretty.Tests; with Natools.S_Expressions.Printers.Pretty.Config.Tests; with Natools.String_Slice_Set_Tests; with Natools.String_Slice_Tests; with Natools.Tests.Text_IO; |
| ︙ | ︙ | |||
93 94 95 96 97 98 99 |
Natools.S_Expressions.Interpreter_Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Lockable");
Natools.S_Expressions.Lockable.Tests.All_Tests (Report);
Report.End_Section;
| | | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
Natools.S_Expressions.Interpreter_Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Lockable");
Natools.S_Expressions.Lockable.Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Parsers");
Natools.S_Expressions.Parsers.Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Printers");
Natools.S_Expressions.Printers.Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Printers.Pretty");
Natools.S_Expressions.Printers.Pretty.Tests.All_Tests (Report);
|
| ︙ | ︙ |