Skip to content
Commit b5a10a22 authored by Nan Zhou's avatar Nan Zhou
Browse files

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: default avatarNan Zhou <nanzhoumails@gmail.com>
Change-Id: Ia2cf9922bd4cb2fe8b4b3912e9153e9ae4eab134
parent 7ea4643a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment