]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
init.
authorWill Budic <redacted>
Sat, 18 May 2024 08:10:37 +0000 (18:10 +1000)
committerWill Budic <redacted>
Sat, 18 May 2024 08:10:37 +0000 (18:10 +1000)
tests/testExperimental.pl [new file with mode: 0644]

diff --git a/tests/testExperimental.pl b/tests/testExperimental.pl
new file mode 100644 (file)
index 0000000..5682e51
--- /dev/null
@@ -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(
+<<FlourWeight<2kg>>>
+<<@<%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();
+}