citrun

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

commit e7aac39d6918aba635f3468dfedec16bcc381459
parent 9a081afc4f05ff948170765450682559297eb00d
Author: kyle <kyle@getaddrinfo.net>
Date:   Sun,  1 Nov 2015 20:11:34 -0700

tests: bring if_statement up to date

Diffstat:
Mtests/if_statement/Makefile | 14++++++++++----
Atests/if_statement/if.c | 20++++++++++++++++++++
Atests/if_statement/if.c.inst_good | 23+++++++++++++++++++++++
Dtests/if_statement/instrumented.c | 22----------------------
Dtests/if_statement/prog.c | 20--------------------
Atests/if_statement/test.sh | 0
6 files changed, 53 insertions(+), 46 deletions(-)

diff --git a/tests/if_statement/Makefile b/tests/if_statement/Makefile @@ -1,5 +1,11 @@ -test: - @echo "test suite empty" +BIN = prog +SRCS = if.c +OBJS = $(SRCS:c=o) -clean: - @rm -f prog prog_inst.c +$(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_statement/if.c b/tests/if_statement/if.c @@ -0,0 +1,20 @@ +#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_statement/if.c.inst_good b/tests/if_statement/if.c.inst_good @@ -0,0 +1,23 @@ +unsigned int lines[198]; +int size = 198; +char file_name[] = "/home/kyle/src/scv/tests/if_statement/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_statement/instrumented.c b/tests/if_statement/instrumented.c @@ -1,22 +0,0 @@ -unsigned int lines[199]; -int size = 199; -#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_statement/prog.c b/tests/if_statement/prog.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_statement/test.sh b/tests/if_statement/test.sh