| 36 | {} |
| 37 | |
| 38 | void perform_test ( |
| 39 | const std::string& arg |
| 40 | ) |
| 41 | { |
| 42 | // This message gets logged to the file debug.txt if the user has enabled logging by |
| 43 | // supplying the -d option on the command line (and they haven't set the logging level |
| 44 | // to something higher than LINFO). |
| 45 | dlog << dlib::LINFO << "some message you want to log"; |
| 46 | dlog << dlib::LINFO << "the argument passed to this test was " << arg; |
| 47 | |
| 48 | // This test is considered a success if this function doesn't throw an exception. |
| 49 | // So we can use the DLIB_TEST_MSG macro to perform our tests since it throws an |
| 50 | // exception containing a message if its first argument is false. |
| 51 | |
| 52 | // make sure 3 is bigger than 2 |
| 53 | DLIB_TEST_MSG(3 > 2,"This message prints if your compiler doesn't know 3 is bigger than 2"); |
| 54 | |
| 55 | // make sure 5 is not equal to 9 |
| 56 | DLIB_TEST_MSG(5 != 9,"This message prints if your compiler thinks 5 is the same as 9"); |
| 57 | |
| 58 | // If your test takes a long time to run you can also call print_spinner() |
| 59 | // periodically. This will cause a spinning / character to display on the |
| 60 | // console to indicate to the user that your test is still running (rather |
| 61 | // than hung) |
| 62 | print_spinner(); |
| 63 | } |
| 64 | |
| 65 | }; |
| 66 |
nothing calls this directly
no test coverage detected