本文整理汇总了C++中done_testing函数的典型用法代码示例。如果您正苦于以下问题:C++ done_testing函数的具体用法?C++ done_testing怎么用?C++ done_testing使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了done_testing函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例5: main
// Test driver
int main(void) {
plan(1);
ok(1, "ok works");
done_testing();
return 0;
}
示例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();
}
示例7: main
int main()
{
plan (NO_PLAN);
sha256_test ();
done_testing ();
return(0);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}