这篇教程C++ ut_asserteq函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ut_asserteq函数的典型用法代码示例。如果您正苦于以下问题:C++ ut_asserteq函数的具体用法?C++ ut_asserteq怎么用?C++ ut_asserteq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ut_asserteq函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dm_test_autoprobe/* Test that autoprobe finds all the expected devices */static int dm_test_autoprobe(struct dm_test_state *dms){ int expected_base_add; struct udevice *dev; struct uclass *uc; int i; ut_assertok(uclass_get(UCLASS_TEST, &uc)); ut_assert(uc); ut_asserteq(1, dm_testdrv_op_count[DM_TEST_OP_INIT]); ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_PROBE]); /* The root device should not be activated until needed */ ut_assert(dms->root->flags & DM_FLAG_ACTIVATED); /* * We should be able to find the three test devices, and they should * all be activated as they are used (lazy activation, required by * U-Boot) */ for (i = 0; i < 3; i++) { ut_assertok(uclass_find_device(UCLASS_TEST, i, &dev)); ut_assert(dev); ut_assertf(!(dev->flags & DM_FLAG_ACTIVATED), "Driver %d/%s already activated", i, dev->name); /* This should activate it */ ut_assertok(uclass_get_device(UCLASS_TEST, i, &dev)); ut_assert(dev); ut_assert(dev->flags & DM_FLAG_ACTIVATED); /* Activating a device should activate the root device */ if (!i) ut_assert(dms->root->flags & DM_FLAG_ACTIVATED); } /* Our 3 dm_test_infox children should be passed to post_probe */ ut_asserteq(3, dm_testdrv_op_count[DM_TEST_OP_POST_PROBE]); /* Also we can check the per-device data */ expected_base_add = 0; for (i = 0; i < 3; i++) { struct dm_test_uclass_perdev_priv *priv; struct dm_test_pdata *pdata; ut_assertok(uclass_find_device(UCLASS_TEST, i, &dev)); ut_assert(dev); priv = dev->uclass_priv; ut_assert(priv); ut_asserteq(expected_base_add, priv->base_add); pdata = dev->platdata; expected_base_add += pdata->ping_add; } return 0;}
开发者ID:KunYi,项目名称:uboot-samx6i,代码行数:60,
示例2: test_bus_parent_data/* Test that the bus can store data about each child */static int test_bus_parent_data(struct unit_test_state *uts){ struct dm_test_parent_data *parent_data; struct udevice *bus, *dev; struct uclass *uc; int value; ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus)); /* Check that parent data is allocated */ ut_assertok(device_find_child_by_seq(bus, 0, true, &dev)); ut_asserteq_ptr(NULL, dev_get_parent_priv(dev)); ut_assertok(device_get_child_by_seq(bus, 0, &dev)); parent_data = dev_get_parent_priv(dev); ut_assert(NULL != parent_data); /* Check that it starts at 0 and goes away when device is removed */ parent_data->sum += 5; ut_asserteq(5, parent_data->sum); device_remove(dev); ut_asserteq_ptr(NULL, dev_get_parent_priv(dev)); /* Check that we can do this twice */ ut_assertok(device_get_child_by_seq(bus, 0, &dev)); parent_data = dev_get_parent_priv(dev); ut_assert(NULL != parent_data); parent_data->sum += 5; ut_asserteq(5, parent_data->sum); /* Add parent data to all children */ ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); value = 5; uclass_foreach_dev(dev, uc) { /* Ignore these if they are not on this bus */ if (dev->parent != bus) { ut_asserteq_ptr(NULL, dev_get_parent_priv(dev)); continue; } ut_assertok(device_probe(dev)); parent_data = dev_get_parent_priv(dev); parent_data->sum = value; value += 5; } /* Check it is still there */ value = 5; uclass_foreach_dev(dev, uc) { /* Ignore these if they are not on this bus */ if (dev->parent != bus) continue; parent_data = dev_get_parent_priv(dev); ut_asserteq(value, parent_data->sum); value += 5; } return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:60,
示例3: dm_test_fdt_uclass_seq/* Test that sequence numbers are allocated properly */static int dm_test_fdt_uclass_seq(struct unit_test_state *uts){ struct udevice *dev; /* A few basic santiy tests */ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 3, true, &dev)); ut_asserteq_str("b-test", dev->name); ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 8, true, &dev)); ut_asserteq_str("a-test", dev->name); ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 5, true, &dev)); ut_asserteq_ptr(NULL, dev); /* Test aliases */ ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 6, &dev)); ut_asserteq_str("e-test", dev->name); ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 7, true, &dev)); /* * Note that c-test nodes are not probed since it is not a top-level * node */ ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 3, &dev)); ut_asserteq_str("b-test", dev->name); /* * d-test wants sequence number 3 also, but it can't have it because * b-test gets it first. */ ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 2, &dev)); ut_asserteq_str("d-test", dev->name); /* d-test actually gets 0 */ ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 0, &dev)); ut_asserteq_str("d-test", dev->name); /* initially no one wants seq 1 */ ut_asserteq(-ENODEV, uclass_get_device_by_seq(UCLASS_TEST_FDT, 1, &dev)); ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 4, &dev)); /* But now that it is probed, we can find it */ ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 1, &dev)); ut_asserteq_str("f-test", dev->name); return 0;}
开发者ID:SunnyBrother,项目名称:u-boot-at91,代码行数:53,
示例4: dm_test_video_base/* Basic test of the video uclass */static int dm_test_video_base(struct unit_test_state *uts){ struct video_priv *priv; struct udevice *dev; ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_asserteq(1366, video_get_xsize(dev)); ut_asserteq(768, video_get_ysize(dev)); priv = dev_get_uclass_priv(dev); ut_asserteq(priv->fb_size, 1366 * 768 * 2); return 0;}
开发者ID:shamanqing,项目名称:u-boot-bd410c,代码行数:14,
示例5: dm_test_reset_bulkstatic int dm_test_reset_bulk(struct unit_test_state *uts){ struct udevice *dev_reset; struct udevice *dev_test; ut_assertok(uclass_get_device_by_name(UCLASS_RESET, "reset-ctl", &dev_reset)); ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID)); ut_asserteq(0, sandbox_reset_query(dev_reset, OTHER_RESET_ID)); ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "reset-ctl-test", &dev_test)); ut_assertok(sandbox_reset_test_get_bulk(dev_test)); ut_assertok(sandbox_reset_test_assert_bulk(dev_test)); ut_asserteq(1, sandbox_reset_query(dev_reset, TEST_RESET_ID)); ut_asserteq(1, sandbox_reset_query(dev_reset, OTHER_RESET_ID)); ut_assertok(sandbox_reset_test_deassert_bulk(dev_test)); ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID)); ut_asserteq(0, sandbox_reset_query(dev_reset, OTHER_RESET_ID)); ut_assertok(sandbox_reset_test_release_bulk(dev_test)); ut_asserteq(1, sandbox_reset_query(dev_reset, TEST_RESET_ID)); ut_asserteq(1, sandbox_reset_query(dev_reset, OTHER_RESET_ID)); return 0;}
开发者ID:axxia,项目名称:axxia_u-boot,代码行数:28,
示例6: test_memset/** * test_memset() - test result of memset() * * @uts: unit test state * @buf: buffer * @mask: value set by memset() * @offset: relative start of region changed by memset() in buffer * @len: length of region changed by memset() * Return: 0 = success, 1 = failure */static int test_memset(struct unit_test_state *uts, u8 buf[], u8 mask, int offset, int len){ int i; for (i = 0; i < BUFLEN; ++i) { if (i < offset || i >= offset + len) { ut_asserteq(i, buf[i]); } else { ut_asserteq(mask, buf[i]); } } return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:24,
示例7: test_memmove/** * test_memmove() - test result of memcpy() or memmove() * * @uts: unit test state * @buf: buffer * @mask: xor mask used to initialize source buffer * @offset1: relative start of copied region in source buffer * @offset2: relative start of copied region in destination buffer * @len: length of region changed by memset() * Return: 0 = success, 1 = failure */static int test_memmove(struct unit_test_state *uts, u8 buf[], u8 mask, int offset1, int offset2, int len){ int i; for (i = 0; i < BUFLEN; ++i) { if (i < offset2 || i >= offset2 + len) { ut_asserteq(i, buf[i]); } else { ut_asserteq((i + offset1 - offset2) ^ mask, buf[i]); } } return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:25,
示例8: dm_test_syscon_base/* Base test of system controllers */static int dm_test_syscon_base(struct unit_test_state *uts){ struct udevice *dev; ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev)); ut_asserteq(SYSCON0, dev->driver_data); ut_assertok(uclass_get_device(UCLASS_SYSCON, 1, &dev)); ut_asserteq(SYSCON1, dev->driver_data); ut_asserteq(-ENODEV, uclass_get_device(UCLASS_SYSCON, 2, &dev)); return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:15,
示例9: dm_test_syscon_by_driver_data/* Test system controller finding */static int dm_test_syscon_by_driver_data(struct unit_test_state *uts){ struct udevice *dev; ut_assertok(syscon_get_by_driver_data(SYSCON0, &dev)); ut_asserteq(SYSCON0, dev->driver_data); ut_assertok(syscon_get_by_driver_data(SYSCON1, &dev)); ut_asserteq(SYSCON1, dev->driver_data); ut_asserteq(-ENODEV, syscon_get_by_driver_data(2, &dev)); return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:15,
示例10: dm_test_remoteproc_base/** * dm_test_remoteproc_base() - test the operations after initializations * @uts: unit test state * * Return: 0 if test passed, else error */static int dm_test_remoteproc_base(struct unit_test_state *uts){ if (!rproc_is_initialized()) ut_assertok(rproc_init()); /* Ensure we are initialized */ ut_asserteq(true, rproc_is_initialized()); /* platform data device 1 */ ut_assertok(rproc_stop(0)); ut_assertok(rproc_reset(0)); /* -> invalid attempt tests */ ut_asserteq(-EINVAL, rproc_start(0)); ut_asserteq(-EINVAL, rproc_ping(0)); /* Valid tests */ ut_assertok(rproc_load(0, 1, 0)); ut_assertok(rproc_start(0)); ut_assertok(rproc_is_running(0)); ut_assertok(rproc_ping(0)); ut_assertok(rproc_reset(0)); ut_assertok(rproc_stop(0)); /* dt device device 1 */ ut_assertok(rproc_stop(1)); ut_assertok(rproc_reset(1)); ut_assertok(rproc_load(1, 1, 0)); ut_assertok(rproc_start(1)); ut_assertok(rproc_is_running(1)); ut_assertok(rproc_ping(1)); ut_assertok(rproc_reset(1)); ut_assertok(rproc_stop(1)); /* dt device device 2 */ ut_assertok(rproc_stop(0)); ut_assertok(rproc_reset(0)); /* -> invalid attempt tests */ ut_asserteq(-EINVAL, rproc_start(0)); ut_asserteq(-EINVAL, rproc_ping(0)); /* Valid tests */ ut_assertok(rproc_load(2, 1, 0)); ut_assertok(rproc_start(2)); ut_assertok(rproc_is_running(2)); ut_assertok(rproc_ping(2)); ut_assertok(rproc_reset(2)); ut_assertok(rproc_stop(2)); return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:55,
示例11: dm_test_blk_get_from_parent/* Test that we can get a block from its parent */static int dm_test_blk_get_from_parent(struct unit_test_state *uts){ struct udevice *dev, *blk; ut_assertok(uclass_get_device(UCLASS_MMC, 0, &dev)); ut_assertok(blk_get_from_parent(dev, &blk)); ut_assertok(uclass_get_device(UCLASS_I2C, 0, &dev)); ut_asserteq(-ENOTBLK, blk_get_from_parent(dev, &blk)); ut_assertok(uclass_get_device(UCLASS_GPIO, 0, &dev)); ut_asserteq(-ENODEV, blk_get_from_parent(dev, &blk)); return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:16,
示例12: dm_test_uclass/* Test uclass init/destroy methods */static int dm_test_uclass(struct unit_test_state *uts){ struct uclass *uc; ut_assertok(uclass_get(UCLASS_TEST, &uc)); ut_asserteq(1, dm_testdrv_op_count[DM_TEST_OP_INIT]); ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_DESTROY]); ut_assert(uc->priv); ut_assertok(uclass_destroy(uc)); ut_asserteq(1, dm_testdrv_op_count[DM_TEST_OP_INIT]); ut_asserteq(1, dm_testdrv_op_count[DM_TEST_OP_DESTROY]); return 0;}
开发者ID:LCameron,项目名称:xilinx-uboot,代码行数:16,
示例13: env_test_attrs_lookupstatic int env_test_attrs_lookup(struct unit_test_state *uts){ char attrs[32]; ut_assertok(env_attr_lookup("foo:bar", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup(",foo:bar", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup(",foo:bar,", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup(" foo:bar", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup("foo : bar", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup(" foo: bar ", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup("foo:bar ", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_assertok(env_attr_lookup(",foo:bar,goo:baz", "foo", attrs)); ut_asserteq_str("bar", attrs); ut_asserteq(-ENOENT, env_attr_lookup(",,", "foo", attrs)); ut_asserteq(-ENOENT, env_attr_lookup("goo:baz", "foo", attrs)); ut_assertok(env_attr_lookup("foo:bar,foo:bat,foo:baz", "foo", attrs)); ut_asserteq_str("baz", attrs); ut_assertok(env_attr_lookup( " foo : bar , foo : bat , foot : baz ", "foo", attrs)); ut_asserteq_str("bat", attrs); ut_assertok(env_attr_lookup( " foo : bar , foo : bat , ufoo : baz ", "foo", attrs)); ut_asserteq_str("bat", attrs); ut_asserteq(-EINVAL, env_attr_lookup(NULL, "foo", attrs)); ut_asserteq(-EINVAL, env_attr_lookup("foo:bar", "foo", NULL)); return 0;}
开发者ID:RowanLiu,项目名称:ported_uboot,代码行数:48,
示例14: dm_leak_check_endint dm_leak_check_end(struct unit_test_state *uts){ struct mallinfo end; int id, diff; /* Don't delete the root class, since we started with that */ for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) { struct uclass *uc; uc = uclass_find(id); if (!uc) continue; ut_assertok(uclass_destroy(uc)); } end = mallinfo(); diff = end.uordblks - uts->start.uordblks; if (diff > 0) printf("Leak: lost %#xd bytes/n", diff); else if (diff < 0) printf("Leak: gained %#xd bytes/n", -diff); ut_asserteq(uts->start.uordblks, end.uordblks); return 0;}
开发者ID:13xiaobang,项目名称:mini2440-uboot_2016.01,代码行数:25,
示例15: dm_test_pci_swapcase/* Test that we can use the swapcase device correctly */static int dm_test_pci_swapcase(struct unit_test_state *uts){ struct udevice *emul, *swap; ulong io_addr, mem_addr; char *ptr; /* Check that asking for the device automatically fires up PCI */ ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 0, &emul)); ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap)); ut_assert(device_active(swap)); /* First test I/O */ io_addr = dm_pci_read_bar32(swap, 0); outb(2, io_addr); ut_asserteq(2, inb(io_addr)); /* * Now test memory mapping - note we must unmap and remap to cause * the swapcase emulation to see our data and response. */ mem_addr = dm_pci_read_bar32(swap, 1); ptr = map_sysmem(mem_addr, 20); strcpy(ptr, "This is a TesT"); unmap_sysmem(ptr); ptr = map_sysmem(mem_addr, 20); ut_asserteq_str("tHIS IS A tESt", ptr); unmap_sysmem(ptr); return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:32,
示例16: _dm_test_net_retry/* The asserts include a return on fail; cleanup in the caller */static int _dm_test_net_retry(struct unit_test_state *uts){ /* * eth1 is disabled and netretry is yes, so the ping should succeed and * the active device should be eth0 */ sandbox_eth_disable_response(1, true); env_set("ethact", "[email C++ ut_assertok函数代码示例 C++ ut_ad函数代码示例
|