test: Use ut_asserteq_mem() where possible
authorSimon Glass <sjg@chromium.org>
Sun, 10 May 2020 18:52:45 +0000 (12:52 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 19 May 2020 18:01:47 +0000 (14:01 -0400)
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>
test/compression.c
test/dm/acpi.c
test/dm/axi.c
test/dm/dma.c
test/dm/eth.c
test/dm/i2c.c
test/dm/misc.c
test/dm/osd.c
test/dm/remoteproc.c
test/dm/sf.c
test/unicode_ut.c

index ad719ddb4d6194b09931740e50aab1904ddeeb18..a2a4b9ff9e85270b23531c59a8210737dfe3f140 100644 (file)
@@ -164,7 +164,7 @@ static int compress_using_bzip2(struct unit_test_state *uts,
 {
        /* There is no bzip2 compression in u-boot, so fake it. */
        ut_asserteq(in_size, strlen(plain));
-       ut_asserteq(0, memcmp(plain, in, in_size));
+       ut_asserteq_mem(plain, in, in_size);
 
        if (bzip2_compressed_size > out_max)
                return -1;
@@ -199,7 +199,7 @@ static int compress_using_lzma(struct unit_test_state *uts,
 {
        /* There is no lzma compression in u-boot, so fake it. */
        ut_asserteq(in_size,  strlen(plain));
-       ut_asserteq(0, memcmp(plain, in, in_size));
+       ut_asserteq_mem(plain, in, in_size);
 
        if (lzma_compressed_size > out_max)
                return -1;
@@ -233,7 +233,7 @@ static int compress_using_lzo(struct unit_test_state *uts,
 {
        /* There is no lzo compression in u-boot, so fake it. */
        ut_asserteq(in_size,  strlen(plain));
-       ut_asserteq(0, memcmp(plain, in, in_size));
+       ut_asserteq_mem(plain, in, in_size);
 
        if (lzo_compressed_size > out_max)
                return -1;
@@ -268,7 +268,7 @@ static int compress_using_lz4(struct unit_test_state *uts,
 {
        /* There is no lz4 compression in u-boot, so fake it. */
        ut_asserteq(in_size,  strlen(plain));
-       ut_asserteq(0, memcmp(plain, in, in_size));
+       ut_asserteq_mem(plain, in, in_size);
 
        if (lz4_compressed_size > out_max)
                return -1;
index 176d207a5544da01843ccb3dc615aa52f248671f..4c46dd83a695bbc0d5b5afd312d7af9ad798eeb8 100644 (file)
@@ -218,20 +218,20 @@ static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts)
 
        rsdp = buf + 16;
        ut_asserteq_ptr(rsdp, ctx.rsdp);
-       ut_assertok(memcmp(RSDP_SIG, rsdp->signature, sizeof(rsdp->signature)));
+       ut_asserteq_mem(RSDP_SIG, rsdp->signature, sizeof(rsdp->signature));
        ut_asserteq(sizeof(*rsdp), rsdp->length);
        ut_assertok(table_compute_checksum(rsdp, 20));
        ut_assertok(table_compute_checksum(rsdp, sizeof(*rsdp)));
 
        rsdt = PTR_ALIGN((void *)rsdp + sizeof(*rsdp), 16);
        ut_asserteq_ptr(rsdt, ctx.rsdt);
-       ut_assertok(memcmp("RSDT", rsdt->header.signature, ACPI_NAME_LEN));
+       ut_asserteq_mem("RSDT", rsdt->header.signature, ACPI_NAME_LEN);
        ut_asserteq(sizeof(*rsdt), rsdt->header.length);
        ut_assertok(table_compute_checksum(rsdt, sizeof(*rsdt)));
 
        xsdt = PTR_ALIGN((void *)rsdt + sizeof(*rsdt), 16);
        ut_asserteq_ptr(xsdt, ctx.xsdt);
-       ut_assertok(memcmp("XSDT", xsdt->header.signature, ACPI_NAME_LEN));
+       ut_asserteq_mem("XSDT", xsdt->header.signature, ACPI_NAME_LEN);
        ut_asserteq(sizeof(*xsdt), xsdt->header.length);
        ut_assertok(table_compute_checksum(xsdt, sizeof(*xsdt)));
 
index 289f07a08a8fef2b711ff74162a387a44829c5c1..e1155a51dd7e542484a8a1caa41d94be59d1d0ef 100644 (file)
@@ -66,11 +66,11 @@ static int dm_test_axi_store(struct unit_test_state *uts)
        /* Test writing */
        val = 0x55667788;
        axi_write(store, 0, &val, AXI_SIZE_32);
-       ut_asserteq(0, memcmp(data, tdata1, ARRAY_SIZE(tdata1)));
+       ut_asserteq_mem(data, tdata1, ARRAY_SIZE(tdata1));
 
        val = 0xaabbccdd;
        axi_write(store, 3, &val, AXI_SIZE_32);
-       ut_asserteq(0, memcmp(data + 3, tdata2, ARRAY_SIZE(tdata1)));
+       ut_asserteq_mem(data + 3, tdata2, ARRAY_SIZE(tdata1));
 
        return 0;
 }
index 12cba57a56f78bd838f7bf7cec4178a740a732ba..317ed4fe8c691b135737103f0faad5a1dfb85d7c 100644 (file)
@@ -30,8 +30,8 @@ static int dm_test_dma_m2m(struct unit_test_state *uts)
                src_buf[i] = i;
 
        ut_assertok(dma_memcpy(dst_buf, src_buf, len));
+       ut_asserteq_mem(src_buf, dst_buf, len);
 
-       ut_assertok(memcmp(src_buf, dst_buf, len));
        return 0;
 }
 DM_TEST(dm_test_dma_m2m, DM_TESTF_SCAN_FDT);
@@ -72,7 +72,7 @@ static int dm_test_dma(struct unit_test_state *uts)
 
        ut_assertok(dma_free(&dma_tx));
        ut_assertok(dma_free(&dma_rx));
-       ut_assertok(memcmp(src_buf, dst_buf, len));
+       ut_asserteq_mem(src_buf, dst_buf, len);
 
        return 0;
 }
@@ -117,7 +117,7 @@ static int dm_test_dma_rx(struct unit_test_state *uts)
 
        ut_assertok(dma_free(&dma_tx));
        ut_assertok(dma_free(&dma_rx));
-       ut_assertok(memcmp(src_buf, dst_buf, len));
+       ut_asserteq_mem(src_buf, dst_buf, len);
 
        return 0;
 }
index 99c1672b99671cf05d1d4c75c1a5d3affcfa32b0..1fddcaabb093258bcf752879b1009ea2975f8646 100644 (file)
@@ -282,17 +282,17 @@ static int sb_check_arp_reply(struct udevice *dev, void *packet,
        ut_assert(arp_is_waiting());
 
        /* Validate response */
-       ut_assert(memcmp(eth->et_src, net_ethaddr, ARP_HLEN) == 0);
-       ut_assert(memcmp(eth->et_dest, priv->fake_host_hwaddr, ARP_HLEN) == 0);
+       ut_asserteq_mem(eth->et_src, net_ethaddr, ARP_HLEN);
+       ut_asserteq_mem(eth->et_dest, priv->fake_host_hwaddr, ARP_HLEN);
        ut_assert(eth->et_protlen == htons(PROT_ARP));
 
        ut_assert(arp->ar_hrd == htons(ARP_ETHER));
        ut_assert(arp->ar_pro == htons(PROT_IP));
        ut_assert(arp->ar_hln == ARP_HLEN);
        ut_assert(arp->ar_pln == ARP_PLEN);
-       ut_assert(memcmp(&arp->ar_sha, net_ethaddr, ARP_HLEN) == 0);
+       ut_asserteq_mem(&arp->ar_sha, net_ethaddr, ARP_HLEN);
        ut_assert(net_read_ip(&arp->ar_spa).s_addr == net_ip.s_addr);
-       ut_assert(memcmp(&arp->ar_tha, priv->fake_host_hwaddr, ARP_HLEN) == 0);
+       ut_asserteq_mem(&arp->ar_tha, priv->fake_host_hwaddr, ARP_HLEN);
        ut_assert(net_read_ip(&arp->ar_tpa).s_addr ==
                  string_to_ip("1.1.2.4").s_addr);
 
@@ -373,8 +373,8 @@ static int sb_check_ping_reply(struct udevice *dev, void *packet,
        ut_assert(arp_is_waiting());
 
        /* Validate response */
-       ut_assert(memcmp(eth->et_src, net_ethaddr, ARP_HLEN) == 0);
-       ut_assert(memcmp(eth->et_dest, priv->fake_host_hwaddr, ARP_HLEN) == 0);
+       ut_asserteq_mem(eth->et_src, net_ethaddr, ARP_HLEN);
+       ut_asserteq_mem(eth->et_dest, priv->fake_host_hwaddr, ARP_HLEN);
        ut_assert(eth->et_protlen == htons(PROT_IP));
 
        ut_assert(net_read_ip(&ip->ip_src).s_addr == net_ip.s_addr);
index cadbb43b9e0d5d93b2ae9596523eb89bcfd50a64..2025c4216d0d91722fe26f684d41cb1cd0563925 100644 (file)
@@ -51,10 +51,10 @@ static int dm_test_i2c_read_write(struct unit_test_state *uts)
        ut_assertok(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
        ut_assertok(i2c_get_chip(bus, chip, 1, &dev));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\0\0\0\0", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\0\0\0\0", sizeof(buf));
        ut_assertok(dm_i2c_write(dev, 2, (uint8_t *)"AB", 2));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\0AB\0", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\0AB\0", sizeof(buf));
 
        return 0;
 }
@@ -123,7 +123,7 @@ static int dm_test_i2c_bytewise(struct unit_test_state *uts)
        ut_assertok(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
        ut_assertok(i2c_get_chip(bus, chip, 1, &dev));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\0\0\0\0", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\0\0\0\0", sizeof(buf));
 
        /* Tell the EEPROM to only read/write one register at a time */
        ut_assertok(uclass_first_device(UCLASS_I2C_EMUL, &eeprom));
@@ -132,34 +132,34 @@ static int dm_test_i2c_bytewise(struct unit_test_state *uts)
 
        /* Now we only get the first byte - the rest will be 0xff */
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\xff\xff\xff\xff", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\xff\xff\xff\xff", sizeof(buf));
 
        /* If we do a separate transaction for each byte, it works */
        ut_assertok(i2c_set_chip_flags(dev, DM_I2C_CHIP_RD_ADDRESS));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\0\0\0\0", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\0\0\0\0", sizeof(buf));
 
        /* This will only write A */
        ut_assertok(i2c_set_chip_flags(dev, 0));
        ut_assertok(dm_i2c_write(dev, 2, (uint8_t *)"AB", 2));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\xff\xff\xff\xff", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\xff\xff\xff\xff", sizeof(buf));
 
        /* Check that the B was ignored */
        ut_assertok(i2c_set_chip_flags(dev, DM_I2C_CHIP_RD_ADDRESS));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\0A\0\0\0", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\0A\0\0\0", sizeof(buf));
 
        /* Now write it again with the new flags, it should work */
        ut_assertok(i2c_set_chip_flags(dev, DM_I2C_CHIP_WR_ADDRESS));
        ut_assertok(dm_i2c_write(dev, 2, (uint8_t *)"AB", 2));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\xff\xff\xff\xff", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\xff\xff\xff\xff", sizeof(buf));
 
        ut_assertok(i2c_set_chip_flags(dev, DM_I2C_CHIP_WR_ADDRESS |
                                                DM_I2C_CHIP_RD_ADDRESS));
        ut_assertok(dm_i2c_read(dev, 0, buf, 5));
-       ut_assertok(memcmp(buf, "\0\0AB\0\0", sizeof(buf)));
+       ut_asserteq_mem(buf, "\0\0AB\0\0", sizeof(buf));
 
        /* Restore defaults */
        sandbox_i2c_eeprom_set_test_mode(eeprom, SIE_TEST_MODE_NONE);
index 4d4232adf1e7ceed98bb57a202c120819b73e678..26fd6acecb9a73b8b67655095808be13ab80c924 100644 (file)
@@ -25,24 +25,24 @@ static int dm_test_misc(struct unit_test_state *uts)
        ut_asserteq(5, misc_write(dev, 4, "WRITE", 5));
        ut_asserteq(9, misc_read(dev, 0, buf, 9));
 
-       ut_assertok(memcmp(buf, "TESTWRITE", 9));
+       ut_asserteq_mem(buf, "TESTWRITE", 9);
 
        /* Call tests */
 
        id = 0;
        ut_assertok(misc_call(dev, 0, &id, 4, buf, 16));
-       ut_assertok(memcmp(buf, "Zero", 4));
+       ut_asserteq_mem(buf, "Zero", 4);
 
        id = 2;
        ut_assertok(misc_call(dev, 0, &id, 4, buf, 16));
-       ut_assertok(memcmp(buf, "Two", 3));
+       ut_asserteq_mem(buf, "Two", 3);
 
        ut_assertok(misc_call(dev, 1, &id, 4, buf, 16));
-       ut_assertok(memcmp(buf, "Forty-two", 9));
+       ut_asserteq_mem(buf, "Forty-two", 9);
 
        id = 1;
        ut_assertok(misc_call(dev, 1, &id, 4, buf, 16));
-       ut_assertok(memcmp(buf, "Forty-one", 9));
+       ut_asserteq_mem(buf, "Forty-one", 9);
 
        /* IOCTL tests */
 
index 6910690b3a9e645ac4e141a7faa6b031c9517c30..5739dfa0b8f2bcfdac86d2de20eda3135d15a8bf 100644 (file)
@@ -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;
 }
index 40675962d87241e32df9ab18a0db156e9bce1710..9511c7dd6f5576b62de6cc1bb6e971c368c18e53 100644 (file)
@@ -223,7 +223,7 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts)
 
        /* Load firmware in loaded_firmware, and verify it */
        ut_assertok(rproc_elf32_load_image(dev, (ulong)valid_elf32, size));
-       ut_assertok(memcmp(loaded_firmware, valid_elf32, loaded_firmware_size));
+       ut_asserteq_mem(loaded_firmware, valid_elf32, loaded_firmware_size);
        ut_asserteq(rproc_elf_get_boot_addr(dev, (unsigned long)valid_elf32),
                    0x08000000);
        unmap_physmem(loaded_firmware, MAP_NOCACHE);
@@ -243,8 +243,8 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts)
                                               &rsc_addr, &rsc_size));
        ut_asserteq(rsc_addr, CONFIG_SYS_SDRAM_BASE);
        ut_asserteq(rsc_size, rsc_table_size);
-       ut_assertok(memcmp(loaded_firmware, valid_elf32 + shdr->sh_offset,
-                          shdr->sh_size));
+       ut_asserteq_mem(loaded_firmware, valid_elf32 + shdr->sh_offset,
+                       shdr->sh_size);
        unmap_physmem(loaded_firmware, MAP_NOCACHE);
 
        /* Invalid ELF Magic */
index 7805af740ed5032f38c95dda016eb2c92858e897..55b8d1545fc59c1328a70bdf2f8a1e5098581265 100644 (file)
@@ -35,7 +35,7 @@ static int dm_test_spi_flash(struct unit_test_state *uts)
 
        dst = map_sysmem(0x20000 + full_size, full_size);
        ut_assertok(spi_flash_read_dm(dev, 0, size, dst));
-       ut_assertok(memcmp(src, dst, size));
+       ut_asserteq_mem(src, dst, size);
 
        /* Erase */
        ut_assertok(spi_flash_erase_dm(dev, 0, size));
@@ -48,7 +48,7 @@ static int dm_test_spi_flash(struct unit_test_state *uts)
                src[i] = i;
        ut_assertok(spi_flash_write_dm(dev, 0, size, src));
        ut_assertok(spi_flash_read_dm(dev, 0, size, dst));
-       ut_assertok(memcmp(src, dst, size));
+       ut_asserteq_mem(src, dst, size);
 
        /* Try the write-protect stuff */
        ut_assertok(uclass_first_device_err(UCLASS_SPI_EMUL, &emul));
index 5f932bffd3a524c11ffb7ce520ca8d4270053712..26d96336f36b26b4923f6ff25f1943ca64ed46c2 100644 (file)
@@ -67,8 +67,9 @@ static int unicode_test_u16_strdup(struct unit_test_state *uts)
        u16 *copy = u16_strdup(c4);
 
        ut_assert(copy != c4);
-       ut_assert(!memcmp(copy, c4, sizeof(c4)));
+       ut_asserteq_mem(copy, c4, sizeof(c4));
        free(copy);
+
        return 0;
 }
 UNICODE_TEST(unicode_test_u16_strdup);
@@ -80,7 +81,8 @@ static int unicode_test_u16_strcpy(struct unit_test_state *uts)
 
        r = u16_strcpy(copy, c1);
        ut_assert(r == copy);
-       ut_assert(!memcmp(copy, c1, sizeof(c1)));
+       ut_asserteq_mem(copy, c1, sizeof(c1));
+
        return 0;
 }
 UNICODE_TEST(unicode_test_u16_strcpy);