Update of /cvsroot/compbench/CompBenchmarks++/CBM-PI/t
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18442
Modified Files:
05-CEL.pl
Log Message:
Many more tests.
Index: 05-CEL.pl
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/05-CEL.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** 05-CEL.pl 5 Mar 2007 20:34:08 -0000 1.1
--- 05-CEL.pl 6 Mar 2007 20:23:53 -0000 1.2
***************
*** 8,12 ****
require "libtest.pl";
! use Test::Simple tests => 84;
our $top_srcdir;
--- 8,12 ----
require "libtest.pl";
! use Test::Simple tests => 138;
our $top_srcdir;
***************
*** 598,601 ****
--- 598,647 ----
}
+ sub test_container {
+ my $cont = new CBM::CelContainer();
+ my $i0 = new CBM::CelStr("x0");
+ my $i1 = new CBM::CelStr("x1");
+
+ $cont->add($i0);
+ $cont->add($i1);
+
+ ok($cont->Evaluate() eq "x1", "container holding x0 x1 returns x1");
+ }
+
+ sub test_include {
+ my $I = new CBM::CelInclude();
+ my $f = new CBM::CelStr("$top_srcdir/reference/cel-str.xml");
+
+ $I->add($f);
+ ok($I->Evaluate() eq "test", "include(cel-str.xml) returns test");
+ }
+
+ sub test_xml {
+ my @tests = ('cel-str', 'cel-logic',
+ 'cel-version', 'cel-math', 'cel-cmp', 'cel-cond',
+ 'cel-var', 'cel-array', 'cel-block', 'cel-loop',
+ 'cel-function', 'cel-stack', 'cel-include');
+ my $r;
+ my $f;
+ my $banner = "<?xml version=\"1.0\" ?>";
+
+ foreach $r (@tests) {
+ $f="$top_srcdir/reference/$r.xml";
+
+ ok(-f $f, "$f exists");
+ my $R = new CBM::CelReader($f);
+
+ my $CEL = $R->parse();
+ ok(defined($CEL), "CEL object for $f is defined");
+
+ my $CELxml = $CEL->str();
+ ok(defined($CELxml), "XML representation for $f is defined");
+
+ my $celxfile = "$banner\n\n$CELxml";
+ my $expected = `cat $f`;
+
+ ok($celxfile eq "$expected\n", "checking if BEG\n$celxfile\nEND matches expected : BEG\n$expected\nEND");
+ }
+ }
$sys = CBM::Init();
***************
*** 614,617 ****
--- 660,666 ----
test_loop_break();
test_loop();
+ test_container();
+ test_include();
+ test_xml();
$sys->done();
|