Overview
Comment: | s_expressions-test_tools: a function to build a S-expression directly from a string |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f0e8bc08bdc94367845880bdc802785d |
User & Date: | nat on 2015-04-04 21:43:04 |
Other Links: | manifest | tags |
Context
2015-04-10
| ||
21:14 | s_expressions: add equality operator on atoms, so clients don't have to depend on Ada.Streams check-in: e76def5969 user: nat tags: trunk | |
2015-04-04
| ||
21:43 | s_expressions-test_tools: a function to build a S-expression directly from a string check-in: f0e8bc08bd user: nat tags: trunk | |
2015-04-03
| ||
21:35 | static_maps-s_expressions-conditionals: add missing package in previous commits check-in: 6078a77bb3 user: nat tags: trunk | |
Changes
Modified tests/natools-s_expressions-test_tools.adb from [d2726429df] to [46b749c9e6].
1 | ------------------------------------------------------------------------------ | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ------------------------------------------------------------------------------ -- Copyright (c) 2013-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 -- -- 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.Parsers; package body Natools.S_Expressions.Test_Tools is Hex_Digits : constant String := "0123456789ABCDEF"; function Encode_Hex (Value : Offset; Length : Positive) return String; function Hex_Slice |
︙ | ︙ | |||
479 480 481 482 483 484 485 486 487 488 489 490 491 492 | & ", expected Add_Atom"); else Test_Tools.Test_Atom_Accessors (Test, Tested, Expected, Level, Context); end if; end Next_And_Check; ------------------- -- Memory Stream -- ------------------- overriding procedure Read | > > > > > > > > > > > > > > > > | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | & ", expected Add_Atom"); else Test_Tools.Test_Atom_Accessors (Test, Tested, Expected, Level, Context); end if; end Next_And_Check; function To_S_Expression (Text : String) return Caches.Reference is begin return To_S_Expression (To_Atom (Text)); end To_S_Expression; function To_S_Expression (Data : Atom) return Caches.Reference is Stream : aliased Memory_Stream; Parser : Parsers.Stream_Parser (Stream'Access); begin Stream.Write (Data); Parser.Next; return Caches.Move (Parser); end To_S_Expression; ------------------- -- Memory Stream -- ------------------- overriding procedure Read |
︙ | ︙ |
Modified tests/natools-s_expressions-test_tools.ads from [f92adbfc76] to [75eef0e387].
1 | ------------------------------------------------------------------------------ | | | 1 2 3 4 5 6 7 8 9 | ------------------------------------------------------------------------------ -- Copyright (c) 2013-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 -- |
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ------------------------------------------------------------------------------ with Ada.Streams; with Natools.Tests; with Natools.S_Expressions.Atom_Buffers; package Natools.S_Expressions.Test_Tools is pragma Preelaborate (Test_Tools); package NT renames Natools.Tests; procedure Dump_Atom | > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ------------------------------------------------------------------------------ with Ada.Streams; with Natools.Tests; with Natools.S_Expressions.Atom_Buffers; with Natools.S_Expressions.Caches; package Natools.S_Expressions.Test_Tools is pragma Preelaborate (Test_Tools); package NT renames Natools.Tests; procedure Dump_Atom |
︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | Tested : in out Descriptor'Class; Expected : in Atom; Level : in Natural; Context : in String := ""); -- 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; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); | > > > > > | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | Tested : in out Descriptor'Class; Expected : in Atom; Level : in Natural; Context : in String := ""); -- Call Tested.Next and check current event is Add_Atom with Expected, -- using Test_Atom_Accessors. function To_S_Expression (Text : String) return Caches.Reference; function To_S_Expression (Data : Atom) return Caches.Reference; -- Store a S-expression from its serialization type Memory_Stream is new Ada.Streams.Root_Stream_Type with private; overriding procedure Read (Stream : in out Memory_Stream; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset); |
︙ | ︙ |