summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-15 16:21:31 (GMT)
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-15 16:21:31 (GMT)
commitddbabaa3b659bed9dcf5c5a2bfc430fb816277c7 (patch)
tree0d0980d41f95385cc0137ec86e7a1cea0065e04c /lib/tests
parent4b9d90f31c700298185aa4c7b20fe1c5e8bf19c2 (diff)
downloadmonitoring-plugins-ddbabaa3b659bed9dcf5c5a2bfc430fb816277c7.tar.gz
Replace all old school booleans in lib witch C99 onesrefs/pull/1937/head
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/test_disk.c20
-rw-r--r--lib/tests/test_utils.c76
2 files changed, 48 insertions, 48 deletions
diff --git a/lib/tests/test_disk.c b/lib/tests/test_disk.c
index 269d20b..e283fe2 100644
--- a/lib/tests/test_disk.c
+++ b/lib/tests/test_disk.c
@@ -44,19 +44,19 @@ main (int argc, char **argv)
44 44
45 plan_tests(33); 45 plan_tests(33);
46 46
47 ok( np_find_name(exclude_filesystem, "/var/log") == FALSE, "/var/log not in list"); 47 ok( np_find_name(exclude_filesystem, "/var/log") == false, "/var/log not in list");
48 np_add_name(&exclude_filesystem, "/var/log"); 48 np_add_name(&exclude_filesystem, "/var/log");
49 ok( np_find_name(exclude_filesystem, "/var/log") == TRUE, "is in list now"); 49 ok( np_find_name(exclude_filesystem, "/var/log") == true, "is in list now");
50 ok( np_find_name(exclude_filesystem, "/home") == FALSE, "/home not in list"); 50 ok( np_find_name(exclude_filesystem, "/home") == false, "/home not in list");
51 np_add_name(&exclude_filesystem, "/home"); 51 np_add_name(&exclude_filesystem, "/home");
52 ok( np_find_name(exclude_filesystem, "/home") == TRUE, "is in list now"); 52 ok( np_find_name(exclude_filesystem, "/home") == true, "is in list now");
53 ok( np_find_name(exclude_filesystem, "/var/log") == TRUE, "/var/log still in list"); 53 ok( np_find_name(exclude_filesystem, "/var/log") == true, "/var/log still in list");
54 54
55 ok( np_find_name(exclude_fstype, "iso9660") == FALSE, "iso9660 not in list"); 55 ok( np_find_name(exclude_fstype, "iso9660") == false, "iso9660 not in list");
56 np_add_name(&exclude_fstype, "iso9660"); 56 np_add_name(&exclude_fstype, "iso9660");
57 ok( np_find_name(exclude_fstype, "iso9660") == TRUE, "is in list now"); 57 ok( np_find_name(exclude_fstype, "iso9660") == true, "is in list now");
58 58
59 ok( np_find_name(exclude_filesystem, "iso9660") == FALSE, "Make sure no clashing in variables"); 59 ok( np_find_name(exclude_filesystem, "iso9660") == false, "Make sure no clashing in variables");
60 60
61 /* 61 /*
62 for (temp_name = exclude_filesystem; temp_name; temp_name = temp_name->next) { 62 for (temp_name = exclude_filesystem; temp_name; temp_name = temp_name->next) {
@@ -120,7 +120,7 @@ main (int argc, char **argv)
120 np_add_parameter(&paths, "/home/tonvoon"); 120 np_add_parameter(&paths, "/home/tonvoon");
121 np_add_parameter(&paths, "/dev/c2t0d0s0"); 121 np_add_parameter(&paths, "/dev/c2t0d0s0");
122 122
123 np_set_best_match(paths, dummy_mount_list, FALSE); 123 np_set_best_match(paths, dummy_mount_list, false);
124 for (p = paths; p; p = p->name_next) { 124 for (p = paths; p; p = p->name_next) {
125 struct mount_entry *temp_me; 125 struct mount_entry *temp_me;
126 temp_me = p->best_match; 126 temp_me = p->best_match;
@@ -144,7 +144,7 @@ main (int argc, char **argv)
144 np_add_parameter(&paths, "/home/tonvoon"); 144 np_add_parameter(&paths, "/home/tonvoon");
145 np_add_parameter(&paths, "/home"); 145 np_add_parameter(&paths, "/home");
146 146
147 np_set_best_match(paths, dummy_mount_list, TRUE); 147 np_set_best_match(paths, dummy_mount_list, true);
148 for (p = paths; p; p = p->name_next) { 148 for (p = paths; p; p = p->name_next) {
149 if (! strcmp(p->name, "/home/groups")) { 149 if (! strcmp(p->name, "/home/groups")) {
150 ok( ! p->best_match , "/home/groups correctly not found"); 150 ok( ! p->best_match , "/home/groups correctly not found");
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[] = {