redfish-core tests: use matcher correctly
This commit corrects the usage of ASSERT, EXPECT, and all the matchers. It also fixes cases where a cleaner matcher can be used. This commit increases readability (with correct and cleaner matcher) and corrects bugs (access iterator before checking validity). Typical incorrect usage is that when a function returns a boolean value to indicated whether the function succeeds or not, unless the function has clear behavior when it fails, we shouldn't continue the test that inspects the output parameters. A typical test codes look like this, ``` ASSERT_TRUE(fooBar(output)); EXPECT_EQ(output, 123); ``` Reference: https://testing.googleblog.com/2008/07/tott-expect-vs-assert.html https://github.com/google/googletest/blob/main/docs/reference/matchers.md Tested: unit test passed. Signed-off-by:Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ia2cf9922bd4cb2fe8b4b3912e9153e9ae4eab134
Loading
Please register or sign in to comment