-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from leapmotion/feature-autoconstruct
Relaxing rules on CoreContext::Construct, adding unit test
- Loading branch information
Showing
5 changed files
with
38 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "stdafx.h" | ||
|
||
class AutoConstructTest: | ||
public testing::Test | ||
{}; | ||
|
||
class HasDefaultCtorAndOthers { | ||
public: | ||
HasDefaultCtorAndOthers(void) : | ||
v(101) | ||
{} | ||
HasDefaultCtorAndOthers(int v) : | ||
v(v) | ||
{} | ||
|
||
const int v; | ||
}; | ||
|
||
TEST_F(AutoConstructTest, AutoConstructNoArgs) { | ||
AutoConstruct<HasDefaultCtorAndOthers> hdcao; | ||
ASSERT_EQ(101, hdcao->v) << "Default constructor was not called as expected"; | ||
} | ||
|
||
TEST_F(AutoConstructTest, AutoConstructWithArgs) { | ||
AutoConstruct<HasDefaultCtorAndOthers> hdcao(495); | ||
ASSERT_EQ(495, hdcao->v) << "Constructor call was not made as expected"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters