summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Lane <iainl@gnome.org>2020-03-12 17:56:56 +0000
committerIain Lane <iain@orangesquash.org.uk>2020-03-18 09:35:01 +0000
commit49fa7c278a05228931b7b436b10b323c1ef6730e (patch)
tree72e3c820dd55fbc7a8aa5b2724e594dfd9c5b4b7
parentd716945125543b999f892fbf6297ff6a37ee111f (diff)
downloadgobject-introspection-49fa7c278a05228931b7b436b10b323c1ef6730e.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 44971506..53c17818 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);
}
/**