From 875aa3c0d227dde03eb1dc31bb4efd0e6ba2908b Mon Sep 17 00:00:00 2001 From: Will Budic Date: Sat, 18 May 2024 18:10:37 +1000 Subject: [PATCH] init. --- tests/testExperimental.pl | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/testExperimental.pl diff --git a/tests/testExperimental.pl b/tests/testExperimental.pl new file mode 100644 index 0000000..5682e51 --- /dev/null +++ b/tests/testExperimental.pl @@ -0,0 +1,50 @@ +#!/usr/bin/env perl +use warnings; use strict; +use Syntax::Keyword::Try; +use Benchmark; +use lib "tests"; +use lib "system/modules"; + +require TestManager; +require CNFParser; +require CNFSQL; + +my $test = TestManager -> new($0); +my $cnf; + +try{ + + die $test->failed() if not $cnf = CNFParser->new(); + $test->case("Passed new instance CNFParser."); + $test->subcase('CNFParser->VERSION is '.CNFParser->VERSION); + $cnf -> parse(undef, q( +<>> +<<@<%DualRatioFlourWater + flour = 75% + water = 25% +>> + )); + + my $weight = $cnf -> anon('FlourWeight'); $weight =~ s/kg/000/g; + my %ratio = $cnf -> collection('%DualRatioFlourWater'); + + # Power of perl will warn, but automatically convert to numeric estimate what want. + my $rFlour = $ratio{flour}/100; + my $rWater = $ratio{water}/100; + + my $waterWeight = ($weight * $rWater); + + + $test->evaluate("Is expected on ".$cnf -> anon('FlourWeight')." of flour, \$waterWeight == 5oo ml?",500,$waterWeight); + +# +# +$test->done(); +# + + +} +catch{ + $test -> dumpTermination($@); + $test -> doneFailed(); +} -- 2.34.1