view src/parallel_execution/perlTests/generate_stub.t @ 702:fb0a9d082360

add twice/main.cbc test
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sat, 22 Aug 2020 19:51:17 +0900
parents f406b70c6e7a
children cf517d3f5ab9
line wrap: on
line source

#!/usr/bin/env perl
use strict;
use warnings;

use Test::More;
use File::Compare qw/compare/;
use File::Temp qw/tempfile/;
use FindBin;


sub compareCbC2C {
  my ($targetFile, $wantCFile) = @_;

  subtest "generate_stub.pl $targetFile" => sub {
    my ($_fh, $testOutputFile) = tempfile();
    close $_fh;
    system("perl", "generate_stub.pl", "-o", $testOutputFile, $targetFile);

    is(compare($wantCFile, $testOutputFile), 0, "$wantCFile eq  $testOutputFile");
  };

}

compareCbC2C('examples/boundedBuffer/BoundedBuffer.cbc', "$FindBin::Bin/BoundedBuffer.c");
compareCbC2C('examples/twice/main.cbc', "$FindBin::Bin/testfiles/twice/main.c");

done_testing;