summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2015-06-27 15:31:19 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2015-06-27 16:04:08 +0100
commit2fe286985f825128142f56df5dc806a78338b308 (patch)
treeffd7669d0647cd368c3a2cf8f634c33648d987c1 /lib
parent0a38e977c026fee3a499946652263b2adfe7c27c (diff)
stats: Use igt_assert_eq_double() when asserting on doubles
Lucky enough to have exact values, == works! Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/igt_stats.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/tests/igt_stats.c b/lib/tests/igt_stats.c
index f09c0793..468bba27 100644
--- a/lib/tests/igt_stats.c
+++ b/lib/tests/igt_stats.c
@@ -41,7 +41,7 @@ static void test_init_zero(void)
stats.mean = 1.;
igt_stats_init(&stats, 2);
- igt_assert(stats.mean == 0.);
+ igt_assert_eq_double(stats.mean, 0.);
}
static void test_init(void)
@@ -87,7 +87,7 @@ static void test_mean(void)
push_fixture_1(&stats);
mean = igt_stats_get_mean(&stats);
- igt_assert(mean == (2 + 4 + 6 + 8 + 10) / 5.);
+ igt_assert_eq_double(mean, (2 + 4 + 6 + 8 + 10) / 5.);
igt_stats_fini(&stats);
}
@@ -101,7 +101,7 @@ static void test_invalidate_mean(void)
push_fixture_1(&stats);
mean1 = igt_stats_get_mean(&stats);
- igt_assert(mean1 == (2 + 4 + 6 + 8 + 10) / 5.);
+ igt_assert_eq_double(mean1, (2 + 4 + 6 + 8 + 10) / 5.);
igt_stats_push(&stats, 100);
@@ -133,13 +133,13 @@ static void test_std_deviation(void)
igt_stats_push(&stats, 9);
mean = igt_stats_get_mean(&stats);
- igt_assert(mean == (2 + 3 * 4 + 2 * 5 + 7 + 9) / 8.);
+ igt_assert_eq_double(mean, (2 + 3 * 4 + 2 * 5 + 7 + 9) / 8.);
variance = igt_stats_get_variance(&stats);
- igt_assert(variance == 4);
+ igt_assert_eq_double(variance, 4);
std_deviation = igt_stats_get_std_deviation(&stats);
- igt_assert(std_deviation == 2);
+ igt_assert_eq_double(std_deviation, 2);
igt_stats_fini(&stats);
}