| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "gate/gatemain.h" | ||
| 2 | #include "gate/applications.hpp" | ||
| 3 | #include "gate/debugging.h" | ||
| 4 | |||
| 5 | namespace gate { namespace apps | ||
| 6 | { | ||
| 7 | |||
| 8 | 1 | static void test_panic() | |
| 9 | { | ||
| 10 | 1 | gate::panic(results::Failed, "panic_app"); | |
| 11 | ✗ | } | |
| 12 | |||
| 13 | 1 | static void test_debugging_failure_messages() | |
| 14 | { | ||
| 15 | 1 | char const* const dbg_msg = "debug-test-trace-message"; | |
| 16 | 1 | char const* const dbg_file = "debug-test-file"; | |
| 17 | 1 | char const* const dbg_origin = "debug-test-trace-origin"; | |
| 18 | |||
| 19 | 1 | gate_debug_trace_platform_error(dbg_msg, dbg_file, 666); | |
| 20 | 1 | gate_debug_trace_result(GATE_RESULT_FAILED, dbg_origin, dbg_msg, 666, dbg_file, 666); | |
| 21 | 1 | gate_debug_assert(true, dbg_msg, dbg_file, 666); | |
| 22 | /* notice: some platforms call an attached debugger or fail without one, | ||
| 23 | some platforms have no debugger-binding, so we need to simulate failing */ | ||
| 24 | 1 | gate::panic(results::Failed, "panic_app"); | |
| 25 | ✗ | } | |
| 26 | |||
| 27 | class GATE_API_LOCAL SpecialTestsApp : public App | ||
| 28 | { | ||
| 29 | public: | ||
| 30 | 2 | virtual void run() override | |
| 31 | { | ||
| 32 |
3/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | static AppOptionDef panic = AppOptionDef::createSwitch("panic", "P", "panic", "Call panic()"); |
| 33 |
3/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
2 | static AppOptionDef debugmessages = AppOptionDef::createSwitch("debugmessages", "DM", "debugmessages", "Write debug messages"); |
| 34 | |||
| 35 | static AppOptionDef* options[] = | ||
| 36 | { | ||
| 37 | &panic, | ||
| 38 | &debugmessages | ||
| 39 | }; | ||
| 40 | |||
| 41 | static size_t const optionsCount = sizeof(options) / sizeof(options[0]); | ||
| 42 | |||
| 43 | 2 | App::parseAppOptions(this->getArgs(), options, optionsCount); | |
| 44 | |||
| 45 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
|
2 | if (panic) |
| 46 | { | ||
| 47 | 1 | test_panic(); | |
| 48 | ✗ | return; | |
| 49 | } | ||
| 50 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | else if(debugmessages) |
| 51 | { | ||
| 52 | 1 | test_debugging_failure_messages(); | |
| 53 | ✗ | return; | |
| 54 | } | ||
| 55 | } | ||
| 56 | }; | ||
| 57 | |||
| 58 | } } // end of namespace gate/apps | ||
| 59 | |||
| 60 | |||
| 61 | 2 | int gate_main(char const* program, char const* const* arguments, gate_size_t argcount, gate_uintptr_t apphandle) | |
| 62 | { | ||
| 63 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | gate::apps::SpecialTestsApp app; |
| 64 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
2 | return gate::App::runApp(app, program, arguments, argcount, apphandle); |
| 65 | } | ||
| 66 |