Last active
January 31, 2018 17:13
-
-
Save lithiumhead/d821ea9b7632f65384f937a9be7eb0a3 to your computer and use it in GitHub Desktop.
TEST() and code in same file - Test Fail
This file contains hidden or 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 <iostream> | |
#include <gtest/gtest.h> | |
double squareroot (double) { | |
return 0; | |
}; | |
TEST (SquareRootTest, PositiveNos) { | |
EXPECT_EQ (18.0, squareroot (324.0)); | |
EXPECT_EQ (25.4, squareroot (645.16)); | |
EXPECT_EQ (50.332, squareroot (2533.310224)); | |
} | |
TEST (SquareRootTest, ZeroAndNegativeNos) { | |
ASSERT_EQ (0.0, squareroot (0.0)); | |
ASSERT_EQ (-1, squareroot (-22.0)); | |
} | |
int main(int argc, char **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