Skip to content

Commit

Permalink
Don't recreate Ops::File for each test.
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Apr 2, 2011
1 parent 9de7241 commit 320a8e7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions t/compilers/opsc/21-jit-files.t
Expand Up @@ -7,14 +7,24 @@ Q:PIR { .include "test_more.pir" };
pir::load_bytecode("opsc.pbc");

my $debug := 0;
# OpLib
my $oplib := pir::new__psp("OpLib", "core_ops");

# Parse "jitted.ops"
my $ops_file := Ops::File.new("t/jit/jitted.ops",
:oplib($oplib),
:core(0),
:quiet(!$debug),
);

for <01 02 03 04 06> {
test_single_file("t/compilers/opsc/data/$_.pir", $debug);
test_single_file("t/compilers/opsc/data/$_.pir", $oplib, $ops_file, $debug);
}

done_testing();

# JIT and run single PIR file.
sub test_single_file($pir, $debug) {
sub test_single_file($pir, $oplib, $ops_file, $debug) {
# Some preparation
my $pbc := subst($pir, / 'pir' $/, 'pbc');

Expand All @@ -31,16 +41,6 @@ sub test_single_file($pir, $debug) {
/;
my $expected := $/[0].join('');

# OpLib
my $oplib := pir::new__psp("OpLib", "core_ops");

# Parse "jitted.ops"
my $ops_file := Ops::File.new("t/jit/jitted.ops",
:oplib($oplib),
:core(0),
:quiet(!$debug),
);

# Create JITter.
my $jitter := Ops::JIT.new($pbc, $ops_file, $oplib, debug => $debug);

Expand Down

0 comments on commit 320a8e7

Please sign in to comment.