aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/chapter-8/test/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tutorial/chapter-8/test/test.c')
-rw-r--r--tutorial/chapter-8/test/test.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tutorial/chapter-8/test/test.c b/tutorial/chapter-8/test/test.c
new file mode 100644
index 000000000..1fef24685
--- /dev/null
+++ b/tutorial/chapter-8/test/test.c
@@ -0,0 +1,18 @@
+#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;
+}