OSDN Git Service

Add assert macros for double and float.
authortsntsumi <tsntsumi@users.sourecforge.jp>
Sat, 6 Jul 2013 08:13:34 +0000 (17:13 +0900)
committertsntsumi <tsntsumi@users.sourecforge.jp>
Sat, 6 Jul 2013 08:13:34 +0000 (17:13 +0900)
src/ccunit/CCUnitAssert.h

index 9afb293..1693ab5 100644 (file)
@@ -532,6 +532,140 @@ extern void ccunit_assert (const char* file, unsigned int line,
 #define CCUNIT_ASSERT_GE_UINT(EXPECT, ACTUAL)  \
   CCUNIT_ASSERT_TEST_UINT (EXPECT, >=, ACTUAL)
 
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_EQ_DOUBLE(EXPECT, ACTUAL)        \
+  CCUNIT_ASSERT_TEST_DOUBLE (EXPECT, ==, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_NE_DOUBLE(EXPECT, ACTUAL)        \
+  CCUNIT_ASSERT_TEST_DOUBLE (EXPECT, !=, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_LT_DOUBLE(EXPECT, ACTUAL)        \
+  CCUNIT_ASSERT_TEST_DOUBLE (EXPECT, <, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_LE_DOUBLE(EXPECT, ACTUAL)        \
+  CCUNIT_ASSERT_TEST_DOUBLE (EXPECT, <=, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_GT_DOUBLE(EXPECT, ACTUAL)        \
+  CCUNIT_ASSERT_TEST_DOUBLE (EXPECT, >, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_GE_DOUBLE(EXPECT, ACTUAL)        \
+  CCUNIT_ASSERT_TEST_DOUBLE (EXPECT, >=, ACTUAL)
+
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_EQ_FLOAT(EXPECT, ACTUAL) \
+  CCUNIT_ASSERT_TEST_FLOAT (EXPECT, ==, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_NE_FLOAT(EXPECT, ACTUAL) \
+  CCUNIT_ASSERT_TEST_FLOAT (EXPECT, !=, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_LT_FLOAT(EXPECT, ACTUAL) \
+  CCUNIT_ASSERT_TEST_FLOAT (EXPECT, <, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_LE_FLOAT(EXPECT, ACTUAL) \
+  CCUNIT_ASSERT_TEST_FLOAT (EXPECT, <=, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_GT_FLOAT(EXPECT, ACTUAL) \
+  CCUNIT_ASSERT_TEST_FLOAT (EXPECT, >, ACTUAL)
+/**
+ * Asserts that a condition is true. If it isn't it longjmp with
+ * _ccunit_runTest_env.
+ *
+ * @param ACTUAL actual value.
+ * @param EXPECT expect value.
+ * @throws _ccunit_runTest_env If condition is false.
+ * @ingroup Assertions
+ */
+#define CCUNIT_ASSERT_GE_FLOAT(EXPECT, ACTUAL) \
+  CCUNIT_ASSERT_TEST_FLOAT (EXPECT, >=, ACTUAL)
+
 #if CCUNIT_HAVE_QUAD_T
 /**
  * Asserts that a condition is true. If it isn't it longjmp with