citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit a4750655f7b4917c1af0f350f254f176f4ac785c
parent d094aa6d31061aa6ce8de98d6b7e3e80e883093b
Author: kyle <kyle@getaddrinfo.net>
Date:   Sat,  5 Mar 2016 01:06:23 -0700

tests: replace home grown with TAP

Diffstat:
MMakefile | 2+-
ASCV/Project.pm | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Drun_tests.sh | 37-------------------------------------
At/fibonacci.t | 108+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
At/for.t | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
At/hello_world.t | 48++++++++++++++++++++++++++++++++++++++++++++++++
At/if.t | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
At/return.t | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
At/switch.t | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
At/while.t | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dtests/Makefile.test | 5-----
Dtests/fibonacci/Makefile | 11-----------
Dtests/fibonacci/fib.c | 35-----------------------------------
Dtests/fibonacci/fib.c.inst_good | 38--------------------------------------
Dtests/fibonacci/test.sh | 14--------------
Dtests/for/Makefile | 11-----------
Dtests/for/for.c | 11-----------
Dtests/for/for.c.inst_good | 14--------------
Dtests/for/test.sh | 0
Dtests/hello_world/Makefile | 11-----------
Dtests/hello_world/hello.c | 8--------
Dtests/hello_world/hello.c.inst_good | 11-----------
Dtests/hello_world/test.sh | 8--------
Dtests/if/Makefile | 11-----------
Dtests/if/if.c | 20--------------------
Dtests/if/if.c.inst_good | 23-----------------------
Dtests/if/test.sh | 0
Dtests/return/Makefile | 11-----------
Dtests/return/return.c | 15---------------
Dtests/return/return.c.inst_good | 18------------------
Dtests/return/test.sh | 0
Dtests/switch/Makefile | 11-----------
Dtests/switch/switch.c | 12------------
Dtests/switch/switch.c.inst_good | 15---------------
Dtests/switch/test.sh | 0
Dtests/while/Makefile | 11-----------
Dtests/while/test.sh | 7-------
Dtests/while/while.c | 12------------
Dtests/while/while.c.inst_good | 15---------------
39 files changed, 534 insertions(+), 396 deletions(-)

diff --git a/Makefile b/Makefile @@ -9,7 +9,7 @@ SUBDIRS = instrument runtime viewer all: make_subdirs test: make_subdirs - @sh run_tests.sh + prove clean: make -C instrument clean diff --git a/SCV/Project.pm b/SCV/Project.pm @@ -0,0 +1,91 @@ +package SCV::Project; +use strict; + +use File::Temp qw( tempdir ); +use Test; +use IPC::Open3; + +sub new { + my ($class, $tmp_dir) = @_; + my $self = {}; + bless ($self, $class); + + # Make new temporary directory, clean it up at exit + $self->{tmp_dir} = tempdir( CLEANUP => 1 ); + return $self; +} + +sub add_src { + my ($self, $source) = @_; + + # Write source code to temp directory + open( my $src_fh, ">", "$self->{tmp_dir}/source.c" ); + syswrite( $src_fh, $source ); + close( $src_fh ); +} + +sub compile { + my ($self) = @_; + my $tmp_dir = $self->{tmp_dir}; + + my $makefile = <<EOF; +BIN = program +SRCS = source.c +OBJS = \$(SRCS:c=o) + +\$(BIN): \$(OBJS) + \$(CC) -o \$(BIN) \$(OBJS) \$(LDLIBS) + +EOF + # Write Makefile to temp directory + open( my $makefile_fh, ">", "$tmp_dir/Makefile" ); + syswrite( $makefile_fh, $makefile ); + + # Hook $PATH so we run our "compiler" first + $ENV{SCV_PATH} = "$ENV{HOME}/src/scv/compilers"; + $ENV{PATH} = "$ENV{SCV_PATH}:$ENV{PATH}"; + + # Link in the runtime + $ENV{CFLAGS} = "-pthread"; + # $ENV{LDLIBS} = "-Lruntime -lruntime -pthread"; + # $ENV{LD_LIBRARY_PATH} = "runtime"; + + my $ret = system( "make -C $tmp_dir" ); + die "make failed: $ret\n" if ($ret); +} + +sub instrumented_src { + my ($self) = @_; + + open( my $inst_fh, "<", "$self->{tmp_dir}/inst/source.c" ); + my $inst_src; + while (my $line = <$inst_fh>) { + $inst_src .= $line; + } + + return $inst_src; +} + +sub run { + my ($self, @args) = @_; + my $tmp_dir = $self->{tmp_dir}; + + my $pid = open3(undef, undef, \*CHLD_ERR, "$tmp_dir/program", @args); + + waitpid( $pid, 0 ); + my $real_ret = $? >> 8; + + my $stderr; + while (my $line = <CHLD_ERR>) { + $stderr .= $line; + } + + return ($real_ret, $stderr); +} + +sub get_tmpdir { + my ($self) = @_; + return $self->{tmp_dir}; +} + +1; diff --git a/run_tests.sh b/run_tests.sh @@ -1,37 +0,0 @@ -#!/bin/sh - -if which tput > /dev/null; then - RED=`tput setaf 1 0 0` - GREEN=`tput setaf 2 0 0` - RESET=`tput sgr0` -fi - -export SCV_PATH="$HOME/src/scv/compilers" -export PATH="$SCV_PATH:$PATH" - -export CFLAGS="-pthread" -export LDLIBS="-L../../runtime -lruntime -pthread" -for t in `ls tests/*/Makefile`; do - dirname=`dirname ${t}` - make -s -C $dirname clean - - if ! make -s -C $dirname; then - echo "$dirname:$RED make failed!$RESET" - continue - fi - - # diff against the last known good instrumented source - if ! make -s -C $dirname "diff"; then - echo "$dirname:$RED make diff failed$RESET" - continue - fi - - # test that the instrumented binary works properly - if ! make -s -C $dirname "test"; then - echo "$dirname:$RED make test failed!$RESET" - continue - fi - - make -s -C $dirname clean - echo "$dirname:$GREEN ok$RESET" -done diff --git a/t/fibonacci.t b/t/fibonacci.t @@ -0,0 +1,108 @@ +use strict; +use SCV::Project; +use Test::More tests => 7; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +#include <err.h> +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> + +long long +fibonacci(long long n) +{ + if (n == 0) + return 0; + else if (n == 1) + return 1; + + return fibonacci(n - 1) + fibonacci(n - 2); +} + +int +main(int argc, char *argv[]) +{ + long long n; + const char *errstr = NULL; + + if (argc != 2) { + fprintf(stderr, "usage: %s <N>\\n", argv[0]); + return 1; + } + + n = strtonum(argv[1], LONG_MIN, LONG_MAX, &errstr); + if (errstr) + err(1, "%s", errstr); + + fprintf(stderr, "result: %lli\\n", fibonacci(n)); + + return 0; +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[530]; +int size = 530; +char file_name[] = "$tmp_dir/source.c"; +#include <err.h> +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> + +long long +fibonacci(long long n) +{ + if ((lines[9] = 1, n == 0)) + return (lines[10] = 1, 0); + else if ((lines[11] = 1, n == 1)) + return (lines[12] = 1, 1); + + return (lines[14] = 1, (lines[14] = 1, fibonacci(n - 1)) + (lines[14] = 1, fibonacci(n - 2))); +} + +int +main(int argc, char *argv[]) +{ + long long n; + const char *errstr = NULL; + + if ((lines[23] = 1, argc != 2)) { + (lines[24] = 1, fprintf(stderr, "usage: %s <N>\\n", argv[0])); + return (lines[25] = 1, 1); + } + + n = (lines[28] = 1, strtonum(argv[1], LONG_MIN, LONG_MAX, &errstr)); + if ((lines[29] = 1, errstr)) + (lines[30] = 1, err(1, "%s", errstr)); + + (lines[32] = 1, fprintf(stderr, "result: %lli\\n", (lines[32] = 1, fibonacci(n)))); + + return (lines[34] = 1, 0); +} +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(); +is($ret, 1, "instrumented program check return code"); + +my ($ret, $err) = $project->run(10); +is($ret, 0, "instrumented program check correctness 1"); +is($err, "result: 55\n", "instrumented program check correctness 1"); + +my ($ret, $err) = $project->run(20); +is($ret, 0, "instrumented program check correctness 2"); +is($err, "result: 6765\n", "instrumented program check correctness 2"); diff --git a/t/for.t b/t/for.t @@ -0,0 +1,52 @@ +use strict; +use SCV::Project; +use Test::More tests => 3; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +int +main(void) +{ + int i; + + for (i = 0; i < 19; i++) { + i++; + } + + return i; +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[78]; +int size = 78; +char file_name[] = "$tmp_dir/source.c"; +int +main(void) +{ + int i; + + for (i = 0; (lines[6] = 1, i < 19); i++) { + i++; + } + + return (lines[10] = 1, i); +} +EOF + +my $inst_src = $project->instrumented_src(); +ok( $inst_src ); + +eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison"; + +my ($ret) = $project->run(); +is($ret, 20, "instrumented program check"); diff --git a/t/hello_world.t b/t/hello_world.t @@ -0,0 +1,48 @@ +use strict; +use SCV::Project; +use Test::More tests => 4; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +#include <stdio.h> + +int +main(void) +{ + fprintf(stderr, "hello, world!"); + return 0; +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[85]; +int size = 85; +char file_name[] = "$tmp_dir/source.c"; +#include <stdio.h> + +int +main(void) +{ + (lines[6] = 1, fprintf(stderr, "hello, world!")); + return (lines[7] = 1, 0); +} +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(); +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 @@ -0,0 +1,70 @@ +use strict; +use SCV::Project; +use Test::More tests => 3; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + if (argc == 1) + return 1; + else + exit(14); + + if (argc == 2) { + return 5; + } + else if (argc == 3) { + return 0; + } + else { + exit(0); + } +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[198]; +int size = 198; +char file_name[] = "$tmp_dir/source.c"; +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + if ((lines[6] = 1, argc == 1)) + return (lines[7] = 1, 1); + else + (lines[9] = 1, exit(14)); + + if ((lines[11] = 1, argc == 2)) { + return (lines[12] = 1, 5); + } + else if ((lines[14] = 1, argc == 3)) { + return (lines[15] = 1, 0); + } + else { + (lines[18] = 1, exit(0)); + } +} +EOF + +my $inst_src = $project->instrumented_src(); +ok( $inst_src ); + +eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison"; + +my ($ret) = $project->run(); +is($ret, 1, "instrumented program check"); diff --git a/t/return.t b/t/return.t @@ -0,0 +1,52 @@ +use strict; +use SCV::Project; +use Test::More tests => 3; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +int foo() { + return 0; +} + +int main(void) { + return 10; + + return 10 + 10; + + return foo(); +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[91]; +int size = 91; +char file_name[] = "$tmp_dir/source.c"; +int foo() { + return (lines[2] = 1, 0); +} + +int main(void) { + return (lines[6] = 1, 10); + + return (lines[8] = 1, 10 + 10); + + return (lines[10] = 1, (lines[10] = 1, foo())); +} +EOF + +my $inst_src = $project->instrumented_src(); +ok( $inst_src ); + +eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison"; + +my ($ret) = $project->run(); +is($ret, 10, "instrumented program check"); diff --git a/t/switch.t b/t/switch.t @@ -0,0 +1,58 @@ +use strict; +use SCV::Project; +use Test::More tests => 3; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +int +main(void) +{ + int i; + + switch (i) { + case 0: + break; + case 1: + break; + } + + return 0; +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[93]; +int size = 93; +char file_name[] = "$tmp_dir/source.c"; +int +main(void) +{ + int i; + + switch ((lines[6] = 1, i)) { + case 0: + break; + case 1: + break; + } + + return (lines[13] = 1, 0); +} +EOF + +my $inst_src = $project->instrumented_src(); +ok( $inst_src ); + +eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison"; + +my ($ret) = $project->run(); +is($ret, 0, "instrumented program check"); diff --git a/t/while.t b/t/while.t @@ -0,0 +1,54 @@ +use strict; +use SCV::Project; +use Test::More tests => 3; +use Test::Differences; + +my $project = SCV::Project->new(); +unified_diff; + +$project->add_src( +<<EOF +int +main(void) +{ + int i; + + i = 0; + while (i < 17) { + i++; + } + + return i; +} +EOF +); + +$project->compile(); + +my $tmp_dir = $project->get_tmpdir(); + +my $inst_src_good = <<EOF; +unsigned int lines[76]; +int size = 76; +char file_name[] = "$tmp_dir/source.c"; +int +main(void) +{ + int i; + + i = 0; + while ((lines[7] = 1, i < 17)) { + i++; + } + + return (lines[11] = 1, i); +} +EOF + +my $inst_src = $project->instrumented_src(); +ok( $inst_src ); + +eq_or_diff $inst_src, $inst_src_good, "instrumented source comparison"; + +my ($ret) = $project->run(); +is($ret, 17, "instrumented program check"); diff --git a/tests/Makefile.test b/tests/Makefile.test @@ -1,5 +0,0 @@ -test: - sh test.sh - -clean: - rm -f $(OBJS) $(BIN) *.{backup,inst} diff --git a/tests/fibonacci/Makefile b/tests/fibonacci/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = fib.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u fib.c.inst fib.c.inst_good - -.include "../Makefile.test" diff --git a/tests/fibonacci/fib.c b/tests/fibonacci/fib.c @@ -1,35 +0,0 @@ -#include <err.h> -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> - -long long -fibonacci(long long n) -{ - if (n == 0) - return 0; - else if (n == 1) - return 1; - - return fibonacci(n - 1) + fibonacci(n - 2); -} - -int -main(int argc, char *argv[]) -{ - long long n; - const char *errstr = NULL; - - if (argc != 2) { - printf("usage: %s <N>\n", argv[0]); - return 1; - } - - n = strtonum(argv[1], LONG_MIN, LONG_MAX, &errstr); - if (errstr) - err(1, "%s", errstr); - - printf("result: %lli\n", fibonacci(n)); - - return 0; -} diff --git a/tests/fibonacci/fib.c.inst_good b/tests/fibonacci/fib.c.inst_good @@ -1,38 +0,0 @@ -unsigned int lines[512]; -int size = 512; -char file_name[] = "/home/kyle/src/scv/tests/fibonacci/fib.c"; -#include <err.h> -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> - -long long -fibonacci(long long n) -{ - if ((lines[9] = 1, n == 0)) - return (lines[10] = 1, 0); - else if ((lines[11] = 1, n == 1)) - return (lines[12] = 1, 1); - - return (lines[14] = 1, (lines[14] = 1, fibonacci(n - 1)) + (lines[14] = 1, fibonacci(n - 2))); -} - -int -main(int argc, char *argv[]) -{ - long long n; - const char *errstr = NULL; - - if ((lines[23] = 1, argc != 2)) { - (lines[24] = 1, printf("usage: %s <N>\n", argv[0])); - return (lines[25] = 1, 1); - } - - n = (lines[28] = 1, strtonum(argv[1], LONG_MIN, LONG_MAX, &errstr)); - if ((lines[29] = 1, errstr)) - (lines[30] = 1, err(1, "%s", errstr)); - - (lines[32] = 1, printf("result: %lli\n", (lines[32] = 1, fibonacci(n)))); - - return (lines[34] = 1, 0); -} diff --git a/tests/fibonacci/test.sh b/tests/fibonacci/test.sh @@ -1,14 +0,0 @@ -#!/bin/sh - -result="`./prog 10`" -if [ "$result" != "result: 55" ]; then - echo "${0}: '$result' != 'result: 55'" - exit 1 -fi - -result="`./prog 20`" -expected="result: 6765" -if [ "$result" != "$expected" ]; then - echo "${0}: '$result' != '$expected'" - exit 1 -fi diff --git a/tests/for/Makefile b/tests/for/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = for.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u for.c.inst_good for.c.inst - -.include "../Makefile.test" diff --git a/tests/for/for.c b/tests/for/for.c @@ -1,11 +0,0 @@ -int -main(void) -{ - int i; - - for (i = 0; i < 10; i++) { - i++; - } - - return i; -} diff --git a/tests/for/for.c.inst_good b/tests/for/for.c.inst_good @@ -1,14 +0,0 @@ -unsigned int lines[78]; -int size = 78; -char file_name[] = "/home/kyle/src/scv/tests/for/for.c"; -int -main(void) -{ - int i; - - for (i = 0; (lines[6] = 1, i < 10); i++) { - i++; - } - - return (lines[10] = 1, i); -} diff --git a/tests/for/test.sh b/tests/for/test.sh diff --git a/tests/hello_world/Makefile b/tests/hello_world/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = hello.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u hello.c.inst hello.c.inst_good - -.include "../Makefile.test" diff --git a/tests/hello_world/hello.c b/tests/hello_world/hello.c @@ -1,8 +0,0 @@ -#include <stdio.h> - -int -main(void) -{ - printf("hello, world\n"); - return 0; -} diff --git a/tests/hello_world/hello.c.inst_good b/tests/hello_world/hello.c.inst_good @@ -1,11 +0,0 @@ -unsigned int lines[77]; -int size = 77; -char file_name[] = "/home/kyle/src/scv/tests/hello_world/hello.c"; -#include <stdio.h> - -int -main(void) -{ - (lines[6] = 1, printf("hello, world\n")); - return (lines[7] = 1, 0); -} diff --git a/tests/hello_world/test.sh b/tests/hello_world/test.sh @@ -1,8 +0,0 @@ -#!/bin/sh - -result="`prog`" -expected="hello, world" -if [ "$result" != "$expected" ]; then - echo "${0}: '$result' != '$expected'" - exit 1 -fi diff --git a/tests/if/Makefile b/tests/if/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = if.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u if.c.inst_good if.c.inst - -.include "../Makefile.test" diff --git a/tests/if/if.c b/tests/if/if.c @@ -1,20 +0,0 @@ -#include <stdlib.h> - -int -main(int argc, char *argv[]) -{ - if (argc == 1) - return 1; - else - exit(14); - - if (argc == 2) { - return 5; - } - else if (argc == 3) { - return 0; - } - else { - exit(0); - } -} diff --git a/tests/if/if.c.inst_good b/tests/if/if.c.inst_good @@ -1,23 +0,0 @@ -unsigned int lines[198]; -int size = 198; -char file_name[] = "/home/kyle/src/scv/tests/if/if.c"; -#include <stdlib.h> - -int -main(int argc, char *argv[]) -{ - if ((lines[6] = 1, argc == 1)) - return (lines[7] = 1, 1); - else - (lines[9] = 1, exit(14)); - - if ((lines[11] = 1, argc == 2)) { - return (lines[12] = 1, 5); - } - else if ((lines[14] = 1, argc == 3)) { - return (lines[15] = 1, 0); - } - else { - (lines[18] = 1, exit(0)); - } -} diff --git a/tests/if/test.sh b/tests/if/test.sh diff --git a/tests/return/Makefile b/tests/return/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = return.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u return.c.inst{_good,} - -.include "../Makefile.test" diff --git a/tests/return/return.c b/tests/return/return.c @@ -1,15 +0,0 @@ -int -foo() -{ - return 0; -} - -int -main(void) -{ - return 10; - - return 10 + 10; - - return foo(); -} diff --git a/tests/return/return.c.inst_good b/tests/return/return.c.inst_good @@ -1,18 +0,0 @@ -unsigned int lines[91]; -int size = 91; -char file_name[] = "/home/kyle/src/scv/tests/return/return.c"; -int -foo() -{ - return (lines[4] = 1, 0); -} - -int -main(void) -{ - return (lines[10] = 1, 10); - - return (lines[12] = 1, 10 + 10); - - return (lines[14] = 1, (lines[14] = 1, foo())); -} diff --git a/tests/return/test.sh b/tests/return/test.sh diff --git a/tests/switch/Makefile b/tests/switch/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = switch.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u switch.c.inst{_good,} - -.include "../Makefile.test" diff --git a/tests/switch/switch.c b/tests/switch/switch.c @@ -1,12 +0,0 @@ -int -main(void) -{ - int i; - - switch (i) { - case 0: - break; - case 1: - break; - } -} diff --git a/tests/switch/switch.c.inst_good b/tests/switch/switch.c.inst_good @@ -1,15 +0,0 @@ -unsigned int lines[81]; -int size = 81; -char file_name[] = "/home/kyle/src/scv/tests/switch/switch.c"; -int -main(void) -{ - int i; - - switch ((lines[6] = 1, i)) { - case 0: - break; - case 1: - break; - } -} diff --git a/tests/switch/test.sh b/tests/switch/test.sh diff --git a/tests/while/Makefile b/tests/while/Makefile @@ -1,11 +0,0 @@ -BIN = prog -SRCS = while.c -OBJS = $(SRCS:c=o) - -$(BIN): $(OBJS) - $(CC) -o $(BIN) $(OBJS) $(LDLIBS) - -diff: - diff -u while.c.inst_good while.c.inst - -.include "../Makefile.test" diff --git a/tests/while/test.sh b/tests/while/test.sh @@ -1,7 +0,0 @@ -#!/bin/sh - -prog -if [ $? -ne 10 ]; then - echo "${0}: basic while loops broken" - exit 1 -fi diff --git a/tests/while/while.c b/tests/while/while.c @@ -1,12 +0,0 @@ -int -main(void) -{ - int i; - - i = 0; - while (i < 10) { - i++; - } - - return i; -} diff --git a/tests/while/while.c.inst_good b/tests/while/while.c.inst_good @@ -1,15 +0,0 @@ -unsigned int lines[76]; -int size = 76; -char file_name[] = "/home/kyle/src/scv/tests/while/while.c"; -int -main(void) -{ - int i; - - i = 0; - while ((lines[7] = 1, i < 10)) { - i++; - } - - return (lines[11] = 1, i); -}