[Intel-gfx] [PATCH i-g-t 15/18] stats: Use igt_assert_eq_double() when asserting on doubles
Damien Lespiau
damien.lespiau at intel.com
Sat Jun 27 08:08:13 PDT 2015
Lucky enough to have exact values, == works!
Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
lib/tests/igt_stats.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/tests/igt_stats.c b/lib/tests/igt_stats.c
index f09c079..468bba2 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);
}
--
2.1.0
More information about the Intel-gfx
mailing list