[gnome-builder] egg-state-machine: Improve assert_prop_equal()
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] egg-state-machine: Improve assert_prop_equal()
- Date: Thu, 21 May 2015 06:58:35 +0000 (UTC)
commit f2a643ec91362d1b69f82891aa2b774185d9202d
Author: Garrett Regier <garrettregier gmail com>
Date: Wed May 20 05:23:10 2015 -0700
egg-state-machine: Improve assert_prop_equal()
Use the correct compare assertion when asserting
that the properties have the same value.
tests/test-egg-state-machine.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/tests/test-egg-state-machine.c b/tests/test-egg-state-machine.c
index d52731a..38d3c53 100644
--- a/tests/test-egg-state-machine.c
+++ b/tests/test-egg-state-machine.c
@@ -163,22 +163,22 @@ assert_prop_equal (gpointer obja,
g_object_get_property (obja, propname, &va);
g_object_get_property (objb, propname, &vb);
-#define ADD_NUMBER_CHECK(NAME, name) \
+#define ADD_CHECK(NAME, name, cmp_type) \
case G_TYPE_##NAME: \
- g_assert_cmpint (g_value_get_##name (&va), ==, g_value_get_##name (&vb)); \
+ g_assert_cmp##cmp_type (g_value_get_##name (&va), ==, g_value_get_##name (&vb)); \
break
switch (pspec->value_type)
{
- case G_TYPE_STRING:
- g_assert_cmpstr (g_value_get_string (&va), ==, g_value_get_string (&vb));
- break;
+ ADD_CHECK (INT, int, int);
+ ADD_CHECK (BOOLEAN, boolean, int);
+
+ ADD_CHECK (UINT, uint, uint);
+
+ ADD_CHECK (FLOAT, float, float);
+ ADD_CHECK (DOUBLE, double, float);
- ADD_NUMBER_CHECK (INT, int);
- ADD_NUMBER_CHECK (UINT, uint);
- ADD_NUMBER_CHECK (FLOAT, float);
- ADD_NUMBER_CHECK (DOUBLE, double);
- ADD_NUMBER_CHECK (BOOLEAN, boolean);
+ ADD_CHECK (STRING, string, str);
default:
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]