summaryrefslogtreecommitdiffstats
path: root/lib/tests/test_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests/test_utils.c')
-rw-r--r--lib/tests/test_utils.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index 08eed240..356887d5 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -38,7 +38,7 @@ main (int argc, char **argv)
38 state_data *temp_state_data; 38 state_data *temp_state_data;
39 time_t current_time; 39 time_t current_time;
40 40
41 plan_tests(172); 41 plan_tests(185);
42 42
43 ok( this_monitoring_plugin==NULL, "monitoring_plugin not initialised"); 43 ok( this_monitoring_plugin==NULL, "monitoring_plugin not initialised");
44 44
@@ -182,6 +182,21 @@ main (int argc, char **argv)
182 ok( get_status(30.0001, thresholds) == STATE_WARNING, "30.0001 - warning"); 182 ok( get_status(30.0001, thresholds) == STATE_WARNING, "30.0001 - warning");
183 ok( get_status(69, thresholds) == STATE_CRITICAL, "69 - critical"); 183 ok( get_status(69, thresholds) == STATE_CRITICAL, "69 - critical");
184 184
185 rc = _set_thresholds(&thresholds, "-10:-2", "-30:20");
186 ok( rc == 0, "Thresholds ('-30:20', '-10:-2') set");
187 ok( thresholds->warning->start == -10, "Warning start set correctly");
188 ok( thresholds->warning->end == -2, "Warning end set correctly");
189 ok( thresholds->critical->start == -30, "Critical start set correctly");
190 ok( thresholds->critical->end == 20, "Critical end set correctly");
191 ok( get_status(-31, thresholds) == STATE_CRITICAL, "-31 - critical");
192 ok( get_status(-29, thresholds) == STATE_WARNING, "-29 - warning");
193 ok( get_status(-11, thresholds) == STATE_WARNING, "-11 - warning");
194 ok( get_status(-10, thresholds) == STATE_OK, "-10 - ok");
195 ok( get_status(-2, thresholds) == STATE_OK, "-2 - ok");
196 ok( get_status(-1, thresholds) == STATE_WARNING, "-1 - warning");
197 ok( get_status(19, thresholds) == STATE_WARNING, "19 - warning");
198 ok( get_status(21, thresholds) == STATE_CRITICAL, "21 - critical");
199
185 char *test; 200 char *test;
186 test = np_escaped_string("bob\\n"); 201 test = np_escaped_string("bob\\n");
187 ok( strcmp(test, "bob\n") == 0, "bob\\n ok"); 202 ok( strcmp(test, "bob\n") == 0, "bob\\n ok");
@@ -440,7 +455,7 @@ main (int argc, char **argv)
440 455
441 ok(this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin"); 456 ok(this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin");
442 457
443 ok(mp_suid() == FALSE, "test aren't suid"); 458 ok(mp_suid() == FALSE, "Test aren't suid");
444 459
445 /* base states with random case */ 460 /* base states with random case */
446 char *states[] = { 461 char *states[] = {