From 192172cfc44220975b34295d38c5213b08de5191 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 10 Dec 2020 23:22:19 +1100 Subject: Some unit tests for Packrat.Parsers --- test/rat_tests-parsers.ads | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 test/rat_tests-parsers.ads (limited to 'test/rat_tests-parsers.ads') diff --git a/test/rat_tests-parsers.ads b/test/rat_tests-parsers.ads new file mode 100644 index 0000000..a70f41e --- /dev/null +++ b/test/rat_tests-parsers.ads @@ -0,0 +1,85 @@ + + +with + + Unit_Tests; + +use + + Unit_Tests; + +private with + + Packrat.No_Lex, + Packrat.Parsers.Debug, + Packrat.Errors, + Packrat.Traits; + + +package Rat_Tests.Parsers is + + + function Count_Check return Test_Result; + function Many_Nomin_Check return Test_Result; + function Many_Min_Check return Test_Result; + + function Many_Until_Nomin_Check return Test_Result; + function Many_Until_Min_Check return Test_Result; + + function Satisfy_Check return Test_Result; + function Satisfy_With_Check return Test_Result; + function Match_Check return Test_Result; + function Match_With_Check return Test_Result; + function Multimatch_Check return Test_Result; + function Take_Check return Test_Result; + function Take_While_Check return Test_Result; + function Take_Until_Check return Test_Result; + + function Empty_Check return Test_Result; + function Not_Empty_Check return Test_Result; + + Combinator_Tests : Test_Array := + ((+"Count", Count_Check'Access), + (+"Many No Minimum", Many_Nomin_Check'Access), + (+"Many With Minimum", Many_Min_Check'Access), + (+"Many_Until No Minimum", Many_Until_Nomin_Check'Access), + (+"Many_Until With Minimum", Many_Until_Min_Check'Access), + (+"Satisfy", Satisfy_Check'Access), + (+"Satisfy_With", Satisfy_With_Check'Access), + (+"Match", Match_Check'Access), + (+"Match_With", Match_With_Check'Access), + (+"Multimatch", Multimatch_Check'Access), + (+"Take", Take_Check'Access), + (+"Take_While", Take_While_Check'Access), + (+"Take_Until", Take_Until_Check'Access), + (+"Empty", Empty_Check'Access), + (+"Not_Empty", Not_Empty_Check'Access)); + + + function Default_Result_Check return Test_Result; + + Other_Tests : Test_Array := + (1 => (+"Default Combinator Result", Default_Result_Check'Access)); + + +private + + + type Parser_Labels_One is (One, Two, Three, Four, Five, Six); + + package Pone is new Packrat.No_Lex + (Parser_Labels_One, Character, String); + + package One_Debug is new Pone.Parsers.Debug; + + + + + function Alphanum_Switch + (Char : in Character) + return Character; + + +end Rat_Tests.Parsers; + + -- cgit