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.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index a109e3f..01afacd 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -62,99 +62,99 @@ main (int argc, char **argv)
62 range = parse_range_string("6"); 62 range = parse_range_string("6");
63 ok( range != NULL, "'6' is valid range"); 63 ok( range != NULL, "'6' is valid range");
64 ok( range->start == 0, "Start correct"); 64 ok( range->start == 0, "Start correct");
65 ok( range->start_infinity == FALSE, "Not using negative infinity"); 65 ok( range->start_infinity == false, "Not using negative infinity");
66 ok( range->end == 6, "End correct"); 66 ok( range->end == 6, "End correct");
67 ok( range->end_infinity == FALSE, "Not using infinity"); 67 ok( range->end_infinity == false, "Not using infinity");
68 free(range); 68 free(range);
69 69
70 range = parse_range_string("1:12%%"); 70 range = parse_range_string("1:12%%");
71 ok( range != NULL, "'1:12%%' is valid - percentages are ignored"); 71 ok( range != NULL, "'1:12%%' is valid - percentages are ignored");
72 ok( range->start == 1, "Start correct"); 72 ok( range->start == 1, "Start correct");
73 ok( range->start_infinity == FALSE, "Not using negative infinity"); 73 ok( range->start_infinity == false, "Not using negative infinity");
74 ok( range->end == 12, "End correct"); 74 ok( range->end == 12, "End correct");
75 ok( range->end_infinity == FALSE, "Not using infinity"); 75 ok( range->end_infinity == false, "Not using infinity");
76 free(range); 76 free(range);
77 77
78 range = parse_range_string("-7:23"); 78 range = parse_range_string("-7:23");
79 ok( range != NULL, "'-7:23' is valid range"); 79 ok( range != NULL, "'-7:23' is valid range");
80 ok( range->start == -7, "Start correct"); 80 ok( range->start == -7, "Start correct");
81 ok( range->start_infinity == FALSE, "Not using negative infinity"); 81 ok( range->start_infinity == false, "Not using negative infinity");
82 ok( range->end == 23, "End correct"); 82 ok( range->end == 23, "End correct");
83 ok( range->end_infinity == FALSE, "Not using infinity"); 83 ok( range->end_infinity == false, "Not using infinity");
84 free(range); 84 free(range);
85 85
86 range = parse_range_string(":5.75"); 86 range = parse_range_string(":5.75");
87 ok( range != NULL, "':5.75' is valid range"); 87 ok( range != NULL, "':5.75' is valid range");
88 ok( range->start == 0, "Start correct"); 88 ok( range->start == 0, "Start correct");
89 ok( range->start_infinity == FALSE, "Not using negative infinity"); 89 ok( range->start_infinity == false, "Not using negative infinity");
90 ok( range->end == 5.75, "End correct"); 90 ok( range->end == 5.75, "End correct");
91 ok( range->end_infinity == FALSE, "Not using infinity"); 91 ok( range->end_infinity == false, "Not using infinity");
92 free(range); 92 free(range);
93 93
94 range = parse_range_string("~:-95.99"); 94 range = parse_range_string("~:-95.99");
95 ok( range != NULL, "~:-95.99' is valid range"); 95 ok( range != NULL, "~:-95.99' is valid range");
96 ok( range->start_infinity == TRUE, "Using negative infinity"); 96 ok( range->start_infinity == true, "Using negative infinity");
97 ok( range->end == -95.99, "End correct (with rounding errors)"); 97 ok( range->end == -95.99, "End correct (with rounding errors)");
98 ok( range->end_infinity == FALSE, "Not using infinity"); 98 ok( range->end_infinity == false, "Not using infinity");
99 free(range); 99 free(range);
100 100
101 range = parse_range_string("12345678901234567890:"); 101 range = parse_range_string("12345678901234567890:");
102 temp = atof("12345678901234567890"); /* Can't just use this because number too large */ 102 temp = atof("12345678901234567890"); /* Can't just use this because number too large */
103 ok( range != NULL, "'12345678901234567890:' is valid range"); 103 ok( range != NULL, "'12345678901234567890:' is valid range");
104 ok( range->start == temp, "Start correct"); 104 ok( range->start == temp, "Start correct");
105 ok( range->start_infinity == FALSE, "Not using negative infinity"); 105 ok( range->start_infinity == false, "Not using negative infinity");
106 ok( range->end_infinity == TRUE, "Using infinity"); 106 ok( range->end_infinity == true, "Using infinity");
107 /* Cannot do a "-1" on temp, as it appears to be same value */ 107 /* Cannot do a "-1" on temp, as it appears to be same value */
108 ok( check_range(temp/1.1, range) == TRUE, "12345678901234567890/1.1 - alert"); 108 ok( check_range(temp/1.1, range) == true, "12345678901234567890/1.1 - alert");
109 ok( check_range(temp, range) == FALSE, "12345678901234567890 - no alert"); 109 ok( check_range(temp, range) == false, "12345678901234567890 - no alert");
110 ok( check_range(temp*2, range) == FALSE, "12345678901234567890*2 - no alert"); 110 ok( check_range(temp*2, range) == false, "12345678901234567890*2 - no alert");
111 free(range); 111 free(range);
112 112
113 range = parse_range_string("~:0"); 113 range = parse_range_string("~:0");
114 ok( range != NULL, "'~:0' is valid range"); 114 ok( range != NULL, "'~:0' is valid range");
115 ok( range->start_infinity == TRUE, "Using negative infinity"); 115 ok( range->start_infinity == true, "Using negative infinity");
116 ok( range->end == 0, "End correct"); 116 ok( range->end == 0, "End correct");
117 ok( range->end_infinity == FALSE, "Not using infinity"); 117 ok( range->end_infinity == false, "Not using infinity");
118 ok( range->alert_on == OUTSIDE, "Will alert on outside of this range"); 118 ok( range->alert_on == OUTSIDE, "Will alert on outside of this range");
119 ok( check_range(0.5, range) == TRUE, "0.5 - alert"); 119 ok( check_range(0.5, range) == true, "0.5 - alert");
120 ok( check_range(-10, range) == FALSE, "-10 - no alert"); 120 ok( check_range(-10, range) == false, "-10 - no alert");
121 ok( check_range(0, range) == FALSE, "0 - no alert"); 121 ok( check_range(0, range) == false, "0 - no alert");
122 free(range); 122 free(range);
123 123
124 range = parse_range_string("@0:657.8210567"); 124 range = parse_range_string("@0:657.8210567");
125 ok( range != 0, "@0:657.8210567' is a valid range"); 125 ok( range != 0, "@0:657.8210567' is a valid range");
126 ok( range->start == 0, "Start correct"); 126 ok( range->start == 0, "Start correct");
127 ok( range->start_infinity == FALSE, "Not using negative infinity"); 127 ok( range->start_infinity == false, "Not using negative infinity");
128 ok( range->end == 657.8210567, "End correct"); 128 ok( range->end == 657.8210567, "End correct");
129 ok( range->end_infinity == FALSE, "Not using infinity"); 129 ok( range->end_infinity == false, "Not using infinity");
130 ok( range->alert_on == INSIDE, "Will alert on inside of this range" ); 130 ok( range->alert_on == INSIDE, "Will alert on inside of this range" );
131 ok( check_range(32.88, range) == TRUE, "32.88 - alert"); 131 ok( check_range(32.88, range) == true, "32.88 - alert");
132 ok( check_range(-2, range) == FALSE, "-2 - no alert"); 132 ok( check_range(-2, range) == false, "-2 - no alert");
133 ok( check_range(657.8210567, range) == TRUE, "657.8210567 - alert"); 133 ok( check_range(657.8210567, range) == true, "657.8210567 - alert");
134 ok( check_range(0, range) == TRUE, "0 - alert"); 134 ok( check_range(0, range) == true, "0 - alert");
135 free(range); 135 free(range);
136 136
137 range = parse_range_string("@1:1"); 137 range = parse_range_string("@1:1");
138 ok( range != NULL, "'@1:1' is a valid range"); 138 ok( range != NULL, "'@1:1' is a valid range");
139 ok( range->start == 1, "Start correct"); 139 ok( range->start == 1, "Start correct");
140 ok( range->start_infinity == FALSE, "Not using negative infinity"); 140 ok( range->start_infinity == false, "Not using negative infinity");
141 ok( range->end == 1, "End correct"); 141 ok( range->end == 1, "End correct");
142 ok( range->end_infinity == FALSE, "Not using infinity"); 142 ok( range->end_infinity == false, "Not using infinity");
143 ok( range->alert_on == INSIDE, "Will alert on inside of this range" ); 143 ok( range->alert_on == INSIDE, "Will alert on inside of this range" );
144 ok( check_range(0.5, range) == FALSE, "0.5 - no alert"); 144 ok( check_range(0.5, range) == false, "0.5 - no alert");
145 ok( check_range(1, range) == TRUE, "1 - alert"); 145 ok( check_range(1, range) == true, "1 - alert");
146 ok( check_range(5.2, range) == FALSE, "5.2 - no alert"); 146 ok( check_range(5.2, range) == false, "5.2 - no alert");
147 free(range); 147 free(range);
148 148
149 range = parse_range_string("1:1"); 149 range = parse_range_string("1:1");
150 ok( range != NULL, "'1:1' is a valid range"); 150 ok( range != NULL, "'1:1' is a valid range");
151 ok( range->start == 1, "Start correct"); 151 ok( range->start == 1, "Start correct");
152 ok( range->start_infinity == FALSE, "Not using negative infinity"); 152 ok( range->start_infinity == false, "Not using negative infinity");
153 ok( range->end == 1, "End correct"); 153 ok( range->end == 1, "End correct");
154 ok( range->end_infinity == FALSE, "Not using infinity"); 154 ok( range->end_infinity == false, "Not using infinity");
155 ok( check_range(0.5, range) == TRUE, "0.5 - alert"); 155 ok( check_range(0.5, range) == true, "0.5 - alert");
156 ok( check_range(1, range) == FALSE, "1 - no alert"); 156 ok( check_range(1, range) == false, "1 - no alert");
157 ok( check_range(5.2, range) == TRUE, "5.2 - alert"); 157 ok( check_range(5.2, range) == true, "5.2 - alert");
158 free(range); 158 free(range);
159 159
160 range = parse_range_string("2:1"); 160 range = parse_range_string("2:1");
@@ -459,7 +459,7 @@ main (int argc, char **argv)
459 459
460 ok(this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin"); 460 ok(this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin");
461 461
462 ok(mp_suid() == FALSE, "Test aren't suid"); 462 ok(mp_suid() == false, "Test aren't suid");
463 463
464 /* base states with random case */ 464 /* base states with random case */
465 char *states[] = { 465 char *states[] = {