diff options
Diffstat (limited to 'optional/optional-test.c')
-rw-r--r-- | optional/optional-test.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/optional/optional-test.c b/optional/optional-test.c index 88577d3..73597e5 100644 --- a/optional/optional-test.c +++ b/optional/optional-test.c @@ -2,9 +2,11 @@ #include "../utest/utest.h" #include <stdio.h> +#include <string.h> -OPTIONALDEC(int); -OPTIONALDEC(char); +DECL_OPTIONAL(int); +DECL_OPTIONAL(char); +DECL_NAMED_OPTIONAL(str, char *); struct my_struct { OPTIONAL(int) a; @@ -27,6 +29,12 @@ TEST_BEGIN(test_optional_example) OPTIONAL(char) y = OPTNONE; OPTIONAL(char) z = OPTSOME('z'); + + OPTIONAL(str) s = OPTSOME("hello, world!"); + + expect(!strcmp(opt_default(s, "NULL!"), "hello, world!"), + "expected to contain string \"hello, world!\""); + float xy, xz; expect(opt_has(my.a), "expected to contain something"); |