diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2012-06-15 00:00:14 -0300 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-06-18 09:29:52 +0100 |
commit | af03a3af7c9dff12d341749ad5c448a4654e2363 (patch) | |
tree | 52da4972320a43b6acbf22e894700108051b576d | |
parent | 2a071d9bad248e4c58f919ed6700adbcf5c62cab (diff) |
insanitytest: Properly check if an item already failed validating.
-rw-r--r-- | lib/insanity/insanitytest.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/insanity/insanitytest.c b/lib/insanity/insanitytest.c index 1c3f442..5f11740 100644 --- a/lib/insanity/insanitytest.c +++ b/lib/insanity/insanitytest.c @@ -582,6 +582,7 @@ insanity_test_validate_checklist_item (InsanityTest * test, const char *label, gboolean success, const char *description) { const ChecklistItem *item; + gpointer cur_success; g_return_if_fail (INSANITY_IS_TEST (test)); g_return_if_fail (label != NULL); @@ -601,12 +602,13 @@ insanity_test_validate_checklist_item (InsanityTest * test, const char *label, insanity_test_ping_unlocked (test); - /* if the item has already been (in)validated, then we invalidate if success is FALSE, - and do nothing if success is TRUE. This ends up doing a AND operation on all booleans + /* if the item has already been invalidated, then we do nothing. + This ends up doing a AND operation on all booleans passed for that checklist item (ie, a checklist item succeeds only if all calls to validate for that item succeed, and fails if any call to validate for that item fails). */ - if (g_hash_table_lookup (test->priv->checklist_results, label) != NULL) { - if (success) { + if ((cur_success = + g_hash_table_lookup (test->priv->checklist_results, label)) != NULL) { + if (!GPOINTER_TO_UINT (cur_success)) { UNLOCK (test); return; } @@ -628,7 +630,7 @@ insanity_test_validate_checklist_item (InsanityTest * test, const char *label, } g_hash_table_insert (test->priv->checklist_results, g_strdup (label), - (success ? ((gpointer) 1) : ((gpointer) 0))); + (success ? GUINT_TO_POINTER (1) : GUINT_TO_POINTER (0))); done: UNLOCK (test); |