summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2019-01-14 14:59:54 +1100
committerJed Barber <jjbarber@y7mail.com>2019-01-14 14:59:54 +1100
commitc0ba281a0bf3edc564a4fee61375691f35632be4 (patch)
treeb6628e49035f21b1f744ad22d684a1b63bafff6b /test
parent93406e9b26f9e4439a8e4d57659489323a4e57b4 (diff)
Merged Packrat.Lexer.Combinators into Packrat.Lexer, separated debugging functions into subpackage in /test subdir
Diffstat (limited to 'test')
-rw-r--r--test/packrat-lexer-debug.adb91
-rw-r--r--test/packrat-lexer-debug.ads37
-rw-r--r--test/ratnest-tests.adb248
3 files changed, 252 insertions, 124 deletions
diff --git a/test/packrat-lexer-debug.adb b/test/packrat-lexer-debug.adb
new file mode 100644
index 0000000..fdd9ae4
--- /dev/null
+++ b/test/packrat-lexer-debug.adb
@@ -0,0 +1,91 @@
+
+
+package body Packrat.Lexer.Debug is
+
+
+ function Create_Result
+ (Length : in Natural;
+ Status : in Result_Status;
+ Value : in Element_Array)
+ return Combinator_Result
+ is
+ This : Combinator_Result;
+ begin
+ This.Length := Length;
+ This.Status := Status;
+ This.Value := new Element_Array (1 .. Value'Length);
+ This.Value.all := Value;
+ return This;
+ end Create_Result;
+
+
+ function Join
+ (Left, Right : in Combinator_Result)
+ return Combinator_Result
+ is
+ Merge : Combinator_Result;
+ Left_Valsize, Right_Valsize, Total_Valsize : Natural;
+ begin
+ if Left.Value /= null then
+ Left_Valsize := Left.Value.all'Length;
+ else
+ Left_Valsize := 0;
+ end if;
+ if Right.Value /= null then
+ Right_Valsize := Right.Value.all'Length;
+ else
+ Right_Valsize := 0;
+ end if;
+ Total_Valsize := Left_Valsize + Right_Valsize;
+
+ if Left.Status = Success or Left.Status = Optional_More then
+ Merge.Length := Left.Length + Right.Length;
+ Merge.Status := Right.Status;
+ if Total_Valsize > 0 then
+ Merge.Value := new Element_Array (1 .. Total_Valsize);
+ if Left.Value /= null then
+ Merge.Value.all (1 .. Left_Valsize) := Left.Value.all;
+ end if;
+ if Right.Value /= null then
+ Merge.Value.all (Left_Valsize + 1 .. Total_Valsize) := Right.Value.all;
+ end if;
+ end if;
+ return Merge;
+ elsif Left.Status = Needs_More then
+ Merge := Left;
+ Merge.Status := Failure;
+ return Merge;
+ else
+ return Left;
+ end if;
+ end Join;
+
+
+ function Status
+ (This : in Combinator_Result)
+ return Result_Status is
+ begin
+ return This.Status;
+ end Status;
+
+
+ function Debug_String
+ (This : in Combinator_Result)
+ return String
+ is
+ Value_Length : Natural;
+ begin
+ if This.Value = null then
+ Value_Length := 0;
+ else
+ Value_Length := This.Value.all'Length;
+ end if;
+ return Integer'Image (This.Length)
+ & " " & Result_Status'Image (This.Status)
+ & " " & Integer'Image (Value_Length);
+ end Debug_String;
+
+
+end Packrat.Lexer.Debug;
+
+
diff --git a/test/packrat-lexer-debug.ads b/test/packrat-lexer-debug.ads
new file mode 100644
index 0000000..e8ddf7b
--- /dev/null
+++ b/test/packrat-lexer-debug.ads
@@ -0,0 +1,37 @@
+
+
+generic
+package Packrat.Lexer.Debug is
+
+
+ Empty_Fail : constant Combinator_Result;
+
+
+ function Create_Result
+ (Length : in Natural;
+ Status : in Result_Status;
+ Value : in Element_Array)
+ return Combinator_Result;
+
+ function Join
+ (Left, Right : in Combinator_Result)
+ return Combinator_Result;
+
+ function Status
+ (This : in Combinator_Result)
+ return Result_Status;
+
+ function Debug_String
+ (This : in Combinator_Result)
+ return String;
+
+
+private
+
+
+ Empty_Fail : constant Combinator_Result := Packrat.Lexer.Empty_Fail;
+
+
+end Packrat.Lexer.Debug;
+
+
diff --git a/test/ratnest-tests.adb b/test/ratnest-tests.adb
index 6f649d9..ebe4dae 100644
--- a/test/ratnest-tests.adb
+++ b/test/ratnest-tests.adb
@@ -4,7 +4,7 @@ with
Ada.Characters.Latin_1,
Ada.Strings.Maps,
- Packrat.Lexer.Combinators,
+ Packrat.Lexer.Debug,
Packrat.Util;
@@ -237,7 +237,7 @@ package body Ratnest.Tests is
package String_Tokens is new Packrat.Tokens (My_Labels, Character, String);
package Slexy is new Packrat.Lexer (My_Labels, Character, String, String_Tokens);
- package Strombo is new Slexy.Combinators;
+ package Slebug is new Slexy.Debug;
use type Slexy.Combinator_Result;
@@ -250,35 +250,35 @@ package body Ratnest.Tests is
return Test_Result
is
One : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "a");
+ Slebug.Create_Result (1, Packrat.Success, "a");
Two : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Success, "bc");
+ Slebug.Create_Result (2, Packrat.Success, "bc");
Three : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "abc");
+ Slebug.Create_Result (3, Packrat.Success, "abc");
Four : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Failure, "xyz");
+ Slebug.Create_Result (3, Packrat.Failure, "xyz");
Five : Slexy.Combinator_Result :=
- Slexy.Create_Result (4, Packrat.Failure, "axyz");
+ Slebug.Create_Result (4, Packrat.Failure, "axyz");
Six : Slexy.Combinator_Result :=
- Slexy.Create_Result (4, Packrat.Needs_More, "cd");
+ Slebug.Create_Result (4, Packrat.Needs_More, "cd");
Seven : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Needs_More, "acd");
+ Slebug.Create_Result (5, Packrat.Needs_More, "acd");
Eight : Slexy.Combinator_Result :=
- Slexy.Create_Result (4, Packrat.Failure, "cd");
+ Slebug.Create_Result (4, Packrat.Failure, "cd");
Nine : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Optional_More, "abc");
+ Slebug.Create_Result (3, Packrat.Optional_More, "abc");
Ten : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Success, "abcbc");
+ Slebug.Create_Result (5, Packrat.Success, "abcbc");
begin
- if One.Join (Two) /= Three or One.Join (Four) /= Five or
- One.Join (Six) /= Seven or Four.Join (Six) /= Four or
- Five.Join (Two) /= Five or Six.Join (Three) /= Eight or
- Slexy.Empty_Fail.Join (One) /= Slexy.Empty_Fail or
- Nine.Join (Two) /= Ten
+ if Slebug.Join (One, Two) /= Three or Slebug.Join (One, Four) /= Five or
+ Slebug.Join (One, Six) /= Seven or Slebug.Join (Four, Six) /= Four or
+ Slebug.Join (Five, Two) /= Five or Slebug.Join (Six, Three) /= Eight or
+ Slebug.Join (Slebug.Empty_Fail, One) /= Slebug.Empty_Fail or
+ Slebug.Join (Nine, Two) /= Ten
then
return Fail;
end if;
@@ -290,11 +290,11 @@ package body Ratnest.Tests is
return Test_Result
is
One : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "abc");
+ Slebug.Create_Result (3, Packrat.Success, "abc");
Two : Slexy.Combinator_Result :=
- Slexy.Create_Result (0, Packrat.Failure, "");
+ Slebug.Create_Result (0, Packrat.Failure, "");
begin
- if One = Two or Two /= Slexy.Empty_Fail then
+ if One = Two or Two /= Slebug.Empty_Fail then
return Fail;
end if;
return Pass;
@@ -307,10 +307,10 @@ package body Ratnest.Tests is
function Sequence_Check
return Test_Result
is
- function Match_A is new Strombo.Match ('a');
- function Match_B is new Strombo.Match ('b');
- function Match_C is new Strombo.Match ('c');
- function Seq_Abc is new Strombo.Sequence
+ function Match_A is new Slexy.Match ('a');
+ function Match_B is new Slexy.Match ('b');
+ function Match_C is new Slexy.Match ('c');
+ function Seq_Abc is new Slexy.Sequence
((Match_A'Unrestricted_Access,
Match_B'Unrestricted_Access,
Match_C'Unrestricted_Access));
@@ -318,14 +318,14 @@ package body Ratnest.Tests is
Test_Str : String := "aababcabcab";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Failure, "a");
+ Slebug.Create_Result (1, Packrat.Failure, "a");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Needs_More, "ab");
+ Slebug.Create_Result (2, Packrat.Needs_More, "ab");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "abc");
- Result4 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (3, Packrat.Success, "abc");
+ Result4 : Slexy.Combinator_Result := Slebug.Empty_Fail;
Result5 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Failure, "ab");
+ Slebug.Create_Result (2, Packrat.Failure, "ab");
begin
if Seq_Abc (Test_Str, 1) /= Result1 or Seq_Abc (Test_Str, 2) /= Result5 or
Seq_Abc (Test_Str, 4) /= Result3 or Seq_Abc (Test_Str, 10) /= Result2 or
@@ -341,24 +341,24 @@ package body Ratnest.Tests is
function Count_Check
return Test_Result
is
- function Match_A is new Strombo.Match ('a');
- function Match_B is new Strombo.Match ('b');
- function Count_2A is new Strombo.Count (Match_A, 2);
- function Count_3B is new Strombo.Count (Match_B, 3);
+ function Match_A is new Slexy.Match ('a');
+ function Match_B is new Slexy.Match ('b');
+ function Count_2A is new Slexy.Count (Match_A, 2);
+ function Count_3B is new Slexy.Count (Match_B, 3);
Test_Str : String := "abaabbaaabbbaaaabbbb";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Failure, "a");
+ Slebug.Create_Result (1, Packrat.Failure, "a");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Success, "aa");
+ Slebug.Create_Result (2, Packrat.Success, "aa");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Failure, "b");
+ Slebug.Create_Result (1, Packrat.Failure, "b");
Result4 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Needs_More, "bb");
+ Slebug.Create_Result (2, Packrat.Needs_More, "bb");
Result5 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "bbb");
- Result6 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (3, Packrat.Success, "bbb");
+ Result6 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Count_2A (Test_Str, 1) /= Result1 or Count_2A (Test_Str, 3) /= Result2 or
Count_3B (Test_Str, 2) /= Result3 or Count_3B (Test_Str, 19) /= Result4 or
@@ -375,39 +375,39 @@ package body Ratnest.Tests is
function Many_Check
return Test_Result
is
- function Match_A is new Strombo.Match ('a');
- function Many_0 is new Strombo.Many (Match_A);
- function Many_4 is new Strombo.Many (Match_A, 4);
+ function Match_A is new Slexy.Match ('a');
+ function Many_0 is new Slexy.Many (Match_A);
+ function Many_4 is new Slexy.Many (Match_A, 4);
- function Match_B is new Strombo.Match ('b');
- function Match_C is new Strombo.Match ('c');
- function Seq_Abc is new Strombo.Sequence
+ function Match_B is new Slexy.Match ('b');
+ function Match_C is new Slexy.Match ('c');
+ function Seq_Abc is new Slexy.Sequence
((Match_A'Unrestricted_Access,
Match_B'Unrestricted_Access,
Match_C'Unrestricted_Access));
- function Many_Seq_0 is new Strombo.Many (Seq_Abc);
- function Many_Seq_4 is new Strombo.Many (Seq_Abc, 4);
+ function Many_Seq_0 is new Slexy.Many (Seq_Abc);
+ function Many_Seq_4 is new Slexy.Many (Seq_Abc, 4);
Test_Str : String := "aaabbaaaaabaa";
Test_Str2 : String := "aababcabcab";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "aaa");
+ Slebug.Create_Result (3, Packrat.Success, "aaa");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Optional_More, "aa");
+ Slebug.Create_Result (2, Packrat.Optional_More, "aa");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Success, "aaaaa");
+ Slebug.Create_Result (5, Packrat.Success, "aaaaa");
Result4 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Failure, "aaa");
- Result5 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (3, Packrat.Failure, "aaa");
+ Result5 : Slexy.Combinator_Result := Slebug.Empty_Fail;
Result6 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Needs_More, "aa");
+ Slebug.Create_Result (2, Packrat.Needs_More, "aa");
Result7 : Slexy.Combinator_Result :=
- Slexy.Create_Result (0, Packrat.Success, "");
+ Slebug.Create_Result (0, Packrat.Success, "");
Result8 : Slexy.Combinator_Result :=
- Slexy.Create_Result (6, Packrat.Optional_More, "abcabc");
+ Slebug.Create_Result (6, Packrat.Optional_More, "abcabc");
Result9 : Slexy.Combinator_Result :=
- Slexy.Create_Result (6, Packrat.Needs_More, "abcabc");
+ Slebug.Create_Result (6, Packrat.Needs_More, "abcabc");
begin
if Many_0 (Test_Str, 1) /= Result1 or Many_4 (Test_Str, 1) /= Result4 or
Many_4 (Test_Str, 6) /= Result3 or Many_0 (Test_Str, 4) /= Result7 or
@@ -424,19 +424,19 @@ package body Ratnest.Tests is
function Many_Until_Check
return Test_Result
is
- function Match_A is new Strombo.Match ('a');
- function Many_Until_0 is new Strombo.Many_Until (Match_A, PU.Is_Digit);
- function Many_Until_3 is new Strombo.Many_Until (Match_A, PU.Is_Digit, 3);
+ function Match_A is new Slexy.Match ('a');
+ function Many_Until_0 is new Slexy.Many_Until (Match_A, PU.Is_Digit);
+ function Many_Until_3 is new Slexy.Many_Until (Match_A, PU.Is_Digit, 3);
Test_Str : String := "aaaabbaaa123aaa";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (4, Packrat.Failure, "aaaa");
+ Slebug.Create_Result (4, Packrat.Failure, "aaaa");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "aaa");
+ Slebug.Create_Result (3, Packrat.Success, "aaa");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Needs_More, "aaa");
- Result4 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (3, Packrat.Needs_More, "aaa");
+ Result4 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Many_Until_0 (Test_Str, 1) /= Result1 or
Many_Until_0 (Test_Str, 7) /= Result2 or
@@ -468,16 +468,16 @@ package body Ratnest.Tests is
return Char = 'a' or Char = 'b' or Char = 'c';
end Is_Abc;
- function Satisfy_123 is new Strombo.Satisfy (Is_123);
- function Satisfy_Abc is new Strombo.Satisfy (Is_Abc);
+ function Satisfy_123 is new Slexy.Satisfy (Is_123);
+ function Satisfy_Abc is new Slexy.Satisfy (Is_Abc);
Test_Str : String := "abc123456def";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "b");
+ Slebug.Create_Result (1, Packrat.Success, "b");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "3");
- Result3 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (1, Packrat.Success, "3");
+ Result3 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Satisfy_123 (Test_Str, 6) /= Result2 or
Satisfy_Abc (Test_Str, 2) /= Result1 or
@@ -512,16 +512,16 @@ package body Ratnest.Tests is
return Character'Val (Character'Pos (Char) - 1);
end Minus_One;
- function Satisfy_Bcd is new Strombo.Satisfy_With (Is_Abc, Minus_One);
- function Satisfy_234 is new Strombo.Satisfy_With (Is_123, Minus_One);
+ function Satisfy_Bcd is new Slexy.Satisfy_With (Is_Abc, Minus_One);
+ function Satisfy_234 is new Slexy.Satisfy_With (Is_123, Minus_One);
Test_Str : String := "abcde12345";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "c");
+ Slebug.Create_Result (1, Packrat.Success, "c");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "2");
- Result3 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (1, Packrat.Success, "2");
+ Result3 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Satisfy_Bcd (Test_Str, 3) /= Result1 or
Satisfy_234 (Test_Str, 7) /= Result2 or
@@ -537,19 +537,19 @@ package body Ratnest.Tests is
function Match_Check
return Test_Result
is
- function Match_A is new Strombo.Match ('a');
- function Match_Slash is new Strombo.Match ('/');
- function Match_4 is new Strombo.Match ('4');
+ function Match_A is new Slexy.Match ('a');
+ function Match_Slash is new Slexy.Match ('/');
+ function Match_4 is new Slexy.Match ('4');
Test_Str : String := "abc1234./5";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "a");
+ Slebug.Create_Result (1, Packrat.Success, "a");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "/");
+ Slebug.Create_Result (1, Packrat.Success, "/");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "4");
- Result4 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (1, Packrat.Success, "4");
+ Result4 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Match_A (Test_Str, 1) /= Result1 or
Match_Slash (Test_Str, 9) /= Result2 or
@@ -573,16 +573,16 @@ package body Ratnest.Tests is
return Character'Val (Character'Pos (Char) + 1);
end Plus_One;
- function Match_A is new Strombo.Match_With ('b', Plus_One);
- function Match_6 is new Strombo.Match_With ('7', Plus_One);
+ function Match_A is new Slexy.Match_With ('b', Plus_One);
+ function Match_6 is new Slexy.Match_With ('7', Plus_One);
Test_Str : String := "abc5678";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "a");
+ Slebug.Create_Result (1, Packrat.Success, "a");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "6");
- Result3 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (1, Packrat.Success, "6");
+ Result3 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Match_A (Test_Str, 1) /= Result1 or
Match_6 (Test_Str, 5) /= Result2 or
@@ -598,20 +598,20 @@ package body Ratnest.Tests is
function Multimatch_Check
return Test_Result
is
- function Match_String1 is new Strombo.Multimatch ("abc");
- function Match_String2 is new Strombo.Multimatch ("hello");
+ function Match_String1 is new Slexy.Multimatch ("abc");
+ function Match_String2 is new Slexy.Multimatch ("hello");
Test_Str : String := "abcdefabhelloworldab";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "abc");
+ Slebug.Create_Result (3, Packrat.Success, "abc");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Needs_More, "ab");
+ Slebug.Create_Result (2, Packrat.Needs_More, "ab");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Success, "hello");
+ Slebug.Create_Result (5, Packrat.Success, "hello");
Result4 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Failure, "ab");
- Result5 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (2, Packrat.Failure, "ab");
+ Result5 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Match_String1 (Test_Str, 1) /= Result1 or
Match_String1 (Test_Str, 7) /= Result4 or
@@ -629,18 +629,18 @@ package body Ratnest.Tests is
function Take_Check
return Test_Result
is
- function Take_1 is new Strombo.Take;
- function Take_5 is new Strombo.Take (5);
+ function Take_1 is new Slexy.Take;
+ function Take_5 is new Slexy.Take (5);
Test_Str : String := "abcdefghi";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "b");
+ Slebug.Create_Result (1, Packrat.Success, "b");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Needs_More, "ghi");
+ Slebug.Create_Result (3, Packrat.Needs_More, "ghi");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Success, "cdefg");
- Result4 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (5, Packrat.Success, "cdefg");
+ Result4 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Take_1 (Test_Str, 2) /= Result1 or Take_5 (Test_Str, 7) /= Result2 or
Take_5 (Test_Str, 3) /= Result3 or
@@ -655,23 +655,23 @@ package body Ratnest.Tests is
function Take_While_Check
return Test_Result
is
- function Take_Letters is new Strombo.Take_While (PU.Is_Letter);
- function Take_Punch is new Strombo.Take_While (PU.Is_Punctuation);
- function Take_Digits is new Strombo.Take_While (PU.Is_Digit);
+ function Take_Letters is new Slexy.Take_While (PU.Is_Letter);
+ function Take_Punch is new Slexy.Take_While (PU.Is_Punctuation);
+ function Take_Digits is new Slexy.Take_While (PU.Is_Digit);
Test_Str : String := "abcde,./;'fghi[]=-^563";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (4, Packrat.Success, "bcde");
+ Slebug.Create_Result (4, Packrat.Success, "bcde");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (2, Packrat.Success, "hi");
+ Slebug.Create_Result (2, Packrat.Success, "hi");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Success, ",./;'");
+ Slebug.Create_Result (5, Packrat.Success, ",./;'");
Result4 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Success, "=-^");
- Result5 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (3, Packrat.Success, "=-^");
+ Result5 : Slexy.Combinator_Result := Slebug.Empty_Fail;
Result6 : Slexy.Combinator_Result :=
- Slexy.Create_Result (3, Packrat.Optional_More, "563");
+ Slebug.Create_Result (3, Packrat.Optional_More, "563");
begin
if Take_Letters (Test_Str, 2) /= Result1 or
Take_Letters (Test_Str, 13) /= Result2 or
@@ -690,20 +690,20 @@ package body Ratnest.Tests is
function Take_Until_Check
return Test_Result
is
- function Take_Till_Punch is new Strombo.Take_Until (PU.Is_Punctuation);
- function Take_Till_Digit is new Strombo.Take_Until (PU.Is_Digit);
+ function Take_Till_Punch is new Slexy.Take_Until (PU.Is_Punctuation);
+ function Take_Till_Digit is new Slexy.Take_Until (PU.Is_Digit);
Test_Str : String := "abcde12345;;;fghi67";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (7, Packrat.Success, "de12345");
+ Slebug.Create_Result (7, Packrat.Success, "de12345");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (4, Packrat.Optional_More, "hi67");
+ Slebug.Create_Result (4, Packrat.Optional_More, "hi67");
Result3 : Slexy.Combinator_Result :=
- Slexy.Create_Result (5, Packrat.Success, "abcde");
+ Slebug.Create_Result (5, Packrat.Success, "abcde");
Result4 : Slexy.Combinator_Result :=
- Slexy.Create_Result (6, Packrat.Success, ";;fghi");
- Result5 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (6, Packrat.Success, ";;fghi");
+ Result5 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if Take_Till_Punch (Test_Str, 4) /= Result1 or
Take_Till_Punch (Test_Str, 16) /= Result2 or
@@ -721,16 +721,16 @@ package body Ratnest.Tests is
function Line_End_Check
return Test_Result
is
- function LF_End is new Strombo.Line_End (Latin.LF);
- function C_End is new Strombo.Line_End ('c');
+ function LF_End is new Slexy.Line_End (Latin.LF);
+ function C_End is new Slexy.Line_End ('c');
Test_Str : String := "abcd" & Latin.LF & "e";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, (1 => Latin.LF));
+ Slebug.Create_Result (1, Packrat.Success, (1 => Latin.LF));
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "c");
- Result3 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (1, Packrat.Success, "c");
+ Result3 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if LF_End (Test_Str, 5) /= Result1 or C_End (Test_Str, 3) /= Result2 or
LF_End (Test_Str, Test_Str'Last + 5) /= Result3 or LF_End (Test_Str, 1) /= Result3
@@ -744,16 +744,16 @@ package body Ratnest.Tests is
function Input_End_Check
return Test_Result
is
- function C_End is new Strombo.Input_End ('c');
- function E_End is new Strombo.Input_End ('e');
+ function C_End is new Slexy.Input_End ('c');
+ function E_End is new Slexy.Input_End ('e');
Test_Str : String := "abcde";
Result1 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "e");
+ Slebug.Create_Result (1, Packrat.Success, "e");
Result2 : Slexy.Combinator_Result :=
- Slexy.Create_Result (1, Packrat.Success, "c");
- Result3 : Slexy.Combinator_Result := Slexy.Empty_Fail;
+ Slebug.Create_Result (1, Packrat.Success, "c");
+ Result3 : Slexy.Combinator_Result := Slebug.Empty_Fail;
begin
if C_End (Test_Str, 3) /= Result2 or E_End (Test_Str, 5) /= Result1 or
C_End (Test_Str, 6) /= Result3 or E_End (Test_Str, 6) /= Result3 or