X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_mount_test.c;h=c084debe46381d54e6ffb95cff612e392930ced6;hb=0a8741b9061f8df4a78a448c021612db06e17425;hp=a16b262c268b254581c22383d907dc6392bdf379;hpb=7bfda8d327240ac73297e4449663814dd0594be5;p=collectd.git diff --git a/src/utils_mount_test.c b/src/utils_mount_test.c index a16b262c..c084debe 100644 --- a/src/utils_mount_test.c +++ b/src/utils_mount_test.c @@ -24,8 +24,10 @@ * Florian octo Forster */ -#include "testing.h" #include "collectd.h" + +#include "common.h" +#include "testing.h" #include "utils_mount.h" #if HAVE_LIBKSTAT @@ -80,16 +82,25 @@ DEF_TEST(cu_mount_getoptionvalue) { char line_opts[] = "foo=one,bar=two,qux=three"; char line_bool[] = "one,two,three"; - - STREQ ("one", cu_mount_getoptionvalue (line_opts, "foo=")); - STREQ ("two", cu_mount_getoptionvalue (line_opts, "bar=")); - STREQ ("three", cu_mount_getoptionvalue (line_opts, "qux=")); - OK (NULL == cu_mount_getoptionvalue (line_opts, "unknown=")); - - STREQ ("", cu_mount_getoptionvalue (line_bool, "one")); - STREQ ("", cu_mount_getoptionvalue (line_bool, "two")); - STREQ ("", cu_mount_getoptionvalue (line_bool, "three")); - OK (NULL == cu_mount_getoptionvalue (line_bool, "four")); + char *v; + + EXPECT_EQ_STR ("one", v = cu_mount_getoptionvalue (line_opts, "foo=")); + sfree (v); + EXPECT_EQ_STR ("two", v = cu_mount_getoptionvalue (line_opts, "bar=")); + sfree (v); + EXPECT_EQ_STR ("three", v = cu_mount_getoptionvalue (line_opts, "qux=")); + sfree (v); + OK (NULL == (v = cu_mount_getoptionvalue (line_opts, "unknown="))); + sfree (v); + + EXPECT_EQ_STR ("", v = cu_mount_getoptionvalue (line_bool, "one")); + sfree (v); + EXPECT_EQ_STR ("", v = cu_mount_getoptionvalue (line_bool, "two")); + sfree (v); + EXPECT_EQ_STR ("", v = cu_mount_getoptionvalue (line_bool, "three")); + sfree (v); + OK (NULL == (v = cu_mount_getoptionvalue (line_bool, "four"))); + sfree (v); return (0); }