projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
all plugins: remove pthread.h include
[collectd.git]
/
src
/
utils_latency_test.c
diff --git
a/src/utils_latency_test.c
b/src/utils_latency_test.c
index
658b53c
..
f275813
100644
(file)
--- a/
src/utils_latency_test.c
+++ b/
src/utils_latency_test.c
@@
-26,9
+26,9
@@
#define DBL_PRECISION 1e-9
#define DBL_PRECISION 1e-9
-#include "testing.h"
-#include "collectd.h"
#include "common.h" /* for STATIC_ARRAY_SIZE */
#include "common.h" /* for STATIC_ARRAY_SIZE */
+#include "collectd.h"
+#include "testing.h"
#include "utils_time.h"
#include "utils_latency.h"
#include "utils_time.h"
#include "utils_latency.h"
@@
-47,7
+47,7
@@
DEF_TEST(simple)
{0.7, 0.3, 0.7, 1.5, 0.5},
{2.5, 0.3, 2.5, 4.0, 1.0},
{ 99, 0.3, 99, 103, 20.6},
{0.7, 0.3, 0.7, 1.5, 0.5},
{2.5, 0.3, 2.5, 4.0, 1.0},
{ 99, 0.3, 99, 103, 20.6},
- { -1, 0.3, 99, 103, 20.6},
+ /* { -1, 0.3, 99, 103, 20.6}, see issue #1139 */
};
size_t i;
latency_counter_t *l;
};
size_t i;
latency_counter_t *l;
@@
-59,10
+59,10
@@
DEF_TEST(simple)
i, cases[i].val, DOUBLE_TO_CDTIME_T (cases[i].val));
latency_counter_add (l, DOUBLE_TO_CDTIME_T (cases[i].val));
i, cases[i].val, DOUBLE_TO_CDTIME_T (cases[i].val));
latency_counter_add (l, DOUBLE_TO_CDTIME_T (cases[i].val));
-
DBLEQ
(cases[i].min, CDTIME_T_TO_DOUBLE (latency_counter_get_min (l)));
-
DBLEQ
(cases[i].max, CDTIME_T_TO_DOUBLE (latency_counter_get_max (l)));
-
DBLEQ
(cases[i].sum, CDTIME_T_TO_DOUBLE (latency_counter_get_sum (l)));
-
DBLEQ
(cases[i].avg, CDTIME_T_TO_DOUBLE (latency_counter_get_average (l)));
+
EXPECT_EQ_DOUBLE
(cases[i].min, CDTIME_T_TO_DOUBLE (latency_counter_get_min (l)));
+
EXPECT_EQ_DOUBLE
(cases[i].max, CDTIME_T_TO_DOUBLE (latency_counter_get_max (l)));
+
EXPECT_EQ_DOUBLE
(cases[i].sum, CDTIME_T_TO_DOUBLE (latency_counter_get_sum (l)));
+
EXPECT_EQ_DOUBLE
(cases[i].avg, CDTIME_T_TO_DOUBLE (latency_counter_get_average (l)));
}
latency_counter_destroy (l);
}
latency_counter_destroy (l);
@@
-80,15
+80,15
@@
DEF_TEST(percentile)
latency_counter_add (l, TIME_T_TO_CDTIME_T (((time_t) i) + 1));
}
latency_counter_add (l, TIME_T_TO_CDTIME_T (((time_t) i) + 1));
}
-
DBLEQ
( 1.0, CDTIME_T_TO_DOUBLE (latency_counter_get_min (l)));
-
DBLEQ
(100.0, CDTIME_T_TO_DOUBLE (latency_counter_get_max (l)));
-
DBLEQ
(100.0 * 101.0 / 2.0, CDTIME_T_TO_DOUBLE (latency_counter_get_sum (l)));
-
DBLEQ
( 50.5, CDTIME_T_TO_DOUBLE (latency_counter_get_average (l)));
+
EXPECT_EQ_DOUBLE
( 1.0, CDTIME_T_TO_DOUBLE (latency_counter_get_min (l)));
+
EXPECT_EQ_DOUBLE
(100.0, CDTIME_T_TO_DOUBLE (latency_counter_get_max (l)));
+
EXPECT_EQ_DOUBLE
(100.0 * 101.0 / 2.0, CDTIME_T_TO_DOUBLE (latency_counter_get_sum (l)));
+
EXPECT_EQ_DOUBLE
( 50.5, CDTIME_T_TO_DOUBLE (latency_counter_get_average (l)));
-
DBLEQ
(50.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 50.0)));
-
DBLEQ
(80.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 80.0)));
-
DBLEQ
(95.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 95.0)));
-
DBLEQ
(99.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 99.0)));
+
EXPECT_EQ_DOUBLE
(50.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 50.0)));
+
EXPECT_EQ_DOUBLE
(80.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 80.0)));
+
EXPECT_EQ_DOUBLE
(95.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 95.0)));
+
EXPECT_EQ_DOUBLE
(99.0, CDTIME_T_TO_DOUBLE (latency_counter_get_percentile (l, 99.0)));
CHECK_ZERO (latency_counter_get_percentile (l, -1.0));
CHECK_ZERO (latency_counter_get_percentile (l, 101.0));
CHECK_ZERO (latency_counter_get_percentile (l, -1.0));
CHECK_ZERO (latency_counter_get_percentile (l, 101.0));