From 8f1667713a961de1f20688470ab84db097151692 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 22 May 2014 10:14:01 +0100 Subject: colour palette as string inlet --- gtest/testgtest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gtest/testgtest.cpp (limited to 'gtest') 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 -- cgit v1.2.3