• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonbathyscaphephpgamewindowsguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

New lambda-based xUnit-style unit-testing framework for C++.


Commit MetaInfo

Revisãoe224542c3a0dc45cefd46bb042b9e88dccc90e10 (tree)
Hora2020-01-23 20:03:20
AutorKaz Nishimura <kazssym@linu...>
CommiterKaz Nishimura

Mensagem de Log

Add constructor overloads to Test/Before/After

Mudança Sumário

Diff

diff -r 98013252b75b -r e224542c3a0d libcppunitx/bits/cppunitx/test.h
--- a/libcppunitx/bits/cppunitx/test.h Thu Jan 23 19:57:57 2020 +0900
+++ b/libcppunitx/bits/cppunitx/test.h Thu Jan 23 20:03:20 2020 +0900
@@ -38,6 +38,8 @@
3838 const std::function<void ()> _function;
3939
4040 public:
41+ Test(const std::string &name, const std::function<void ()> &function);
42+
4143 Test(const std::string &name, std::function<void ()> &&function);
4244
4345 // To suppress implicit definitions.
@@ -63,7 +65,9 @@
6365 const std::function<void ()> _function;
6466
6567 public:
66- Before(std::function<void ()> &&function);
68+ explicit Before(const std::function<void ()> &function);
69+
70+ explicit Before(std::function<void ()> &&function);
6771
6872 // To suppress implicit definitions.
6973 Before(const Before &) = delete;
@@ -82,7 +86,9 @@
8286 const std::function<void ()> _function;
8387
8488 public:
85- After(std::function<void ()> &&function);
89+ explicit After(const std::function<void ()> &function);
90+
91+ explicit After(std::function<void ()> &&function);
8692
8793 // To suppress implicit definitions.
8894 After(const After &) = delete;
diff -r 98013252b75b -r e224542c3a0d libcppunitx/test.cpp
--- a/libcppunitx/test.cpp Thu Jan 23 19:57:57 2020 +0900
+++ b/libcppunitx/test.cpp Thu Jan 23 20:03:20 2020 +0900
@@ -31,6 +31,13 @@
3131
3232 // Class 'Test' implementation.
3333
34+Test::Test(const string &name, const function<void ()> &function)
35+ : _name(name), _function(function)
36+{
37+ auto driver = TestDriver::getInstance();
38+ driver->installTest(this);
39+}
40+
3441 Test::Test(const string &name, function<void ()> &&function)
3542 : _name(name), _function(function)
3643 {
@@ -46,6 +53,13 @@
4653
4754 // Class 'Before' implementation.
4855
56+Before::Before(const function<void ()> &function)
57+ : _function(function)
58+{
59+ auto driver = TestDriver::getInstance();
60+ driver->installBefore(this);
61+}
62+
4963 Before::Before(function<void ()> &&function)
5064 : _function(function)
5165 {
@@ -61,6 +75,13 @@
6175
6276 // Class 'After' implementation.
6377
78+After::After(const function<void ()> &function)
79+ : _function(function)
80+{
81+ auto driver = TestDriver::getInstance();
82+ driver->installAfter(this);
83+}
84+
6485 After::After(function<void ()> &&function)
6586 : _function(function)
6687 {