diff options
author | Simon Glass <sjg@chromium.org> | 2020-05-10 12:52:45 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-05-19 14:01:47 -0400 |
commit | f91f366bd56ef290b7b1f24a40a8be02c148d6d9 (patch) | |
tree | d7c6b993a6fd5f5a4dea7731855baabde6ff16b1 /test/dm/osd.c | |
parent | d934b43a0294148267c88f22d47aa2ebd77512a5 (diff) |
test: Use ut_asserteq_mem() where possible
Quite a few tests still use ut_assertok(memcmp(...)) and variants. Modify
them to use the macro designed for this purpose.
Suggested-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Diffstat (limited to 'test/dm/osd.c')
-rw-r--r-- | test/dm/osd.c | 134 |
1 files changed, 71 insertions, 63 deletions
diff --git a/test/dm/osd.c b/test/dm/osd.c index 6910690b3a..5739dfa0b8 100644 --- a/test/dm/osd.c +++ b/test/dm/osd.c @@ -71,27 +71,29 @@ static int dm_test_osd_basics(struct unit_test_state *uts) ut_assertok(sandbox_osd_get_mem(dev, mem, memsize)); split(mem, memsize / 2, text, colors); - ut_assertok(memcmp(text, " " - " " - " " - " " - " " - " " - " " - " " - " " - " ", memsize / 2)); - - ut_assertok(memcmp(colors, "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk", memsize / 2)); + ut_asserteq_mem(text, + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", memsize / 2); + + ut_asserteq_mem(colors, + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk", memsize / 2); print_mem(mem, 10, 10); @@ -100,27 +102,29 @@ static int dm_test_osd_basics(struct unit_test_state *uts) ut_assertok(sandbox_osd_get_mem(dev, mem, memsize)); split(mem, memsize / 2, text, colors); - ut_assertok(memcmp(text, " " - " Blah " - " " - " " - " " - " " - " " - " " - " " - " ", memsize / 2)); - - ut_assertok(memcmp(colors, "kkkkkkkkkk" - "krrrrkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk" - "kkkkkkkkkk", memsize / 2)); + ut_asserteq_mem(text, + " " + " Blah " + " " + " " + " " + " " + " " + " " + " " + " ", memsize / 2); + + ut_asserteq_mem(colors, + "kkkkkkkkkk" + "krrrrkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk" + "kkkkkkkkkk", memsize / 2); print_mem(mem, 10, 10); @@ -152,17 +156,19 @@ static int dm_test_osd_extended(struct unit_test_state *uts) ut_assertok(sandbox_osd_get_mem(dev, mem, memsize)); split(mem, memsize / 2, text, colors); - ut_assertok(memcmp(text, " " - " " - " " - " " - " ", memsize / 2)); + ut_asserteq_mem(text, + " " + " " + " " + " " + " ", memsize / 2); - ut_assertok(memcmp(colors, "kkkkkkkkkkkkkkkkkkkk" - "kkkkkkkkkkkkkkkkkkkk" - "kkkkkkkkkkkkkkkkkkkk" - "kkkkkkkkkkkkkkkkkkkk" - "kkkkkkkkkkkkkkkkkkkk", memsize / 2)); + ut_asserteq_mem(colors, + "kkkkkkkkkkkkkkkkkkkk" + "kkkkkkkkkkkkkkkkkkkk" + "kkkkkkkkkkkkkkkkkkkk" + "kkkkkkkkkkkkkkkkkkkk" + "kkkkkkkkkkkkkkkkkkkk", memsize / 2); print_mem(mem, 20, 5); @@ -192,17 +198,19 @@ static int dm_test_osd_extended(struct unit_test_state *uts) print_mem(mem, 20, 5); - ut_assertok(memcmp(text, "+---- OSD menu ----+" - "| * Entry 1 |" - "| (*) Entry 2 |" - "| * Entry 3 |" - "+------------------+", memsize / 2)); - - ut_assertok(memcmp(colors, "gggggggggggggggggggg" - "gkbbbbbbbbbbbkkkkkkg" - "gkbbbbbbbbbbbkkkkkkg" - "gkbbbbbbbbbbbkkkkkkg" - "gggggggggggggggggggg", memsize / 2)); + ut_asserteq_mem(text, + "+---- OSD menu ----+" + "| * Entry 1 |" + "| (*) Entry 2 |" + "| * Entry 3 |" + "+------------------+", memsize / 2); + + ut_asserteq_mem(colors, + "gggggggggggggggggggg" + "gkbbbbbbbbbbbkkkkkkg" + "gkbbbbbbbbbbbkkkkkkg" + "gkbbbbbbbbbbbkkkkkkg" + "gggggggggggggggggggg", memsize / 2); return 0; } |