the Compartmented Robust Posix C++ Unit Test system

ANY_CODE

Special value denoting any exit-code.

Used in: an EXPECT_EXIT(num, action?) modifier. See TEST(name, ...).

Example: The test program

     
     #include <crpcut.hpp>
     
     TEST(expected_exit, EXPECT_EXIT(ANY_CODE))
     {
       exit(3);
     }
     
     TEST(unexpected_no_exit, EXPECT_EXIT(ANY_CODE))
     {
       // do nothing
     }
     
     int main(int argc, char *argv[])
     {
       return crpcut::run(argc, argv);
     }

reports one failed test:


     FAILED!: unexpected_no_exit
     phase="running"  --------------------------------------------------------------
     samples/exit_any_code.cpp:35
     Unexpectedly survived
     Expected exit with any code
     -------------------------------------------------------------------------------
     ===============================================================================
     2 test cases selected
     
                    Sum   Critical   Non-critical
     PASSED   :       1          1              0
     FAILED   :       1          1              0