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>
diff --git a/test/dm/osd.c b/test/dm/osd.c
index 6910690..5739dfa 100644
--- a/test/dm/osd.c
+++ b/test/dm/osd.c
@@ -71,27 +71,29 @@
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, "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk", 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 @@
ut_assertok(sandbox_osd_get_mem(dev, mem, memsize));
split(mem, memsize / 2, text, colors);
- ut_assertok(memcmp(text, " "
- " Blah "
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- " ", memsize / 2));
+ ut_asserteq_mem(text,
+ " "
+ " Blah "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " ", memsize / 2);
- ut_assertok(memcmp(colors, "kkkkkkkkkk"
- "krrrrkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk"
- "kkkkkkkkkk", 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 @@
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 @@
print_mem(mem, 20, 5);
- ut_assertok(memcmp(text, "+---- OSD menu ----+"
- "| * Entry 1 |"
- "| (*) Entry 2 |"
- "| * Entry 3 |"
- "+------------------+", memsize / 2));
+ ut_asserteq_mem(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(colors,
+ "gggggggggggggggggggg"
+ "gkbbbbbbbbbbbkkkkkkg"
+ "gkbbbbbbbbbbbkkkkkkg"
+ "gkbbbbbbbbbbbkkkkkkg"
+ "gggggggggggggggggggg", memsize / 2);
return 0;
}