From 670e21a7aa4b1eb9ed1862a4faa7e0d62d0899cf Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 10 Jan 2019 23:29:16 +1100 Subject: Test framework for Lexer Combinators --- test/ratnest-tests.adb | 116 +++++++++++++++++++++++++++++++++++++++++++++++++ test/ratnest-tests.ads | 44 ++++++++++++++++++- test/test_main.adb | 4 ++ 3 files changed, 162 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ratnest-tests.adb b/test/ratnest-tests.adb index 1f0950d..72023d0 100644 --- a/test/ratnest-tests.adb +++ b/test/ratnest-tests.adb @@ -4,6 +4,7 @@ with Ada.Characters.Latin_1, Ada.Strings.Maps, + Packrat.Lexer.Combinators, Packrat.Util; @@ -204,6 +205,121 @@ package body Ratnest.Tests is + function Lex_Sequence_Check + return Test_Result is + begin + return Failure; + end Lex_Sequence_Check; + + + function Lex_Count_Check + return Test_Result is + begin + return Failure; + end Lex_Count_Check; + + + function Lex_Many_Check + return Test_Result is + begin + return Failure; + end Lex_Many_Check; + + + function Lex_Many_Until_Check + return Test_Result is + begin + return Failure; + end Lex_Many_Until_Check; + + + function Lex_Satisfy_Check + return Test_Result is + begin + return Failure; + end Lex_Satisfy_Check; + + + function Lex_Satisfy_With_Check + return Test_Result is + begin + return Failure; + end Lex_Satisfy_With_Check; + + + function Lex_Match_Check + return Test_Result is + begin + return Failure; + end Lex_Match_Check; + + + function Lex_Match_With_Check + return Test_Result is + begin + return Failure; + end Lex_Match_With_Check; + + + function Lex_Multimatch_Check + return Test_Result is + begin + return Failure; + end Lex_Multimatch_Check; + + + function Lex_Take_Check + return Test_Result is + begin + return Failure; + end Lex_Take_Check; + + + function Lex_Take_While_Check + return Test_Result is + begin + return Failure; + end Lex_Take_While_Check; + + + function Lex_Take_Until_Check + return Test_Result is + begin + return Failure; + end Lex_Take_Until_Check; + + + function Line_Start_Check + return Test_Result is + begin + return Failure; + end Line_Start_Check; + + + function Line_End_Check + return Test_Result is + begin + return Failure; + end Line_End_Check; + + + function Input_Start_Check + return Test_Result is + begin + return Failure; + end Input_Start_Check; + + + function Input_End_Check + return Test_Result is + begin + return Failure; + end Input_End_Check; + + + + + function In_Set_Check return Test_Result is diff --git a/test/ratnest-tests.ads b/test/ratnest-tests.ads index 3c83a23..e9ea347 100644 --- a/test/ratnest-tests.ads +++ b/test/ratnest-tests.ads @@ -29,8 +29,48 @@ package Ratnest.Tests is function Token_Store_Check return Test_Result; Token_Tests : Test_Array := - ((+"Token Adjust", Token_Adjust_Check'Access), - (+"Token Storage", Token_Store_Check'Access)); + ((+"Adjust", Token_Adjust_Check'Access), + (+"Storage", Token_Store_Check'Access)); + + + + + function Lex_Sequence_Check return Test_Result; + function Lex_Count_Check return Test_Result; + function Lex_Many_Check return Test_Result; + function Lex_Many_Until_Check return Test_Result; + + function Lex_Satisfy_Check return Test_Result; + function Lex_Satisfy_With_Check return Test_Result; + function Lex_Match_Check return Test_Result; + function Lex_Match_With_Check return Test_Result; + function Lex_Multimatch_Check return Test_Result; + function Lex_Take_Check return Test_Result; + function Lex_Take_While_Check return Test_Result; + function Lex_Take_Until_Check return Test_Result; + + function Line_Start_Check return Test_Result; + function Line_End_Check return Test_Result; + function Input_Start_Check return Test_Result; + function Input_End_Check return Test_Result; + + Lexer_Combinator_Tests : Test_Array := + ((+"Sequence", Lex_Sequence_Check'Access), + (+"Count", Lex_Count_Check'Access), + (+"Many", Lex_Many_Check'Access), + (+"Many_Until", Lex_Many_Until_Check'Access), + (+"Satisfy", Lex_Satisfy_Check'Access), + (+"Satisfy With", Lex_Satisfy_With_Check'Access), + (+"Match", Lex_Match_Check'Access), + (+"Match With", Lex_Match_With_Check'Access), + (+"Multimatch", Lex_Multimatch_Check'Access), + (+"Take", Lex_Take_Check'Access), + (+"Take While", Lex_Take_While_Check'Access), + (+"Take Until", Lex_Take_Until_Check'Access), + (+"Line Start", Line_Start_Check'Access), + (+"Line End", Line_End_Check'Access), + (+"Input Start", Input_Start_Check'Access), + (+"Input_End", Input_End_Check'Access)); diff --git a/test/test_main.adb b/test/test_main.adb index a2682f4..d181b3e 100644 --- a/test/test_main.adb +++ b/test/test_main.adb @@ -34,6 +34,10 @@ begin Put (Tok.Debug_String); New_Line; + Put_Line ("Running tests for Packrat.Lexer.Combinators..."); + Run_Tests (Lexer_Combinator_Tests); + New_Line; + Put_Line ("Running tests for Packrat.Util..."); Put_Line ("Testing set predicates..."); Run_Tests (Set_Predicate_Tests); -- cgit