From 81f7e19f212f9d1ac75e04e62933e6c918219cfc Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 9 Jan 2019 22:58:10 +1100 Subject: Packrat.Tokens added, tested, and functional --- test/ratnest-tests.adb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/ratnest-tests.adb') diff --git a/test/ratnest-tests.adb b/test/ratnest-tests.adb index df17775..1f0950d 100644 --- a/test/ratnest-tests.adb +++ b/test/ratnest-tests.adb @@ -162,6 +162,48 @@ package body Ratnest.Tests is + function Token_Adjust_Check + return Test_Result + is + type My_Labels is (One, Two, Three); + package My_Tokens is new Packrat.Tokens (My_Labels, Character, String); + + 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 Failure; + end if; + return Success; + end Token_Adjust_Check; + + + function Token_Store_Check + return Test_Result + is + type My_Labels is (One, Two, Three); + package My_Tokens is new Packrat.Tokens (My_Labels, Character, String); + + 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 Failure; + end if; + return Success; + end Token_Store_Check; + + + + + function In_Set_Check return Test_Result is -- cgit