commit 256dd1cf150d0adf9754d1965573e2f01640af9c
parent 42d625e6fd7be18f6d2bda9477a18728d384f8fe
Author: kyle <kyle@getaddrinfo.net>
Date: Thu, 10 Mar 2016 20:57:33 -0700
fixup other tests after last commit
Diffstat:
9 files changed, 47 insertions(+), 37 deletions(-)
diff --git a/SCV/Viewer.pm b/SCV/Viewer.pm
@@ -25,8 +25,6 @@ sub accept {
my $socket = $self->{viewer_socket};
$self->{client_socket} = $socket->accept();
-
- print STDERR "accept(): accepted client\n";
}
sub request_data {
diff --git a/t/fibonacci.t b/t/fibonacci.t
@@ -4,6 +4,7 @@ use SCV::Viewer;
use Test::More tests => 7;
use Test::Differences;
+my $viewer = SCV::Viewer->new();
my $project = SCV::Project->new();
unified_diff;
@@ -32,7 +33,7 @@ main(int argc, char *argv[])
const char *errstr = NULL;
if (argc != 2) {
- fprintf(stderr, "usage: %s <N>\\n", argv[0]);
+ fprintf(stderr, "usage: %s <N>", argv[0]);
return 1;
}
@@ -40,7 +41,7 @@ main(int argc, char *argv[])
if (errstr)
err(1, "%s", errstr);
- fprintf(stderr, "result: %lli\\n", fibonacci(n));
+ fprintf(stderr, "result: %lli", fibonacci(n));
return 0;
}
@@ -53,7 +54,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[36];
+static uint64_t lines[36];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -84,7 +85,7 @@ main(int argc, char *argv[])
const char *errstr = NULL;
if ((++lines[23], argc != 2)) {
- (++lines[24], fprintf(stderr, "usage: %s <N>\\n", argv[0]));
+ (++lines[24], fprintf(stderr, "usage: %s <N>", argv[0]));
return (++lines[25], 1);
}
@@ -92,7 +93,7 @@ main(int argc, char *argv[])
if ((++lines[29], errstr))
(++lines[30], err(1, "%s", errstr));
- (++lines[32], fprintf(stderr, "result: %lli\\n", (++lines[32], fibonacci(n))));
+ (++lines[32], fprintf(stderr, "result: %lli", (++lines[32], fibonacci(n))));
return (++lines[34], 0);
}
@@ -103,13 +104,16 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret, $err) = $project->run();
+$project->run();
+my ($ret, $err) = $project->wait();
is($ret, 1, "instrumented program check return code");
-my ($ret, $err) = $project->run(10);
+$project->run(10);
+my ($ret, $err) = $project->wait();
is($ret, 0, "instrumented program check correctness 1");
-is($err, "result: 55\n", "instrumented program check correctness 1");
+is($err, "result: 55", "instrumented program check correctness 1");
-my ($ret, $err) = $project->run(20);
+$project->run(20);
+my ($ret, $err) = $project->wait(20);
is($ret, 0, "instrumented program check correctness 2");
-is($err, "result: 6765\n", "instrumented program check correctness 2");
+is($err, "result: 6765", "instrumented program check correctness 2");
diff --git a/t/for.t b/t/for.t
@@ -1,8 +1,10 @@
use strict;
use SCV::Project;
+use SCV::Viewer;
use Test::More tests => 3;
use Test::Differences;
+my $viewer = SCV::Viewer->new();
my $project = SCV::Project->new();
unified_diff;
@@ -28,7 +30,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[12];
+static uint64_t lines[12];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -54,5 +56,6 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret) = $project->run();
+$project->run();
+my ($ret) = $project->wait();
is($ret, 20, "instrumented program check");
diff --git a/t/hello_world.t b/t/hello_world.t
@@ -1,8 +1,10 @@
use strict;
use SCV::Project;
+use SCV::Viewer;
use Test::More tests => 4;
use Test::Differences;
+my $viewer = SCV::Viewer->new();
my $project = SCV::Project->new();
unified_diff;
@@ -25,7 +27,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[9];
+static uint64_t lines[9];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -48,7 +50,7 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret, $err) = $project->run();
+$project->run();
+my ($ret, $err) = $project->wait();
is( $ret, 0, "instrumented program check return code" );
-
is( $err, "hello, world!", "instrumented program check error message" );
diff --git a/t/if.t b/t/if.t
@@ -37,7 +37,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[21];
+static uint64_t lines[21];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -72,5 +72,6 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret) = $project->run();
+$project->run();
+my ($ret) = $project->wait();
is($ret, 1, "instrumented program check");
diff --git a/t/multiple_sources.t b/t/multiple_sources.t
@@ -1,8 +1,10 @@
use strict;
use SCV::Project;
-use Test::More tests => 2;
+use SCV::Viewer;
+use Test::More tests => 1;
use Test::Differences;
+my $project = SCV::Viewer->new();
my $project = SCV::Project->new();
unified_diff;
@@ -41,15 +43,6 @@ EOF
$project->compile();
-my $tmp_dir = $project->get_tmpdir();
-
-my $inst_src_good = <<EOF;
-EOF
-
-my $inst_src = $project->instrumented_src();
-ok( $inst_src );
-
-#eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-
-my ($ret, $err) = $project->run();
+$project->run();
+my ($ret, $err) = $project->wait();
is($ret, 0, "instrumented program check return code");
diff --git a/t/return.t b/t/return.t
@@ -1,8 +1,10 @@
use strict;
use SCV::Project;
+use SCV::Viewer;
use Test::More tests => 3;
use Test::Differences;
+my $viewer = SCV::Viewer->new();
my $project = SCV::Project->new();
unified_diff;
@@ -28,7 +30,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[12];
+static uint64_t lines[12];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -54,5 +56,6 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret) = $project->run();
+$project->run();
+my ($ret) = $project->wait();
is($ret, 10, "instrumented program check");
diff --git a/t/switch.t b/t/switch.t
@@ -1,8 +1,10 @@
use strict;
use SCV::Project;
+use SCV::Viewer;
use Test::More tests => 3;
use Test::Differences;
+my $viewer = SCV::Viewer->new();
my $project = SCV::Project->new();
unified_diff;
@@ -31,7 +33,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[15];
+static uint64_t lines[15];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -60,5 +62,6 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret) = $project->run();
+$project->run();
+my ($ret) = $project->wait();
is($ret, 0, "instrumented program check");
diff --git a/t/while.t b/t/while.t
@@ -1,8 +1,10 @@
use strict;
use SCV::Project;
+use SCV::Viewer;
use Test::More tests => 3;
use Test::Differences;
+my $viewer = SCV::Project->new();
my $project = SCV::Project->new();
unified_diff;
@@ -29,7 +31,7 @@ my $tmp_dir = $project->get_tmpdir();
my $inst_src_good = <<EOF;
#include <scv_global.h>
-static unsigned int lines[13];
+static uint64_t lines[13];
struct scv_node node1;
struct scv_node node0 = {
.lines_ptr = lines,
@@ -56,5 +58,6 @@ ok( $inst_src );
eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison";
-my ($ret) = $project->run();
+$project->run();
+my ($ret) = $project->wait();
is($ret, 17, "instrumented program check");