Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Assert gives fatal error
- // Expect doesn't give fatal error, the program continues
- #include "pch.h"
- #include <math.h>
- #include "gtest/gtest.h"
- float a = 50.3321;
- double squareRoot(const double a)
- {
- return sqrt(a);
- }
- TEST(TestName, Subset1) {
- EXPECT_EQ(18.0, squareRoot(324.0));
- EXPECT_EQ(25.4, squareRoot(645.16));
- //EXPECT_DOUBLE_EQ(50.3321, a); // if false the program continues
- ASSERT_EQ(18.0, squareRoot(324.0));
- }
- TEST(TestName2, Subset2)
- {
- EXPECT_GT(10, 2);
- ASSERT_GT(10, 22);
- EXPECT_LT(2, 10);
- }
- TEST(SquareRootTest, ZeroAndNegativeNos) {
- ASSERT_EQ(0.0, squareRoot(0.0));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement