src/core/model/test.h
changeset 7252 c8200621e252
parent 7169 358f71a624d8
child 7379 ff0d074f885a
equal deleted inserted replaced
7251:b2fe610ad03f 7252:c8200621e252
    60  */
    60  */
    61 #define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line)                                  \
    61 #define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line)                                  \
    62   do {                                                                                                  \
    62   do {                                                                                                  \
    63       if (!((actual) == (limit)))                                                                         \
    63       if (!((actual) == (limit)))                                                                         \
    64         {                                                                                                 \
    64         {                                                                                                 \
    65           if (gBreakOnFailure) { *(int *)0 = 0;}                                                           \
    65           if (gBreakOnFailure) { *(int *)0 = 0; }                                                           \
    66           std::ostringstream msgStream;                                                                   \
    66           std::ostringstream msgStream;                                                                   \
    67           msgStream << msg;                                                                               \
    67           msgStream << msg;                                                                               \
    68           std::ostringstream actualStream;                                                                \
    68           std::ostringstream actualStream;                                                                \
    69           actualStream << actual;                                                                         \
    69           actualStream << actual;                                                                         \
    70           std::ostringstream limitStream;                                                                 \
    70           std::ostringstream limitStream;                                                                 \
   112  */
   112  */
   113 #define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line)                                  \
   113 #define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line)                                  \
   114   do {                                                                                                  \
   114   do {                                                                                                  \
   115       if (!((actual) == (limit)))                                                                         \
   115       if (!((actual) == (limit)))                                                                         \
   116         {                                                                                                 \
   116         {                                                                                                 \
   117           if (gBreakOnFailure) { *(int *)0 = 0;}                                                           \
   117           if (gBreakOnFailure) { *(int *)0 = 0; }                                                           \
   118           std::ostringstream msgStream;                                                                   \
   118           std::ostringstream msgStream;                                                                   \
   119           msgStream << msg;                                                                               \
   119           msgStream << msg;                                                                               \
   120           std::ostringstream actualStream;                                                                \
   120           std::ostringstream actualStream;                                                                \
   121           actualStream << actual;                                                                         \
   121           actualStream << actual;                                                                         \
   122           std::ostringstream limitStream;                                                                 \
   122           std::ostringstream limitStream;                                                                 \
   170  */
   170  */
   171 #define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line)                                  \
   171 #define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line)                                  \
   172   do {                                                                                                  \
   172   do {                                                                                                  \
   173       if (!((actual) == (limit)))                                                                         \
   173       if (!((actual) == (limit)))                                                                         \
   174         {                                                                                                 \
   174         {                                                                                                 \
   175           if (gBreakOnFailure) { *(int *)0 = 0;}                                                           \
   175           if (gBreakOnFailure) { *(int *)0 = 0; }                                                           \
   176           std::ostringstream msgStream;                                                                   \
   176           std::ostringstream msgStream;                                                                   \
   177           msgStream << msg;                                                                               \
   177           msgStream << msg;                                                                               \
   178           std::ostringstream actualStream;                                                                \
   178           std::ostringstream actualStream;                                                                \
   179           actualStream << actual;                                                                         \
   179           actualStream << actual;                                                                         \
   180           std::ostringstream limitStream;                                                                 \
   180           std::ostringstream limitStream;                                                                 \
   223  */
   223  */
   224 #define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line)                                       \
   224 #define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line)                                       \
   225   do {                                                                                                                \
   225   do {                                                                                                                \
   226       if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol))                                                     \
   226       if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol))                                                     \
   227         {                                                                                                               \
   227         {                                                                                                               \
   228           if (gBreakOnFailure) { *(int *)0 = 0;}                                                                         \
   228           if (gBreakOnFailure) { *(int *)0 = 0; }                                                                         \
   229           std::ostringstream msgStream;                                                                                 \
   229           std::ostringstream msgStream;                                                                                 \
   230           msgStream << msg;                                                                                             \
   230           msgStream << msg;                                                                                             \
   231           std::ostringstream actualStream;                                                                              \
   231           std::ostringstream actualStream;                                                                              \
   232           actualStream << actual;                                                                                       \
   232           actualStream << actual;                                                                                       \
   233           std::ostringstream limitStream;                                                                               \
   233           std::ostringstream limitStream;                                                                               \
   299  */
   299  */
   300 #define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line)                                       \
   300 #define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line)                                       \
   301   do {                                                                                                                \
   301   do {                                                                                                                \
   302       if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol))                                                     \
   302       if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol))                                                     \
   303         {                                                                                                               \
   303         {                                                                                                               \
   304           if (gBreakOnFailure) { *(int *)0 = 0;}                                                                         \
   304           if (gBreakOnFailure) { *(int *)0 = 0; }                                                                         \
   305           std::ostringstream msgStream;                                                                                 \
   305           std::ostringstream msgStream;                                                                                 \
   306           msgStream << msg;                                                                                             \
   306           msgStream << msg;                                                                                             \
   307           std::ostringstream actualStream;                                                                              \
   307           std::ostringstream actualStream;                                                                              \
   308           actualStream << actual;                                                                                       \
   308           actualStream << actual;                                                                                       \
   309           std::ostringstream limitStream;                                                                               \
   309           std::ostringstream limitStream;                                                                               \
   381  */
   381  */
   382 #define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line)                                       \
   382 #define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line)                                       \
   383   do {                                                                                                                \
   383   do {                                                                                                                \
   384       if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol))                                                     \
   384       if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol))                                                     \
   385         {                                                                                                               \
   385         {                                                                                                               \
   386           if (gBreakOnFailure) { *(int *)0 = 0;}                                                                         \
   386           if (gBreakOnFailure) { *(int *)0 = 0; }                                                                         \
   387           std::ostringstream msgStream;                                                                                 \
   387           std::ostringstream msgStream;                                                                                 \
   388           msgStream << msg;                                                                                             \
   388           msgStream << msg;                                                                                             \
   389           std::ostringstream actualStream;                                                                              \
   389           std::ostringstream actualStream;                                                                              \
   390           actualStream << actual;                                                                                       \
   390           actualStream << actual;                                                                                       \
   391           std::ostringstream limitStream;                                                                               \
   391           std::ostringstream limitStream;                                                                               \
   457  */
   457  */
   458 #define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line)                                  \
   458 #define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line)                                  \
   459   do {                                                                                                  \
   459   do {                                                                                                  \
   460       if (!((actual) != (limit)))                                                                         \
   460       if (!((actual) != (limit)))                                                                         \
   461         {                                                                                                 \
   461         {                                                                                                 \
   462           if (gBreakOnFailure) { *(int *)0 = 0;}                                                           \
   462           if (gBreakOnFailure) { *(int *)0 = 0; }                                                           \
   463           std::ostringstream msgStream;                                                                   \
   463           std::ostringstream msgStream;                                                                   \
   464           msgStream << msg;                                                                               \
   464           msgStream << msg;                                                                               \
   465           std::ostringstream actualStream;                                                                \
   465           std::ostringstream actualStream;                                                                \
   466           actualStream << actual;                                                                         \
   466           actualStream << actual;                                                                         \
   467           std::ostringstream limitStream;                                                                 \
   467           std::ostringstream limitStream;                                                                 \
   508  */
   508  */
   509 #define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line)                                  \
   509 #define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line)                                  \
   510   do {                                                                                                  \
   510   do {                                                                                                  \
   511       if (!((actual) != (limit)))                                                                         \
   511       if (!((actual) != (limit)))                                                                         \
   512         {                                                                                                 \
   512         {                                                                                                 \
   513           if (gBreakOnFailure) { *(int *)0 = 0;}                                                           \
   513           if (gBreakOnFailure) { *(int *)0 = 0; }                                                           \
   514           std::ostringstream msgStream;                                                                   \
   514           std::ostringstream msgStream;                                                                   \
   515           msgStream << msg;                                                                               \
   515           msgStream << msg;                                                                               \
   516           std::ostringstream actualStream;                                                                \
   516           std::ostringstream actualStream;                                                                \
   517           actualStream << actual;                                                                         \
   517           actualStream << actual;                                                                         \
   518           std::ostringstream limitStream;                                                                 \
   518           std::ostringstream limitStream;                                                                 \
   565  */
   565  */
   566 #define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line)                                  \
   566 #define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line)                                  \
   567   do {                                                                                                  \
   567   do {                                                                                                  \
   568       if (!((actual) != (limit)))                                                                         \
   568       if (!((actual) != (limit)))                                                                         \
   569         {                                                                                                 \
   569         {                                                                                                 \
   570           if (gBreakOnFailure) { *(int *)0 = 0;}                                                           \
   570           if (gBreakOnFailure) { *(int *)0 = 0; }                                                           \
   571           std::ostringstream msgStream;                                                                   \
   571           std::ostringstream msgStream;                                                                   \
   572           msgStream << msg;                                                                               \
   572           msgStream << msg;                                                                               \
   573           std::ostringstream actualStream;                                                                \
   573           std::ostringstream actualStream;                                                                \
   574           actualStream << actual;                                                                         \
   574           actualStream << actual;                                                                         \
   575           std::ostringstream limitStream;                                                                 \
   575           std::ostringstream limitStream;                                                                 \
   616  */
   616  */
   617 #define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line)                                   \
   617 #define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line)                                   \
   618   do {                                                                                                   \
   618   do {                                                                                                   \
   619       if (!((actual) < (limit)))                                                                           \
   619       if (!((actual) < (limit)))                                                                           \
   620         {                                                                                                  \
   620         {                                                                                                  \
   621           if (gBreakOnFailure) { *(int *)0 = 0;}                                                            \
   621           if (gBreakOnFailure) { *(int *)0 = 0; }                                                            \
   622           std::ostringstream msgStream;                                                                    \
   622           std::ostringstream msgStream;                                                                    \
   623           msgStream << msg;                                                                                \
   623           msgStream << msg;                                                                                \
   624           std::ostringstream actualStream;                                                                 \
   624           std::ostringstream actualStream;                                                                 \
   625           actualStream << actual;                                                                          \
   625           actualStream << actual;                                                                          \
   626           std::ostringstream limitStream;                                                                  \
   626           std::ostringstream limitStream;                                                                  \
   660  */
   660  */
   661 #define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line)                                   \
   661 #define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line)                                   \
   662   do {                                                                                                   \
   662   do {                                                                                                   \
   663       if (!((actual) < (limit)))                                                                           \
   663       if (!((actual) < (limit)))                                                                           \
   664         {                                                                                                  \
   664         {                                                                                                  \
   665           if (gBreakOnFailure) { *(int *)0 = 0;}                                                            \
   665           if (gBreakOnFailure) { *(int *)0 = 0; }                                                            \
   666           std::ostringstream msgStream;                                                                    \
   666           std::ostringstream msgStream;                                                                    \
   667           msgStream << msg;                                                                                \
   667           msgStream << msg;                                                                                \
   668           std::ostringstream actualStream;                                                                 \
   668           std::ostringstream actualStream;                                                                 \
   669           actualStream << actual;                                                                          \
   669           actualStream << actual;                                                                          \
   670           std::ostringstream limitStream;                                                                  \
   670           std::ostringstream limitStream;                                                                  \
   700  */
   700  */
   701 #define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line)                                   \
   701 #define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line)                                   \
   702   do {                                                                                                   \
   702   do {                                                                                                   \
   703       if (!((actual) > (limit)))                                                                           \
   703       if (!((actual) > (limit)))                                                                           \
   704         {                                                                                                  \
   704         {                                                                                                  \
   705           if (gBreakOnFailure) { *(int *)0 = 0;}                                                            \
   705           if (gBreakOnFailure) { *(int *)0 = 0; }                                                            \
   706           std::ostringstream msgStream;                                                                    \
   706           std::ostringstream msgStream;                                                                    \
   707           msgStream << msg;                                                                                \
   707           msgStream << msg;                                                                                \
   708           std::ostringstream actualStream;                                                                 \
   708           std::ostringstream actualStream;                                                                 \
   709           actualStream << actual;                                                                          \
   709           actualStream << actual;                                                                          \
   710           std::ostringstream limitStream;                                                                  \
   710           std::ostringstream limitStream;                                                                  \
   744  */
   744  */
   745 #define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line)                                   \
   745 #define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line)                                   \
   746   do {                                                                                                   \
   746   do {                                                                                                   \
   747       if (!((actual) > (limit)))                                                                           \
   747       if (!((actual) > (limit)))                                                                           \
   748         {                                                                                                  \
   748         {                                                                                                  \
   749           if (gBreakOnFailure) { *(int *)0 = 0;}                                                            \
   749           if (gBreakOnFailure) { *(int *)0 = 0; }                                                            \
   750           std::ostringstream msgStream;                                                                    \
   750           std::ostringstream msgStream;                                                                    \
   751           msgStream << msg;                                                                                \
   751           msgStream << msg;                                                                                \
   752           std::ostringstream actualStream;                                                                 \
   752           std::ostringstream actualStream;                                                                 \
   753           actualStream << actual;                                                                          \
   753           actualStream << actual;                                                                          \
   754           std::ostringstream limitStream;                                                                  \
   754           std::ostringstream limitStream;                                                                  \