本文整理汇总了C++中DO_TEST函数的典型用法代码示例。如果您正苦于以下问题:C++ DO_TEST函数的具体用法?C++ DO_TEST怎么用?C++ DO_TEST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DO_TEST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_UTIL
static void TEST_UTIL(void)
{
DO_TEST(TEST_UTIL_Log);
DO_TEST(TEST_CORE_GetUsername);
DO_TEST(TEST_UTIL_MatchesMask);
DO_TEST(TEST_CORE_GetVMPageSize);
}
示例2: main
int
main(int argc, char** argv)
{
if (DO_TEST(1)) {
std::cout << "Test returns true for 1" << std::endl;
} else {
std::cout << "Test returns false for 1" << std::endl;
}
if (DO_TEST(0)) {
std::cout << "Test returns true for 0" << std::endl;
} else {
std::cout << "Test returns false for 0" << std::endl;
}
if (DO_TEST(1 != 0)) {
std::cout << "Test returns true for 1 != 0" << std::endl;
} else {
std::cout << "Test returns false for 1 != 0" << std::endl;
}
bool y = DO_TEST(3);
if (y) {
std::cout << "Test returns true for 3" << std::endl;
} else {
std::cout << "Test returns false for 3" << std::endl;
}
}
示例3: TEST_CORE
static void TEST_CORE(void)
{
/* Do all TEST_CORE_***() tests */
DO_TEST(TEST_CORE_Io);
DO_TEST(TEST_CORE_Lock);
DO_TEST(TEST_CORE_Log);
}
示例4: mymain
static int
mymain(void)
{
int ret = 0;
if (VIR_ALLOC(testSnapshotXMLVariableLineRegex) < 0)
goto cleanup;
if (regcomp(testSnapshotXMLVariableLineRegex,
testSnapshotXMLVariableLineRegexStr,
REG_EXTENDED | REG_NOSUB) != 0) {
ret = -1;
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"failed to compile test regex");
goto cleanup;
}
# define DO_TEST(name) \
if (virTestRun("VBox Snapshot XML-2-XML " name, \
testCompareXMLToXMLHelper, (name)) < 0) \
ret = -1
DO_TEST("2disks-nosnap");
DO_TEST("2disks-1snap");
DO_TEST("2disks-2snap");
DO_TEST("2disks-3snap");
DO_TEST("2disks-3snap-brother");
cleanup:
if (testSnapshotXMLVariableLineRegex)
regfree(testSnapshotXMLVariableLineRegex);
VIR_FREE(testSnapshotXMLVariableLineRegex);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例5: mymain
static int
mymain(void)
{
int ret = 0;
virCapsPtr caps;
if (virThreadInitialize() < 0)
exit(EXIT_FAILURE);
if (!(caps = testQemuCapsInit()))
exit(EXIT_FAILURE);
virEventRegisterDefaultImpl();
#define DO_TEST(name) \
if (virtTestRun(# name, 1, testQemuMonitorJSON ## name, caps) < 0) \
ret = -1
DO_TEST(GetStatus);
DO_TEST(GetVersion);
DO_TEST(GetMachines);
DO_TEST(GetCPUDefinitions);
DO_TEST(GetCommands);
virObjectUnref(caps);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例6: test_main
int test_main(void)
{
int rc = 0;
pj_caching_pool caching_pool;
pj_init();
pj_caching_pool_init(&caching_pool, &pj_pool_factory_default_policy, 0);
pj_log_set_decor(PJ_LOG_HAS_NEWLINE);
pj_log_set_level(3);
mem = &caching_pool.factory;
DO_TEST(sdp_neg_test());
//DO_TEST(sdp_test (&caching_pool.factory));
//DO_TEST(rtp_test(&caching_pool.factory));
//DO_TEST(session_test (&caching_pool.factory));
DO_TEST(jbuf_main());
DO_TEST(mips_test());
DO_TEST(codec_test_vectors());
PJ_LOG(3,(THIS_FILE," "));
on_return:
if (rc != 0) {
PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!"));
} else {
PJ_LOG(3,(THIS_FILE,"Looks like everything is okay!"));
}
pj_caching_pool_destroy(&caching_pool);
return rc;
}
示例7: mymain
static int
mymain(void)
{
int ret = 0;
testQemuData data;
#if !WITH_YAJL
fputs("libvirt not compiled with yajl, skipping this test\n", stderr);
return EXIT_AM_SKIP;
#endif
if (virThreadInitialize() < 0)
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
#define DO_TEST_FULL(name, guest) \
data.base = name; \
data.guestarch = guest; \
if (virtTestRun(name, testQemuCapsXML, &data) < 0) \
ret = -1
#define DO_TEST(name) DO_TEST_FULL(name, VIR_ARCH_I686)
DO_TEST("all_1.6.0-1");
DO_TEST("nodisksnapshot_1.6.0-1");
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例8: mymain
static int
mymain(void)
{
int ret = 0;
if ((caps = testLXCCapsInit()) == NULL)
return EXIT_FAILURE;
# define DO_TEST_FULL(name, is_different, inactive) \
do { \
const struct testInfo info = {name, is_different, inactive}; \
if (virtTestRun("LXC XML-2-XML " name, \
1, testCompareXMLToXMLHelper, &info) < 0) \
ret = -1; \
} while (0)
# define DO_TEST(name) \
DO_TEST_FULL(name, 0, false)
# define DO_TEST_DIFFERENT(name) \
DO_TEST_FULL(name, 1, false)
/* Unset or set all envvars here that are copied in lxcdBuildCommandLine
* using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
* values for these envvars */
setenv("PATH", "/bin", 1);
DO_TEST("systemd");
DO_TEST("hostdev");
virObjectUnref(caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例9: mymain
static int
mymain(int argc, char **argv)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(name) \
if (virtTestRun("Network XML-2-XML " name, \
1, testCompareXMLToXMLHelper, (name)) < 0) \
ret = -1
DO_TEST("isolated-network");
DO_TEST("routed-network");
DO_TEST("nat-network");
DO_TEST("netboot-network");
DO_TEST("netboot-proxy-network");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
示例10: mymain
static int
mymain(void)
{
int ret = 0;
if (!(caps = testXLInitCaps()))
return EXIT_FAILURE;
if (!(xmlopt = libxlCreateXMLConf()))
return EXIT_FAILURE;
#define DO_TEST_PARSE(name) \
do { \
struct testInfo info0 = { name, 0 }; \
if (virtTestRun("Xen XL-2-XML Parse " name, \
testCompareHelper, &info0) < 0) \
ret = -1; \
} while (0)
#define DO_TEST_FORMAT(name) \
do { \
struct testInfo info1 = { name, 1 }; \
if (virtTestRun("Xen XL-2-XML Format " name, \
testCompareHelper, &info1) < 0) \
ret = -1; \
} while (0)
#define DO_TEST(name) \
do { \
DO_TEST_PARSE(name); \
DO_TEST_FORMAT(name); \
} while (0)
DO_TEST("paravirt-maxvcpus");
DO_TEST("new-disk");
DO_TEST_FORMAT("disk-positional-parms-full");
DO_TEST_FORMAT("disk-positional-parms-partial");
DO_TEST("spice");
DO_TEST("spice-features");
DO_TEST("vif-rate");
DO_TEST("paravirt-cmdline");
DO_TEST_FORMAT("paravirt-cmdline-extra-root");
DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root");
DO_TEST("rbd-multihost-noauth");
#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
DO_TEST("fullvirt-multiusb");
#endif
#ifdef LIBXL_HAVE_BUILDINFO_KERNEL
DO_TEST("fullvirt-direct-kernel-boot");
DO_TEST_FORMAT("fullvirt-direct-kernel-boot-extra");
DO_TEST_FORMAT("fullvirt-direct-kernel-boot-bogus-extra");
#endif
virObjectUnref(caps);
virObjectUnref(xmlopt);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例11: main
int main( int argc, char *argv[])
{
int failures = 0;
failures += DO_TEST( t_null_buffer);
failures += DO_TEST( t_no_clusters);
failures += DO_TEST( t_input_only);
failures += DO_TEST( t_output_only);
failures += DO_TEST( t_both);
return test_exit( failures);
}
示例12: main
int main(int argc, char *argv[])
{
int const n=1024;
float *x, *y, *z;
int i;
printf("OV_PLATFORM: %s\n", OV_PLATFORM);
printf("OV_FLOAT_WIDTH %d\n", OV_FLOAT_WIDTH);
x=(float*)malloc(sizeof(float)*(n));
y=(float*)calloc(n, sizeof(float));
z=(float*)calloc(n, sizeof(float));
/*
Init
*/
// float f=8388608.0f;
// float f=-2147483647.0f;
float f=-1.0e20;
int k=*(int*)&f;
printf("k=%d, f=%f\n", k, f);
while(fabs(f)>0.4f)
{
//printf("k=%d, f=%f\n", k, f);
for (i=0; i<n; i++)
{
// printf("k=%d, f=%f\n", k, f);
k--;
f=*(float*)&k;
x[i]=f;
}
//for (i=0; i<n; i++) printf("x[%d]=%f\n",i,x[i]);
DO_TEST(ov_floorf, floorf);
DO_TEST(ov_ceilf, ceilf);
if ((f<0.0f) && (f>-.5))
{
f=2147483647.0f;
k=*(int*)&f;
}
}
free(x);
free(y);
free(z);
printf("Passed all tests.\n");
return 0;
}
示例13: mymain
static int
mymain(void)
{
int ret = 0;
if ((driver.caps = testQemuCapsInit()) == NULL)
return EXIT_FAILURE;
# define DO_TEST(name, uuid, internal) \
do { \
const struct testInfo info = {name, uuid, internal}; \
if (virtTestRun("SNAPSHOT XML-2-XML " name, \
1, testCompareXMLToXMLHelper, &info) < 0) \
ret = -1; \
} while (0)
/* Unset or set all envvars here that are copied in qemudBuildCommandLine
* using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
* values for these envvars */
setenv("PATH", "/bin", 1);
DO_TEST("all_parameters", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", 1);
DO_TEST("disk_snapshot", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 1);
DO_TEST("full_domain", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 1);
DO_TEST("noparent_nodescription_noactive", NULL, 0);
DO_TEST("noparent_nodescription", NULL, 1);
DO_TEST("noparent", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", 0);
DO_TEST("metadata", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 0);
DO_TEST("external_vm", "c7a5fdbd-edaf-9455-926a-d65c16db1809", 0);
virObjectUnref(driver.caps);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
示例14: main
int
main()
{
// construction
{
std::string const s( "test" );
breath::string_argument
arg( s ) ;
DO_TEST( arg.value() == "test" ) ;
char const * s2 = "test-2" ;
breath::string_argument
arg2( s2 ) ;
DO_TEST(arg2.value() == "test-2" ) ;
}
}
示例15: main
int
main()
{
std::ostringstream oss ;
stream_guard const guard( std::cout, oss.rdbuf() ) ;
// TEST 1)
// check that 1 << 3 is output as "1 << 3", first, and not directly as "8"
BREATH_DUMP_EXPRESSION( 1 << 3 ) ;
DO_TEST( oss.str() == "1 << 3 = 8\n" ) ;
clear_stringstream( oss ) ;
// TEST 2)
// now check with some strings (gps ricordati di portare questo test nei
// test di BREATH_STRINGIZE (e controllare cosa dice lo standard)!)
BREATH_DUMP_EXPRESSION( "test" ) ;
DO_TEST( oss.str() == "\"test\" = test\n" ) ;
clear_stringstream( oss ) ;
// TEST 3)
// check that macros are expanded (the replacement lists here are
// intentionally not parenthesized, although we already have a
// separate parenthesis-test in place)
# define OBJECT_LIKE_DUMMY 1 << 3 * 2
# define FUNCTION_LIKE_DUMMY() 1 << 3 * 4
BREATH_DUMP_EXPRESSION( OBJECT_LIKE_DUMMY ) ;
DO_TEST( oss.str() == "1 << 3 * 2 = 64 [from: OBJECT_LIKE_DUMMY]\n" ) ;
clear_stringstream( oss ) ;
BREATH_DUMP_EXPRESSION( FUNCTION_LIKE_DUMMY() ) ;
DO_TEST( oss.str() == "1 << 3 * 4 = 4096 [from: FUNCTION_LIKE_DUMMY()]\n" ) ;
clear_stringstream( oss ) ;
// TEST 4)
// the one case that the macro doesn't detect: a macro that is object-like
// and expands to its own name (of course it's not important, but it's good
// to have a test here, in case I manage to detect it)
int BREATH_dummy = 1 ;
# define BREATH_dummy BREATH_dummy
BREATH_DUMP_EXPRESSION( BREATH_dummy ) ;
DO_TEST( oss.str() == "BREATH_dummy = 1\n" ) ;
clear_stringstream( oss ) ;
}