summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/test_utils.c14
-rw-r--r--lib/utils_base.c1
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index d4a0800..79e1110 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(141); 41 plan_tests(150);
42 42
43 ok( this_nagios_plugin==NULL, "nagios_plugin not initialised"); 43 ok( this_nagios_plugin==NULL, "nagios_plugin not initialised");
44 44
@@ -132,6 +132,18 @@ main (int argc, char **argv)
132 ok( check_range(0, range) == TRUE, "0 - alert"); 132 ok( check_range(0, range) == TRUE, "0 - alert");
133 free(range); 133 free(range);
134 134
135 range = parse_range_string("@1:1");
136 ok( range != NULL, "'@1:1' is a valid range");
137 ok( range->start == 1, "Start correct");
138 ok( range->start_infinity == FALSE, "Not using negative infinity");
139 ok( range->end == 1, "End correct");
140 ok( range->end_infinity == FALSE, "Not using infinity");
141 ok( range->alert_on == INSIDE, "Will alert on inside of this range" );
142 ok( check_range(0.5, range) == FALSE, "0.5 - no alert");
143 ok( check_range(1, range) == TRUE, "1 - alert");
144 ok( check_range(5.2, range) == FALSE, "5.2 - no alert");
145 free(range);
146
135 range = parse_range_string("1:1"); 147 range = parse_range_string("1:1");
136 ok( range != NULL, "'1:1' is a valid range"); 148 ok( range != NULL, "'1:1' is a valid range");
137 ok( range->start == 1, "Start correct"); 149 ok( range->start == 1, "Start correct");
diff --git a/lib/utils_base.c b/lib/utils_base.c
index c93e9c3..8685e6f 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -28,6 +28,7 @@
28#include <stdarg.h> 28#include <stdarg.h>
29#include "utils_base.h" 29#include "utils_base.h"
30#include <fcntl.h> 30#include <fcntl.h>
31#include <sys/stat.h>
31 32
32#define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } } 33#define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } }
33 34