Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | s_expressions-printers-tests: fully-covering test suite for canonical atom printer |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
08a213ab1fdaa9aafb8cfc727987d9b6 |
| User & Date: | nat 2014-01-09 22:19:52.659 |
Context
|
2014-01-10
| ||
| 22:49 | s_expressions-parsers: new package containing an event-base S-expression parser check-in: dffc102c0d user: nat tags: trunk | |
|
2014-01-09
| ||
| 22:19 | s_expressions-printers-tests: fully-covering test suite for canonical atom printer check-in: 08a213ab1f user: nat tags: trunk | |
|
2014-01-08
| ||
| 20:14 | s_expressions-test_tools: new type memory stream to test input and output interfaces to streams check-in: e57fb70751 user: nat tags: trunk | |
Changes
Added tests/natools-s_expressions-printers-tests.adb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 76 77 78 |
------------------------------------------------------------------------------
-- 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 --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Test_Tools;
package body Natools.S_Expressions.Printers.Tests is
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Canonical_Test (Report);
end All_Tests;
procedure Canonical_Test (Report : in out NT.Reporter'Class) is
Name : constant String := "Canonical encoding";
begin
declare
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));
Report.Info ("Left to expect: """
& To_String (Stream.Unread_Expected) & '"');
Report.Info ("Written data: """
& To_String (Stream.Get_Data) & '"');
else
Report.Item (Name, NT.Success);
end if;
end;
exception
when Error : others => Report.Report_Exception (Name, Error);
end Canonical_Test;
end Natools.S_Expressions.Printers.Tests;
|
Added tests/natools-s_expressions-printers-tests.ads.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ------------------------------------------------------------------------------ -- 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 -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.S_Expressions.Printers.Tests provides a test suite for the -- -- canonical printer. -- ------------------------------------------------------------------------------ with Natools.Tests; package Natools.S_Expressions.Printers.Tests is pragma Preelaborate (Tests); package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); procedure Canonical_Test (Report : in out NT.Reporter'Class); end Natools.S_Expressions.Printers.Tests; |
Changes to tests/test_all.adb.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
with Ada.Command_Line;
with Ada.Text_IO;
with Natools.Chunked_Strings.Tests;
with Natools.Getopt_Long_Tests;
with Natools.Reference_Tests;
with Natools.S_Expressions.Atom_Buffers.Tests;
with Natools.S_Expressions.Encodings.Tests;
with Natools.String_Slice_Set_Tests;
with Natools.String_Slice_Tests;
with Natools.Tests.Text_IO;
procedure Test_All is
package Uneven_Chunked_Strings is new Natools.Chunked_Strings
(Default_Allocation_Unit => 7,
| > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
with Ada.Command_Line;
with Ada.Text_IO;
with Natools.Chunked_Strings.Tests;
with Natools.Getopt_Long_Tests;
with Natools.Reference_Tests;
with Natools.S_Expressions.Atom_Buffers.Tests;
with Natools.S_Expressions.Encodings.Tests;
with Natools.S_Expressions.Printers.Tests;
with Natools.String_Slice_Set_Tests;
with Natools.String_Slice_Tests;
with Natools.Tests.Text_IO;
procedure Test_All is
package Uneven_Chunked_Strings is new Natools.Chunked_Strings
(Default_Allocation_Unit => 7,
|
| ︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
Report.Section ("S_Expressions.Atom_Buffers");
Natools.S_Expressions.Atom_Buffers.Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Encodings");
Natools.S_Expressions.Encodings.Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("String_Slices");
Natools.String_Slice_Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("String_Slices.Slice_Sets");
Natools.String_Slice_Set_Tests.All_Tests (Report);
| > > > > | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
Report.Section ("S_Expressions.Atom_Buffers");
Natools.S_Expressions.Atom_Buffers.Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("S_Expressions.Encodings");
Natools.S_Expressions.Encodings.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 ("String_Slices");
Natools.String_Slice_Tests.All_Tests (Report);
Report.End_Section;
Report.Section ("String_Slices.Slice_Sets");
Natools.String_Slice_Set_Tests.All_Tests (Report);
|
| ︙ | ︙ |