Created
February 29, 2012 03:21
-
-
Save hwada/1937329 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
#include "stdafx.h" | |
#include "gtest/gtest.h" | |
#pragma comment(lib, "gtestd.lib") | |
int Factorial(int n) { | |
int result = 1; | |
for (int i = 1; i <= n; i++) { | |
result *= i; | |
} | |
return result; | |
} | |
TEST(FactorialTest, Negative) { | |
EXPECT_EQ(1, Factorial(-5)); | |
EXPECT_EQ(1, Factorial(-1)); | |
EXPECT_GT(Factorial(-10), 0); | |
} | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
::testing::InitGoogleTest(&argc, argv); | |
return RUN_ALL_TESTS(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment