本文整理汇总了C++中done_testing函数的典型用法代码示例。如果您正苦于以下问题:C++ done_testing函数的具体用法?C++ done_testing怎么用?C++ done_testing使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了done_testing函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int
main() {
int i, ntests;
ntests = sizeof(tests) / sizeof(*tests);
for (i = 0; i < ntests; i++) {
const struct test t = tests[i];
{
dt_t src = dt_from_ywd(t.y, t.w, t.d);
dt_t got = dt_end_of_week(src, t.dow);
dt_t exp = dt_from_ywd(t.ey, t.ew, t.ed);
cmp_ok(got, "==", exp, "dt_end_of_week(%d, %d)", src, t.dow);
}
{
dt_t src = dt_from_ywd(t.y, t.w, t.d);
dt_t dt1 = dt_end_of_week(src, t.dow);
dt_t dt2 = dt_start_of_week(src, t.dow) + 6;
cmp_ok(dt1, "==", dt2, "dt_end_of_week(%d, %d) == dt_start_of_week(%d, %d) + 6",
src, t.dow, src, t.dow);
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:26,代码来源:end_of_week.c
示例2: main
int main (int argc, char **argv)
{
flux_t h;
heartbeat_t *hb;
flux_msg_handler_t *w;
plan (18);
check_codec ();
(void)setenv ("FLUX_CONNECTOR_PATH", CONNECTOR_PATH, 0);
ok ((h = flux_open ("loop://", 0)) != NULL,
"opened loop connector");
if (!h)
BAIL_OUT ("can't continue without loop handle");
flux_fatal_set (h, fatal_err, NULL);
ok ((hb = heartbeat_create ()) != NULL,
"heartbeat_create works");
heartbeat_set_flux (hb, h);
ok (heartbeat_get_rate (hb) == 2.,
"heartbeat_get_rate returns default of 2s");
errno = 0;
ok (heartbeat_set_rate (hb, -1) < 1 && errno == EINVAL,
"heartbeat_set_rate -1 fails with EINVAL");
errno = 0;
ok (heartbeat_set_rate (hb, 1000000) < 1 && errno == EINVAL,
"heartbeat_set_rate 1000000 fails with EINVAL");
ok (heartbeat_set_ratestr (hb, "250ms") == 0,
"heartbeat_set_ratestr 250ms works");
ok (heartbeat_get_rate (hb) == 0.250,
"heartbeat_get_rate returns what was set");
ok (heartbeat_set_rate (hb, 0.1) == 0,
"heartbeat_set_rate 0.1 works");
ok (heartbeat_get_rate (hb) == 0.1,
"heartbeat_get_rate returns what was set");
ok (heartbeat_get_epoch (hb) == 0,
"heartbeat_get_epoch works, default is zero");
w = flux_msg_handler_create (h, FLUX_MATCH_EVENT, heartbeat_event_cb, hb);
ok (w != NULL,
"created event watcher");
flux_msg_handler_start (w);
ok (heartbeat_start (hb) == 0,
"heartbeat_start works");
ok (flux_reactor_run (flux_get_reactor (h), 0) == 0,
"flux reactor exited normally");
heartbeat_destroy (hb);
flux_msg_handler_destroy (w);
flux_close (h);
done_testing ();
return 0;
}
开发者ID:tpatki,项目名称:flux-core,代码行数:60,代码来源:heartbeat.c
示例3: _subtest
void _subtest(char *name, void *(*func)(void), const char *file, uint line)
{
uint subtestp;
// Push tests status stack
if (++current == SUBTEST_MAX_DEPTH) {
bail("Too deep subtest nesting. You can change macro SUBTEST_MAX_DEPTH to change this value.");
}
plan(-1);
func();
done_testing(-1);
// Pop tests status stack
subtestp = current--;
assert(current >= 0);
if (tests[subtestp].run == 0) {
_fail(file, line, "No tests run for subtest \"%s\"", name);
} else {
__ok((tests[subtestp].run == tests[subtestp].pass), 0, file, line, name, NULL);
}
}
开发者ID:kawamuray,项目名称:ctap,代码行数:25,代码来源:ctap.c
示例4: main
int
main() {
int i, ntests;
ntests = sizeof(tests) / sizeof(*tests);
for (i = 0; i < ntests; i++) {
const struct test t = tests[i];
{
dt_t src = dt_from_yd(t.y, t.d);
dt_t got = dt_add_years(src, t.delta, t.adjust);
dt_t exp = dt_from_yd(t.ey, t.ed);
cmp_ok(got, "==", exp, "dt_add_years(%d (%.4d-%.3d), %d, %d)",
src, t.y, t.d, t.delta, t.adjust);
}
if (t.adjust != DT_EXCESS) {
dt_t dt1 = dt_from_yd(t.y, t.d);
dt_t dt2 = dt_add_years(dt1, t.delta, t.adjust);
int got = dt_delta_years(dt1, dt2, 0);
cmp_ok(got, "==", t.delta, "dt_delta_years(%d, %d, false)", dt1, dt2);
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:25,代码来源:add_years.c
示例5: main
// Test driver
int main(void) {
plan(1);
ok(1, "ok works");
done_testing();
return 0;
}
开发者ID:AdunSG,项目名称:Pktgen-DPDK,代码行数:8,代码来源:pktgen-seq.t.c
示例6: main
int
main() {
int ntests, nholidays;
int i;
dt_t holidays[20];
nholidays = sizeof(days) / sizeof(*days);
for (i = 0; i < nholidays; i++) {
const struct ymd date = days[i];
holidays[i] = dt_from_ymd(date.y, date.m, date.d);
}
ntests = sizeof(tests) / sizeof(*tests);
for (i = 0; i < ntests; i++) {
const struct test t = tests[i];
{
dt_t src = dt_from_ymd(t.y, t.m, t.d);
dt_t got = dt_add_workdays(src, t.delta, holidays, nholidays);
dt_t exp = dt_from_ymd(t.ey, t.em, t.ed);
cmp_ok(got, "==", exp, "dt_add_workdays(%.4d-%.2d-%.2d, %d)",
src, t.y, t.m, t.d, t.delta);
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:26,代码来源:add_workdays.c
示例7: main
int main()
{
plan (NO_PLAN);
sha256_test ();
done_testing ();
return(0);
}
开发者ID:flux-framework,项目名称:flux-core,代码行数:7,代码来源:sha256.c
示例8: main
int main (int argc, char *argv[])
{
flux_t *h;
plan (NO_PLAN);
(void)setenv ("FLUX_CONNECTOR_PATH",
flux_conf_get ("connector_path", CONF_FLAG_INTREE), 0);
ok ((h = flux_open ("loop://", 0)) != NULL,
"opened loop connector");
if (!h)
BAIL_OUT ("can't continue without loop handle");
flux_attr_set_cacheonly (h, "rank", "0");
flux_attr_set_cacheonly (h, "tbon.level", "0");
flux_attr_set_cacheonly (h, "tbon.maxlevel", "0");
test_nopolicy (h); // 6
test_hwm (h); // 37
test_timed(h); // 18
flux_close (h);
done_testing();
return (0);
}
开发者ID:flux-framework,项目名称:flux-core,代码行数:25,代码来源:reduce.c
示例9: main
int
main() {
int i, ntests;
ntests = sizeof(good) / sizeof(*good);
for (i = 0; i < ntests; i++) {
const struct good_t t = good[i];
{
dt_t got = 0, exp = 0;
size_t glen;
glen = dt_parse_iso_date(t.str, strlen(t.str), &got);
ok(glen == t.elen, "dt_parse_iso_date(%s) size_t: %d", t.str, (int)glen);
exp = dt_from_ymd(t.ey, t.em, t.ed);
cmp_ok(got, "==", exp, "dt_parse_iso_date(%s)", t.str);
}
}
ntests = sizeof(bad) / sizeof(*bad);
for (i = 0; i < ntests; i++) {
const struct bad_t t = bad[i];
{
dt_t got = 0;
size_t glen;
glen = dt_parse_iso_date(t.str, strlen(t.str), &got);
ok(glen == 0, "dt_parse_iso_date(%s) size_t: %d", t.str, (int)glen);
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:33,代码来源:parse_iso_date.c
示例10: main
int main(void)
{
in_addrX ipnum;
struct stat sstat;
char *fname = get_test_db_fname();
int err = stat(fname, &sstat);
ok(err == 0, "%s exists", fname);
MMDB_s *mmdb = MMDB_open(fname, MMDB_MODE_MEMORY_CACHE);
ok(mmdb != NULL, "MMDB_open successful");
if (mmdb) {
MMDB_root_entry_s root = {.entry.mmdb = mmdb };
char *ipstr = "24.24.24.24";
ip_to_num(mmdb, ipstr, &ipnum);
err = MMDB_lookup_by_ipnum_128(ipnum.v6, &root);
ok(err == MMDB_SUCCESS, "Search for %s SUCCESSFUL", ipstr);
ok(root.entry.offset > 0, "Found something %s good", ipstr);
MMDB_decode_all_s *decode_all;
int err = MMDB_get_tree(&root.entry, &decode_all);
if (err == MMDB_SUCCESS) {
if (decode_all != NULL)
MMDB_dump(mmdb, decode_all, 0);
MMDB_free_decode_all(decode_all);
}
}
done_testing();
}
开发者ID:billfehring,项目名称:libmaxminddb,代码行数:28,代码来源:dump_t.c
示例11: main
int main () {
carp_bool status;
carp_ht h;
carp_ht_entry *res;
const char *key = "mykey";
const char *badkey = "badkey";
carp_value value = 17;
plan(NO_PLAN);
carp_ht_init(&h, 10);
status = carp_ht_del(&h, key);
ok(status == 1, "Delete fails with empty table.");
status = carp_ht_set(&h, key, value);
ok(status == 0, "Set returns successfully.");
res = carp_ht_get(&h, key);
ok(res->value == value && !strcmp(key, res->key), \
"Gets correct struct back.");
res = carp_ht_get(&h, badkey);
ok(res == NULL, "Bad key gives null response.");
carp_ht_cleanup(&h);
done_testing();
}
开发者ID:FelixZhang00,项目名称:carp,代码行数:29,代码来源:ht.c
示例12: main
int
main() {
int i, ntests;
ntests = sizeof(good) / sizeof(*good);
for (i = 0; i < ntests; i++) {
const struct good_t t = good[i];
{
int offset = 0;
size_t glen;
glen = dt_parse_iso_zone_lenient(t.str, strlen(t.str), &offset);
ok(glen == t.elen, "dt_parse_iso_zone_lenient(%s) size_t: %d", t.str, (int)glen);
cmp_ok(offset, "==", t.offset, "dt_parse_iso_zone_lenient(%s)", t.str);
}
}
ntests = sizeof(bad) / sizeof(*bad);
for (i = 0; i < ntests; i++) {
const struct bad_t t = bad[i];
{
int offset = 0;
size_t glen;
glen = dt_parse_iso_zone_lenient(t.str, strlen(t.str), &offset);
ok(glen == 0, "dt_parse_iso_zone_lenient(%s) size_t: %d", t.str, (int)glen);
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:32,代码来源:parse_iso_zone_lenient.c
示例13: main
int
main() {
int i, ntests;
ntests = sizeof(tests) / sizeof(*tests);
for (i = 0; i < ntests; i++) {
const struct test t = tests[i];
{
dt_t src = dt_from_ymd(t.y, t.m, t.d);
dt_t got = dt_start_of_month(src, t.delta);
dt_t exp = dt_from_ymd(t.ey, t.em, t.ed);
cmp_ok(got, "==", exp, "dt_start_of_month(%d (%.4d-%.2d-%.2d), %d)",
src, t.y, t.m, t.d, t.delta);
}
{
dt_t src = dt_from_ymd(t.y, t.m, t.d);
dt_t dt1 = dt_start_of_month(src, t.delta);
dt_t dt2 = dt_end_of_month(src, t.delta - 1) + 1;
cmp_ok(dt1, "==", dt2, "dt_start_of_month(%d, %d) == dt_end_of_month(%d, %d - 1) + 1",
src, t.y, src, t.y);
}
{
dt_t dt1 = dt_from_ymd(t.y, t.m, t.d);
dt_t dt2 = dt_start_of_month(dt1, t.delta);
int got = dt_delta_months(dt1, dt2, 0);
cmp_ok(got, "==", t.delta, "dt_delta_months(%d, %d, false)", dt1, dt2);
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:33,代码来源:start_of_month.c
示例14: main
int main () {
carp_value val = 127;
carp_value code[] = {CARP_I(LOADR), CARP_R0, val,
CARP_I(MOV), CARP_R1, CARP_R0,
CARP_I(MOV), CARP_R2, CARP_R0,
CARP_I(INCR), CARP_R2,
CARP_I(MOV), CARP_R3, CARP_R0,
CARP_I(DECR), CARP_R3,
CARP_I(HALT), EXIT_SUCCESS};
carp_vm_init(&m, 1, 0);
carp_vm_load(&m, code, sizeof(code)/sizeof(*code));
carp_vm_run(&m);
carp_vm_cleanup(&m);
plan(NO_PLAN);
ok(m.regs[CARP_R0] == val, "Set register successfully.");
ok(m.regs[CARP_R1] == val, "Moved register successfully.");
ok(m.regs[CARP_R2] == val + 1, "Incremented register successfully.");
ok(m.regs[CARP_R3] == val - 1, "Decremented register successfully.");
done_testing();
}
开发者ID:FelixZhang00,项目名称:carp,代码行数:28,代码来源:register.c
示例15: main
int
main() {
int i, ntests;
ntests = sizeof(tests) / sizeof(*tests);
for (i = 0; i < ntests; i++) {
const struct test t = tests[i];
{
dt_t got = dt_from_nth_weekday_in_year(t.y, t.nth);
dt_t exp = dt_from_yd(t.ey, t.ed);
cmp_ok(got, "==", exp, "dt_from_nth_weekday_in_year(%d, %d)", t.y, t.nth);
}
{
dt_t src = dt_from_yd(t.y, 1);
dt_t got = dt_nth_weekday_in_year(src, t.nth);
dt_t exp = dt_from_yd(t.ey, t.ed);
cmp_ok(got, "==", exp, "dt_nth_weekday_in_year(%d, %d)", src, t.nth);
}
{
dt_t src = dt_from_nth_weekday_in_year(t.y, t.nth);
int got = dt_weekday_in_year(src, t.nth < 0);
cmp_ok(got, "==", t.nth, "dt_weekday_in_year(%d, %s)", src, (t.nth < 0 ? "true" : "false"));
}
}
done_testing();
}
开发者ID:chansen,项目名称:c-dt,代码行数:30,代码来源:nth_weekday_in_year.c
示例16: main
int main(void) {
test_field();
test_schedule_get();
test_schedule_set();
test_schedule_valid();
done_testing();
return 0;
}
开发者ID:AndyA,项目名称:cronostat,代码行数:8,代码来源:crono.c
示例17: main
/***
* Test driver
***/
int main(void) {
test_pktgen_rnd_bits_init();
test_pktgen_set_random_bitfield();
test_pktgen_rnd_bits_apply();
done_testing();
return 0;
}
开发者ID:javarange,项目名称:Pktgen-DPDK,代码行数:11,代码来源:pktgen-random.t.c
示例18: main
int main(void)
{
const char *version = TMMDB_lib_version();
ok(version != NULL, "TMMDB_lib_version exists");
if (version)
ok(strcmp(version, PACKAGE_VERSION) == 0,
"version is " PACKAGE_VERSION);
done_testing();
}
开发者ID:borisz,项目名称:libtinymmdb,代码行数:9,代码来源:version_t.c
示例19: main
int main(int argc, char **argv)
{
subtest("request", test_request);
subtest("response", test_response);
subtest("headers", test_headers);
subtest("chunked", test_chunked);
subtest("chunked-consume-trailer", test_chunked_consume_trailer);
return done_testing();
}
开发者ID:Gentoooo,项目名称:picohttpparser,代码行数:9,代码来源:test.c
示例20: main
int main()
{
plan(1);
int i;
scanf("%d", &i);
is_eq(i, 7);
done_testing();
}
开发者ID:hajimehoshi,项目名称:c2go,代码行数:10,代码来源:scanf.c
注:本文中的done_testing函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论