本文整理汇总了C++中plan_tests函数的典型用法代码示例。如果您正苦于以下问题:C++ plan_tests函数的具体用法?C++ plan_tests怎么用?C++ plan_tests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plan_tests函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
plan_tests(9 + 36 + 18);
const GeoPoint a(Angle::degrees(fixed(7.7061111111111114)),
Angle::degrees(fixed(51.051944444444445)));
const GeoPoint b(Angle::degrees(fixed(7.599444444444444)),
Angle::degrees(fixed(51.099444444444444)));
const GeoPoint c(Angle::degrees(fixed(4.599444444444444)),
Angle::degrees(fixed(47.099444444444444)));
fixed distance = Distance(a, b);
ok1(distance > fixed(9130) && distance < fixed(9140));
Angle bearing = Bearing(a, b);
ok1(bearing.value_degrees() > fixed(304));
ok1(bearing.value_degrees() < fixed(306));
bearing = Bearing(b, a);
ok1(bearing.value_degrees() > fixed(124));
ok1(bearing.value_degrees() < fixed(126));
distance = ProjectedDistance(a, b, a);
ok1(is_zero(distance));
distance = ProjectedDistance(a, b, b);
ok1(distance > fixed(9120) && distance < fixed(9140));
const GeoPoint middle(a.Longitude.Fraction(b.Longitude, fixed_half),
a.Latitude.Fraction(b.Latitude, fixed_half));
distance = ProjectedDistance(a, b, middle);
ok1(distance > fixed(9100/2) && distance < fixed(9140/2));
fixed big_distance = Distance(a, c);
ok1(big_distance > fixed(494000) && big_distance < fixed(495000));
TestLinearDistance();
return exit_status();
}
开发者ID:macsux,项目名称:XCSoar,代码行数:39,代码来源:TestEarth.cpp
示例2: main
int main(int argc, char **argv) {
plan_tests(8);
downtime_id = strtoul(svr_hostname, &end_ptr, 10);
ok(downtime_id == 0, "hostname downtime_id is 0");
ok(strlen(end_ptr) == 8, "hostname end_ptr is 8 chars");
downtime_id = strtoul(svr_fqdn, &end_ptr, 10);
ok(downtime_id == 0, "fqdn downtime_id is 0");
ok(strlen(end_ptr) == 20, "fqdn end_ptr is 20 chars");
downtime_id = strtoul(svr_ip, &end_ptr, 10);
ok(downtime_id == 192, "ip downtime_id is 192");
ok(strlen(end_ptr) == 8, "ip end_ptr is 8 chars");
downtime_id = strtoul(svr_downtime_id, &end_ptr, 10);
ok(downtime_id == 1234, "svr_downtime_id downtime_id is 1234");
ok(strlen(end_ptr) == 0, "svr_downtime_id end_ptr is 0 chars");
return exit_status();
}
开发者ID:formorer,项目名称:icinga-core,代码行数:22,代码来源:test_strtoul.c
示例3: main
int main(void)
{
int status;
plan_tests(3);
if (fork() == 0) {
int fds[2];
ok1(pipe(fds) == 0);
io_new_conn(NULL, fds[0], setup_waiter, &status);
io_loop(NULL, NULL);
exit(1);
}
ok1(wait(&status) != -1);
ok1(WIFSIGNALED(status));
ok1(WTERMSIG(status) == SIGABRT);
/* This exits depending on whether all tests passed */
return exit_status();
}
开发者ID:HSchroeder,项目名称:ccan,代码行数:22,代码来源:run-13-all-idle.c
示例4: main
int main(void)
{
plan_tests(9);
MEMREF act, x = strref("hello, world");
# define S(s) ((s) ? (s) : "(null)")
# define TRY(p, l, exp) \
if (!ok(!refcmp(act = subref(x,p,l), strref(exp)), "(%d, %d): %s", p, l, S(exp))) \
fprintf(stderr, "act[%"FSIZE"d]: %.*s\n", act.len, (int)act.len, S(act.ptr))
TRY( 0, 5, "hello");
TRY( 2, 3, "llo");
TRY( -5, 2, "wo");
TRY( -5, 99, "world");
TRY(-12, 2, "he");
TRY( 0, -1, x.ptr); // (len) is unsigned, so (-1) is just a very big positive number.
TRY( 0, 0, NULL);
TRY( 1, 0, NULL);
TRY(-13, 2, NULL);
return exit_status();
}
开发者ID:mischasan,项目名称:util,代码行数:22,代码来源:subref_t.c
示例5: main
int main(int argc, char **argv)
{
plan_tests(2095);
glide_settings.SetDefaults();
TestAll();
glide_polar.SetMC(fixed(0.1));
TestAll();
glide_polar.SetMC(fixed(1));
TestAll();
glide_polar.SetMC(fixed(4));
TestAll();
glide_polar.SetMC(fixed(10));
TestAll();
return exit_status();
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:22,代码来源:TestMacCready.cpp
示例6: main
int
main(int argc, char *argv[])
{
unsigned int rc = 0;
unsigned int side_effect = 0;
rc = plan_tests(4);
diag("Returned: %d", rc);
rc = ok(1 == 1, "1 equals 1"); /* Should always work */
diag("Returned: %d", rc);
do {
if(1) {
rc = skip(1, "Testing skipping");
continue;
}
side_effect++;
ok(side_effect == 1, "side_effect checked out");
} while(0);
diag("Returned: %d", rc);
skip_start(1 == 1, 1, "Testing skipping #2");
side_effect++;
rc = ok(side_effect == 1, "side_effect checked out");
diag("Returned: %d", rc);
skip_end;
rc = ok(side_effect == 0, "side_effect is %d", side_effect);
diag("Returned: %d", rc);
return exit_status();
}
开发者ID:AstroProfundis,项目名称:nagios-plugins,代码行数:39,代码来源:test.c
示例7: main
int main(int argc, char *argv[])
{
char **split, *str;
void *ctx;
plan_tests(16);
split = strsplit(NULL, "hello world", " ");
ok1(talloc_array_length(split) == 4);
ok1(!strcmp(split[0], "hello"));
ok1(!strcmp(split[1], ""));
ok1(!strcmp(split[2], "world"));
ok1(split[3] == NULL);
talloc_free(split);
split = strsplit(NULL, "hello world", "o ");
ok1(talloc_array_length(split) == 6);
ok1(!strcmp(split[0], "hell"));
ok1(!strcmp(split[1], ""));
ok1(!strcmp(split[2], ""));
ok1(!strcmp(split[3], "w"));
ok1(!strcmp(split[4], "rld"));
ok1(split[5] == NULL);
ctx = split;
split = strsplit(ctx, "hello world", "o ");
ok1(talloc_parent(split) == ctx);
talloc_free(ctx);
str = strjoin(NULL, (char **)substrings, ", ");
ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar, "));
ctx = str;
str = strjoin(ctx, (char **)substrings, "");
ok1(!strcmp(str, "farbarbazbbazar"));
ok1(talloc_parent(str) == ctx);
talloc_free(ctx);
return exit_status();
}
开发者ID:Honglongwu,项目名称:ccan,代码行数:38,代码来源:run.c
示例8: main
int main(void)
{
char haystack1[] = "abcd\0efgh";
char haystack2[] = "ab\0ab\0ab\0ab";
char needle1[] = "ab";
char needle2[] = "d\0e";
/* This is how many tests you plan to run */
plan_tests(19);
ok1(memmem(haystack1, sizeof(haystack1), needle1, 2) == haystack1);
ok1(memmem(haystack1, sizeof(haystack1), needle1, 3) == NULL);
ok1(memmem(haystack1, sizeof(haystack1), needle2, 3) == (haystack1 + 3));
ok1(memmem(haystack2, sizeof(haystack2), needle1, sizeof(needle1))
== haystack2);
ok1(memmem(haystack2, sizeof(haystack2), needle2, 3) == NULL);
ok1(memrchr(haystack1, 'a', sizeof(haystack1)) == haystack1);
ok1(memrchr(haystack1, 'b', sizeof(haystack1)) == haystack1 + 1);
ok1(memrchr(haystack1, 'c', sizeof(haystack1)) == haystack1 + 2);
ok1(memrchr(haystack1, 'd', sizeof(haystack1)) == haystack1 + 3);
ok1(memrchr(haystack1, 'e', sizeof(haystack1)) == haystack1 + 5);
ok1(memrchr(haystack1, 'f', sizeof(haystack1)) == haystack1 + 6);
ok1(memrchr(haystack1, 'g', sizeof(haystack1)) == haystack1 + 7);
ok1(memrchr(haystack1, 'h', sizeof(haystack1)) == haystack1 + 8);
ok1(memrchr(haystack1, '\0', sizeof(haystack1)) == haystack1 + 9);
ok1(memrchr(haystack1, 'i', sizeof(haystack1)) == NULL);
ok1(memrchr(haystack2, 'a', sizeof(haystack2)) == haystack2 + 9);
ok1(memrchr(haystack2, 'b', sizeof(haystack2)) == haystack2 + 10);
ok1(memrchr(haystack2, '\0', sizeof(haystack2)) == haystack2 + 11);
ok1(memrchr(needle1, '\0', 2) == NULL);
/* This exits depending on whether all tests passed */
return exit_status();
}
开发者ID:275288698,项目名称:jiadu_ccan,代码行数:38,代码来源:api.c
示例9: main
int main(int argc, char** argv)
{
if (!parse_args(argc,argv)) {
return 0;
}
plan_tests(16);
Waypoints waypoints;
ok(setup_waypoints(waypoints),"waypoint setup",0);
unsigned size = waypoints.size();
ok(test_lookup(waypoints,3),"waypoint lookup",0);
ok(!test_lookup(waypoints,5000),"waypoint bad lookup",0);
ok(test_nearest(waypoints),"waypoint nearest",0);
ok(test_nearest_landable(waypoints),"waypoint nearest landable",0);
ok(test_location(waypoints,true),"waypoint location good",0);
ok(test_location(waypoints,false),"waypoint location bad",0);
ok(test_range(waypoints,100)==1,"waypoint visit range 100m",0);
ok(test_radius(waypoints,100)==1,"waypoint radius 100m",0);
ok(test_range(waypoints,500000)== waypoints.size(),"waypoint range 500000m",0);
ok(test_radius(waypoints,25000)<= test_range(waypoints,25000),"waypoint radius<range",0);
// test clear
waypoints.clear();
ok(waypoints.size()==0,"waypoint clear",0);
setup_waypoints(waypoints);
ok(size == waypoints.size(),"waypoint setup after clear",0);
ok(test_copy(waypoints),"waypoint copy",0);
ok(test_erase(waypoints,3),"waypoint erase",0);
ok(test_replace(waypoints,4),"waypoint replace",0);
return exit_status();
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:38,代码来源:test_waypoints.cpp
示例10: main
int main(int argc, char *argv[])
{
unsigned int i;
struct ntdb_context *ntdb;
int flags[] = { NTDB_INTERNAL,
NTDB_INTERNAL|NTDB_CONVERT,
NTDB_CONVERT };
NTDB_DATA key = ntdb_mkdata("key", 3);
NTDB_DATA data = ntdb_mkdata("data", 4);
failtest_init(argc, argv);
failtest_hook = block_repeat_failures;
failtest_exit_check = exit_check_log;
failtest_suppress = true;
plan_tests(sizeof(flags) / sizeof(flags[0]) * 3 + 1);
for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
ntdb = ntdb_open("run-12-check.ntdb", flags[i]|MAYBE_NOSYNC,
O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
ok1(ntdb);
ok1(ntdb_store(ntdb, key, data, NTDB_INSERT) == 0);
/* This is what we really want to test: ntdb_check(). */
failtest_suppress = false;
if (!ok1(ntdb_check(ntdb, NULL, NULL) == 0))
goto fail;
failtest_suppress = true;
ntdb_close(ntdb);
}
ok1(tap_log_messages == 0);
failtest_exit(exit_status());
fail:
failtest_suppress = true;
ntdb_close(ntdb);
failtest_exit(exit_status());
}
开发者ID:AIdrifter,项目名称:samba,代码行数:38,代码来源:run-12-check.c
示例11: main
int main(void)
{
struct cdump_definitions *defs;
const struct cdump_type *t, *t2;
char *ctx = tal(NULL, char), *problems;
/* This is how many tests you plan to run */
plan_tests(16);
defs = cdump_extract(ctx, "struct foo { struct bar *bar; };\n"
"struct bar { int x; };", &problems);
ok1(defs);
ok1(tal_parent(defs) == ctx);
ok1(!problems);
t = strmap_get(&defs->structs, "foo");
ok1(t);
t2 = strmap_get(&defs->structs, "bar");
ok1(t2);
ok1(t2->kind == CDUMP_STRUCT);
ok1(streq(t2->name, "bar"));
ok1(tal_count(t2->u.members) == 1);
ok1(t2->u.members[0].type->kind == CDUMP_UNKNOWN);
ok1(streq(t2->u.members[0].type->name, "int"));
ok1(t->kind == CDUMP_STRUCT);
ok1(streq(t->name, "foo"));
ok1(tal_count(t->u.members) == 1);
ok1(streq(t->u.members[0].name, "bar"));
ok1(t->u.members[0].type->kind == CDUMP_POINTER);
ok1(t->u.members[0].type->u.ptr == t2);
tal_free(ctx);
/* This exits depending on whether all tests passed */
return exit_status();
}
开发者ID:dooglus,项目名称:ccan,代码行数:38,代码来源:run-forward-decl.c
示例12: main
int main(int argc, char** argv) {
// default arguments
verbose=1;
if (!parse_args(argc,argv)) {
return 0;
}
TaskBehaviour task_behaviour;
TaskEventsPrint default_events(verbose);
GlidePolar glide_polar(fixed_two);
Waypoints waypoints;
setup_waypoints(waypoints);
TaskManager task_manager(default_events,
task_behaviour,
waypoints);
task_manager.set_glide_polar(glide_polar);
test_task(task_manager, waypoints, 0);
plan_tests(1);
ok(test_edit(task_manager, task_behaviour),
"edit task", 0);
/*
plan_tests(task_manager.task_size());
// here goes, example, edit all task points
SafeTaskEdit ste(task_manager, waypoints);
for (unsigned i=0; i<task_manager.task_size(); i++) {
ok(ste.edit(i),"edit tp",0);
task_report(task_manager, "edit tp\n");
}
*/
return exit_status();
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:38,代码来源:test_edittp.cpp
示例13: main
int main(void)
{
struct io_listener *l;
int fd;
struct timers timers;
struct timer timer, *expired;
struct addrinfo *addrinfo;
/* This is how many tests you plan to run */
plan_tests(7);
fake_time = time_now();
timers_init(&timers, fake_time);
timer_init(&timer);
timer_add(&timers, &timer,
timeabs_add(fake_time, time_from_sec(1000)));
fd = make_listen_fd(PORT, &addrinfo);
freeaddrinfo(addrinfo);
ok1(fd >= 0);
l = io_new_listener(NULL, fd, init_conn, NULL);
ok1(l);
fake_time.ts.tv_sec += 1000;
ok1(io_time_override(get_fake_time) == time_now);
ok1(io_loop(&timers, &expired) == NULL);
ok1(expired == &timer);
ok1(!timers_expire(&timers, fake_time));
ok1(io_time_override(time_now) == get_fake_time);
io_close_listener(l);
timers_cleanup(&timers);
/* This exits depending on whether all tests passed */
return exit_status();
}
开发者ID:braydonf,项目名称:lightning,代码行数:38,代码来源:run-20-io_time_override.c
示例14: main
int
main (int argc, char **argv)
{
time_t rotation_time;
struct stat stat_info, stat_new;
plan_tests(14);
rotation_time = (time_t)1242949698;
log_rotation_method=5;
ok(rotate_log_file(rotation_time) == ERROR, "Got error for a bad log_rotation_method");
log_file="renamefailure";
log_rotation_method=LOG_ROTATION_HOURLY;
ok(rotate_log_file(rotation_time) == ERROR, "Got an error with rename");
ok( strcmp(saved_dest, "var/nagios-05-22-2009-00.log")==0, "Got an hourly rotation" );
log_file="var/nagios.log";
log_rotation_method=LOG_ROTATION_HOURLY;
ok(system("cp var/nagios.log.dummy var/nagios.log")==0, "Copied in dummy nagios.log for archiving");
ok(rotate_log_file(rotation_time) == OK, "Log rotation should work happily");
ok( system("diff var/nagios.log var/nagios.log.expected > /dev/null")==0, "Got correct contents of nagios.log");
ok( system("diff var/nagios.log.dummy var/nagios-05-22-2009-00.log")==0, "nagios log archived correctly" );
unlink("var/nagios-05-22-2009-00.log");
ok( system("chmod 777 var/nagios.log")==0, "Changed mode of nagios.log" );
ok( stat("var/nagios.log", &stat_info) == 0, "Got stat info for log file" );
ok( rotate_log_file(rotation_time) == OK, "Log rotate to check if mode is retained" );
ok( stat("var/nagios-05-22-2009-00.log", &stat_new) == 0, "Got new stat info for archived log file" );
ok( stat_info.st_mode == stat_new.st_mode, "Mode for archived file same as original log file" );
ok( stat("var/nagios.log", &stat_new) == 0, "Got new stat info for new log file" );
ok( stat_info.st_mode == stat_new.st_mode, "Mode for new log file kept same as original log file" );
return exit_status ();
}
开发者ID:Elbandi,项目名称:nagios3,代码行数:38,代码来源:test_logging.c
示例15: main
int main(int argc, char *argv[])
{
const int flags[] = { NTDB_DEFAULT, NTDB_NOMMAP,
NTDB_CONVERT, NTDB_NOMMAP|NTDB_CONVERT };
int i;
struct ntdb_context *ntdb;
NTDB_DATA key, data;
plan_tests(sizeof(flags)/sizeof(flags[0]) * 5);
agent = prepare_external_agent();
if (!agent)
err(1, "preparing agent");
unlock_callback = after_unlock;
for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) {
diag("Test with %s and %s\n",
(flags[i] & NTDB_CONVERT) ? "CONVERT" : "DEFAULT",
(flags[i] & NTDB_NOMMAP) ? "no mmap" : "mmap");
unlink(TEST_DBNAME);
ntdb = ntdb_open(TEST_DBNAME, flags[i]|MAYBE_NOSYNC,
O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
ok1(ntdb);
opened = true;
ok1(ntdb_transaction_start(ntdb) == 0);
key = ntdb_mkdata("hi", strlen("hi"));
data = ntdb_mkdata("world", strlen("world"));
ok1(ntdb_store(ntdb, key, data, NTDB_INSERT) == 0);
ok1(ntdb_transaction_commit(ntdb) == 0);
ok(!errors, "We had %u open errors", errors);
opened = false;
ntdb_close(ntdb);
}
return exit_status();
}
开发者ID:HSchroeder,项目名称:ccan,代码行数:38,代码来源:run-56-open-during-transaction.c
示例16: main
int main(int argc, char *argv[])
{
plan_tests(12);
/* --aaa without args. */
opt_register_arg("-a|--aaa", test_arg, NULL, "aaa", "");
ok1(!parse_args(&argc, &argv, "--aaa", NULL));
ok1(strstr(err_output, ": --aaa: requires an argument"));
free(err_output);
err_output = NULL;
ok1(!parse_args(&argc, &argv, "-a", NULL));
ok1(strstr(err_output, ": -a: requires an argument"));
free(err_output);
err_output = NULL;
/* Multiple */
opt_register_arg("--bbb|-b|-c|--ccc", test_arg, NULL, "aaa", "");
ok1(!parse_args(&argc, &argv, "--bbb", NULL));
ok1(strstr(err_output, ": --bbb: requires an argument"));
free(err_output);
err_output = NULL;
ok1(!parse_args(&argc, &argv, "-b", NULL));
ok1(strstr(err_output, ": -b: requires an argument"));
free(err_output);
err_output = NULL;
ok1(!parse_args(&argc, &argv, "-c", NULL));
ok1(strstr(err_output, ": -c: requires an argument"));
free(err_output);
err_output = NULL;
ok1(!parse_args(&argc, &argv, "--ccc", NULL));
ok1(strstr(err_output, ": --ccc: requires an argument"));
free(err_output);
err_output = NULL;
/* parse_args allocates argv */
free(argv);
return exit_status();
}
开发者ID:preigoto,项目名称:nsgminer,代码行数:38,代码来源:run-correct-reporting.c
示例17: main
int main(int argc, char *argv[])
{
const char *myname = argv[0];
plan_tests(7);
/* Simple short arg.*/
ok1(!parse_args(&argc, &argv, "-a", NULL));
/* Simple long arg.*/
ok1(!parse_args(&argc, &argv, "--aaa", NULL));
/* Extra arguments preserved. */
ok1(parse_args(&argc, &argv, "extra", "args", NULL));
ok1(argc == 3);
ok1(argv[0] == myname);
ok1(strcmp(argv[1], "extra") == 0);
ok1(strcmp(argv[2], "args") == 0);
/* parse_args allocates argv */
free(argv);
return exit_status();
}
开发者ID:Krellan,项目名称:bfgminer,代码行数:23,代码来源:run-no-options.c
示例18: main
int main(int _argc,const char *_argv[]){
isaac64_ctx isaac64;
int i;
int j;
/*This is how many tests you plan to run.*/
plan_tests(2);
isaac64_init(&isaac64,NULL,0);
for(j=0;j<ISAAC64_SZ;j++)isaac64_next_uint64(&isaac64);
for(i=0;i<2;i++){
int nmatches;
nmatches=0;
for(j=0;j<ISAAC64_SZ;j++){
nmatches+=isaac64_next_uint64(&isaac64)==STATEVEC64[(i+1)*ISAAC64_SZ-j-1];
}
ok1(nmatches==ISAAC64_SZ);
}
/*TODO: We should test the random float/double routines, but they are not
guaranteed to return the same values on all platforms, because the number
of bits in the mantissa may be different.
Perhaps some simple statistical tests would suffice.*/
return exit_status();
}
开发者ID:HSchroeder,项目名称:ccan,代码行数:23,代码来源:run64.c
示例19: main
int main(void)
{
char *parent, *c;
int i;
plan_tests(1 + 3 * 100 + 98);
parent = tal(NULL, char);
ok1(parent);
for (i = 0; i < 100; i++) {
c = tal_arr(parent, char, 1);
ok1(tal_resizez(&c, i));
ok1(tal_count(c) == i);
ok1(tal_parent(c) == parent);
if (i > 1)
ok1(c[i-1] == '\0');
}
tal_free(parent);
tal_cleanup();
return exit_status();
}
开发者ID:Astn,项目名称:Generate-Tags,代码行数:23,代码来源:run-resizez.c
示例20: main
int
main(int argc, char** argv)
{
const char hc_path[] = "tmp/terrain";
TCHAR jp2_path[4096];
_tcscpy(jp2_path, PathName(hc_path));
_tcscat(jp2_path, _T(DIR_SEPARATOR_S) _T("terrain.jp2"));
TCHAR j2w_path[4096];
_tcscpy(j2w_path, PathName(hc_path));
_tcscat(j2w_path, _T(DIR_SEPARATOR_S) _T("terrain.j2w"));
NullOperationEnvironment operation;
RasterMap map(jp2_path, j2w_path, NULL, operation);
do {
map.SetViewCenter(map.GetMapCenter(), fixed(100000));
} while (map.IsDirty());
plan_tests(4 + NUM_SOL);
ok(test_route(28, map), "route 28", 0);
return exit_status();
}
开发者ID:steffenpassmann,项目名称:XCSoar,代码行数:23,代码来源:test_route.cpp
注:本文中的plan_tests函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论