diff options
Diffstat (limited to 'tutorial/chapter-5/test/test.c')
-rw-r--r-- | tutorial/chapter-5/test/test.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tutorial/chapter-5/test/test.c b/tutorial/chapter-5/test/test.c new file mode 100644 index 000000000..f3bdf646c --- /dev/null +++ b/tutorial/chapter-5/test/test.c @@ -0,0 +1,22 @@ +//! [0] +// test/test.c + +#include "lib.h" + +#include <stdio.h> +#include <string.h> + +int main(int argc, char *argv[]) +{ + if (argc > 2) { + printf("usage: test [value]\n"); + return 1; + } + const char *expected = argc == 2 ? argv[1] : "Hello from library"; + if (strcmp(get_string(), expected) != 0) { + printf("text differs\n"); + return 1; + } + return 0; +} +//! [0]
\ No newline at end of file |