diff options
author | Jack Lloyd <[email protected]> | 2019-02-05 10:27:10 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-02-05 10:27:10 -0500 |
commit | 11d30b5d9f40b196458c2aab835df0e9dacd508d (patch) | |
tree | b0391d825137cf57efc9ace45fd9a1a4b0f77b30 /src/tests/tests.cpp | |
parent | b17e60cfa93a514ebb58dfc6138bc41f3000293d (diff) |
Clean up test registration a bit
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r-- | src/tests/tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index 6b44bccd9..537c27b3e 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -479,6 +479,16 @@ std::map<std::string, std::function<Test* ()>>& Test::global_registry() } //static +void Test::register_test(const std::string& name, + std::function<Test* ()> maker_fn) + { + if(Test::global_registry().count(name) != 0) + throw Test_Error("Duplicate registration of test '" + name + "'"); + + Test::global_registry().insert(std::make_pair(name, maker_fn)); + } + +//static uint64_t Test::timestamp() { auto now = std::chrono::high_resolution_clock::now().time_since_epoch(); |