aboutsummaryrefslogtreecommitdiff
path: root/lib/tests/test_utils.c
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2009-01-26 02:05:21 -0500
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2009-01-26 02:05:21 -0500
commitba132e9e521218efc5d35aa5f7a024cba93f5e29 (patch)
tree9328162d51cc85d99cf7c18b40e3b9684a17dedf /lib/tests/test_utils.c
parent0a74b6fda08c484cba7216596d2ffa3931b900e5 (diff)
downloadmonitoring-plugins-ba132e9e521218efc5d35aa5f7a024cba93f5e29.tar.gz
Make extract_value more generic:
Add a separator argument passed using defines.
Diffstat (limited to 'lib/tests/test_utils.c')
-rw-r--r--lib/tests/test_utils.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index 97343afa..3a45944a 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -172,83 +172,83 @@ main (int argc, char **argv)
test = np_escaped_string("everything");
ok( strcmp(test, "everything") == 0, "everything okay");
- /* np_extract_value tests (23) */
- test=np_extract_value("foo=bar, bar=foo, foobar=barfoo\n", "foo");
+ /* np_extract_ntpvar tests (23) */
+ test=np_extract_ntpvar("foo=bar, bar=foo, foobar=barfoo\n", "foo");
ok(test && !strcmp(test, "bar"), "1st test as expected");
free(test);
- test=np_extract_value("foo=bar,bar=foo,foobar=barfoo\n", "bar");
+ test=np_extract_ntpvar("foo=bar,bar=foo,foobar=barfoo\n", "bar");
ok(test && !strcmp(test, "foo"), "2nd test as expected");
free(test);
- test=np_extract_value("foo=bar, bar=foo, foobar=barfoo\n", "foobar");
+ test=np_extract_ntpvar("foo=bar, bar=foo, foobar=barfoo\n", "foobar");
ok(test && !strcmp(test, "barfoo"), "3rd test as expected");
free(test);
- test=np_extract_value("foo=bar\n", "foo");
+ test=np_extract_ntpvar("foo=bar\n", "foo");
ok(test && !strcmp(test, "bar"), "Single test as expected");
free(test);
- test=np_extract_value("foo=bar, bar=foo, foobar=barfooi\n", "abcd");
+ test=np_extract_ntpvar("foo=bar, bar=foo, foobar=barfooi\n", "abcd");
ok(!test, "Key not found 1");
- test=np_extract_value("foo=bar\n", "abcd");
+ test=np_extract_ntpvar("foo=bar\n", "abcd");
ok(!test, "Key not found 2");
- test=np_extract_value("foo=bar=foobar", "foo");
+ test=np_extract_ntpvar("foo=bar=foobar", "foo");
ok(test && !strcmp(test, "bar=foobar"), "Strange string 1");
free(test);
- test=np_extract_value("foo", "foo");
+ test=np_extract_ntpvar("foo", "foo");
ok(!test, "Malformed string 1");
- test=np_extract_value("foo,", "foo");
+ test=np_extract_ntpvar("foo,", "foo");
ok(!test, "Malformed string 2");
- test=np_extract_value("foo=", "foo");
+ test=np_extract_ntpvar("foo=", "foo");
ok(!test, "Malformed string 3");
- test=np_extract_value("foo=,bar=foo", "foo");
+ test=np_extract_ntpvar("foo=,bar=foo", "foo");
ok(!test, "Malformed string 4");
- test=np_extract_value(",foo", "foo");
+ test=np_extract_ntpvar(",foo", "foo");
ok(!test, "Malformed string 5");
- test=np_extract_value("=foo", "foo");
+ test=np_extract_ntpvar("=foo", "foo");
ok(!test, "Malformed string 6");
- test=np_extract_value("=foo,", "foo");
+ test=np_extract_ntpvar("=foo,", "foo");
ok(!test, "Malformed string 7");
- test=np_extract_value(",,,", "foo");
+ test=np_extract_ntpvar(",,,", "foo");
ok(!test, "Malformed string 8");
- test=np_extract_value("===", "foo");
+ test=np_extract_ntpvar("===", "foo");
ok(!test, "Malformed string 9");
- test=np_extract_value(",=,=,", "foo");
+ test=np_extract_ntpvar(",=,=,", "foo");
ok(!test, "Malformed string 10");
- test=np_extract_value("=,=,=", "foo");
+ test=np_extract_ntpvar("=,=,=", "foo");
ok(!test, "Malformed string 11");
- test=np_extract_value(" foo=bar ,\n bar=foo\n , foobar=barfoo \n ", "foo");
+ test=np_extract_ntpvar(" foo=bar ,\n bar=foo\n , foobar=barfoo \n ", "foo");
ok(test && !strcmp(test, "bar"), "Random spaces and newlines 1");
free(test);
- test=np_extract_value(" foo=bar ,\n bar=foo\n , foobar=barfoo \n ", "bar");
+ test=np_extract_ntpvar(" foo=bar ,\n bar=foo\n , foobar=barfoo \n ", "bar");
ok(test && !strcmp(test, "foo"), "Random spaces and newlines 2");
free(test);
- test=np_extract_value(" foo=bar ,\n bar=foo\n , foobar=barfoo \n ", "foobar");
+ test=np_extract_ntpvar(" foo=bar ,\n bar=foo\n , foobar=barfoo \n ", "foobar");
ok(test && !strcmp(test, "barfoo"), "Random spaces and newlines 3");
free(test);
- test=np_extract_value(" foo=bar ,\n bar\n \n= \n foo\n , foobar=barfoo \n ", "bar");
+ test=np_extract_ntpvar(" foo=bar ,\n bar\n \n= \n foo\n , foobar=barfoo \n ", "bar");
ok(test && !strcmp(test, "foo"), "Random spaces and newlines 4");
free(test);
- test=np_extract_value("", "foo");
+ test=np_extract_ntpvar("", "foo");
ok(!test, "Empty string return NULL");
return exit_status();