Created
February 19, 2017 00:10
-
-
Save JayBazuzi/5fd9e61635f6cb08bb7eba60c1ff850e to your computer and use it in GitHub Desktop.
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
#define Example(name, body) Example_(name, body, __COUNTER__) | |
#define Example_(name, body, counter) Example__(name, body, counter) | |
#define Example__(name, body, counter) \ | |
struct ExampleInitializer##counter \ | |
{ \ | |
ExampleInitializer##counter() \ | |
{ \ | |
allExamples.Add({__FILE__, name, body}); \ | |
} \ | |
} ExampleInitializer##counter##Instance; \ | |
Example("it multiplies two numbers", [] | |
{ | |
auto testSubject = Calculator(); | |
auto result = testSubject.Multiply(6, 9); | |
Assert(result == 42); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment