chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0d585d8
)
test-strv.c: added strv_split_nulstr() test
author
Daniel Buch
<boogiewasthere@gmail.com>
Mon, 18 Feb 2013 22:53:33 +0000
(23:53 +0100)
committer
Thomas Hindoe Paaboel Andersen
<phomes@gmail.com>
Mon, 18 Feb 2013 22:57:43 +0000
(23:57 +0100)
src/test/test-strv.c
patch
|
blob
|
history
diff --git
a/src/test/test-strv.c
b/src/test/test-strv.c
index a8801b56b5f0d5c9096aff03d7dea33f1c001ba5..ea1f0881feead8c93c8fa9ce58a186a933053a01 100644
(file)
--- a/
src/test/test-strv.c
+++ b/
src/test/test-strv.c
@@
-100,6
+100,18
@@
static void test_strv_join(void) {
assert_se(streq(t, ""));
}
assert_se(streq(t, ""));
}
+static void test_strv_split_nulstr(void) {
+ _cleanup_strv_free_ char **l = NULL;
+ const char nulstr[] = "str0\0str1\0str2\0str3\0";
+
+ l = strv_split_nulstr (nulstr);
+
+ assert_se(streq(l[0], "str0"));
+ assert_se(streq(l[1], "str1"));
+ assert_se(streq(l[2], "str2"));
+ assert_se(streq(l[3], "str3"));
+}
+
static void test_strv_parse_nulstr(void) {
_cleanup_strv_free_ char **l = NULL;
const char nulstr[] = "fuck\0fuck2\0fuck3\0\0fuck5\0\0xxx";
static void test_strv_parse_nulstr(void) {
_cleanup_strv_free_ char **l = NULL;
const char nulstr[] = "fuck\0fuck2\0fuck3\0\0fuck5\0\0xxx";
@@
-208,6
+220,7
@@
int main(int argc, char *argv[]) {
test_strv_find();
test_strv_find_prefix();
test_strv_join();
test_strv_find();
test_strv_find_prefix();
test_strv_join();
+ test_strv_split_nulstr();
test_strv_parse_nulstr();
test_strv_overlap();
test_strv_sort();
test_strv_parse_nulstr();
test_strv_overlap();
test_strv_sort();