int main(int argc, char **argv) { //create some elements to test against std::vector<std::pair<std::string, int> > elements; for (size_t i = 0; i < TEST_SIZE; ++i) { //random string char k[STRING_SIZE]; for (size_t j = 0; j < STRING_SIZE - 1; ++j) { k[j] = (char)(96 + rand()%25); } k[STRING_SIZE - 1] = 0; elements.push_back(std::make_pair<std::string, int>(k, i + 1)); } //do tests BiasedSkiplist<std::string, int> *sl = new BiasedSkiplist<std::string, int>(20); //insert into the hash table for (size_t i = 0; i < TEST_SIZE; ++i) { sl->insert(elements[i].first, elements[i].second, rand()%10); } runtests(sl, elements); delete sl; return 0; }
int main(int argc, char **argv) { int result; char testdir[MAXPATHLEN]; char ironout[MAXPATHLEN]; char origin[MAXPATHLEN]; if (argc < 2) { printf("Usage: %s testdir\n", argv[0]); return 1; } mktempdir(TEMPDIR); getcwd(origin, MAXPATHLEN); abspath(testdir, argv[1]); abspath(ironout, "ironout"); chdir(TEMPDIR); result = runtests(testdir, ironout); chdir(origin); rmtempdir(TEMPDIR, 1); return result; }
int main(int argc, char **argv) { struct alg *alg = NULL; int count = 1; int sizes[128], nsizes = 0; u_long cmd = CIOCGSESSION2; int testall = 0; int maxthreads = 1; int profile = 0; int i, ch; while ((ch = getopt(argc, argv, "cpzsva:bd:t:")) != -1) { switch (ch) { #ifdef CIOCGSSESSION case 's': cmd = CIOCGSSESSION; break; #endif case 'v': verbose++; break; case 'a': alg = getalgbyname(optarg); if (alg == NULL) { if (streq(optarg, "rijndael")) alg = getalgbyname("aes"); else usage(argv[0]); } break; case 'd': crid = crlookup(optarg); break; case 't': maxthreads = atoi(optarg); break; case 'z': testall = 1; break; case 'p': profile = 1; break; case 'b': opflags |= COP_F_BATCH; break; case 'c': verify = 1; break; default: usage(argv[0]); } } argc -= optind, argv += optind; if (argc > 0) count = atoi(argv[0]); while (argc > 1) { int s = atoi(argv[1]); if (nsizes < N(sizes)) { sizes[nsizes++] = s; } else { printf("Too many sizes, ignoring %u\n", s); } argc--, argv++; } if (nsizes == 0) { if (alg) sizes[nsizes++] = alg->blocksize; else sizes[nsizes++] = 8; if (testall) { while (sizes[nsizes-1] < 8*1024) { sizes[nsizes] = sizes[nsizes-1]<<1; nsizes++; } } } if (testall) { for (i = 0; i < N(algorithms); i++) { int j; alg = &algorithms[i]; for (j = 0; j < nsizes; j++) runtests(alg, count, sizes[j], cmd, maxthreads, profile); } } else { if (alg == NULL) alg = getalgbycode(CRYPTO_3DES_CBC); for (i = 0; i < nsizes; i++) runtests(alg, count, sizes[i], cmd, maxthreads, profile); } return (0); }
int main(int argc, char **argv) { struct alg *alg = NULL; int count = 1; int sizes[128], nsizes = 0; u_long cmd = CIOCGSESSION2; int testall = 0; int maxthreads = 1; int profile = 0; int i, ch; srandom(time(0)); while ((ch = getopt(argc, argv, "cpzsva:bd:t:S:VKD")) != -1) { switch (ch) { case 'V': swap_iv = 1; break; case 'K': swap_key = 1; break; case 'D': swap_data = 1; break; #ifdef CIOCGSSESSION case 's': cmd = CIOCGSSESSION; break; #endif case 'v': verbose++; break; case 'a': alg = getalgbyname(optarg); if (alg == NULL) { if (streq(optarg, "rijndael")) alg = getalgbyname("aes"); else usage(argv[0]); } break; case 'S': srandom(atoi(optarg)); break; case 'd': crid = crlookup(optarg); break; case 't': maxthreads = atoi(optarg); break; case 'z': testall = 1; break; case 'p': profile = 1; break; case 'b': opflags |= COP_F_BATCH; break; case 'c': verify = 1; break; default: usage(argv[0]); } } argc -= optind, argv += optind; if (argc > 0) count = atoi(argv[0]); while (argc > 1) { int s = atoi(argv[1]); if (nsizes < N(sizes)) { sizes[nsizes++] = s; } else { printf("Too many sizes, ignoring %u\n", s); } argc--, argv++; } if (nsizes == 0) { if (alg) sizes[nsizes++] = alg->blocksize; else sizes[nsizes++] = 8; if (testall) { /* * OCF is limited to CRYPTO_MAX_DATA_LEN, so make it 256 bytes less * for safety sakes. */ while (sizes[nsizes-1] < (CRYPTO_MAX_DATA_LEN - 256)) { sizes[nsizes] = sizes[nsizes-1]<<1; if (sizes[nsizes] > CRYPTO_MAX_DATA_LEN) sizes[nsizes] -= 256; nsizes++; } } } if (testall) { for (i = 0; i < N(algorithms); i++) { int j; alg = &algorithms[i]; for (j = 0; j < nsizes; j++) runtests(alg, count, sizes[j], cmd, maxthreads, profile); } } else { if (alg == NULL) alg = getalgbycode(CRYPTO_3DES_CBC); for (i = 0; i < nsizes; i++) runtests(alg, count, sizes[i], cmd, maxthreads, profile); } return (0); }
int main (int argc, char** argv) { char* servername = NULL; char* filename = NULL; GSList* task_list = NULL; int option; int num_ites; int i; extern char *optarg; /*default number of phase is 1*/ num_ites = 1; while ((option = getopt(argc, argv, "N:h")) != -1){ switch(option){ case 'N': if (sscanf(optarg, "%d", &num_ites) <= 0) { usage(argv[0]); exit(1); } break; case 'h': default: usage(argv[0]); exit(1); } } gi.clientID = 0; for (i = optind ; i < argc; i++) { if (filename == NULL){ filename = argv[i]; } else { servername = argv[i]; gi.clientID = 1; } } if (filename == NULL){ usage(argv[0]); exit(1); } gi.testpass = 0; gi.testwarn = 0; gi.testfail = 0; strlcpy(gi.filename, filename, sizeof(gi.filename)); init_comm(servername); for (i = 0; i < num_ites; i++){ output("Iteration %d: \n", i); task_list = generate_task_list(); runtests(task_list); remove_task_list(task_list); } test_exit(); return 0; }