这篇教程C++ ut_assertok函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ut_assertok函数的典型用法代码示例。如果您正苦于以下问题:C++ ut_assertok函数的具体用法?C++ ut_assertok怎么用?C++ ut_assertok使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ut_assertok函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dm_test_power_regulator_set_get_enable/* Test regulator set and get Enable method */static int dm_test_power_regulator_set_get_enable(struct unit_test_state *uts){ const char *platname; struct udevice *dev; bool val_set = true; /* Set the Enable of LDO1 - default is disabled */ platname = regulator_names[LDO1][PLATNAME]; ut_assertok(regulator_get_by_platname(platname, &dev)); ut_assertok(regulator_set_enable(dev, val_set)); /* Get the Enable state of LDO1 and compare it with the requested one */ ut_asserteq(regulator_get_enable(dev), val_set); return 0;}
开发者ID:axxia,项目名称:axxia_u-boot,代码行数:17,
示例2: dm_test_autobind/* Test that binding with platdata occurs correctly */static int dm_test_autobind(struct dm_test_state *dms){ struct udevice *dev; /* * We should have a single class (UCLASS_ROOT) and a single root * device with no children. */ ut_assert(dms->root); ut_asserteq(1, list_count_items(&gd->uclass_root)); ut_asserteq(0, list_count_items(&gd->dm_root->child_head)); ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]); ut_assertok(dm_scan_platdata()); /* We should have our test class now at least, plus more children */ ut_assert(1 < list_count_items(&gd->uclass_root)); ut_assert(0 < list_count_items(&gd->dm_root->child_head)); /* Our 3 dm_test_infox children should be bound to the test uclass */ ut_asserteq(3, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]); /* No devices should be probed */ list_for_each_entry(dev, &gd->dm_root->child_head, sibling_node) ut_assert(!(dev->flags & DM_FLAG_ACTIVATED)); /* Our test driver should have been bound 3 times */ ut_assert(dm_testdrv_op_count[DM_TEST_OP_BIND] == 3); return 0;}
开发者ID:Android4SAM,项目名称:u-boot-at91,代码行数:32,
示例3: dm_test_operations/* Check that we can perform operations on devices */static int dm_test_operations(struct dm_test_state *dms){ struct udevice *dev; int i; /* * Now check that the ping adds are what we expect. This is using the * ping-add property in each node. */ for (i = 0; i < ARRAY_SIZE(test_pdata); i++) { uint32_t base; ut_assertok(uclass_get_device(UCLASS_TEST, i, &dev)); /* * Get the 'reg' property, which tells us what the ping add * should be. We don't use the platdata because we want * to test the code that sets that up (testfdt_drv_probe()). */ base = test_pdata[i].ping_add; debug("dev=%d, base=%d/n", i, base); ut_assert(!dm_check_operations(dms, dev, base, dev->priv)); } return 0;}
开发者ID:Android4SAM,项目名称:u-boot-at91,代码行数:28,
示例4: 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,
示例5: dm_test_mmc_base/* * Basic test of the mmc uclass. We could expand this by implementing an MMC * stack for sandbox, or at least implementing the basic operation. */static int dm_test_mmc_base(struct unit_test_state *uts){ struct udevice *dev; ut_assertok(uclass_get_device(UCLASS_MMC, 0, &dev)); return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:12,
示例6: dm_test_mmc_blkstatic int dm_test_mmc_blk(struct unit_test_state *uts){ struct udevice *dev; struct blk_desc *dev_desc; char cmp[1024]; ut_assertok(uclass_get_device(UCLASS_MMC, 0, &dev)); ut_assertok(blk_get_device_by_str("mmc", "0", &dev_desc)); /* Read a few blocks and look for the string we expect */ ut_asserteq(512, dev_desc->blksz); memset(cmp, '/0', sizeof(cmp)); ut_asserteq(2, blk_dread(dev_desc, 0, 2, cmp)); ut_assertok(strcmp(cmp, "this is a test")); return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:17,
示例7: dm_test_sysreset_get_statusstatic int dm_test_sysreset_get_status(struct unit_test_state *uts){ struct udevice *dev; char msg[64]; /* Device 1 is the warm sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev)); ut_assertok(sysreset_get_status(dev, msg, sizeof(msg))); ut_asserteq_str("Reset Status: WARM", msg); /* Device 2 is the cold sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev)); ut_assertok(sysreset_get_status(dev, msg, sizeof(msg))); ut_asserteq_str("Reset Status: COLD", msg); return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:17,
示例8: dm_test_sysreset_get_laststatic int dm_test_sysreset_get_last(struct unit_test_state *uts){ struct udevice *dev; /* Device 1 is the warm sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev)); ut_asserteq(SYSRESET_WARM, sysreset_get_last(dev)); /* Device 2 is the cold sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev)); ut_asserteq(SYSRESET_POWER, sysreset_get_last(dev)); /* This is device 0, the non-DT one */ ut_asserteq(SYSRESET_POWER, sysreset_get_last_walk()); return 0;}
开发者ID:Noltari,项目名称:u-boot,代码行数:17,
示例9: dm_test_pci_busnum/* Test that sandbox PCI bus numbering works correctly */static int dm_test_pci_busnum(struct unit_test_state *uts){ struct udevice *bus; ut_assertok(uclass_get_device_by_seq(UCLASS_PCI, 0, &bus)); return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:9,
示例10: dm_test_mainint dm_test_main(const char *test_name){ struct dm_test *tests = ll_entry_start(struct dm_test, dm_test); const int n_ents = ll_entry_count(struct dm_test, dm_test); struct dm_test_state *dms = &global_test_state; struct dm_test *test; /* * If we have no device tree, or it only has a root node, then these * tests clearly aren't going to work... */ if (!gd->fdt_blob || fdt_next_node(gd->fdt_blob, 0, NULL) < 0) { puts("Please run with test device tree:/n" " dtc -I dts -O dtb test/dm/test.dts -o test/dm/test.dtb/n" " ./u-boot -d test/dm/test.dtb/n"); ut_assert(gd->fdt_blob); } if (!test_name) printf("Running %d driver model tests/n", n_ents); for (test = tests; test < tests + n_ents; test++) { if (test_name && strcmp(test_name, test->name)) continue; printf("Test: %s/n", test->name); ut_assertok(dm_test_init(dms)); dms->start = mallinfo(); if (test->flags & DM_TESTF_SCAN_PDATA) ut_assertok(dm_scan_platdata(false)); if (test->flags & DM_TESTF_PROBE_TEST) ut_assertok(do_autoprobe(dms)); if (test->flags & DM_TESTF_SCAN_FDT) ut_assertok(dm_scan_fdt(gd->fdt_blob, false)); if (test->func(dms)) break; ut_assertok(dm_test_destroy(dms)); } printf("Failures: %d/n", dms->fail_count); return 0;}
开发者ID:dongzengwu,项目名称:u-boot-stm32f4,代码行数:45,
示例11: dm_test_eth_act/** * This test case is trying to test the following scenario: * - All ethernet devices are not probed * - "ethaddr" for all ethernet devices are not set * - "ethact" is set to a valid ethernet device name * * With Sandbox default test configuration, all ethernet devices are * probed after power-up, so we have to manually create such scenario: * - Remove all ethernet devices * - Remove all "ethaddr" environment variables * - Set "ethact" to the first ethernet device * * Do a ping test to see if anything goes wrong. */static int dm_test_eth_act(struct unit_test_state *uts){ struct udevice *dev[DM_TEST_ETH_NUM]; const char *ethname[DM_TEST_ETH_NUM] = {"[email C++ utarray_front函数代码示例 C++ ut_asserteq函数代码示例
|