From: Will Budic Date: Sat, 18 May 2024 08:10:37 +0000 (+1000) Subject: init. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=875aa3c0d227dde03eb1dc31bb4efd0e6ba2908b;p=PerlCNF.git init. --- 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(); +}