int main() { pj_caching_pool cp; pj_status_t status; // Must init PJLIB before anything else status = pj_init(); if (status != PJ_SUCCESS) { my_perror("Error initializing PJLIB", status); return 1; } // Create the pool factory, in this case, a caching pool, // using default pool policy. pj_caching_pool_init(&cp, NULL, 1024*1024 ); pj_pool_t *pool = pj_pool_create(&cp.factory, "pool1", 4000, 4000, NULL); pj_str_t test1_str = test1(); PRINT_PSTR_DETAILS(&test1_str); pj_str_t test2_str = test2(); PRINT_PSTR_DETAILS(&test2_str); pj_str_t test3_str = test3(); PRINT_PSTR_DETAILS(&test3_str); PRINT_PSTR_DETAILS(test4()); PRINT_PSTR_DETAILS(test5()); PRINT_PSTR_DETAILS(test6(pool)); pj_str_t test7_str = test7(); PRINT_PSTR_DETAILS(&test7_str); pj_str_t test8_str = test8(pool); PRINT_PSTR_DETAILS(&test8_str); pj_pool_release(pool); // Done with demos, destroy caching pool before exiting app. pj_caching_pool_destroy(&cp); return 0; }
int main(int argc, char* argv[]) { mpi::environment env(argc, argv); mpi::communicator world; if (world.rank() < 0){ int i = 0; char hostname[256]; gethostname(hostname, sizeof(hostname)); printf("PID %d on %s ready for attach\n", getpid(), hostname); fflush(stdout); while (0 == i) sleep(5); } if(world.rank()>0){ Worker w(world); }else{ cout << "Starting" << endl; test7(world); } }
int main(int argc, char **argv) { #if HAVE_SETLOCALE setlocale(LC_ALL, "C"); #endif test1(); test2(); test3(); test4(); test5(); test6(); test7(); test8(); test9(); test10(); return (0); }
int main () { int ret = 0; printf ("Direct case testing of CPP core functions\n"); ret += test0 (); ret += test1 (); ret += test2 (); ret += test3 (); ret += test4 (); ret += test5 (); ret += test6 (); ret += test7 (); ret += test8 (); ret += test9 (); ret += test10 (); ret += test11 (); ret += test12 (); ret += test13 (); ret += test14 (); ret += test15 (); ret += test16 (); ret += test17 (); ret += test18 (); ret += test19 (); ret += test20 (); ret += test21 (); ret += test22 (); ret += test23 (); ret += test24 (); ret += test25 (); ret += test26 (); ret += test27 (); ret += test28 (); ret += test29 (); ret += test30 (); ret += test31 (); printf ("# test failures: %d\n", ret); return 0; }
int main(void) { char * stars = "*****************************************************\n"; printf("%s*\n* Singly Linked Lists\n*\n%s", stars, stars); test1(); test2(); test3(); test4(); test5(); test6(); printf("%s*\n* Doubly Linked Lists\n*\n%s", stars, stars); test7(); test8(); test9(); printf("%s*\n* Circular Linked Lists\n*\n%s", stars, stars); test10(); test11(); test12(); }
int main () { gint nfailed = 0; nfailed += test1 (); nfailed += test3 (); nfailed += test4 (); nfailed += test5 (); nfailed += test6 (); nfailed += test7 (); nfailed += test8 (); nfailed += test9 (); nfailed += test10 (); nfailed += test11 (); nfailed += test12 (); nfailed += test13 (); g_print ("Test %s\n", nfailed > 0 ? "Failed" : "Ok"); return nfailed > 0 ? 1 : 0; }
int main() { unsigned int tests=0, succ=0; TEST(test1()); TEST(test2()); TEST(test3()); TEST(test4()); TEST(test5()); TEST(test6()); TEST(test7()); TEST(test8()); #ifndef NDEBUG printf("%s: Passed %u of %u tests\n", tests-succ==0?"SUCCESS":"FAILED",succ,tests); #endif return tests-succ; }
int main(int argc, char ** argv) { char * test; if (argc <2) { printf("Usage: test_resizable_table test1|test2|...test7\n"); exit(1); } test = argv[1]; printf("Running %s\n", test); if (strcmp(test, "test1")==0) { test1(); } else if (strcmp(test, "test2")==0) { test2(); } else if (strcmp(test, "test3")==0) { test3(); } else if (strcmp(test, "test4")==0) { test4(); } else if (strcmp(test, "test5")==0) { test5(); } else if (strcmp(test, "test6")==0) { test6(); } else if (strcmp(test, "test7")==0) { test7(); } else { printf("Test not found!!n"); exit(1); } return 0; }
int main (int argc, char** argv) { if (argc < 2) { printf ("%s\n", USAGE); exit (EXIT_FAILURE); } switch (strtol (argv[1],0,10)) { case 1: test1 (); break; case 2: test2 (); break; case 3: test3 (); break; case 4: test4 (); break; case 5: test5 (); break; case 6: test6 (); break; case 7: if (argc != 3) { printf ("%s numPushes\n", USAGE); exit (EXIT_FAILURE); } test7 (strtol (argv[2] ,0, 10)); break; case 8: test8(); break; default: printf ("%s\n", USAGE); exit (EXIT_FAILURE); } }
int main(int argc, char *argv[]) { int x[] = { 1, 2, 3 }; int len = sizeof(x) / sizeof(int); printf("%d\n", sizeof(x)); test(x); test2(x); test3(len, x); test4(len, x); test5(len, &x); int y[][2] = { {10, 11}, {20, 21}, {30, 31} }; int a = sizeof(y) / (sizeof(int) * 2); int b = 2; test6(a, b, y); test7(a, b, y); test8(a, b, &y); char* s[] = {"aaa", "bbb", "ccc"}; test9(sizeof(s) / sizeof(char*), s); test10(sizeof(s) / sizeof(char*), s); int* xx[] = { &(int){111}, &(int){222}, &(int){333}, NULL };
GLDEF_C TInt E32Main() { test.Title(); test.Start(_L("Test ftol")); TReal f=34.567; TInt i=TInt(f); test(i==34); test.Next(_L("Test TBuf8/16::Num() using selected numbers")); test1(); test.Next(_L("Test specific numbers for Math::Round(_,_,_)")); test2(); test.Next(_L("Test TBuf8/16::Num() using selected numbers in calculator mode")); test3(); test.Next(_L("Test errors")); test4(); test.Next(_L("Test TLex8/16::Val using selected values which give exact results")); test5(); test.Next(_L("Test TLex8/16::Val using values which do NOT give exact results")); test6(); test.Next(_L("Test errors")); test7(); test.Next(_L("Test for CALC")); test8(); // test.Next(_L("Ascii/Unicode: TText")); AsciiUnicode<TReal64,TText,TLex,TBuf<0x20>,TPtr> T1; T1.Test1(); test.Next(_L("Ascii/Unicode: TText8")); AsciiUnicode<TReal32,TText8,TLex8,TBuf8<0x20>,TPtr8> T2; T2.Test1(); test.Next(_L("Ascii/Unicode: TText16")); AsciiUnicode<TReal32,TText16,TLex16,TBuf16<0x20>,TPtr16> T3; T3.Test1(); // test.End(); return(KErrNone); }
int main(int argc, char * const *argv) { int guid_alt = argc > 1 && !strcmp(argv[1], "-g"); /* {2cb56191-ee6f-432d-a377-853d3c6b949e} */ CSSM_GUID s3dl_guid = { 0x2cb56191, 0xee6f, 0x432d, { 0xa3, 0x77, 0x85, 0x3d, 0x3c, 0x6b, 0x94, 0x9e } }; const CSSM_GUID *guid = guid_alt ? & s3dl_guid : &gGuidAppleFileDL; CSSM_DL_HANDLE dl; /* Total number of test cases in this file. */ plan_tests(45); ok(cssm_attach(guid, &dl), "cssm_attach"); ok(tests_begin(argc, argv), "setup"); /* Run tests. */ ok(test1(dl), "create close delete"); ok(test2(dl), "create delete close"); ok(test3(dl), "autocommit off create close delete"); ok(test4(dl), "autocommit off create delete close"); ok(test5(dl), "autocommit off create rollback close delete"); ok(test6(dl), "autocommit off create rollback delete close"); ok(test7(dl), "autocommit off create delete rollback close"); ok(test8(dl), "delete non existant db"); ok(cssm_detach(guid, dl), "cssm_detach"); ok(tests_end(1), "cleanup"); TODO: { ok_leaks("leaks"); } return 0; }
int __cdecl main(int argc, char *argv[]) { WCHAR szwInsert[] = {'I','N','S','E','R','T','\0'}; WCHAR szwFoo[] = {'f','o','o','\0'}; WCHAR szwBar[] = {'b','a','r','\0'}; /* * Initialize the PAL and return FAILURE if this fails */ if(0 != (PAL_Initialize(argc, argv))) { return FAIL; } if(test1(0,szwInsert) || /* Test %s */ test2(0,40) || /* Test %i */ test3(0,'a') || /* Test %c */ test4(0,'a') || /* Test %C */ test5(0,57) || /* Test %d */ test6(0,'a','b') || /* Test %hc, %hC */ test7(0,90,"foo","bar") || /* Test %hd,hs,hS */ test8(0,'a','b',50,100) || /* Test %lc, lC, ld, li */ test9(0,szwFoo,szwBar,56) || /* Test %ls,lS,lu */ test10(0,0x123ab,0x123cd) || /* Test %lx, %lX */ test11(0,(void *)0x123ab,"foo") || /* Test %p, %S */ test12(0,100,0x123ab,0x123cd)) /* Test %u,x,X */ { } PAL_Terminate(); return PASS; }
int main () { int ret = 0; printf ("Direct case testing of bstraux functions\n"); ret += test0 (); ret += test1 (); ret += test2 (); ret += test3 (); ret += test4 (); ret += test5 (); ret += test6 (); ret += test7 (); ret += test8 (); ret += test9 (); ret += test10 (); ret += test11 (); ret += test12 (); ret += test13 (); printf ("# test failures: %d\n", ret); return 0; }
NOMIPS16 int main () { int little_endian; v2sf a, b, c, d; int i, j, k, l; union { long long ll; int i[2]; } endianness_test; endianness_test.ll = 1; little_endian = endianness_test.i[0]; /* cabs.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {-56, -78}; i = 0; j = 0; k = 0; l = 0; if (__builtin_mips_any_cabs_eq_ps(a, b) != i) abort (); if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) abort (); if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) abort (); if (__builtin_mips_all_cabs_eq_ps(a, b) != l) abort (); /* cabs.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {-12, -78}; i = 1; if (little_endian) { j = 0; k = 1; } else { j = 1; k = 0; } l = 0; if (__builtin_mips_any_cabs_eq_ps(a, b) != i) abort (); if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) abort (); if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) abort (); if (__builtin_mips_all_cabs_eq_ps(a, b) != l) abort (); /* cabs.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {-56, -34}; i = 1; if (little_endian) { j = 1; k = 0; } else { j = 0; k = 1; } l = 0; if (__builtin_mips_any_cabs_eq_ps(a, b) != i) abort (); if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) abort (); if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) abort (); if (__builtin_mips_all_cabs_eq_ps(a, b) != l) abort (); /* cabs.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {-12, -34}; i = 1; j = 1; k = 1; l = 1; if (__builtin_mips_any_cabs_eq_ps(a, b) != i) abort (); if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) abort (); if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) abort (); if (__builtin_mips_all_cabs_eq_ps(a, b) != l) abort (); /* Test all comparisons */ if (little_endian) { a = (v2sf) {1984.0, 10.58}; b = (v2sf) {-1984.0, -567.345}; } else { a = (v2sf) {10.58, 1984.0}; b = (v2sf) {-567.345, -1984.0}; } i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 0) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 0) abort (); i = test6 (a, b); if (i != 0) abort (); i = test7 (a, b); if (i != 0) abort (); i = test8 (a, b); if (i != 1) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 1) abort (); i = test11 (a, b); if (i != 0) abort (); i = test12 (a, b); if (i != 1) abort (); i = test13 (a, b); if (i != 0) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 0) abort (); i = test16 (a, b); if (i != 1) abort (); i = test17 (a, b); if (i != 1) abort (); i = test18 (a, b); if (i != 0) abort (); i = test19 (a, b); if (i != 0) abort (); i = test20 (a, b); if (i != 1) abort (); i = test21 (a, b); if (i != 1) abort (); i = test22 (a, b); if (i != 0) abort (); i = test23 (a, b); if (i != 0) abort (); i = test24 (a, b); if (i != 1) abort (); i = test25 (a, b); if (i != 1) abort (); i = test26 (a, b); if (i != 1) abort (); i = test27 (a, b); if (i != 1) abort (); i = test28 (a, b); if (i != 1) abort (); i = test29 (a, b); if (i != 1) abort (); i = test30 (a, b); if (i != 1) abort (); i = test31 (a, b); if (i != 1) abort (); i = test32 (a, b); if (i != 0) abort (); i = test33 (a, b); if (i != 0) abort (); i = test34 (a, b); if (i != 0) abort (); i = test35 (a, b); if (i != 0) abort (); i = test36 (a, b); if (i != 0) abort (); i = test37 (a, b); if (i != 0) abort (); i = test38 (a, b); if (i != 0) abort (); i = test39 (a, b); if (i != 0) abort (); i = test40 (a, b); if (i != 1) abort (); i = test41 (a, b); if (i != 0) abort (); i = test42 (a, b); if (i != 1) abort (); i = test43 (a, b); if (i != 0) abort (); i = test44 (a, b); if (i != 1) abort (); i = test45 (a, b); if (i != 0) abort (); i = test46 (a, b); if (i != 1) abort (); i = test47 (a, b); if (i != 0) abort (); i = test48 (a, b); if (i != 1) abort (); i = test49 (a, b); if (i != 1) abort (); i = test50 (a, b); if (i != 0) abort (); i = test51 (a, b); if (i != 0) abort (); i = test52 (a, b); if (i != 1) abort (); i = test53 (a, b); if (i != 1) abort (); i = test54 (a, b); if (i != 0) abort (); i = test55 (a, b); if (i != 0) abort (); i = test56 (a, b); if (i != 1) abort (); i = test57 (a, b); if (i != 1) abort (); i = test58 (a, b); if (i != 1) abort (); i = test59 (a, b); if (i != 1) abort (); i = test60 (a, b); if (i != 1) abort (); i = test61 (a, b); if (i != 1) abort (); i = test62 (a, b); if (i != 1) abort (); i = test63 (a, b); if (i != 1) abort (); /* Reverse arguments */ i = test0 (b, a); if (i != 0) abort (); i = test1 (b, a); if (i != 0) abort (); i = test2 (b, a); if (i != 0) abort (); i = test3 (b, a); if (i != 0) abort (); i = test4 (b, a); if (i != 0) abort (); i = test5 (b, a); if (i != 0) abort (); i = test6 (b, a); if (i != 0) abort (); i = test7 (b, a); if (i != 0) abort (); i = test8 (b, a); if (i != 1) abort (); i = test9 (b, a); if (i != 0) abort (); i = test10 (b, a); if (i != 1) abort (); i = test11 (b, a); if (i != 0) abort (); i = test12 (b, a); if (i != 1) abort (); i = test13 (b, a); if (i != 0) abort (); i = test14 (b, a); if (i != 1) abort (); i = test15 (b, a); if (i != 0) abort (); i = test16 (b, a); if (i != 0) abort (); i = test17 (b, a); if (i != 0) abort (); i = test18 (b, a); if (i != 0) abort (); i = test19 (b, a); if (i != 0) abort (); i = test20 (b, a); if (i != 0) abort (); i = test21 (b, a); if (i != 0) abort (); i = test22 (b, a); if (i != 0) abort (); i = test23 (b, a); if (i != 0) abort (); i = test24 (b, a); if (i != 1) abort (); i = test25 (b, a); if (i != 0) abort (); i = test26 (b, a); if (i != 1) abort (); i = test27 (b, a); if (i != 0) abort (); i = test28 (b, a); if (i != 1) abort (); i = test29 (b, a); if (i != 0) abort (); i = test30 (b, a); if (i != 1) abort (); i = test31 (b, a); if (i != 0) abort (); i = test32 (b, a); if (i != 0) abort (); i = test33 (b, a); if (i != 0) abort (); i = test34 (b, a); if (i != 0) abort (); i = test35 (b, a); if (i != 0) abort (); i = test36 (b, a); if (i != 0) abort (); i = test37 (b, a); if (i != 0) abort (); i = test38 (b, a); if (i != 0) abort (); i = test39 (b, a); if (i != 0) abort (); i = test40 (b, a); if (i != 1) abort (); i = test41 (b, a); if (i != 0) abort (); i = test42 (b, a); if (i != 1) abort (); i = test43 (b, a); if (i != 0) abort (); i = test44 (b, a); if (i != 1) abort (); i = test45 (b, a); if (i != 0) abort (); i = test46 (b, a); if (i != 1) abort (); i = test47 (b, a); if (i != 0) abort (); i = test48 (b, a); if (i != 0) abort (); i = test49 (b, a); if (i != 0) abort (); i = test50 (b, a); if (i != 0) abort (); i = test51 (b, a); if (i != 0) abort (); i = test52 (b, a); if (i != 0) abort (); i = test53 (b, a); if (i != 0) abort (); i = test54 (b, a); if (i != 0) abort (); i = test55 (b, a); if (i != 0) abort (); i = test56 (b, a); if (i != 1) abort (); i = test57 (b, a); if (i != 0) abort (); i = test58 (b, a); if (i != 1) abort (); i = test59 (b, a); if (i != 0) abort (); i = test60 (b, a); if (i != 1) abort (); i = test61 (b, a); if (i != 0) abort (); i = test62 (b, a); if (i != 1) abort (); i = test63 (b, a); if (i != 0) abort (); #ifndef __FAST_MATH__ /* Test all comparisons */ if (little_endian) { a = (v2sf) {qnan, qnan}; b = (v2sf) {-1984.0, -567.345}; } else { a = (v2sf) {qnan, qnan}; b = (v2sf) {-567.345, -1984.0}; } i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 0) abort (); i = test4 (a, b); if (i != 1) abort (); i = test5 (a, b); if (i != 1) abort (); i = test6 (a, b); if (i != 1) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 0) abort (); i = test11 (a, b); if (i != 0) abort (); i = test12 (a, b); if (i != 1) abort (); i = test13 (a, b); if (i != 1) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); i = test16 (a, b); if (i != 0) abort (); i = test17 (a, b); if (i != 0) abort (); i = test18 (a, b); if (i != 0) abort (); i = test19 (a, b); if (i != 0) abort (); i = test20 (a, b); if (i != 1) abort (); i = test21 (a, b); if (i != 1) abort (); i = test22 (a, b); if (i != 1) abort (); i = test23 (a, b); if (i != 1) abort (); i = test24 (a, b); if (i != 0) abort (); i = test25 (a, b); if (i != 0) abort (); i = test26 (a, b); if (i != 0) abort (); i = test27 (a, b); if (i != 0) abort (); i = test28 (a, b); if (i != 1) abort (); i = test29 (a, b); if (i != 1) abort (); i = test30 (a, b); if (i != 1) abort (); i = test31 (a, b); if (i != 1) abort (); i = test32 (a, b); if (i != 0) abort (); i = test33 (a, b); if (i != 0) abort (); i = test34 (a, b); if (i != 0) abort (); i = test35 (a, b); if (i != 0) abort (); i = test36 (a, b); if (i != 1) abort (); i = test37 (a, b); if (i != 1) abort (); i = test38 (a, b); if (i != 1) abort (); i = test39 (a, b); if (i != 1) abort (); i = test40 (a, b); if (i != 0) abort (); i = test41 (a, b); if (i != 0) abort (); i = test42 (a, b); if (i != 0) abort (); i = test43 (a, b); if (i != 0) abort (); i = test44 (a, b); if (i != 1) abort (); i = test45 (a, b); if (i != 1) abort (); i = test46 (a, b); if (i != 1) abort (); i = test47 (a, b); if (i != 1) abort (); i = test48 (a, b); if (i != 0) abort (); i = test49 (a, b); if (i != 0) abort (); i = test50 (a, b); if (i != 0) abort (); i = test51 (a, b); if (i != 0) abort (); i = test52 (a, b); if (i != 1) abort (); i = test53 (a, b); if (i != 1) abort (); i = test54 (a, b); if (i != 1) abort (); i = test55 (a, b); if (i != 1) abort (); i = test56 (a, b); if (i != 0) abort (); i = test57 (a, b); if (i != 0) abort (); i = test58 (a, b); if (i != 0) abort (); i = test59 (a, b); if (i != 0) abort (); i = test60 (a, b); if (i != 1) abort (); i = test61 (a, b); if (i != 1) abort (); i = test62 (a, b); if (i != 1) abort (); i = test63 (a, b); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }
int main(int argc, char* argv[]) { printf("----------------------------\n"); printf("LibAudioStream based Player \n"); printf("----------------------------\n\n"); int res = LibVersion(); ///int samplerate = 96000; int samplerate = 44100; #ifndef WIN32 SetMaximumFiles(1024); printf("sysconf id_max %ld\n", sysconf(_SC_OPEN_MAX)); #endif // Try to open Jack version AudioPlayerPtr player = OpenAudioPlayer(IN_CHANNELS, OUT_CHANNELS, CHANNELS, samplerate, 512, 65536 * 8, 131072 * 4, kJackRenderer, 1); // If failure opens PortAudio version if (!player) { player = OpenAudioPlayer(IN_CHANNELS, OUT_CHANNELS, CHANNELS, samplerate, 1024, 65536 * 8, 131072 * 8, kPortAudioRenderer, 1); } // If failure opens CoreAudio version if (!player) { player = OpenAudioPlayer(IN_CHANNELS, OUT_CHANNELS, CHANNELS, samplerate, 1024, 65536 * 8, 131072 * 8, kCoreAudioRenderer, 1); } StartAudioPlayer(player); printf("Type 'b' to start playing from the begining\n"); printf("Type 's' to stop playing\n"); printf("Type 'p' to play from the current position\n"); printf("Type '+' to raise volume\n"); printf("Type '-' to lower volume\n"); printf("Type '1' to pan left\n"); printf("Type '2' to pan right\n"); printf("Type 'n' to go to next test\n"); /* ExecTest(player, test0()); ExecTest(player, test0()); ExecTest(player, test0()); ExecTest(player, test0()); ExecTest(player, test0()); ExecTest(player, test0()); ExecTest(player, test0()); */ ExecTest(player, test0()); ExecTest(player, test1()); ExecTest(player, test1()); ExecTest(player, test2()); ExecTest(player, test3()); ExecTest(player, test4()); ExecTest(player, test5()); ExecTest(player, test6()); ExecTest(player, test7()); ExecTest(player, test8()); ExecTest(player, test9()); ExecTest(player, test9bis()); //ExecTest(player, test10()); ExecTest(player, test10bis()); //ExecTest(player, test11()); ExecTest(player, test11bis()); ExecTest(player, test12()); ExecTest(player, test13()); /* test20(); test21(); */ //ExecTest(player, test0()); StopAudioPlayer(player); CloseAudioPlayer(player); printf("Quit\n"); return 0; }
/* * Tests all classes depending of moNeighborhoodStat.h */ int main() { //test de moNeighborhoodStat.h std::cout << "[t-moNeighborhoodStat] => START" << std::endl; moNeighborComparator<bitNeighbor> neighborComp; moSolNeighborComparator<bitNeighbor> solNeighborComp; evalOneMax eval(10); bitNeighborhood n(10); bitVector sol; sol.push_back(true); sol.push_back(false); sol.push_back(true); sol.push_back(true); sol.push_back(false); sol.push_back(true); sol.push_back(false); sol.push_back(true); sol.push_back(true); sol.push_back(true); sol.fitness(7); moNeighborhoodStat<bitNeighbor> test(n, eval, neighborComp, solNeighborComp); test(sol); assert(test.getMin()==8); assert(test.getMax()==6); assert(test.getMean()==6.6); double sd=test.getSD(); assert(sd>0.966 && sd<0.967); assert(test.getMedian()==6); assert(test.getQ1()==6); assert(test.getQ3()==8); assert(test.getSize()==10); assert(test.getNbSup()==7); assert(test.getNbInf()==3); assert(test.getNbEqual()==0); assert(test.className()=="moNeighborhoodStat"); std::cout << "[t-moNeighborhoodStat] => OK" << std::endl; //test of moMaxNeighborStat.h std::cout << "[t-moMaxNeighborStat] => START" << std::endl; moMaxNeighborStat<bitNeighbor> test2(test); test2(sol); assert(test2.value()==6); assert(test2.className()=="moMaxNeighborStat"); std::cout << "[t-moMaxNeighborStat] => OK" << std::endl; //test of moMinNeighborStat.h std::cout << "[t-moMinNeighborStat] => START" << std::endl; moMinNeighborStat<bitNeighbor> test3(test); test3(sol); assert(test3.value()==8); assert(test3.className()=="moMinNeighborStat"); std::cout << "[t-moMinNeighborStat] => OK" << std::endl; //test of moNbInfNeighborStat.h std::cout << "[t-moNbInfNeighborStat] => START" << std::endl; moNbInfNeighborStat<bitNeighbor> test4(test); test4(sol); assert(test4.value()==3); assert(test4.className()=="moNbInfNeighborStat"); std::cout << "[t-moNbInfNeighborStat] => OK" << std::endl; //test of moNbSupNeighborStat.h std::cout << "[t-moNbSupNeighborStat] => START" << std::endl; moNbSupNeighborStat<bitNeighbor> test5(test); test5(sol); assert(test5.value()==7); assert(test5.className()=="moNbSupNeighborStat"); std::cout << "[t-moNbSupNeighborStat] => OK" << std::endl; //test of moNeutralDegreeNeighborStat.h std::cout << "[t-moNeutralDegreeNeighborStat] => START" << std::endl; moNeutralDegreeNeighborStat<bitNeighbor> test6(test); test6(sol); assert(test6.value()==0); assert(test6.className()=="moNeutralDegreeNeighborStat"); std::cout << "[t-moNeutralDegreeNeighborStat] => OK" << std::endl; //test of moSecondMomentNeighborStat.h std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl; moSecondMomentNeighborStat<bitNeighbor> test7(test); test7.init(sol); test7(sol); assert(test7.value().first==6.6); assert(test7.value().second > 0.966 && test7.value().second < 0.967); assert(test7.className()=="moSecondMomentNeighborStat"); std::cout << "[t-moSecondMomentNeighborStat] => OK" << std::endl; //test of moSizeNeighborStat.h std::cout << "[t-moSizeNeighborStat] => START" << std::endl; moSizeNeighborStat<bitNeighbor> test8(test); test8(sol); assert(test8.value()==10); assert(test8.className()=="moSizeNeighborStat"); std::cout << "[t-moSizeNeighborStat] => OK" << std::endl; //test of moAverageFitnessNeighborStat.h std::cout << "[t-moAverageFitnessNeighborStat] => START" << std::endl; moAverageFitnessNeighborStat<bitNeighbor> test9(test); test9(sol); assert(test9.value()==6.6); assert(test9.className()=="moAverageFitnessNeighborStat"); std::cout << "[t-moAverageFitnessNeighborStat] => OK" << std::endl; //test of moStdFitnessNeighborStat.h std::cout << "[t-moStdFitnessNeighborStat] => START" << std::endl; moStdFitnessNeighborStat<bitNeighbor> test10(test); test10(sol); assert(test10.value()> 0.966 && test10.value() < 0.967); assert(test10.className()=="moStdFitnessNeighborStat"); std::cout << "[t-moStdFitnessNeighborStat] => OK" << std::endl; //test of moQuartilesNeighborStat.h std::cout << "[t-moQuartilesNeighborStat] => START" << std::endl; moQuartilesNeighborStat<bitNeighbor> test11(test); test11.init(sol); test11(sol); assert(test11.value().first==6); assert(test11.value().second==8); assert(test11.className()=="moQuartilesNeighborStat"); std::cout << "[t-moQuartilesNeighborStat] => OK" << std::endl; //test of moMedianNeighborStat.h std::cout << "[t-moMedianNeighborStat] => START" << std::endl; moMedianNeighborStat<bitNeighbor> test12(test); test12(sol); assert(test12.value()==6); assert(test12.className()=="moMedianNeighborStat"); std::cout << "[t-moMedianNeighborStat] => OK" << std::endl; //test of moQ1NeighborStat.h std::cout << "[t-moQ1NeighborStat] => START" << std::endl; moQ1NeighborStat<bitNeighbor> test13(test); test13(sol); assert(test13.value()==6); assert(test13.className()=="moQ1NeighborStat"); std::cout << "[t-moQ1NeighborStat] => OK" << std::endl; //test of moQ3NeighborStat.h std::cout << "[t-moQ3NeighborStat] => START" << std::endl; moQ3NeighborStat<bitNeighbor> test14(test); test14(sol); assert(test14.value()==8); assert(test14.className()=="moQ3NeighborStat"); std::cout << "[t-moQ3NeighborStat] => OK" << std::endl; return EXIT_SUCCESS; }
int main(void) { handle = LSQ_CreateSequence(); handleAll = LSQ_CreateSequence(); int i; printf("Generating test data"); srand ( time(NULL) ); for(i = 0; i < 50; i++) { front[i] = rand() % MAX_ELEMENT_VALUE +1; rear[i] = rand() % MAX_ELEMENT_VALUE +1; all[i] = rand() % MAX_ELEMENT_VALUE +1; all[i + 50] = rand() % MAX_ELEMENT_VALUE +1; } printf("\t ---\t OK \n"); printf("Insert front elements"); for(i = 0; i < 50; i++) { LSQ_InsertFrontElement(handle, front[i]); } printf("\t ---\t OK \n"); printf("Insert rear elements"); for(i = 0; i < 50; i++) { LSQ_InsertRearElement(handle, rear[i]); } printf("\t ---\t OK \n"); printf("Insert ALL elements"); for(i = 0; i < MAX_handleALL_LEN; i++) { LSQ_InsertRearElement(handleAll, all[i]); } printf("\t ---\t OK \n"); /* Create and destroy sequence immediately */ test1(); /* Create sequence, fill front, fill rear and destroy */ test2(); /* Test before first and past rear */ test3(); /* Test moving on list with setPosition */ test4(); /* Test moving on list with Advance/Rewind */ test5(); /* Test moving on list with ShiftPosition */ test6(); /* Test moving on list with GetElementByIndex */ test7(); /* Test delete with DeleteFrontElement */ test8(); /* Test delete with DeleteRearElement */ test9(); /* Test IsIteratorDereferencable, DeleteGivenElement pastReaer, beforeFirst */ test10(); return 0; }
int main(int argc, char *argv[]) { sc_uint item = -1; fflush(stdout); timer = g_timer_new(); g_timer_start(timer); printf("MD5: %d\n", g_checksum_type_get_length(G_CHECKSUM_MD5) ); printf("SHA1: %d\n", g_checksum_type_get_length(G_CHECKSUM_SHA1) ); printf("SHA256: %d\n", g_checksum_type_get_length(G_CHECKSUM_SHA256) ); sc_storage_initialize("repo"); g_timer_stop(timer); printf("Segment loading speed: %f seg/sec\n", sc_storage_get_segments_count() / g_timer_elapsed(timer, 0)); //test5(); //test6(); //test7(); while (item != 0) { printf("Commands:\n" "0 - exit\n" "1 - test allocation\n" "2 - test sc-addr utilities\n" "3 - test arc deletion\n" "4 - test iterators\n" "5 - test contents\n" "6 - test content finding\n" "7 - test events\n" "\nCommand: "); scanf("%d", &item); printf("\n----- Test %d -----\n", item); switch(item) { case 1: test1(); break; case 2: test2(); break; case 3: test3(); break; case 4: test4(); break; case 5: test5(); break; case 6: test6(); break; case 7: test7(); break; }; printf("\n----- Finished -----\n"); } timer = g_timer_new(); item = sc_storage_get_segments_count(); g_timer_reset(timer); // crash when uncomment sc_storage_shutdown(); g_timer_stop(timer); printf("Segments save speed: %f seg/sec\n", item / g_timer_elapsed(timer, 0)); g_timer_destroy(timer); return 0; }
NOMIPS16 int main() { union { long long ll; int i[2]; } endianness_test; int little_endian; v2sf a, b; int i, j; endianness_test.ll = 1; little_endian = endianness_test.i[0]; /* Case 1 {diff, diff} */ a = (v2sf) {1, 2}; b = (v2sf) {3, 4}; i = __builtin_mips_upper_c_eq_ps (a, b); j = __builtin_mips_lower_c_eq_ps (a, b); if (i != 0 || j != 0) abort (); /* Case 2 {same, diff} */ a = (v2sf) {1.0, 2.0}; b = (v2sf) {1.0, 4.0}; i = __builtin_mips_upper_c_eq_ps (a, b); j = __builtin_mips_lower_c_eq_ps (a, b); if (little_endian) { if (i != 0 || j != 1) abort (); } else { if (i != 1 || j != 0) abort (); } /* Case 3 {diff, same} */ a = (v2sf) {1, 2}; b = (v2sf) {3, 2}; i = __builtin_mips_upper_c_eq_ps (a, b); j = __builtin_mips_lower_c_eq_ps (a, b); if (little_endian) { if (i != 1 || j != 0) abort (); } else { if (i != 0 || j != 1) abort (); } /* Case 4 {same, same} */ a = (v2sf) {1, 2}; b = (v2sf) {1, 2}; i = __builtin_mips_upper_c_eq_ps (a, b); j = __builtin_mips_lower_c_eq_ps (a, b); if (i != 1 || j != 1) abort (); /* Test upper/lower with 16 operators */ if (little_endian) { a = (v2sf) {1984.0, 10.58}; b = (v2sf) {1984.0, 567.345}; } else { a = (v2sf) {10.58, 1984.0}; b = (v2sf) {567.345, 1984.0}; } i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 0) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 1) abort (); i = test6 (a, b); if (i != 0) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 1) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 1) abort (); i = test11 (a, b); if (i != 0) abort (); i = test12 (a, b); if (i != 1) abort (); i = test13 (a, b); if (i != 1) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); i = test16 (a, b); if (i != 0) abort (); i = test17 (a, b); if (i != 0) abort (); i = test18 (a, b); if (i != 0) abort (); i = test19 (a, b); if (i != 0) abort (); i = test20 (a, b); if (i != 0) abort (); i = test21 (a, b); if (i != 1) abort (); i = test22 (a, b); if (i != 0) abort (); i = test23 (a, b); if (i != 1) abort (); i = test24 (a, b); if (i != 1) abort (); i = test25 (a, b); if (i != 0) abort (); i = test26 (a, b); if (i != 1) abort (); i = test27 (a, b); if (i != 0) abort (); i = test28 (a, b); if (i != 1) abort (); i = test29 (a, b); if (i != 1) abort (); i = test30 (a, b); if (i != 1) abort (); i = test31 (a, b); if (i != 1) abort (); /* Reverse arguments */ i = test0 (b, a); if (i != 0) abort (); i = test1 (b, a); if (i != 0) abort (); i = test2 (b, a); if (i != 0) abort (); i = test3 (b, a); if (i != 0) abort (); i = test4 (b, a); if (i != 0) abort (); i = test5 (b, a); if (i != 1) abort (); i = test6 (b, a); if (i != 0) abort (); i = test7 (b, a); if (i != 1) abort (); i = test8 (b, a); if (i != 0) abort (); i = test9 (b, a); if (i != 0) abort (); i = test10 (b, a); if (i != 0) abort (); i = test11 (b, a); if (i != 0) abort (); i = test12 (b, a); if (i != 0) abort (); i = test13 (b, a); if (i != 1) abort (); i = test14 (b, a); if (i != 0) abort (); i = test15 (b, a); if (i != 1) abort (); i = test16 (b, a); if (i != 0) abort (); i = test17 (b, a); if (i != 0) abort (); i = test18 (b, a); if (i != 0) abort (); i = test19 (b, a); if (i != 0) abort (); i = test20 (b, a); if (i != 0) abort (); i = test21 (b, a); if (i != 1) abort (); i = test22 (b, a); if (i != 0) abort (); i = test23 (b, a); if (i != 1) abort (); i = test24 (b, a); if (i != 0) abort (); i = test25 (b, a); if (i != 0) abort (); i = test26 (b, a); if (i != 0) abort (); i = test27 (b, a); if (i != 0) abort (); i = test28 (b, a); if (i != 0) abort (); i = test29 (b, a); if (i != 1) abort (); i = test30 (b, a); if (i != 0) abort (); i = test31 (b, a); if (i != 1) abort (); #ifndef __FAST_MATH__ /* Test upper/lower with 16 operators */ if (little_endian) { a = (v2sf) {qnan, qnan}; b = (v2sf) {1984.0, 567.345}; } else { a = (v2sf) {qnan, qnan}; b = (v2sf) {567.345, 1984.0}; } i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 1) abort (); i = test3 (a, b); if (i != 1) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 0) abort (); i = test6 (a, b); if (i != 1) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 1) abort (); i = test11 (a, b); if (i != 1) abort (); i = test12 (a, b); if (i != 0) abort (); i = test13 (a, b); if (i != 0) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); i = test16 (a, b); if (i != 0) abort (); i = test17 (a, b); if (i != 0) abort (); i = test18 (a, b); if (i != 1) abort (); i = test19 (a, b); if (i != 1) abort (); i = test20 (a, b); if (i != 0) abort (); i = test21 (a, b); if (i != 0) abort (); i = test22 (a, b); if (i != 1) abort (); i = test23 (a, b); if (i != 1) abort (); i = test24 (a, b); if (i != 0) abort (); i = test25 (a, b); if (i != 0) abort (); i = test26 (a, b); if (i != 1) abort (); i = test27 (a, b); if (i != 1) abort (); i = test28 (a, b); if (i != 0) abort (); i = test29 (a, b); if (i != 0) abort (); i = test30 (a, b); if (i != 1) abort (); i = test31 (a, b); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }
int main(int argc, char* argv[]) { orte_proc_info(); /* initialize proc info structure */ orte_process_info.my_name = (orte_process_name_t*)malloc(sizeof(orte_process_name_t)); orte_process_info.my_name->cellid = 0; orte_process_info.my_name->jobid = 0; orte_process_info.my_name->vpid = 0; test_init("orte_session_dir_t"); test_out = fopen( "test_session_dir_out", "w+" ); if( test_out == NULL ) { test_failure("test_session_dir couldn't open test file failed"); test_finalize(); exit(1); } fprintf(test_out, "running test1\n"); if (test1()) { test_success(); } else { test_failure("orte_session_dir_t test1 failed"); } fprintf(test_out, "running test2\n"); if (test2()) { test_success(); } else { test_failure("orte_session_dir_t test2 failed"); } fprintf(test_out, "running test3\n"); if (test3()) { test_success(); } else { test_failure("orte_session_dir_t test3 failed"); } fprintf(test_out, "running test4\n"); if (test4()) { test_success(); } else { test_failure("orte_session_dir_t test4 failed"); } fprintf(test_out, "running test5\n"); if (test5()) { test_success(); } else { test_failure("orte_session_dir_t test5 failed"); } fprintf(test_out, "running test6\n"); if (test6()) { test_success(); } else { test_failure("orte_session_dir_t test6 failed"); } fprintf(test_out, "running test7\n"); if (test7()) { test_success(); } else { test_failure("orte_session_dir_t test7 failed"); } fprintf(test_out, "running test8\n"); if (test8()) { test_success(); } else { test_failure("orte_session_dir_t test8 failed"); } fprintf(test_out, "completed all tests\n"); fclose(test_out); /* clean up */ orte_proc_info_finalize(); test_finalize(); return 0; }
int main (int argc, char* argv[]) { opal_init(&argc, &argv); test_out = stderr; /* run the tests */ fprintf(test_out, "executing test1\n"); if (test1()) { fprintf(test_out, "Test1 succeeded\n"); } else { fprintf(test_out, "Test1 failed\n"); } fprintf(test_out, "executing test2\n"); if (test2()) { fprintf(test_out, "Test2 succeeded\n"); } else { fprintf(test_out, "Test2 failed\n"); } fprintf(test_out, "executing test3\n"); if (test3()) { fprintf(test_out, "Test3 succeeded\n"); } else { fprintf(test_out, "Test3 failed\n"); } fprintf(test_out, "executing test4\n"); if (test4()) { fprintf(test_out, "Test4 succeeded\n"); } else { fprintf(test_out, "Test4 failed\n"); } fprintf(test_out, "executing test5\n"); if (test5()) { fprintf(test_out, "Test5 succeeded\n"); } else { fprintf(test_out, "Test5 failed\n"); } fprintf(test_out, "executing test6\n"); if (test6()) { fprintf(test_out, "Test6 succeeded\n"); } else { fprintf(test_out, "Test6 failed\n"); } fprintf(test_out, "executing test7\n"); if (test7()) { fprintf(test_out, "Test7 succeeded\n"); } else { fprintf(test_out, "Test7 failed\n"); } fprintf(test_out, "executing test8\n"); if (test8()) { fprintf(test_out, "Test8 succeeded\n"); } else { fprintf(test_out, "Test8 failed\n"); } fprintf(test_out, "executing test9\n"); if (test9()) { fprintf(test_out, "Test9 succeeded\n"); } else { fprintf(test_out, "opal_dss test9 failed\n"); } fprintf(test_out, "executing test10\n"); if (test10()) { fprintf(test_out, "Test10 succeeded\n"); } else { fprintf(test_out, "opal_dss test10 failed\n"); } fprintf(test_out, "executing test11\n"); if (test11()) { fprintf(test_out, "Test11 succeeded\n"); } else { fprintf(test_out, "opal_dss test11 failed\n"); } fprintf(test_out, "executing test12\n"); if (test12()) { fprintf(test_out, "Test12 succeeded\n"); } else { fprintf(test_out, "opal_dss test12 failed\n"); } fclose(test_out); opal_finalize(); return(0); }
int main(){ long start, end, total; double each; long record[8]; puts(" --- [ Benchmarking Procedure Call ] --- "); total = 0; puts(" - Running with 0 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test0(); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[0] = each; total = 0; puts(" - Running with 1 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test1(0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[1] = each; total = 0; puts(" - Running with 2 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test2(0, 0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[2] = each; total = 0; puts(" - Running with 3 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test3(0, 0, 0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[3] = each; total = 0; puts(" - Running with 4 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test4(0, 0, 0, 0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[4] = each; total = 0; puts(" - Running with 5 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test5(0, 0, 0, 0, 0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[5] = each; total = 0; puts(" - Running with 6 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test6(0, 0, 0, 0, 0, 0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[6] = each; total = 0; puts(" - Running with 7 argument"); for (int i = 0; i < TIMES; i++){ start = rdtsc(); test7(0, 0, 0, 0, 0, 0, 0); end = rdtsc(); total += end - start; } each = total * 1.0 / TIMES ; printf(" Time to run %d iteration : %ld \n", TIMES, total); printf(" Average ReadOverhead : %f \n", each); record[7] = each; puts(" - Final ... "); }
int main () { float a, b; int i; /* cabs.eq.s */ a = 12; b = -56; i = 0; if (__builtin_mips_cabs_eq_s(a, b) != i) abort (); /* cabs.eq.s */ a = 12; b = -12; i = 1; if (__builtin_mips_cabs_eq_s(a, b) != i) abort (); /* Test all comparisons */ a = 10.58; b = 567.345; i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 0) abort (); i = test4 (a, b); if (i != 1) abort (); i = test5 (a, b); if (i != 1) abort (); i = test6 (a, b); if (i != 1) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 0) abort (); i = test11 (a, b); if (i != 0) abort (); i = test12 (a, b); if (i != 1) abort (); i = test13 (a, b); if (i != 1) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); /* Reversed arguments */ i = test0 (b, a); if (i != 0) abort (); i = test1 (b, a); if (i != 0) abort (); i = test2 (b, a); if (i != 0) abort (); i = test3 (b, a); if (i != 0) abort (); i = test4 (b, a); if (i != 0) abort (); i = test5 (b, a); if (i != 0) abort (); i = test6 (b, a); if (i != 0) abort (); i = test7 (b, a); if (i != 0) abort (); i = test8 (b, a); if (i != 0) abort (); i = test9 (b, a); if (i != 0) abort (); i = test10 (b, a); if (i != 0) abort (); i = test11 (b, a); if (i != 0) abort (); i = test12 (b, a); if (i != 0) abort (); i = test13 (b, a); if (i != 0) abort (); i = test14 (b, a); if (i != 0) abort (); i = test15 (b, a); if (i != 0) abort (); #ifndef __FAST_MATH__ /* Test all comparisons */ a = 1.0f/0.0f - 1.0f/0.0f; // QNaN b = 567.345; i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 1) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 1) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 1) abort (); i = test6 (a, b); if (i != 0) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 1) abort (); i = test10 (a, b); if (i != 0) abort (); i = test11 (a, b); if (i != 1) abort (); i = test12 (a, b); if (i != 0) abort (); i = test13 (a, b); if (i != 1) abort (); i = test14 (a, b); if (i != 0) abort (); i = test15 (a, b); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }
NOMIPS16 int main () { v2sf a, b, c, d; int i, j; /* c.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {33, 44}; c = (v2sf) {55, 66}; d = (v2sf) {77, 88}; i = 0; j = 0; if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) abort (); /* c.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {11, 44}; c = (v2sf) {55, 66}; d = (v2sf) {77, 88}; i = 1; j = 0; if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) abort (); /* c.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {33, 22}; c = (v2sf) {55, 66}; d = (v2sf) {77, 88}; i = 1; j = 0; if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) abort (); /* c.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {33, 44}; c = (v2sf) {55, 66}; d = (v2sf) {55, 88}; i = 1; j = 0; if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) abort (); /* c.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {33, 44}; c = (v2sf) {55, 66}; d = (v2sf) {77, 66}; i = 1; j = 0; if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) abort (); /* c.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {11, 22}; c = (v2sf) {55, 66}; d = (v2sf) {55, 66}; i = 1; j = 1; if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) abort (); /* Test all comparisons */ a = (v2sf) {11, 33}; b = (v2sf) {33, 11}; c = (v2sf) {55, 66}; d = (v2sf) {55, 88}; i = test0 (a, b, c, d); if (i != 0) abort (); i = test1 (a, b, c, d); if (i != 0) abort (); i = test2 (a, b, c, d); if (i != 0) abort (); i = test3 (a, b, c, d); if (i != 0) abort (); i = test4 (a, b, c, d); if (i != 1) abort (); i = test5 (a, b, c, d); if (i != 0) abort (); i = test6 (a, b, c, d); if (i != 1) abort (); i = test7 (a, b, c, d); if (i != 0) abort (); i = test8 (a, b, c, d); if (i != 1) abort (); i = test9 (a, b, c, d); if (i != 0) abort (); i = test10 (a, b, c, d); if (i != 1) abort (); i = test11 (a, b, c, d); if (i != 0) abort (); i = test12 (a, b, c, d); if (i != 1) abort (); i = test13 (a, b, c, d); if (i != 0) abort (); i = test14 (a, b, c, d); if (i != 1) abort (); i = test15 (a, b, c, d); if (i != 0) abort (); i = test16 (a, b, c, d); if (i != 0) abort (); i = test17 (a, b, c, d); if (i != 0) abort (); i = test18 (a, b, c, d); if (i != 0) abort (); i = test19 (a, b, c, d); if (i != 0) abort (); i = test20 (a, b, c, d); if (i != 1) abort (); i = test21 (a, b, c, d); if (i != 0) abort (); i = test22 (a, b, c, d); if (i != 1) abort (); i = test23 (a, b, c, d); if (i != 0) abort (); i = test24 (a, b, c, d); if (i != 1) abort (); i = test25 (a, b, c, d); if (i != 0) abort (); i = test26 (a, b, c, d); if (i != 1) abort (); i = test27 (a, b, c, d); if (i != 0) abort (); i = test28 (a, b, c, d); if (i != 1) abort (); i = test29 (a, b, c, d); if (i != 0) abort (); i = test30 (a, b, c, d); if (i != 1) abort (); i = test31 (a, b, c, d); if (i != 0) abort (); /* Reversed arguments */ i = test0 (b, a, d, c); if (i != 0) abort (); i = test1 (b, a, d, c); if (i != 0) abort (); i = test2 (b, a, d, c); if (i != 0) abort (); i = test3 (b, a, d, c); if (i != 0) abort (); i = test4 (b, a, d, c); if (i != 1) abort (); i = test5 (b, a, d, c); if (i != 0) abort (); i = test6 (b, a, d, c); if (i != 1) abort (); i = test7 (b, a, d, c); if (i != 0) abort (); i = test8 (b, a, d, c); if (i != 1) abort (); i = test9 (b, a, d, c); if (i != 0) abort (); i = test10 (b, a, d, c); if (i != 1) abort (); i = test11 (b, a, d, c); if (i != 0) abort (); i = test12 (b, a, d, c); if (i != 1) abort (); i = test13 (b, a, d, c); if (i != 0) abort (); i = test14 (b, a, d, c); if (i != 1) abort (); i = test15 (b, a, d, c); if (i != 0) abort (); i = test16 (b, a, d, c); if (i != 0) abort (); i = test17 (b, a, d, c); if (i != 0) abort (); i = test18 (b, a, d, c); if (i != 0) abort (); i = test19 (b, a, d, c); if (i != 0) abort (); i = test20 (b, a, d, c); if (i != 1) abort (); i = test21 (b, a, d, c); if (i != 0) abort (); i = test22 (b, a, d, c); if (i != 1) abort (); i = test23 (b, a, d, c); if (i != 0) abort (); i = test24 (b, a, d, c); if (i != 1) abort (); i = test25 (b, a, d, c); if (i != 0) abort (); i = test26 (b, a, d, c); if (i != 1) abort (); i = test27 (b, a, d, c); if (i != 0) abort (); i = test28 (b, a, d, c); if (i != 1) abort (); i = test29 (b, a, d, c); if (i != 0) abort (); i = test30 (b, a, d, c); if (i != 1) abort (); i = test31 (b, a, d, c); if (i != 0) abort (); #ifndef __FAST_MATH__ /* Test all comparisons */ a = (v2sf) {qnan, qnan}; b = (v2sf) {33, 11}; c = (v2sf) {qnan, qnan}; d = (v2sf) {55, 88}; i = test0 (a, b, c, d); if (i != 0) abort (); i = test1 (a, b, c, d); if (i != 0) abort (); i = test2 (a, b, c, d); if (i != 1) abort (); i = test3 (a, b, c, d); if (i != 1) abort (); i = test4 (a, b, c, d); if (i != 0) abort (); i = test5 (a, b, c, d); if (i != 0) abort (); i = test6 (a, b, c, d); if (i != 1) abort (); i = test7 (a, b, c, d); if (i != 1) abort (); i = test8 (a, b, c, d); if (i != 0) abort (); i = test9 (a, b, c, d); if (i != 0) abort (); i = test10 (a, b, c, d); if (i != 1) abort (); i = test11 (a, b, c, d); if (i != 1) abort (); i = test12 (a, b, c, d); if (i != 0) abort (); i = test13 (a, b, c, d); if (i != 0) abort (); i = test14 (a, b, c, d); if (i != 1) abort (); i = test15 (a, b, c, d); if (i != 1) abort (); i = test16 (a, b, c, d); if (i != 0) abort (); i = test17 (a, b, c, d); if (i != 0) abort (); i = test18 (a, b, c, d); if (i != 1) abort (); i = test19 (a, b, c, d); if (i != 1) abort (); i = test20 (a, b, c, d); if (i != 0) abort (); i = test21 (a, b, c, d); if (i != 0) abort (); i = test22 (a, b, c, d); if (i != 1) abort (); i = test23 (a, b, c, d); if (i != 1) abort (); i = test24 (a, b, c, d); if (i != 0) abort (); i = test25 (a, b, c, d); if (i != 0) abort (); i = test26 (a, b, c, d); if (i != 1) abort (); i = test27 (a, b, c, d); if (i != 1) abort (); i = test28 (a, b, c, d); if (i != 0) abort (); i = test29 (a, b, c, d); if (i != 0) abort (); i = test30 (a, b, c, d); if (i != 1) abort (); i = test31 (a, b, c, d); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }
int main(int argc, const char* argv[]) { int n = 0; #if 0 { HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); DuplicateHandle(GetCurrentProcess(), out, GetCurrentProcess(), &out, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); SetStdHandle(STD_OUTPUT_HANDLE, out); } { HANDLE out = GetStdHandle(STD_ERROR_HANDLE); DuplicateHandle(GetCurrentProcess(), out, GetCurrentProcess(), &out, 0, FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); SetStdHandle(STD_ERROR_HANDLE, out); } #endif if(argc == 2) { n = atoi(argv[1]); } else if(argc == 3 && strcmp(argv[1], "run") == 0) { n = atoi(argv[2]); } /* Check arguments. */ if(((n >= 1 && n <= 8) || n == 108) && argc == 3) { /* This is the child process for a requested test number. */ switch (n) { case 1: return test1(argc, argv); case 2: return test2(argc, argv); case 3: return test3(argc, argv); case 4: return test4(argc, argv); case 5: return test5(argc, argv); case 6: test6(argc, argv); return 0; case 7: return test7(argc, argv); case 8: return test8(argc, argv); case 108: return test8_grandchild(argc, argv); } fprintf(stderr, "Invalid test number %d.\n", n); return 1; } else if(n >= 1 && n <= 8) { /* This is the parent process for a requested test number. */ int states[8] = { kwsysProcess_State_Exited, kwsysProcess_State_Exited, kwsysProcess_State_Expired, kwsysProcess_State_Exception, kwsysProcess_State_Exited, kwsysProcess_State_Expired, kwsysProcess_State_Exited, kwsysProcess_State_Exited }; int exceptions[8] = { kwsysProcess_Exception_None, kwsysProcess_Exception_None, kwsysProcess_Exception_None, kwsysProcess_Exception_Fault, kwsysProcess_Exception_None, kwsysProcess_Exception_None, kwsysProcess_Exception_None, kwsysProcess_Exception_None }; int values[8] = {0, 123, 1, 1, 0, 0, 0, 0}; int outputs[8] = {1, 1, 1, 1, 1, 0, 1, 1}; int delays[8] = {0, 0, 0, 0, 0, 1, 0, 0}; double timeouts[8] = {10, 10, 10, 30, 30, 10, -1, 10}; int polls[8] = {0, 0, 0, 0, 0, 0, 1, 0}; int repeat[8] = {2, 1, 1, 1, 1, 1, 1, 1}; int r; const char* cmd[4]; #ifdef _WIN32 char* argv0 = 0; if(n == 0 && (argv0 = strdup(argv[0]))) { /* Try converting to forward slashes to see if it works. */ char* c; for(c=argv0; *c; ++c) { if(*c == '\\') { *c = '/'; } } cmd[0] = argv0; } else { cmd[0] = argv[0]; } #else cmd[0] = argv[0]; #endif cmd[1] = "run"; cmd[2] = argv[1]; cmd[3] = 0; fprintf(stdout, "Output on stdout before test %d.\n", n); fprintf(stderr, "Output on stderr before test %d.\n", n); fflush(stdout); fflush(stderr); r = runChild(cmd, states[n-1], exceptions[n-1], values[n-1], 0, outputs[n-1], delays[n-1], timeouts[n-1], polls[n-1], repeat[n-1], 0); fprintf(stdout, "Output on stdout after test %d.\n", n); fprintf(stderr, "Output on stderr after test %d.\n", n); fflush(stdout); fflush(stderr); #if defined(_WIN32) if(argv0) { free(argv0); } #endif return r; } else if(argc > 2 && strcmp(argv[1], "0") == 0) { /* This is the special debugging test to run a given command line. */ const char** cmd = argv+2; int state = kwsysProcess_State_Exited; int exception = kwsysProcess_Exception_None; int value = 0; double timeout = 0; int r = runChild(cmd, state, exception, value, 0, 1, 0, timeout, 0, 1, 0); return r; } else { /* Improper usage. */ fprintf(stdout, "Usage: %s <test number>\n", argv[0]); return 1; } }
int main () { double a, b; int i; /* cabs.eq.d */ a = 12; b = -56; i = 0; if (__builtin_mips_cabs_eq_d(a, b) != i) abort (); /* cabs.eq.d */ a = 12; b = -12; i = 1; if (__builtin_mips_cabs_eq_d(a, b) != i) abort (); /* Test all operators */ a = 1984.0; b = 1984.0; i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 1) abort (); i = test3 (a, b); if (i != 1) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 0) abort (); i = test6 (a, b); if (i != 1) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 1) abort (); i = test11 (a, b); if (i != 1) abort (); i = test12 (a, b); if (i != 0) abort (); i = test13 (a, b); if (i != 0) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); /* Reverse arguments */ i = test0 (b, a); if (i != 0) abort (); i = test1 (b, a); if (i != 0) abort (); i = test2 (b, a); if (i != 1) abort (); i = test3 (b, a); if (i != 1) abort (); i = test4 (b, a); if (i != 0) abort (); i = test5 (b, a); if (i != 0) abort (); i = test6 (b, a); if (i != 1) abort (); i = test7 (b, a); if (i != 1) abort (); i = test8 (b, a); if (i != 0) abort (); i = test9 (b, a); if (i != 0) abort (); i = test10 (b, a); if (i != 1) abort (); i = test11 (b, a); if (i != 1) abort (); i = test12 (b, a); if (i != 0) abort (); i = test13 (b, a); if (i != 0) abort (); i = test14 (b, a); if (i != 1) abort (); i = test15 (b, a); if (i != 1) abort (); #ifndef __FAST_MATH__ /* Test all operators */ a = 1.0/0.0 - 1.0/0.0; // QNaN b = 1.0/0.0 - 1.0/0.0; // QNaN i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 1) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 1) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 1) abort (); i = test6 (a, b); if (i != 0) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 1) abort (); i = test10 (a, b); if (i != 0) abort (); i = test11 (a, b); if (i != 1) abort (); i = test12 (a, b); if (i != 0) abort (); i = test13 (a, b); if (i != 1) abort (); i = test14 (a, b); if (i != 0) abort (); i = test15 (a, b); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }
int main() { vcg::Point3d p1(20.0, 25.0, 10.0); vcg::Point3d p2(-6.0, 25.0, 50.0); vcg::Shotd shot1; vcg::Shotd shot2; // Initialize camera 1 (C1) shot1.Intrinsics.cameraType = vcg::Camera<double>::PERSPECTIVE; shot1.Intrinsics.FocalMm = 30.0; shot1.Intrinsics.CenterPx[0] = 600.0; shot1.Intrinsics.CenterPx[1] = 400.0; shot1.Intrinsics.ViewportPx[0] = 1200; shot1.Intrinsics.ViewportPx[1] = 800; shot1.Intrinsics.PixelSizeMm[0] = 0.029166; shot1.Intrinsics.PixelSizeMm[1] = 0.029166; // no distorion is assumed (!) shot1.Intrinsics.DistorCenterPx[0] = shot1.Intrinsics.DistorCenterPx[1] = 0.0; shot1.Intrinsics.k[0] = 0.0; shot1.Intrinsics.k[1] = 0.0; shot1.Intrinsics.k[2] = 0.0; shot1.Intrinsics.k[3] = 0.0; vcg::Matrix44d R1; // -10 degree around Y axis double deg2rad = 0.01745329251994329576923690768489; R1.ElementAt(0,0) = vcg::math::Cos(-10.0*deg2rad); R1.ElementAt(0,1) = 0.0; R1.ElementAt(0,2) = vcg::math::Sin(-10.0*deg2rad); R1.ElementAt(0,3) = 0.0; R1.ElementAt(1,0) = 0.0; R1.ElementAt(1,1) = 1.0; R1.ElementAt(1,2) = 0.0; R1.ElementAt(1,3) = 0.0; R1.ElementAt(2,0) = -vcg::math::Sin(-10.0*deg2rad); R1.ElementAt(2,1) = 0.0; R1.ElementAt(2,2) = vcg::math::Cos(-10.0*deg2rad); R1.ElementAt(2,3) = 0.0; R1.ElementAt(3,0) = 0.0; R1.ElementAt(3,1) = 0.0; R1.ElementAt(3,2) = 0.0; R1.ElementAt(3,3) = 1.0; vcg::Point3d T1(30.0, 30.0, 80.0); shot1.Extrinsics.SetTra(T1); shot1.Extrinsics.SetRot(R1); // Initialize camera 2 (C2) shot2.Intrinsics.cameraType = vcg::Camera<double>::PERSPECTIVE; shot2.Intrinsics.FocalMm = 30.0; shot2.Intrinsics.CenterPx[0] = 600.0; shot2.Intrinsics.CenterPx[1] = 400.0; shot2.Intrinsics.ViewportPx[0] = 1200; shot2.Intrinsics.ViewportPx[1] = 800; shot2.Intrinsics.PixelSizeMm[0] = 0.029166; shot2.Intrinsics.PixelSizeMm[1] = 0.029166; // no distortion is assumed (!) shot2.Intrinsics.DistorCenterPx[0] = shot2.Intrinsics.DistorCenterPx[1] = 0.0; shot2.Intrinsics.k[0] = 0.0; shot2.Intrinsics.k[1] = 0.0; shot2.Intrinsics.k[2] = 0.0; shot2.Intrinsics.k[3] = 0.0; vcg::Matrix44d R2; // 18 degree around Y axis (+ 180 degree for the correct orientation of the camera) R2.ElementAt(0,0) = vcg::math::Cos(-45.0*deg2rad); R2.ElementAt(0,1) = 0.0; R2.ElementAt(0,2) = vcg::math::Sin(-45.0*deg2rad); R2.ElementAt(0,3) = 0.0; R2.ElementAt(1,0) = 0.0; R2.ElementAt(1,1) = 1.0; R2.ElementAt(1,2) = 0.0; R2.ElementAt(1,3) = 0.0; R2.ElementAt(2,0) = -vcg::math::Sin(-45.0*deg2rad); R2.ElementAt(2,1) = 0.0; R2.ElementAt(2,2) = vcg::math::Cos(-45.0*deg2rad); R2.ElementAt(2,3) = 0.0; R2.ElementAt(3,0) = 0.0; R2.ElementAt(3,1) = 0.0; R2.ElementAt(3,2) = 0.0; R2.ElementAt(3,3) = 1.0; vcg::Point3d T2(50.0, 30.0, 80.0); shot2.Extrinsics.SetTra(T2); shot2.Extrinsics.SetRot(R2); // TEST 1 - project a 3D point in World coordinates on the image plane if (test1(shot1, shot2, p1, p2)) { std::cout << "TEST 1 (projection) - PASSED(!)" << std::endl; } else std::cout << "TEST 1 (projection) - FAILED(!)" << std::endl; // TEST 2 - projection and unprojection if (test2(shot1, shot2, p1, p2)) { std::cout << "TEST 2 (unprojection) - PASSED(!)" << std::endl; } else { std::cout << "TEST 2 (unprojection) - FAILED(!)" << std::endl; } // TEST 3 - DEPTH COMPUTATION if (test3(shot1, shot2, p1, p2)) { std::cout << "TEST 3 (depth computation) - PASSED(!)" << std::endl; } else { std::cout << "TEST 3 (depth computation) - FAILED(!)" << std::endl; } // TEST 4 - CAMERA CONVERSION - CONVERT FOCAL IN PIXELS IN FOCAL IN MM if (test4(shot1, p1)) { std::cout << "TEST 4 (focal in px to focal in mm) - PASSED(!)" << std::endl; } else { std::cout << "TEST 4 (focal in px to focal in mm) - FAILED(!)" << std::endl; } // TEST 5 - CAMERA-SHOT MODIFICATION - CHANGE SCALE FACTOR OF THE WORLD if (test5(shot1, p1, p2)) { std::cout << "TEST 5 (scaling the World) - PASSED(!)" << std::endl; } else { std::cout << "TEST 5 (scaling the World) - FAILED(!)" << std::endl; } // TEST 6 - WORLD-TO-EXTRINSICS AND EXTRINSICS-TO-WORLD TRANSFORMATIONS if (test6(shot1, shot2, p1, p2)) { std::cout << "TEST 6 (World-to-Extrinsics and Extrinsics-to-World) - PASSED(!)" << std::endl; } else { std::cout << "TEST 6 (World-to-Extrinsics and Extrinsics-to-World) - FAILE(!)" << std::endl; } // TEST 7 - SHOT MODIFICATION - ROTO-TRANSLATION OF THE SHOT COORDINATES SYSTEM if (test7(shot1, p1, p2)) { std::cout << "TEST 7 (roto-translation of the Shot coordinates system) - PASSED(!)" << std::endl; } else { std::cout << "TEST 7 (roto-translation of the Shot coordinates system) - FAILED(!)" << std::endl; } // TEST 7 - SHOT MODIFICATION - ROTO-TRANSLATION OF THE SHOT COORDINATES SYSTEM if (test8(shot1, shot2, p1, p2)) { std::cout << "TEST 8 (roto-translation of the Shot coordinates system) - PASSED(!)" << std::endl; } else { std::cout << "TEST 8 (roto-translation of the Shot coordinates system) - FAILED(!)" << std::endl; } // TEST 9 - SHOT MODIFICATION - ROTO-TRANSLATION OF THE SHOT COORDINATES SYSTEM if (test9(shot1, shot2, p1, p2)) { std::cout << "TEST 9 (roto-translation of the Shot coordinates system) - PASSED(!)" << std::endl; } else { std::cout << "TEST 9 (roto-translation of the Shot coordinates system) - FAILED(!)" << std::endl; } // TEST 10 - SHOT MODIFICATION - SIMILARITY TRANSFORMATION if (test10(shot1, shot2, p1, p2)) { std::cout << "TEST 10 (similarity transform of the Shot coordinates system) - PASSED(!)" << std::endl; } else { std::cout << "TEST 10 (similarity transform of the Shot coordinates system) - FAILED(!)" << std::endl; } return 0; }
int CollisionDetection::getSide(Rect *_player, Rect *_platform) { int result = -1; int testvar = 0; if (test1(_player, _platform)) { testvar = testvar + 1; } if (test2(_player, _platform)) { testvar = testvar + 2; } if (test3(_player, _platform)) { testvar = testvar + 4; } if (test4(_player, _platform)) { testvar = testvar + 8; } if (test5(_player, _platform)) { testvar = testvar + 16; } if (test6(_player, _platform)) { testvar = testvar + 32; } if (test7(_player, _platform)) { testvar = testvar + 64; } if (test8(_player, _platform)) { testvar = testvar + 128; } switch (testvar) { //left = 1, bottom = 2, right = 3, top = 4 // 0,1,1,1,1,0,0,1=121 case 121: result = 2; break; //0,0,1,0,1,0,0,1=73 case 73: result = 4; break; //0,1,1,0,1,0,1,1 case 107: result = 3; break; //0,1,1,0,0,0,0,1 case 97: result = 1; break; //0,0,1,0,0,0,1,1 case 35: result = 4; break; //0,0,1,1,0,0,0,1 case 49: result = 1; break; //0,0,1,1,1,0,1,1 = 59 case 59: result = 3; break; //0,1,1,1,0,0,1,1 = 115 case 115: result = 2; break; //top left corner //0,0,1,0,0,0,0,1 case 33: if ((_player->getX() + _player->getWidth()) - _platform->getX() > (_player->getY() + _player->getHeight()) - _platform->getY()) { result = 4; } else { result = 1; } break; //top right corner //0,0,1,0,1,0,1,1 = 43 case 43: if (_platform->getX() + _platform->getWidth() - _player->getX() > (_player->getY() + _player->getHeight()) - _platform->getY()) { result = 4; } else { result = 3; } break; //bottom left corner //0,1,1,1,0,0,0,1 = 113 case 113: if (_player->getX() + _player->getWidth() - _platform->getX() > _platform->getY() + _platform->getHeight() - _player->getY()) { result = 2; } else { result = 1; } break; //bottom right corner //0,1,1,1,1,0,1,1 = 123 case 123: if (_platform->getX() + _platform->getWidth() - _player->getX() > _platform->getY() + _platform->getHeight() - _player->getY()) { result = 2; } else { result = 3; } break; } return result; }
NOMIPS16 int main () { v2sf a, b, c, d; int i, j; /* c.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {56, 78}; i = 0; j = 0; if (__builtin_mips_any_c_eq_ps(a, b) != i) abort (); if (__builtin_mips_all_c_eq_ps(a, b) != j) abort (); /* c.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {12, 78}; i = 1; j = 0; if (__builtin_mips_any_c_eq_ps(a, b) != i) abort (); if (__builtin_mips_all_c_eq_ps(a, b) != j) abort (); /* c.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {56, 34}; i = 1; j = 0; if (__builtin_mips_any_c_eq_ps(a, b) != i) abort (); if (__builtin_mips_all_c_eq_ps(a, b) != j) abort (); /* c.eq.ps */ a = (v2sf) {12, 34}; b = (v2sf) {12, 34}; i = 1; j = 1; if (__builtin_mips_any_c_eq_ps(a, b) != i) abort (); if (__builtin_mips_all_c_eq_ps(a, b) != j) abort (); /* Test with 16 operators */ a = (v2sf) {10.58, 1984.0}; b = (v2sf) {567.345, 1984.0}; i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 0) abort (); i = test3 (a, b); if (i != 0) abort (); i = test4 (a, b); if (i != 1) abort (); i = test5 (a, b); if (i != 0) abort (); i = test6 (a, b); if (i != 1) abort (); i = test7 (a, b); if (i != 0) abort (); i = test8 (a, b); if (i != 1) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 1) abort (); i = test11 (a, b); if (i != 0) abort (); i = test12 (a, b); if (i != 1) abort (); i = test13 (a, b); if (i != 1) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); i = test16 (a, b); if (i != 0) abort (); i = test17 (a, b); if (i != 0) abort (); i = test18 (a, b); if (i != 0) abort (); i = test19 (a, b); if (i != 0) abort (); i = test20 (a, b); if (i != 1) abort (); i = test21 (a, b); if (i != 0) abort (); i = test22 (a, b); if (i != 1) abort (); i = test23 (a, b); if (i != 0) abort (); i = test24 (a, b); if (i != 1) abort (); i = test25 (a, b); if (i != 0) abort (); i = test26 (a, b); if (i != 1) abort (); i = test27 (a, b); if (i != 0) abort (); i = test28 (a, b); if (i != 1) abort (); i = test29 (a, b); if (i != 1) abort (); i = test30 (a, b); if (i != 1) abort (); i = test31 (a, b); if (i != 1) abort (); /* Reverse arguments */ i = test0 (b, a); if (i != 0) abort (); i = test1 (b, a); if (i != 0) abort (); i = test2 (b, a); if (i != 0) abort (); i = test3 (b, a); if (i != 0) abort (); i = test4 (b, a); if (i != 1) abort (); i = test5 (b, a); if (i != 0) abort (); i = test6 (b, a); if (i != 1) abort (); i = test7 (b, a); if (i != 0) abort (); i = test8 (b, a); if (i != 0) abort (); i = test9 (b, a); if (i != 0) abort (); i = test10 (b, a); if (i != 0) abort (); i = test11 (b, a); if (i != 0) abort (); i = test12 (b, a); if (i != 1) abort (); i = test13 (b, a); if (i != 0) abort (); i = test14 (b, a); if (i != 1) abort (); i = test15 (b, a); if (i != 0) abort (); i = test16 (b, a); if (i != 0) abort (); i = test17 (b, a); if (i != 0) abort (); i = test18 (b, a); if (i != 0) abort (); i = test19 (b, a); if (i != 0) abort (); i = test20 (b, a); if (i != 1) abort (); i = test21 (b, a); if (i != 0) abort (); i = test22 (b, a); if (i != 1) abort (); i = test23 (b, a); if (i != 0) abort (); i = test24 (b, a); if (i != 0) abort (); i = test25 (b, a); if (i != 0) abort (); i = test26 (b, a); if (i != 0) abort (); i = test27 (b, a); if (i != 0) abort (); i = test28 (b, a); if (i != 1) abort (); i = test29 (b, a); if (i != 0) abort (); i = test30 (b, a); if (i != 1) abort (); i = test31 (b, a); if (i != 0) abort (); #ifndef __FAST_MATH__ /* Test with 16 operators */ a = (v2sf) {qnan, qnan}; b = (v2sf) {567.345, 1984.0}; i = test0 (a, b); if (i != 0) abort (); i = test1 (a, b); if (i != 0) abort (); i = test2 (a, b); if (i != 1) abort (); i = test3 (a, b); if (i != 1) abort (); i = test4 (a, b); if (i != 0) abort (); i = test5 (a, b); if (i != 0) abort (); i = test6 (a, b); if (i != 1) abort (); i = test7 (a, b); if (i != 1) abort (); i = test8 (a, b); if (i != 0) abort (); i = test9 (a, b); if (i != 0) abort (); i = test10 (a, b); if (i != 1) abort (); i = test11 (a, b); if (i != 1) abort (); i = test12 (a, b); if (i != 0) abort (); i = test13 (a, b); if (i != 0) abort (); i = test14 (a, b); if (i != 1) abort (); i = test15 (a, b); if (i != 1) abort (); i = test16 (a, b); if (i != 0) abort (); i = test17 (a, b); if (i != 0) abort (); i = test18 (a, b); if (i != 1) abort (); i = test19 (a, b); if (i != 1) abort (); i = test20 (a, b); if (i != 0) abort (); i = test21 (a, b); if (i != 0) abort (); i = test22 (a, b); if (i != 1) abort (); i = test23 (a, b); if (i != 1) abort (); i = test24 (a, b); if (i != 0) abort (); i = test25 (a, b); if (i != 0) abort (); i = test26 (a, b); if (i != 1) abort (); i = test27 (a, b); if (i != 1) abort (); i = test28 (a, b); if (i != 0) abort (); i = test29 (a, b); if (i != 0) abort (); i = test30 (a, b); if (i != 1) abort (); i = test31 (a, b); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }