google test assert eq float 1

google test assert eq float

ASSERT_NEAR(13.45, 13.45, 0.01); // third member is precision (for floats)

Here is what the above code is Doing:
1. We’re including the header file for the Google Test framework.
2. We’re using the namespace for the Google Test framework.
3. We’re defining a test fixture class called MyTest.
4. We’re defining a test case called MyTestCase.
5. We’re using the ASSERT_EQ macro to test for equality.
6. We’re using the ASSERT_NE macro to test for inequality.
7. We’re using the ASSERT_TRUE macro to test for true.
8. We’re using the ASSERT_FALSE macro to test for false.
9. We’re using the ASSERT_NEAR macro to test for nearness.

Similar Posts