the Compartmented Robust Posix C++ Unit Test system


Assert that an expression evaluates to greater than or equal to another.

Used in: A test function body, the constructor or destructor of a fixture, or a function called from them. See TEST(name, ...).

Requirement: The expression (a >= b) can be evaluated as a bool.

The assertion succeeds if, and only if, the expression bool(a >= b) evaluates to true.

On success the test function continues without side effects.

On failure the test is terminated with an error report. The report includes the exact parameter text for each parameter and, when they are output streamable, a text representation of each expression value, or a byte by byte hex dump otherwise.

See also: VERIFY_GE(a, b)

Example: The test program

     #include <crpcut.hpp>
     struct a {
       a(int val) : n(val) {}
       int n;
       operator int() const { return n; }
       a val1(3);
       int val2 = 3;
       ASSERT_GE(val1, val2);
       a val1(3);
       int val2 = 4;
       ASSERT_GE(val1, val2);
     int main(int argc, char *argv[])
       return crpcut::run(argc, argv);


reports one failed test:

     FAILED!: assert_ge_fails
     phase="running"  --------------------------------------------------------------
     ASSERT_GE(val1, val2)
       where val1 = 4-byte object <0300 0000>
             val2 = 4
     2 test cases selected
                    Sum   Critical   Non-critical
     PASSED   :       1          1              0
     FAILED   :       1          1              0