summaryrefslogtreecommitdiff
path: root/test/ratnest-tests-tokens.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2019-01-29 16:51:45 +1100
committerJed Barber <jjbarber@y7mail.com>2019-01-29 16:51:45 +1100
commit8eb1ca2817786f48385ba5f5baa43272de8d7eec (patch)
treec7404c36e5dea7e47cc7250cb2495089e636b231 /test/ratnest-tests-tokens.adb
parent8e1f7f57bc08b98d95beead0630964baf913cc0d (diff)
Completed more Graphs tests, restructured Ratnest.Tests package layout
Diffstat (limited to 'test/ratnest-tests-tokens.adb')
-rw-r--r--test/ratnest-tests-tokens.adb69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/ratnest-tests-tokens.adb b/test/ratnest-tests-tokens.adb
new file mode 100644
index 0000000..7a2588a
--- /dev/null
+++ b/test/ratnest-tests-tokens.adb
@@ -0,0 +1,69 @@
+
+
+separate (Ratnest.Tests)
+package body Tokens is
+
+
+ type My_Labels is (One, Two, Three);
+ package My_Tokens is new Packrat.Tokens (My_Labels, Character, String);
+
+
+
+
+
+ function Adjust_Check
+ return Test_Result
+ is
+ A : My_Tokens.Token;
+ begin
+ declare
+ B : My_Tokens.Token := My_Tokens.Create (One, 1, 3, "abc");
+ begin
+ A := B;
+ end;
+ if not A.Initialized or else A.Value /= "abc" then
+ return Fail;
+ end if;
+ return Pass;
+ end Adjust_Check;
+
+
+
+
+
+ function Equals_Check
+ return Test_Result
+ is
+ use type My_Tokens.Token;
+ A : My_Tokens.Token := My_Tokens.Create (One, 1, 3, "abc");
+ B : My_Tokens.Token := My_Tokens.Create (One, 1, 3, "abc");
+ begin
+ if A /= B then
+ return Fail;
+ end if;
+ return Pass;
+ end Equals_Check;
+
+
+
+
+
+ function Store_Check
+ return Test_Result
+ is
+ T : My_Tokens.Token := My_Tokens.Create (One, 1, 3, "abc");
+ begin
+ if not T.Initialized or else
+ T.Label /= One or else
+ T.Start /= 1 or else T.Finish /= 3 or else
+ T.Value /= "abc"
+ then
+ return Fail;
+ end if;
+ return Pass;
+ end Store_Check;
+
+
+end Tokens;
+
+