diff options
| author | Tim Redfern <tim@eclectronics.org> | 2014-05-22 10:14:01 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2014-05-22 10:14:01 +0100 |
| commit | 8f1667713a961de1f20688470ab84db097151692 (patch) | |
| tree | 43f3b068dac7b30df538344ef16d7c6003036203 /gtest | |
| parent | bb6498e5ff6a8a8af8c06300dac051659a37e89b (diff) | |
colour palette as string inlet
Diffstat (limited to 'gtest')
| -rw-r--r-- | gtest/testgtest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gtest/testgtest.cpp b/gtest/testgtest.cpp new file mode 100644 index 0000000..bca9594 --- /dev/null +++ b/gtest/testgtest.cpp @@ -0,0 +1,22 @@ +#include "gtest/gtest.h" +#include "math.h" + +double squareroot(double input){ + return pow(input,0.5); +} + +TEST(SquareRootTest, PositiveNos) { + EXPECT_EQ (18.0, squareroot(324.0)); + EXPECT_EQ (25.4, squareroot(645.16)); + EXPECT_EQ (50.3321, 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(); +}
\ No newline at end of file |
