int main () { testc (0, 0); testc (1, 1); testc (SCHAR_MAX, 1); testc (SCHAR_MAX+1, 0); testc (UCHAR_MAX, 0); tests (0, 0); tests (1, 1); tests (SHRT_MAX, 1); tests (SHRT_MAX+1, 0); tests (USHRT_MAX, 0); testi (0, 0); testi (1, 1); testi (INT_MAX, 1); testi (INT_MAX+1U, 0); testi (UINT_MAX, 0); testl (0, 0); testl (1, 1); testl (LONG_MAX, 1); testl (LONG_MAX+1UL, 0); testl (ULONG_MAX, 0); return 0; }
int si_40_seckey_custom(int argc, char *const *argv) { plan_tests(20 * 4); tests(&kCustomKeyDescriptor_version0); tests(&kCustomKeyDescriptor_version1); tests(&kCustomKeyDescriptor_version2); tests(&kCustomKeyDescriptor_version3); return 0; }
void ps::testAll(){ std::cout << "Normal Distribution w/ Mean of 6000, Standard Deviation of 1000" << std::endl; tests(testcycles1); std::cout << "------------------------\n" << std::endl; std::cout << "Normal Distribution w/ Mean of 6000, Standard Deviation of 4000" << std::endl; tests(testcycles2); std::cout << "------------------------\n" << std::endl; std::cout << "Normal Distribution w/ Mean of 3000, Standard Deviation of 6000" << std::endl; tests(testcycles3); std::cout << "------------------------\n" << std::endl; std::cout << "All Values 3000 cycles" << std::endl; tests(testcycles4); }
int run_tests() { int failures = 0; for (test_vector::const_iterator i = tests().begin(); i != tests().end(); ++i) { try { std::cout << "Running " << i->first << "..." << std::endl; i->second(); } catch (const assertion_failure& failure) { std::cout << failure.what() << std::endl; ++failures; } } return failures; }
int tc_libcxx_containers_forwardlist_ops_splice_after_range(void) { { // splicing different containers typedef std::forward_list<T> C; for (int f = 0; f <= size_t2+1; ++f) { for (int l = f; l <= size_t2+1; ++l) { for (int p = 0; p <= size_t1; ++p) { C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); c1.splice_after(next(c1.cbefore_begin(), p), std::move(c2), next(c2.cbefore_begin(), f), next(c2.cbefore_begin(), l)); testd(c1, p, f, l); } } } // splicing within same container for (int f = 0; f <= size_t1+1; ++f) { for (int l = f; l <= size_t1; ++l) { for (int p = 0; p <= f; ++p) { C c1(std::begin(t1), std::end(t1)); c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1), next(c1.cbefore_begin(), f), next(c1.cbefore_begin(), l)); tests(c1, p, f, l); } for (int p = l; p <= size_t1; ++p) { C c1(std::begin(t1), std::end(t1)); c1.splice_after(next(c1.cbefore_begin(), p), std::move(c1), next(c1.cbefore_begin(), f), next(c1.cbefore_begin(), l)); tests(c1, p, f, l); } } } } TC_SUCCESS_RESULT(); return 0; }
int main(){ solutions s; tests(); printf("-- dancing links simple samples ; see code for details. -- \n\n"); printf("test case 1 - all solutions \n"); print_data((int*)data1, n_rows, n_cols); s = dancing_links(n_rows, n_cols, (int*)data1, 0); print_solutions(s); free_solutions(s); printf("\n"); printf("test case 2 - 1st solution \n"); print_data(data2, 4, 3); s = dancing_links(4, 3, data2, 1); print_solutions(s); free_solutions(s); printf("\n"); printf("test case 2 - up to 3 solutions \n"); s = dancing_links(4, 3, data2, 3); print_solutions(s); free_solutions(s); printf("\n"); printf("memory check:\n"); printf(" malloc() + calloc() - free() = %i \n\n", get_allocation_count()); return 0; }
int si_73_secpasswordgenerate(int argc, char *const *argv) { plan_tests(298); tests(); return 0; }
int main() { tests(); Array1 a1; Array2 a2; a1.add(4); a1.add(3); a1.sort(); a2.add(new MyClass(8)); a2.add(new MyClass(7)); a2.sort(); std::cout << "a1:" << std::endl; for (int i = 0; i < a1.length(); i++) { std::cout << i << ": " << a1[i] << std::endl; } std::cout << "a2:" << std::endl; for (int i = 0; i < a2.length(); i++) { std::cout << i << ": " << a2[i]->getValue() << std::endl; } return 0; }
// Main program int main(void) { char i; char *heap_end; // Initialize all modules uart_init(115200); accel_init(); touch_init((1 << 9) | (1 << 10)); // Channels 9 and 10 // usb_init(); setvbuf(stdin, NULL, _IONBF, 0); // No buffering // Run tests tests(); delay(500); RGB_LED(0,100,0); // Green // Welcome banner iprintf("\r\n\r\n====== Freescale Freedom FRDM-LK25Z\r\n"); iprintf("Built: %s %s\r\n\r\n", __DATE__, __TIME__); heap_end = _sbrk(0); iprintf("Heap: %p to %p (%d bytes used)\r\n", __heap_start, heap_end, heap_end - __heap_start); iprintf("Stack: %p to %p (%d bytes used)\r\n", &i, __StackTop, __StackTop - &i); iprintf("%d bytes free\r\n", &i - heap_end); for(;;) { iprintf("monitor> "); getchar(); iprintf("\r\n"); iprintf("Inputs: x=%5d y=%5d z=%5d ", accel_x(), accel_y(), accel_z()); iprintf("touch=(%d,%d)\r\n", touch_data(9), touch_data(10)); // usb_dump(); } }
int main(int argc, char *argv[]) { int c; while( (c = getopt(argc, argv, "hftv|help")) != -1) { switch(c) { case 'h': print_usage(argc, argv); exit(0); break; case 'f': daemonize = 0; break; case 't': tests(); exit(0); break; case 'v': verbose = 1; break; default: print_usage(argc, argv); exit(0); break; } } // pointer to mbpfan() function in mbpfan.c void (*fan_control)() = mbpfan; go_daemon(fan_control); exit(0); }
int main(int argc, char ** argv){ loadData(data,true); loadTestData(); loadUserItemData(users, items, data); for(int i = 0; i < data.size(); ++i) nu[data[i].user]++; #define K 7 vector< vector< map<int,float> > > tests(K); vector< float > weight(K); int k = 0; loadResults("../ret2/results-knni-iuf.txt.0", tests[k]); weight[k] = 1; ++k; loadResults("../ret2/results-knnu-iif.txt.0", tests[k]); weight[k] = 1; ++k; loadResults("../ret2/results-knnui.txt.0", tests[k]); weight[k] = 1; ++k; loadResults("../ret2/results-language.txt.0", tests[k]); weight[k] = 0.4; ++k; loadResults("../ret2/results-repos.txt.0", tests[k]); weight[k] = 0.4; ++k; loadResults("../ret2/results-reponame.txt.0", tests[k]); weight[k] = 0.2; ++k; loadResults("../ret2/results-pop-nic.txt.0", tests[k]); weight[k] = 0.01; ++k; srand(time(0)); int j = 0; for(int step = 0; step < 20; ++step){ int i = j % K; ++j; float w0 = weight[i]; int r0 = bag(tests, weight); weight[i] *= (1 + 0.5 * (rand01() - 0.5)); int r1 = bag(tests, weight); if(r1 <= r0) weight[i] = w0; cout << step << "\t" << r0 << "\t" << r1 << endl; } for(int i = 0; i < weight.size(); ++i) cout << i << "\t" << weight[i] << endl; return 0; }
int main(int argc, char *argv[]) { int argn; bool debug = false; bool verbose = false; bool help = false; bool keep = false; khGetopt options; options.flagOpt("debug", debug); options.flagOpt("verbose", verbose); options.flagOpt("keep_output", keep); options.flagOpt("help", help); options.flagOpt("?", help); if (!options.processAll(argc, argv, argn) || help || argn < argc) { std::cerr << "usage: " << std::string(argv[0]) << " [-debug] [-verbose] [-keep_output] [-help]" << std::endl; exit(1); } if (verbose) { setNotifyLevel(NFY_VERBOSE); } else if (debug) { setNotifyLevel(NFY_DEBUG); } CachedReadAccessorUnitTest tests(keep); int status = tests.Run(); return status; }
/***********************************************************************//** * @brief Print test suites information * * @param[in] chatter Chattiness (defaults to NORMAL). * @return String containing test suites information. ***************************************************************************/ std::string GTestSuites::print(const GChatter& chatter) const { // Initialise result string std::string result; // Continue only if chatter is not silent if (chatter != SILENT) { // Append header result.append("=== GTestSuites ==="); // Append information result.append("\n"+gammalib::parformat("Name")+m_name); result.append("\n"+gammalib::parformat("Number of test suites")); result.append(gammalib::str(size())); result.append("\n"+gammalib::parformat("Number of tests")); result.append(gammalib::str(tests())); result.append("\n"+gammalib::parformat("Number of errors")); result.append(gammalib::str(errors())); result.append("\n"+gammalib::parformat("Number of failures")); result.append(gammalib::str(failures())); // Append test suites for (int i = 0; i < size(); ++i) { result.append("\n"); result.append((*this)[i]->print(chatter)); } } // endif: chatter was not silent // Return result return result; }
void UniquePtrArrayTest() { // posiible, but generates runtime error // std::unique_ptr<int> p(new int[10]); // only delete will be called std::unique_ptr<Test[]> tests(new Test[3]); }
int si_31_keychain_unreadable(int argc, char *const *argv) { plan_tests(8); tests(); return 0; }
int si_24_sectrust_nist(int argc, char *const *argv) { plan_tests(179); tests(); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); usesp = 0; tests (); #ifndef CHECK_EXTERNAL /* no need to check twice */ usesp = 1; tests (); #endif test_generic (2, 1000, 100); tests_end_mpfr (); return 0; }
int secd_70_otr_remote(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int sc_20_keynames(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int si_41_sececkey(int argc, char *const *argv) { plan_tests(164); tests(); return 0; }
int so_01_serverencryption(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int pbkdf2_00_hmac_sha1(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int otr_00_identity(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int sc_40_circle(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int ssl_47_falsestart(int argc, char *const *argv) { plan_tests(NSERVERS*NLOOPS*2); tests(); return 0; }
int sc_90_ckdclient(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int vmdh_42_example2(int argc, char *const *argv) { plan_tests(5); tests(); return 0; }
int secd_56_account_apply(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int otr_30_negotiation(int argc, char *const *argv) { plan_tests(kTestTestCount); tests(); return 0; }
int si_23_sectrust_ocsp_wwdr(int argc, char *const *argv) { plan_tests(7); tests(); return 0; }