@cryptotaxi247 / netdata-1 / commits / dd61c64f2

added unittest to ensure calloc() sets alarms to uninitialized

Costa Tsaousis (ktsaou) committed Oct 15, 2017 at 14:40 UTC dd61c64f2bac90aecff9aa8457fae1d0062ea393
1 file changed +7
src/unit_test.c
+7
@@ -3,6 +3,13 @@
3 static int check_rrdcalc_comparisons(void) {
4 RRDCALC_STATUS a, b;
5
6 + // make sure calloc() sets the status to UNINITIALIZED
7 + memset(&a, 0, sizeof(RRDCALC_STATUS));
8 + if(a != RRDCALC_STATUS_UNINITIALIZED) {
9 + fprintf(stderr, "%s is not zero.\n", rrdcalc_status2string(RRDCALC_STATUS_UNINITIALIZED));
10 + return 1;
11 + }
12 +
13 a = RRDCALC_STATUS_REMOVED;
14 b = RRDCALC_STATUS_UNDEFINED;
15 if(!(a < b)) {