citrun

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

commit f403443cf5158285884b9a6ac356bd9334302a5c
parent fe98fdcaa9c9aafe357345b67bcb9995986aac53
Author: kyle <kyle@getaddrinfo.net>
Date:   Mon, 26 Oct 2015 22:39:36 -0600

tests: add if_statement

Diffstat:
Atests/if_statement/instrumented.c | 21+++++++++++++++++++++
Atests/if_statement/prog.c | 20++++++++++++++++++++
Atests/if_statement/test.sh | 4++++
3 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/tests/if_statement/instrumented.c b/tests/if_statement/instrumented.c @@ -0,0 +1,21 @@ +static unsigned int lines[199]; +#include <stdlib.h> + +int +main(int argc, char *argv[]) +{ + if (lines[6] = 1, argc == 1) + return lines[7] = 1, 1; + else + 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 { + exit(0); + } +} diff --git a/tests/if_statement/prog.c b/tests/if_statement/prog.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/test.sh b/tests/if_statement/test.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "${0}: test suite empty" +exit 1