nlib

Defines a predicate assertion. More...

Go to the source code of this file.

Namespaces

 nn::nlib
 Implements common features and features that are highly platform-dependent. Also refer to nlib Platform APIs. nlib_ns is an alias.
 
 nn::nlib::testing
 Framework to test C++ code. View the description of List of testing Library Features.
 

Macros

Test of Existing Boolean Functions (ASSERT_PREDn)

For functions that return a bool type, you can view the function arguments when the function fails by providing the function to the following macros.

#define ASSERT_PRED1(pred, v1)   NLIB_TESTING_PRED1_(pred, v1, NLIB_TESTING_FATAL_)
 Evaluates whether pred(v1) is true. If the test fails, control leaves the currently running function.
 
#define ASSERT_PRED2(pred, v1, v2)   NLIB_TESTING_PRED2_(pred, v1, v2, NLIB_TESTING_FATAL_)
 Evaluates whether pred(v1, v2) is true. If the test fails, control leaves the currently running function.
 
#define ASSERT_PRED3(pred, v1, v2, v3)   NLIB_TESTING_PRED3_(pred, v1, v2, v3, NLIB_TESTING_FATAL_)
 Evaluates whether pred(v1, v2, v3) is true. If the test fails, control leaves the currently running function.
 
#define ASSERT_PRED4(pred, v1, v2, v3, v4)   NLIB_TESTING_PRED4_(pred, v1, v2, v3, v4, NLIB_TESTING_FATAL_)
 Evaluates whether pred(v1, v2, v3, v4) is true. If the test fails, control leaves the currently running function.
 
#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5)   NLIB_TESTING_PRED5_(pred, v1, v2, v3, v4, v5, NLIB_TESTING_FATAL_)
 Evaluates whether pred(v1, v2, v3, v4, v5) is true. If the test fails, control leaves the currently running function.
 
Test of Existing Boolean Functions (EXPECT_PREDn)

For functions that return a bool type, you can view the function arguments when the function fails by providing the function to the following macros.

#define EXPECT_PRED1(pred, v1)   NLIB_TESTING_PRED1_(pred, v1, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED1.
 
#define EXPECT_PRED2(pred, v1, v2)   NLIB_TESTING_PRED2_(pred, v1, v2, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED2.
 
#define EXPECT_PRED3(pred, v1, v2, v3)   NLIB_TESTING_PRED3_(pred, v1, v2, v3, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED3.
 
#define EXPECT_PRED4(pred, v1, v2, v3, v4)   NLIB_TESTING_PRED4_(pred, v1, v2, v3, v4, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED4.
 
#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5)   NLIB_TESTING_PRED5_(pred, v1, v2, v3, v4, v5, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED5.
 
Customizing the Display by Defining a Test-Only Boolean Function (ASSERT_PRED_FORMATn)

Use the following macros to customize the message when ASSERT_PREDn fails.

#define ASSERT_PRED_FORMAT1(pred_format, v1)   NLIB_TESTING_PRED_FORMAT1_(pred_format, v1, NLIB_TESTING_FATAL_)
 ASSERT_PRED1 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function. More...
 
#define ASSERT_PRED_FORMAT2(pred_format, v1, v2)   NLIB_TESTING_PRED_FORMAT2_(pred_format, v1, v2, NLIB_TESTING_FATAL_)
 ASSERT_PRED2 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function. More...
 
#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3)   NLIB_TESTING_PRED_FORMAT3_(pred_format, v1, v2, v3, NLIB_TESTING_FATAL_)
 ASSERT_PRED3 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function. More...
 
#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4)   NLIB_TESTING_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, NLIB_TESTING_FATAL_)
 ASSERT_PRED4 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function. More...
 
#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5)   NLIB_TESTING_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, NLIB_TESTING_FATAL_)
 ASSERT_PRED5 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function. More...
 
Customizing the Display by Defining a Test-Only Boolean Function (EXPECT_PRED_FORMATn)

Use the following macros to customize the message when EXPECT_PREDn() fails.

#define EXPECT_PRED_FORMAT1(pred_format, v1)   NLIB_TESTING_PRED_FORMAT1_(pred_format, v1, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just likeASSERT_PRED_FORMAT1.
 
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2)   NLIB_TESTING_PRED_FORMAT2_(pred_format, v1, v2, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just likeASSERT_PRED_FORMAT2.
 
#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3)   NLIB_TESTING_PRED_FORMAT3_(pred_format, v1, v2, v3, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED_FORMAT3.
 
#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4)   NLIB_TESTING_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED_FORMAT4.
 
#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5)   NLIB_TESTING_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, NLIB_TESTING_NONFATAL_)
 Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED_FORMAT5.
 

Detailed Description

Defines a predicate assertion.

Definition in file Pred.h.