add NS_TEST_ASSERT_UNEQUAL
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sun, 12 Aug 2007 18:37:38 +0200
changeset 1348 b77625f55e90
parent 1347 83786345b743
child 1349 11562f6b73aa
add NS_TEST_ASSERT_UNEQUAL
src/core/test.h
--- a/src/core/test.h	Sun Aug 12 18:28:37 2007 +0200
+++ b/src/core/test.h	Sun Aug 12 18:37:38 2007 +0200
@@ -119,6 +119,23 @@
         result = false;                                 \
       }
 /**
+ * Convenience macro to check that a value returned by a test is what
+ * is expected.  Note: this macro assumes a 'bool result = true'
+ * declaration exists in the test function body, and that the function
+ * returns that value.
+ *
+ * \param got value obtained from the test
+ * \param expected value that the test is expected to return
+ */
+#define NS_TEST_ASSERT_UNEQUAL(got, expected)           \
+    if ((got) == (expected))                            \
+      {                                                 \
+        Failure () << __FILE__ << ":" <<__LINE__        \
+                   << ": did not want " << (expected)   \
+                   << ", got " << (got) << std::endl;   \
+        result = false;                                 \
+      }
+/**
  * Convenience macro to check an assertion is held during an unit
  * test.  Note: this macro assumes a 'bool result = true' declaration
  * exists in the test function body, and that the function returns