#include #include #include #include struct TestStruct { TestStruct(const char* name) : m_name(name) { // Just to make sure this constructor doesn't get optimized out time_t t = time(NULL); ctime(&t); } const char* name() { return m_name; } private: const char* m_name; }; TestStruct g_struct("Example Struct"); TestResult test_successful_global_constructor() { validate(g_struct.name()); validate(!strcmp(g_struct.name(), "Example Struct")); test_success; } Result test_main() { test_prelude; run_test(test_successful_global_constructor); return {}; }