summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Lane <iainl@gnome.org>2020-03-12 17:56:56 +0000
committerChristoph Reiter <reiter.christoph@gmail.com>2020-04-05 15:53:34 +0200
commite809109017208e716c4c433f03db743846da4a43 (patch)
tree04aeb9710153a5e25b54c3951310ac55c643b181
parent137952c03abd2acd454b834d8cc7ae10915c8aa0 (diff)
downloadgobject-introspection-e809109017208e716c4c433f03db743846da4a43.tar.gz
gimarshallingtests: Use g_assert_cmpfloat_with_epsilon
Comparing floats directly doesn't always work on all architectures.
-rw-r--r--tests/gimarshallingtests.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 92868016..cff2dcb0 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3167,13 +3167,13 @@ gi_marshalling_tests_ghashtable_double_in (GHashTable *hash_table)
double *value;
value = g_hash_table_lookup (hash_table, "-1");
- g_assert_cmpfloat (*value, ==, -0.1);
+ g_assert_cmpfloat_with_epsilon (*value, -0.1, 0.01);
value = g_hash_table_lookup (hash_table, "0");
g_assert_cmpfloat (*value, ==, 0.0);
value = g_hash_table_lookup (hash_table, "1");
- g_assert_cmpfloat (*value, ==, 0.1);
+ g_assert_cmpfloat_with_epsilon (*value, 0.1, 0.01);
value = g_hash_table_lookup (hash_table, "2");
- g_assert_cmpfloat (*value, ==, 0.2);
+ g_assert_cmpfloat_with_epsilon (*value, 0.2, 0.01);
}
/**
@@ -3188,13 +3188,13 @@ gi_marshalling_tests_ghashtable_float_in (GHashTable *hash_table)
float *value;
value = g_hash_table_lookup (hash_table, "-1");
- g_assert_cmpfloat (*value, ==, -0.1f);
+ g_assert_cmpfloat_with_epsilon (*value, -0.1f, 0.01f);
value = g_hash_table_lookup (hash_table, "0");
g_assert_cmpfloat (*value, ==, 0.0f);
value = g_hash_table_lookup (hash_table, "1");
- g_assert_cmpfloat (*value, ==, 0.1f);
+ g_assert_cmpfloat_with_epsilon (*value, 0.1f, 0.01f);
value = g_hash_table_lookup (hash_table, "2");
- g_assert_cmpfloat (*value, ==, 0.2f);
+ g_assert_cmpfloat_with_epsilon (*value, 0.2f, 0.01f);
}
/**