int main () { v2sf a, b, c, d; int i, j; /* cabs.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_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.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_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.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_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.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_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.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_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.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_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_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, char **argv){ return test1(argc, argv) + test2(argc, argv); //return MYFTPP_test_sync(100, stdout); }
int main(void) { int a[] = {1, 2, 3, 4, 5, 6, 7, 8}; int b[] = {4, 6, 8, 2, 4, 3, 5, 8}; int c[8]; int size = sizeof(a) / sizeof(a[0]); int v1[] = {1, 2, 3}; int v2[] = {3, 4, 7}; int vsize = sizeof(v1) / sizeof(v1[0]); int v3[sizeof(v1) / sizeof(v1[0])]; int product; /* reverse an array */ printf("Array a:\n"); print_array(a, size); reverse_array(a, size); printf("Array a reversed:\n"); print_array(a, size); printf("\n"); /* add two arrays into a third array */ printf("Array b:\n"); print_array(b, size); add_arrays(a, b, c, size); printf("Array c (sum of array a and array b):\n"); print_array(c, size); printf("\n"); /* multiply each element by 10 */ scalar_multiply(c, size, 10); printf("All values of c multiplied by 10:\n"); print_array(c, size); printf("\n"); /* multiply two arrays (dot product) */ printf("Array v1:"); print_array(v1, vsize); printf("Array v2:"); print_array(v2, vsize); product = dot_product(v1, v2, vsize); printf("The dot product of v1 * v2 is %i\n", product); printf("\n"); /* multiply two arrays (cross product) */ printf("Array v1:"); print_array(v1, vsize); printf("Array v2:"); print_array(v2, vsize); cross_product(v1, v2, v3); printf("The cross product of v1 x v2 is:"); print_array(v3, 3); printf("\n"); /* more tests */ test1(); test2(); printf("\n"); return 0; }
int main(){ test1(); // test3(); }
dgInt32 dgCollisionCylinder::CalculatePlaneIntersection (const dgVector& normal, const dgVector& origin, dgVector* const contactsOut) const { dgInt32 count = 0; if (normal.m_x < dgFloat32 (-0.995f)) { if (normal.m_x < dgFloat32(-0.9995f)) { dgMatrix matrix(normal); matrix.m_posit.m_x = origin.m_x; dgVector scale(m_radio0); const int n = sizeof (m_unitCircle) / sizeof (m_unitCircle[0]); for (dgInt32 i = 0; i < n; i++) { contactsOut[i] = matrix.TransformVector(m_unitCircle[i].CompProduct4(scale)) & dgVector::m_triplexMask; } count = RectifyConvexSlice(n, normal, contactsOut); } else { dgFloat32 magInv = dgRsqrt(normal.m_y * normal.m_y + normal.m_z * normal.m_z); dgFloat32 cosAng = normal.m_y * magInv; dgFloat32 sinAng = normal.m_z * magInv; dgAssert(dgAbsf(normal.m_z * cosAng - normal.m_y * sinAng) < dgFloat32(1.0e-4f)); dgVector normal1(normal.m_x, normal.m_y * cosAng + normal.m_z * sinAng, dgFloat32(0.0f), dgFloat32(0.0f)); dgVector origin1(origin.m_x, origin.m_y * cosAng + origin.m_z * sinAng, origin.m_z * cosAng - origin.m_y * sinAng, dgFloat32(0.0f)); count = dgCollisionConvex::CalculatePlaneIntersection(normal1, origin1, contactsOut); if (count > 6) { dgInt32 dy = 2 * 6; dgInt32 dx = 2 * count; dgInt32 acc = dy - count; dgInt32 index = 0; for (dgInt32 i = 0; i < count; i++) { if (acc > 0) { contactsOut[index] = contactsOut[i]; index++; acc -= dx; } acc += dy; } count = index; } for (dgInt32 i = 0; i < count; i++) { dgFloat32 y = contactsOut[i].m_y; dgFloat32 z = contactsOut[i].m_z; contactsOut[i].m_y = y * cosAng - z * sinAng; contactsOut[i].m_z = z * cosAng + y * sinAng; } } } else if (normal.m_x > dgFloat32 (0.995f)) { if (normal.m_x > dgFloat32 (0.9995f)) { dgMatrix matrix(normal); matrix.m_posit.m_x = origin.m_x; dgVector scale(m_radio1); const int n = sizeof (m_unitCircle) / sizeof (m_unitCircle[0]); for (dgInt32 i = 0; i < n; i++) { contactsOut[i] = matrix.TransformVector(m_unitCircle[i].CompProduct4(scale)) & dgVector::m_triplexMask; } count = RectifyConvexSlice(n, normal, contactsOut); } else { dgFloat32 magInv = dgRsqrt(normal.m_y * normal.m_y + normal.m_z * normal.m_z); dgFloat32 cosAng = normal.m_y * magInv; dgFloat32 sinAng = normal.m_z * magInv; dgAssert(dgAbsf(normal.m_z * cosAng - normal.m_y * sinAng) < dgFloat32(1.0e-4f)); dgVector normal1(normal.m_x, normal.m_y * cosAng + normal.m_z * sinAng, dgFloat32(0.0f), dgFloat32(0.0f)); dgVector origin1(origin.m_x, origin.m_y * cosAng + origin.m_z * sinAng, origin.m_z * cosAng - origin.m_y * sinAng, dgFloat32(0.0f)); count = dgCollisionConvex::CalculatePlaneIntersection(normal1, origin1, contactsOut); if (count > 6) { dgInt32 dy = 2 * 6; dgInt32 dx = 2 * count; dgInt32 acc = dy - count; dgInt32 index = 0; for (dgInt32 i = 0; i < count; i++) { if (acc > 0) { contactsOut[index] = contactsOut[i]; index++; acc -= dx; } acc += dy; } count = index; } for (dgInt32 i = 0; i < count; i++) { dgFloat32 y = contactsOut[i].m_y; dgFloat32 z = contactsOut[i].m_z; contactsOut[i].m_y = y * cosAng - z * sinAng; contactsOut[i].m_z = z * cosAng + y * sinAng; } } } else { dgFloat32 magInv = dgRsqrt(normal.m_y * normal.m_y + normal.m_z * normal.m_z); dgFloat32 cosAng = normal.m_y * magInv; dgFloat32 sinAng = normal.m_z * magInv; dgAssert(dgAbsf(normal.m_z * cosAng - normal.m_y * sinAng) < dgFloat32(1.0e-4f)); dgVector normal1(normal.m_x, normal.m_y * cosAng + normal.m_z * sinAng, dgFloat32(0.0f), dgFloat32(0.0f)); dgVector origin1(origin.m_x, origin.m_y * cosAng + origin.m_z * sinAng, origin.m_z * cosAng - origin.m_y * sinAng, dgFloat32(0.0f)); count = 0; int i0 = 3; dgVector test0((m_profile[i0] - origin1).DotProduct4(normal1)); for (int i = 0; (i < 4) && (count < 2); i++) { dgVector test1((m_profile[i] - origin1).DotProduct4(normal1)); dgVector acrossPlane(test0.CompProduct4(test1)); if (acrossPlane.m_x < 0.0f) { dgVector step(m_profile[i] - m_profile[i0]); contactsOut[count] = m_profile[i0] - step.Scale4(test0.m_x / (step.DotProduct4(normal1).m_x)); count++; } i0 = i; test0 = test1; } for (dgInt32 i = 0; i < count; i++) { dgFloat32 y = contactsOut[i].m_y; dgFloat32 z = contactsOut[i].m_z; contactsOut[i].m_y = y * cosAng - z * sinAng; contactsOut[i].m_z = z * cosAng + y * sinAng; } } return count; }
int main(void) { test1(); test2(); return 0; }
int main(int argc, char* argv[]) { char* p = test1(); test2(); return 0; }
int main(int argc, char *argv[]) { // debug level verbosity: 0-silent, 1-oneline, 2-more 3-full // char *s; int nfailed = 0; int dbglvl = 1; HTM_ID id; char futyi[50] = "J2000 6 41.4 47.9"; // s = (char *) malloc(1024); if(1){ nfailed += test1(dbglvl); nfailed += test2(dbglvl); nfailed += test3(dbglvl); nfailed += test4(dbglvl); nfailed += itest1(dbglvl); nfailed += itest2(dbglvl); nfailed += itest3(dbglvl); nfailed += itest4(dbglvl); nfailed += itest5(dbglvl); nfailed += itest6(dbglvl); nfailed += itest7(dbglvl); nfailed += itest8(dbglvl); nfailed += itest9(dbglvl); nfailed += itest9(dbglvl); nfailed += itest10(dbglvl); nfailed += itest11(dbglvl); } if(1){ //ckp1(); htmSqlInterface *htm = new htmSqlInterface(6); id = htm->lookupID(futyi); delete htm; nfailed += mtest_lookup(dbglvl); //ckp2(); //s2s1(); } { time_t timer; time_t now, then; long initial = 10000L; long counter = initial; htmSqlInterface *htm = new htmSqlInterface(6); now = time( &timer ); while(counter-- > 0){ // if ((counter % 10000) == 0) // cerr << "Here: " << counter << std::endl; id = htm->lookupID(futyi); } then = time (&timer); std::cout << initial << " iterations in " << then - now << " seconds" << std::endl; std::cout << initial / (double) (then - now) << " per second" << std::endl; std::cout << (1000.0 * (then - now)) / initial << " milliseconds each" << std::endl; } showtest("All tests", nfailed, 1); { double ra, dec; int level; cc_parseVectors(futyi, &level, &ra, &dec); cc_radec2ID(ra, dec); std::cout << "Futyi: (" << level << ") " << ra << ", " << dec << std::endl; } return 0; }
int main(int argc, char *argv[]) { return test1() + test2(); }
void test2() { char* p = test1(); free(p); p = NULL; }
NOMIPS16 int main () { v2sf a, b, c, d, e, f; /* Case 1 {diff, diff} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-7, -6}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Case 2 {same, diff} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-5, -6}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Case 3 {diff, same} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-9, -12}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Case 4 {same, same} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-5, -12}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Test all 16 operators */ a = (v2sf) {-123, 123}; b = (v2sf) {1000, -1000}; c = (v2sf) {-33, 123}; d = (v2sf) {8, -78}; e = test0 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test1 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test2 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test3 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test4 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test5 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test6 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test7 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test8 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test9 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test10 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test11 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test12 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test13 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test14 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test15 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test16 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test17 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test18 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test19 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test20 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test21 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test22 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test23 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test24 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test25 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test26 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test27 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test28 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test29 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test30 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test31 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); /* Reversed arguments */ e = test0 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test1 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test2 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test3 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test4 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test5 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test6 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test7 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test8 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test9 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test10 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test11 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test12 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test13 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test14 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test15 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test16 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test17 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test18 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test19 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test20 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test21 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test22 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test23 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test24 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test25 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test26 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test27 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test28 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test29 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test30 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test31 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); #ifndef __FAST_MATH__ /* Test all 16 operators */ a = (v2sf) {qnan, qnan}; b = (v2sf) {1000, -1000}; c = (v2sf) {8, -78}; d = (v2sf) {-33, 123}; e = test0 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test1 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test2 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test3 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test4 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test5 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test6 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test7 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test8 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test9 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test10 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test11 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test12 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test13 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test14 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test15 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test16 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test17 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test18 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test19 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test20 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test21 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test22 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test23 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test24 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test25 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test26 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test27 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test28 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test29 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test30 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test31 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); #endif printf ("Test Passes\n"); exit (0); }
int test(char** p) { test1(p); printf("1111 %x\n", p); return 0; }
int MEKD_Test_Debug_Ghosts_Test1() { /// TEST 1 if( Show_Description ) cout << "\n -- STARTING TEST 1 -- \n"; const unsigned int Nr_of_models = 21; double ME[Nr_of_models]; double ME_shuffled[Nr_of_models]; MEKD test1(8.0, ""); string model[Nr_of_models]; model[0] = "ZZ"; model[1] = "ggSpin0Pm"; model[2] = "ggSpin0Ph"; model[3] = "ggSpin0M"; model[4] = "qqZ4l_Background"; model[5] = "qqZ4l_Signal"; model[6] = "qqSpin1M"; model[7] = "qqSpin1P"; model[8] = "ggSpin2Pm"; //8 model[9] = "ggSpin2Ph"; //9 model[10] = "ggSpin2Mh"; //10 model[11] = "ggSpin2Pb"; //11 model[12] = "Spin0Pm"; model[13] = "Spin0Ph"; model[14] = "Spin0M"; model[15] = "Spin1M"; model[16] = "Spin1P"; model[17] = "Spin2Pm"; model[18] = "Spin2Ph"; model[19] = "Spin2Mh"; model[20] = "Spin2Pb"; if( Show_Description ) cout << "Testing ME ordering using int computeME( string, vector<double*>, vector<int>, double& );\n"; for( unsigned int count=0; count < Nr_of_models; count++ ) { if( (error_value=test1.computeME( model[count], Set_Of_Arrays, Set_Of_IDs, ME[count] )) != 0 ) cout << "ERROR CODE in ME for " << model[count] << "; Err: " << error_value << endl; } if( Show_Basic_Data ) { if( Show_Description ) cout << "Initial results, before any permutation.\n"; cout.width( 20 ); cout << std::left << "Model" << std::right << "ME value\n\n"; for( unsigned int count=0; count < Nr_of_models; count++ ) { cout.width( 20 ); cout << std::left << model[count] << std::right << ME[count] << endl; } } unsigned int order[Nr_of_models]; for( unsigned int count=0; count < Nr_of_models; count++ ) order[count] = count; std::sort( order, order+Nr_of_models ); for( unsigned int perm=0; perm < shuffles_for_ghosts; perm++ ) { std::random_shuffle( order, order+Nr_of_models ); for( unsigned int count=0; count < Nr_of_models; count++ ) { if( (error_value=test1.computeME( model[order[count]], Set_Of_Arrays, Set_Of_IDs, ME_shuffled[order[count]] )) != 0 ) cout << "ERROR CODE in ME for " << model[order[count]] << "; Err: " << error_value << endl; if( (ME[order[count]] - ME_shuffled[order[count]]) != 0 ) { if( Show_Basic_Data ) { cout << "Problem in moving order of calculation for " << model[order[count]] << " detected!\n"; cout << "Previously calculated models in this shuffle: "; for( unsigned int count2=0; count2 < count; count2++ ) cout << model[order[count2]] << " "; } return 1; } } if( Show_Debug ) { if( Show_Description ) cout << "Results after a permutation.\n"; cout.width( 20 ); cout << std::left << "Model" << std::right << "ME value\n\n"; for( unsigned int count=0; count < Nr_of_models; count++ ) { cout.width( 20 ); cout << std::left << model[count] << std::right << ME_shuffled[count] << endl; } } } return 0; }
int main() { test1(); test2(); }
/* * function: main() */ int main(int argc, char *argv[]) { printf("bytes test:\n"); test1(); printf("\nhex test:\n"); test2(); }
void test ( const CharT *s ) { typedef std::experimental::basic_string_view<CharT> string_view_t; string_view_t sv1 ( s ); test1(sv1, 0, 0); test1(sv1, 1, 0); test1(sv1, 20, 0); test1(sv1, sv1.size(), 0); test1(sv1, 0, 3); test1(sv1, 2, 3); test1(sv1, 100, 3); test1(sv1, 0, string_view_t::npos); test1(sv1, 2, string_view_t::npos); test1(sv1, sv1.size(), string_view_t::npos); test1(sv1, sv1.size() + 1, 0); test1(sv1, sv1.size() + 1, 1); test1(sv1, sv1.size() + 1, string_view_t::npos); }
int main() { test1(); return 0; }
int main() { test0(); test1(); }
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 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"); } fprintf(test_out, "executing test13\n"); if (test13()) { fprintf(test_out, "Test13 succeeded\n"); } else { fprintf(test_out, "opal_dss test13 failed\n"); } fclose(test_out); opal_finalize(); return(0); }
main() { struct timespec start_time; /* Clock value just before test1 */ struct timespec end_time_1; /* Clock value just after test1 & before test2 */ struct timespec end_time_2; /* Clock value just after test2 & before test3 */ struct timespec end_time_3; /* Clock value just after test2 */ float secs_diff_1, ns_diff_1, diff_1; float secs_diff_2, ns_diff_2, diff_2; float secs_diff_3, ns_diff_3, diff_3; float sum_1=0, avg_1=0 ; float sum_2=0, avg_2=0 ; float sum_3=0, avg_3=0 ; int i, j, n; double C, D, P; bool ans1, ans2, ans3; bool third = NULL; /* Get task sets from user*/ printf ("%s\n", "Enter the number of tasks"); scanf("%d" , &total_tasks); for (i=0; i < total_tasks; i++ ) { printf ( "Enter parameters(execution time, relative deadline, period) for task %i \n" ,i); scanf ("%lf %lf %lf" , &task[i][0],&task[i][1],&task[i][2]); } /*Conditions to perform each tests*/ for (j=0; j < total_tasks; j++) { /*Compare relative deadline to the period*/ if( task[j][1] <= task[j][2] ) { third=true; } else { third=false; } } /*Measure time interval 1000 times for each of test*/ for (n=0; n < 1000 ; n++) { /* Record the start time for test1 */ clock_gettime(CLOCK_REALTIME, &start_time); ans1=test1(); /* Record the end time for test1 and start time for test2*/ clock_gettime(CLOCK_REALTIME, &end_time_1); ans2=test2(); /* Record the end time for test2 and start time for test3 */ clock_gettime(CLOCK_REALTIME, &end_time_2); ans3=test3(); /* Record the end time for test3 */ clock_gettime(CLOCK_REALTIME, &end_time_3); /* Test1:Compute the difference between the start time and the end time */ secs_diff_1 = (long)(end_time_1.tv_sec) - (long)(start_time.tv_sec); ns_diff_1 = end_time_1.tv_nsec - start_time.tv_nsec; diff_1 = secs_diff_1 * 1000000000 + ns_diff_1; sum_1 = diff_1 + sum_1; /* Test2:Compute the difference between the start time and the end time */ secs_diff_2 = (long)(end_time_2.tv_sec) - (long)(end_time_1.tv_sec); ns_diff_2 = end_time_2.tv_nsec - end_time_1.tv_nsec; diff_2 = secs_diff_2 * 1000000000 + ns_diff_2; sum_2 = diff_2+ sum_2; /* Test3:Compute the difference between the start time and the end time */ secs_diff_3 = (long)(end_time_3.tv_sec) - (long)(end_time_2.tv_sec); ns_diff_3 = end_time_3.tv_nsec - end_time_2.tv_nsec; diff_3 = secs_diff_3 * 1000000000 + ns_diff_3; sum_3 = diff_3 + sum_3; } /* Finding the average time for each test*/ avg_1 = (sum_1/1000.00)/1000000.00; avg_2 = (sum_2/1000.00)/1000000.00; avg_3 = (sum_3/1000.00)/1000000.00; /* Liu& Layland and Hyperbolic bound not applicable if relative deadline smaller than period*/ if(third==true) { printf( "Liu and Layland bound: not applicable (time: 0 ms)\n"); printf( "Hyperbolic bound: not applicable (time: 0 ms)\n"); if (ans3==true){ printf( "Response time analysis: schedulable (time: %4.6f ms)\n",avg_3); } else { printf( "Response time analysis: not schedulable (time: %4.6f ms)\n",avg_3); } } /* Liu& Layland applicable*/ else if (third==false) { if (ans1==true){ printf( "Liu and Layland bound: schedulable (time: %4.6f ms)\n",avg_1); } else { printf( "Liu and Layland bound: not schedulable (time: %4.6f ms)\n",avg_1); } if (ans2==true){ printf( "Hyperbolic bound: schedulable (time: %4.6f ms)\n",avg_2); } else { printf( "Hyperbolic bound: not schedulable (time: %4.6f ms)\n",avg_2); } printf( "Response time analysis: not applicable (time: 0 ms)\n"); } }
int main() { test1(30); test2(30); test3(30); }
int main() { test1(); }
int main() { test1(); test2(); test3(); return 0; }
std::string test1_nonvirt() const { return test1(); }
int main (int argc, char* argv[]) { int ret = 0; 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"); ret = 1; } fprintf(test_out, "executing test2\n"); if (test2()) { fprintf(test_out, "Test2 succeeded\n"); } else { fprintf(test_out, "Test2 failed\n"); ret = 2; } fprintf(test_out, "executing test3\n"); if (test3()) { fprintf(test_out, "Test3 succeeded\n"); } else { fprintf(test_out, "Test3 failed\n"); ret = 3; } fprintf(test_out, "executing test4\n"); if (test4()) { fprintf(test_out, "Test4 succeeded\n"); } else { fprintf(test_out, "Test4 failed\n"); ret = 4; } fprintf(test_out, "executing test5\n"); if (test5()) { fprintf(test_out, "Test5 succeeded\n"); } else { fprintf(test_out, "Test5 failed\n"); ret = 5; } fprintf(test_out, "executing test6\n"); if (test6()) { fprintf(test_out, "Test6 succeeded\n"); } else { fprintf(test_out, "Test6 failed\n"); ret = 6; } fprintf(test_out, "executing test7\n"); if (test7()) { fprintf(test_out, "Test7 succeeded\n"); } else { fprintf(test_out, "Test7 failed\n"); ret = 7; } fprintf(test_out, "executing test8\n"); if (test8()) { fprintf(test_out, "Test8 succeeded\n"); } else { fprintf(test_out, "Test8 failed\n"); ret = 8; } fprintf(test_out, "executing test9\n"); if (test9()) { fprintf(test_out, "Test9 succeeded\n"); } else { fprintf(test_out, "opal_dss test9 failed\n"); ret = 9; } fprintf(test_out, "executing test10\n"); if (test10()) { fprintf(test_out, "Test10 succeeded\n"); } else { fprintf(test_out, "opal_dss test10 failed\n"); ret = 10; } fprintf(test_out, "executing test11\n"); if (test11()) { fprintf(test_out, "Test11 succeeded\n"); } else { fprintf(test_out, "opal_dss test11 failed\n"); ret = 11; } fprintf(test_out, "executing test12\n"); if (test12()) { fprintf(test_out, "Test12 succeeded\n"); } else { fprintf(test_out, "opal_dss test12 failed\n"); ret = 12; } fclose(test_out); opal_finalize(); return ret; }