// Test the same things as for constructor
// now using experimental assignment operator
void runCIMNameAssignmentTests()
{
    // this is part of the experimental interface
    // valid assignment calls
    test11();
    // UTF-8 related tests, circumvent if UTF-8 support disabled
    test12();
    test13();
    // invalid assignment calls
    test14();
    test15();
    test16();
}
Beispiel #2
0
void initWorldModelling(int testcase)
{
    /* create world */
    dRandSetSeed(1);
    dInitODE();
    //dInitODE2(dInitFlagManualThreadCleanup);
    //dAllocateODEDataForThread(dAllocateMaskAll);
    world = dWorldCreate();
    space = dHashSpaceCreate (0);

    //dWorldSetAutoDisableFlag(World, 1);

    // The parameter needs to be zero.
    contactgroup = dJointGroupCreate (0);
    dWorldSetGravity (world,0,-9.81f,0);
    dWorldSetCFM (world,1e-2f);   //1e-5f was the originally value used.
    dWorldSetERP(world,1.0f);   // 1 is Error Correction is applied.

    // Set Damping
    dWorldSetLinearDamping(world, 0.01f);  // 0.00001
    dWorldSetAngularDamping(world, 0.005f);     // 0.005
    dWorldSetMaxAngularSpeed(world, 200);

    // Set and get the depth of the surface layer around all geometry objects. Contacts are allowed to sink into the surface layer up to the given depth before coming to rest. The default value is zero. Increasing this to some small value (e.g. 0.001) can help prevent jittering problems due to contacts being repeatedly made and broken.
    dWorldSetContactSurfaceLayer (world,0.001f);

    ground = dCreatePlane (space,0,1,0,0);



    switch(testcase)
    {
    case 1:initIslands();test1();break;// Carrier stability
    case 2:initIslands();test1();test2();break;// Manta landing on island.
    case 3:initIslands();test1();test2();test3();break;// Manta crashing on structure
    case 4:initIslands();test1();test2();test3();test4();break;// Manta landing on runway
    case 5:initIslands();test1();test2();break;// Manta landing on aircraft
    case 6:initIslands();test1();test6();break;// Carrier stranded on island
    case 7:test1();test2();test7();break; //Manta crashing on water.
    case 8:initIslands();test1();test8();break; // Walrus reaching island.
    case 9:test1();test9();break; // Walrus stability.
    case 10:initIslands();test1();test10();break; // Walrus arrive to island and build the command center.
    case 11:initIslands();test11();break; // Carrier stability far away.
    case 12:initIslands();test1();test12();break; // Bullets
    case 13:initIslands();test13();break;
    default:initIslands();test1();break;
    }

    testing = testcase;

}
void parse_cmd(String str)
{
  if(str == "help") {printHelp();}
  else if(str == "t1") {test01(RUNTEST);}
  else if(str == "t2") {test02(RUNTEST);}
  else if(str == "t3") {test03(RUNTEST);}
  else if(str == "t4") {test04(RUNTEST);}
  else if(str == "t5") {test05(RUNTEST);}
  else if(str == "t6") {test06(RUNTEST);}
  else if(str == "t7") {test07(RUNTEST);}
  else if(str == "t8") {test08(RUNTEST);}
  else if(str == "t9") {test09(RUNTEST);}
  else if(str == "ta") {test10(RUNTEST);}
  else if(str == "tb") {test11(RUNTEST);}
  else if(str == "tc") {test12(RUNTEST);}
  else if(str == "td") {test13(RUNTEST);}
  else if(str == "te") {test14(RUNTEST);}
  else if(str == "tf") {test15(RUNTEST);}

  else if(str == "d1") {test01(DESCRIPTION);}
  else if(str == "d2") {test02(DESCRIPTION);}
  else if(str == "d3") {test03(DESCRIPTION);}
  else if(str == "d4") {test04(DESCRIPTION);}
  else if(str == "d5") {test05(DESCRIPTION);}
  else if(str == "d6") {test06(DESCRIPTION);}
  else if(str == "d7") {test07(DESCRIPTION);}
  else if(str == "d8") {test08(DESCRIPTION);}
  else if(str == "d9") {test09(DESCRIPTION);}
  else if(str == "da") {test10(DESCRIPTION);}
  else if(str == "db") {test11(DESCRIPTION);}
  else if(str == "dc") {test12(DESCRIPTION);}
  else if(str == "dd") {test13(DESCRIPTION);}
  else if(str == "de") {test14(DESCRIPTION);}
  else if(str == "df") {test15(DESCRIPTION);}

  else {Serial.print("\n\rBad Command: "); Serial.println(str);}
}
Beispiel #4
0
void		test_operatorMult()
{
  std::cout << "Start operator *" << std::endl;
  //The lines below is about overflow operations *, to check it
  //uncomment the lines below :
  // numeric::Fraction<int> test(std::numeric_limits<int>::max(), 3);
  // numeric::Fraction<int> test2(3, 7);
  // numeric::Fraction<int> result = test * test2;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int> test3(std::numeric_limits<int>::min(), 3);
  // numeric::Fraction<int> test4(2, 9);
  // numeric::Fraction<int> result2 = test3 * test4;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int> test5(std::numeric_limits<int>::min(), 3);
  // numeric::Fraction<int> test6(std::numeric_limits<int>::min(), 9);
  // numeric::Fraction<int> result3 = test5 * test6;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int> test7(2, std::numeric_limits<int>::max());
  // numeric::Fraction<int> test8(3, std::numeric_limits<int>::max());
  // numeric::Fraction<int> result3 = test7 * test8;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int> test9(4, std::numeric_limits<int>::min());
  // numeric::Fraction<int> test10(3, std::numeric_limits<int>::min());
  // numeric::Fraction<int> result4 = test9 * test10;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int> test11(9, std::numeric_limits<int>::max());
  // numeric::Fraction<int> test12(5, std::numeric_limits<int>::min());
  // numeric::Fraction<int> result5 = test11 * test12;
  numeric::Fraction<int>    test13(4, 9);
  numeric::Fraction<int>    test14(2, 3);
  numeric::Fraction<int>    result6 = test13 * test14;
  numeric::Fraction<int> const    result6_test(8, 27);
  if (result6 == result6_test)
    std::cout << "OK" << std::endl;
  else
    std::cout << "KO" << std::endl;
  numeric::Fraction<int>    test15(7, 12);
  numeric::Fraction<int>    test16(1, 1);
  numeric::Fraction<int>    result7 = test15 * test16;
  numeric::Fraction<int> const    result7_test(7, 12);
  if (result7 == result7_test)
    std::cout << "OK" << std::endl;
  else
    std::cout << "KO" << std::endl;
  numeric::Fraction<int>   test17(8, 0);
  numeric::Fraction<int>   test18(-1, 0);
  numeric::Fraction<int>   result8 = test17 * test18;
  std::cout << "-Inf" << " " << "RESULT = " << result8 << std::endl;
}
Beispiel #5
0
void		test_operatorDiv()
{
  std::cout << "Start operator /" << std::endl;
  //The lines below is about overflow operations /, to check
  //the assertions, please uncomment the lines below :
  // numeric::Fraction<int>	test1(std::numeric_limits<int>::max(), 3);
  // numeric::Fraction<int>	test2(5, std::numeric_limits<int>::max());
  // numeric::Fraction<int>	result = test1 / test2;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int>	test3(3, 80);
  // numeric::Fraction<int>	test4(std::numeric_limits<int>::max(), 2);
  // numeric::Fraction<int>	result2 = test3 / test4;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int>	test5(std::numeric_limits<int>::min(), 9);
  // numeric::Fraction<int>	test6(9, 8);
  // numeric::Fraction<int>	result3 = test5 / test6;
  // std::cout << "FAIL" << std::endl;
  // numeric::Fraction<int>	test7(9, 66);
  // numeric::Fraction<int>	test8(44, std::numeric_limits<int>::max());
  // numeric::Fraction<int>	result4 = test7 / test8;
  // std::cout << "FAIL" << std::endl;
  numeric::Fraction<int>	test9(3, 5);
  numeric::Fraction<int>	test10(7, 2);
  numeric::Fraction<int>	result5 = test9 / test10;
  numeric::Fraction<int> const	result_test5(6, 35);
  if (result5 == result_test5)
    std::cout << "OK" << std::endl;
  else
    std::cout << "KO" << std::endl;
  numeric::Fraction<int>	test11(9, 12);
  numeric::Fraction<int>	test12(12, 9);
  numeric::Fraction<int>	result6 = test11 / test12;
  numeric::Fraction<int> const	result_test6(81, 144);
  if (result6 == result_test6)
    std::cout << "OK" << std::endl;
  else
    std::cout << "KO" << std::endl;
  numeric::Fraction<int>	test13(0, 0);
  numeric::Fraction<int>	test14(12, 3);
  numeric::Fraction<int>	result7 = test13 / test14;
  std::cout << "RESULT = " << result7  << std::endl << "Result supposed to be = NaN" << std::endl;
  numeric::Fraction<int>	test15(10, 0);
  numeric::Fraction<int>	test16(4, -9);
  numeric::Fraction<int>	result8 = test15 / test16;
  std::cout << "RESULT = " << result8 << std::endl << "Result supposed to be = -Inf" << std::endl;
}
void Test::runTests()
{

        int score = 0;

        std::cerr << "\n\n=========================\n";
        std::cerr << "   RUNNING TEST SUITE    \n";
        std::cerr << "=========================\n\n";

        //Run test and award points where appropriate
        score += test1() ? 1: 0;
        score += test2() ? 1: 0;
        score += test3() ? 1: 0;
        score += test4() ? 2: 0;
        score += test5() ? 2: 0;
        score += test6() ? 2: 0;
        score += test7() ? 2: 0;
        score += test8() ? 1: 0;
        score += test9() ? 2: 0;
        score += test10() ? 2: 0;
        score += test11() ? 1: 0;
        score += test12() ? 3: 0;
        score += test13() ? 1: 0;
        score += test14() ? 1: 0;
        score += test15() ? 2: 0;
        score += test16() ? 2: 0;
        score += test17() ? 3: 0;
        score += test18() ? 3: 0;
        score += test19() ? 3: 0;
        score += test20() ? 2: 0;
        score += test21() ? 2: 0;
        score += test22() ? 3: 0;
        score += test23() ? 5: 0;
        score += test24() ? 2: 0;
        score += test25() ? 2: 0;
        score += test26() ? 3: 0;
        score += test27() ? 3: 0;
        score += test28() ? 2: 0;
        score += test29() ? 2: 0;
        score += test30() ? 7: 0;
        score += test31() ? 7: 0;


        std::cerr << "Score: " << score << " / " << MAX_SCORE << std::endl;
}
Beispiel #7
0
int main() {
  test1();
  test2();
  test3();
  test4();
  test5();
  test6();
  test7();
  test8();
  test9();
  test10();
  test11();
  test12();
  test13();

  printf("No errors detected!\n");

  return CORRECT;
}
Beispiel #8
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)
{
   test01();
   test02();
   test03();
   test04();
   test05();
   test06();
   test07();
   test08();
   test09();
   test10();
   test11();
   test12();
   test13();
   test14();
   test15();
   test16();
   test17();
   return 0;
}
void printHelp(void)
{
  Serial.println("Tests:");
   Serial.print("  "); test01(TESTHELP); Serial.println();
   Serial.print("  "); test02(TESTHELP); Serial.println();
   Serial.print("  "); test03(TESTHELP); Serial.println();
   Serial.print("  "); test04(TESTHELP); Serial.println();
   Serial.print("  "); test05(TESTHELP); Serial.println();
   Serial.print("  "); test06(TESTHELP); Serial.println();
   Serial.print("  "); test07(TESTHELP); Serial.println();
   Serial.print("  "); test08(TESTHELP); Serial.println();
   Serial.print("  "); test09(TESTHELP); Serial.println();
   Serial.print("  "); test10(TESTHELP); Serial.println();
   Serial.print("  "); test11(TESTHELP); Serial.println();
   Serial.print("  "); test12(TESTHELP); Serial.println();
   Serial.print("  "); test13(TESTHELP); Serial.println();
   Serial.print("  "); test14(TESTHELP); Serial.println();
   Serial.print("  "); test15(TESTHELP); Serial.println();
   Serial.print("  "); test16(TESTHELP); Serial.println();
   Serial.println();
}
Beispiel #11
0
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;
}
Beispiel #12
0
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;
}
/*
 * 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;
}
Beispiel #14
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);
}
Beispiel #15
0
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);
}
Beispiel #16
0
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 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;
    }

    fprintf(test_out, "executing test13\n");
    if (test13()) {
        fprintf(test_out, "Test13 succeeded\n");
    } else {
        fprintf(test_out, "opal_dss test13 failed\n");
        ret = 13;
    }

    fclose(test_out);

    opal_finalize();

    return(ret);
}
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);
}
Beispiel #18
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 ()
{
  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);
}
Beispiel #20
0
int main(int argc, char** argv)
{

// Execute the tests only if trace calls are included

#ifdef PEGASUS_REMOVE_TRACE
    cout << argv[0] << " +++++ passed all tests" << endl;
    return 0;
#else

    const char* tmpDir = getenv ("PEGASUS_TMP");
    if (tmpDir == NULL)
    {
        tmpDir = ".";
    }
    String f1 (tmpDir);
    f1.append("/testtracer1.trace");
    FILE1 = f1.getCString();
    String f2 (tmpDir);
    f2.append("/testtracer2.trace");
    FILE2 = f2.getCString();
    String f3 (tmpDir);
    f3.append("/testtracer3.trace");
    FILE3 = f3.getCString();
    String f4 (tmpDir);
    f4.append("/testtracer4.trace");
    FILE4 = f4.getCString();

    System::removeFile(FILE1);
    System::removeFile(FILE2);
    System::removeFile(FILE3);
    System::removeFile(FILE4);
    if (test1() == 0)
    {
       cout << "Tracer test (test1) failed" << endl;
       exit(1);
    }
    if (test2() == 0)
    {
       cout << "Tracer test (test2) failed" << endl;
       exit(1);
    }
    if (test3() == 0)
    {
       cout << "Tracer test (test3) failed" << endl;
       exit(1);
    }
    if (test4() != 0)
    {
       cout << "Tracer test (test4) failed" << endl;
       exit(1);
    }
    if (test5() != 0)
    {
       cout << "Tracer test (test5) failed" << endl;
       exit(1);
    }
    if (test6() != 0)
    {
       cout << "Tracer test (test6) failed" << endl;
       exit(1);
    }
    if (test7() != 0)
    {
       cout << "Tracer test (test7) failed" << endl;
       exit(1);
    }
    if (test8() != 0)
    {
       cout << "Tracer test (test8) failed" << endl;
       exit(1);
    }
    if (test9() != 0)
    {
       cout << "Tracer test (test9) failed" << endl;
       exit(1);
    }
    if (test10() != 0)
    {
       cout << "Tracer test (test10) failed" << endl;
       exit(1);
    }
    if (test11() != 0)
    {
       cout << "Tracer test (test11) failed" << endl;
       exit(1);
    }
    if (test12() != 0)
    {
       cout << "Tracer test (test12) failed" << endl;
       exit(1);
    }
    if (test13() != 0)
    {
       cout << "Tracer test (test13) failed" << endl;
       exit(1);
    }
    if (test14() != 0)
    {
       cout << "Tracer test (test14) failed" << endl;
       exit(1);
    }
    if (test15() != 0)
    {
       cout << "Tracer test (test15) failed" << endl;
       exit(1);
    }
    if (test16() != 0)
    {
       cout << "Tracer test (test16) failed" << endl;
       exit(1);
    }
    if (test17() != 0)
    {
       cout << "Tracer test (test17) failed" << endl;
       exit(1);
    }
    if (test18() != 0)
    {
       cout << "Tracer test (test18) failed" << endl;
       exit(1);
    }
    if (test19() != 0)
    {
       cout << "Tracer test (test19) failed" << endl;
       exit(1);
    }
    if (test20() != 0)
    {
       cout << "Tracer test (test20) failed" << endl;
       exit(1);
    }
    if (test21() != 0)
    {
       cout << "Tracer test (test21) failed" << endl;
       exit(1);
    }
    if (test22() != 0)
    {
       cout << "Tracer test (test22) failed" << endl;
       exit(1);
    }
    cout << argv[0] << " +++++ passed all tests" << endl;
    System::removeFile(FILE1);
    System::removeFile(FILE2);
    System::removeFile(FILE3);
    System::removeFile(FILE4);
    return 0;
#endif
}
Beispiel #21
0
int main()
{
    char line[256];
    char args[4][64];

    /* It mainly calls ComputerThink(maxdepth) to calculate to desired ply */
    char s[256];
    int from;
    int dest;
    int i;

    hashRndInit();
    startgame ();

    maxDepth = 6;		/* Max depth to search */
    MOVE moveBuf[200];
    MOVE theBest;
    int movecnt;

    /* Belka */
    puts (" \n Kitteneitor version June 5th 2013 by Emilio Diaz \n =================================================\n\n");
    puts (" Help overview:");
    puts (" making a move: e.g. e2e4, c7c5, a7a8q, e1g1 etc.");
    puts (" d ............ displaying current board");
    puts (" on ........... forcing the engine to move");
    puts (" sd <n> ....... setting depth to <n> plies");
    puts (" undo ......... taking back last move (ply)");
    puts (" quit ......... quit console application \n\n");
    /* Belka */

    side = WHITE;
    computerSide = BLACK;	/* Human is white side */

    hdp = 0;			/* Current move order */
    for (;;)
    {
        fflush (stdout);
        if (side == computerSide)
        {
            /* Computer's turn */
            theBest = ComputerThink (maxDepth);

            if (theBest.type_of_move > 8)
                printf ("type of move the best %d \n", theBest.type_of_move);

            makeMove (theBest);

            /* Just the move without pawn crown */
            printf("move %c%d%c%d",
                   'a' + COL(theBest.from),
                   8 - ROW(theBest.from),
                   'a' + COL(theBest.dest),
                   8 - ROW(theBest.dest));
            /* Check whether it's a crown */
            switch (theBest.type_of_move)
            {
               case MOVE_TYPE_PROMOTION_TO_QUEEN:
                  printf("q\n");
                  break;
               case MOVE_TYPE_PROMOTION_TO_ROOK:
                  printf("r\n");
                  break;
               case MOVE_TYPE_PROMOTION_TO_BISHOP:
                  printf("b\n");
                  break;
               case MOVE_TYPE_PROMOTION_TO_KNIGHT:
                  printf("n\n");
                  break;
               default:
                  printf("\n");
            }   /* end switch */

            printBoard ();
            printf ("Castle rights: %d\n", castle);
            fflush (stdout);
            continue;
        }

        printf ("k> ");

        /* Get user input */
        if (!fgets (line, 256, stdin))
            return 0;
        if (line[0] == '\n')
            continue;
        sscanf (line, "%s", s);

//        if (scanf ("%s", s) == EOF)	/* Shut down the program */
//            return 0;

        if (!strcmp (s, "d"))
        {
            printBoard ();
            continue;
        }
        if (!strcmp (s, "test1"))
        {
            test1 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test2"))
        {
            test2 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test3"))
        {
            test3 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test4"))
        {
            test4 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test5"))
        {
            test5 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test6"))
        {
            test6 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test7"))
        {
            test7 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test8"))
        {
            test8 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test9"))
        {
            test9 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test10"))
        {
            test10 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test11"))
        {
            test11 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test12"))
        {
            test12 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test13"))
        {
            test13 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "test14"))
        {
            test14 ();
            printBoard();
            continue;
        }
        if (!strcmp (s, "testMoveGen")) //Belka: McKenzie test position
        {
            testMoveGen();
            printBoard();
            continue;
        }
        if (!strcmp (s, "testEvalSym")) //Belka: McKenzie test position
        {
            testEvalSym();
            continue;
        }
        if (!strcmp (s, "countNodes"))
        {
            countNodes();
            continue;
        }
        if (!strcmp (s, "testWhitePassedPawns"))
        {
            testWhitePassedPawns ();
            continue;
        }
        if (!strcmp (s, "testBlackPassedPawns"))
        {
            testBlackPassedPawns ();
            continue;
        }
        if (!strcmp (s, "testWhiteDoubledPawns"))
        {
            testWhiteDoubledPawns ();
            continue;
        }
        if (!strcmp (s, "testBlackDoubledPawns"))
        {
            testBlackDoubledPawns ();
            continue;
        }
        if (!strcmp (s, "testIsIsolatedPawnWhite"))
        {
            testIsIsolatedPawnWhite ();
            continue;
        }
        if (!strcmp (s, "testIsIsolatedPawnBlack"))
        {
            testIsIsolatedPawnBlack ();
            continue;
        }
        if (!strcmp (s, "showPawnsInfo"))
        {
            showPawnsInfo ();
            continue;
        }
        if (!strcmp (s, "testisSqProtectedByAPawn"))
        {
             testisSqProtectedByAPawn();
            continue;
        }
//        if (!strcmp (s, "testIsSqProtectedByAKnight"))
//        {
//             testIsSqProtectedByAKnight();
//            continue;
//        }
//        if (!strcmp (s, "testIsSqProtectedByABishop"))
//        {
//             testIsSqProtectedByABishop();
//            continue;
//        }
        if (!strcmp (s, "testOpenCols"))
        {
             testOpenCols();
            continue;
        }
        if (!strcmp (s, "undo"))
        {
            takeBack ();
            printBoard ();
            computerSide = (WHITE + BLACK) - computerSide;
            continue;
        }
        if (!strcmp(s,"setboard"))
        {
            strcpy(fenBuf, "");
            sscanf(line, "setboard %s %s %s %s", args[0],args[1],args[2],args[3]);
            strcat(fenBuf, args[0]);
            strcat(fenBuf, args[1]);
            strcat(fenBuf, args[2]);
            strcat(fenBuf, args[3]);
            setBoard(fenBuf);
            continue;
        }
        if (!strcmp (s, "xboard"))
        {
            xboard ();
            return 0;
        }
        if (!strcmp (s, "on"))
        {
            computerSide = side;
            continue;
        }
        if (!strcmp (s, "pass"))
        {
            side = (WHITE + BLACK) - side;
            computerSide = (WHITE + BLACK) - side;
            continue;
        }
        if (!strcmp (s, "sd"))
        {
            sscanf (line, "sd %d", &maxDepth);
            continue;
        }

//        if (!strcmp (s, "fen"))
//        {
//            strcpy (fenstring, "");

//            sscanf (linea, "fen %s %s %s %s", args[0], args[1], args[2],
//                    args[3]);

//            strcat (fenstring, args[0]);
//            strcat (fenstring, args[1]);
//            strcat (fenstring, args[2]);
//            strcat (fenstring, args[3]);

//            fen (fenstring);
//        }

        if (!strcmp (s, "perft"))
        {
            sscanf (line, "perft %d", &maxDepth);
            clock_t start;
            clock_t stop;
            double t = 0.0;
            /* Start timer */
            start = clock ();
            U64 count = perft (maxDepth);
            /* Stop timer */
            stop = clock ();
            t = (double) (stop - start) / CLOCKS_PER_SEC;
//            printf ("nodes = %'llu\n", count);
            printf ("nodes = %8"  PRId64 "\n", count); // Belka
            printf ("time = %.2f s\n", t);
            continue;
        }
        if (!strcmp (s, "quit"))
        {
            printf ("Good bye!\n");
            return 0;
        }

        /* Maybe the user entered a move? */
        from = s[0] - 'a';
        from += 8 * (8 - (s[1] - '0'));
        dest = s[2] - 'a';
        dest += 8 * (8 - (s[3] - '0'));
        ply = 0;
        movecnt = genMoves (side, moveBuf);

        /* Loop through the moves to see whether it's legal */
        for (i = 0; i < movecnt; i++)
            if (moveBuf[i].from == from && moveBuf[i].dest == dest)
            {
                /* Promotion move? */
                if (piece[from] == PAWN && (dest < 8 || dest > 55))
                {
                    switch (s[4])
                    {
                    case 'q':
                        moveBuf[i].type_of_move = MOVE_TYPE_PROMOTION_TO_QUEEN;
                        break;

                    case 'r':
                        moveBuf[i].type_of_move = MOVE_TYPE_PROMOTION_TO_ROOK;
                        break;

                    case 'b':
                        moveBuf[i].type_of_move = MOVE_TYPE_PROMOTION_TO_BISHOP;
                        break;

                    case 'n':
                        moveBuf[i].type_of_move = MOVE_TYPE_PROMOTION_TO_KNIGHT;
                        break;

                    default:
                        puts("Promoting to a McGuffin..., I'll give you a queen");
                        moveBuf[i].type_of_move = MOVE_TYPE_PROMOTION_TO_QUEEN;
                    }
                }
                if (!makeMove (moveBuf[i]))
                {
                    takeBack ();
                    printf ("Illegal move.\n");
                }
                break;
            }
        printBoard ();
    }
}
Beispiel #22
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);
}
Beispiel #23
0
int main() {
  {

    static_assert(
        ranges::detail::BidirectionalCursor<
        ranges::detail::reverse_cursor<bidirectional_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::detail::BidirectionalCursor<
        ranges::detail::reverse_cursor<random_access_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::detail::RandomAccessCursor<
        ranges::detail::reverse_cursor<random_access_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::BidirectionalIterator<
            ranges::reverse_iterator<bidirectional_iterator<const char *>>>{},
        "");
    static_assert(
        ranges::RandomAccessIterator<
            ranges::reverse_iterator<random_access_iterator<const char *>>>{},
        "");
  }
  { // test
    test<bidirectional_iterator<const char *>>();
    test<random_access_iterator<char *>>();
    test<char *>();
    test<const char *>();
  }
  { // test 2
    const char s[] = "123";
    test2(bidirectional_iterator<const char *>(s));
    test2(random_access_iterator<const char *>(s));
  }
  { // test3
    Derived d;
    test3<bidirectional_iterator<Base *>>(
        bidirectional_iterator<Derived *>(&d));
    test3<random_access_iterator<const Base *>>(
        random_access_iterator<Derived *>(&d));
  }
  { // test4
    const char *s = "1234567890";
    random_access_iterator<const char *> b(s);
    random_access_iterator<const char *> e(s + 10);
    while (b != e)
      test4(b++);
  }
  { // test5
    const char *s = "1234567890";
    test5(bidirectional_iterator<const char *>(s),
          bidirectional_iterator<const char *>(s), false);
    test5(bidirectional_iterator<const char *>(s),
          bidirectional_iterator<const char *>(s + 1), true);
    test5(random_access_iterator<const char *>(s),
          random_access_iterator<const char *>(s), false);
    test5(random_access_iterator<const char *>(s),
          random_access_iterator<const char *>(s + 1), true);
    test5(s, s, false);
    test5(s, s + 1, true);
  }
  {
    const char *s = "123";
    test6(bidirectional_iterator<const char *>(s + 1),
          bidirectional_iterator<const char *>(s));
    test6(random_access_iterator<const char *>(s + 1),
          random_access_iterator<const char *>(s));
    test6(s + 1, s);
  }
  {
    const char *s = "123";
    test7(bidirectional_iterator<const char *>(s + 1),
          bidirectional_iterator<const char *>(s));
    test7(random_access_iterator<const char *>(s + 1),
          random_access_iterator<const char *>(s));
    test7(s + 1, s);
  }
  {
    const char *s = "1234567890";
    test8(random_access_iterator<const char *>(s + 5), 5,
          random_access_iterator<const char *>(s));
    test8(s + 5, 5, s);
  }
  {
    const char *s = "1234567890";
    test9(random_access_iterator<const char *>(s + 5), 5,
          random_access_iterator<const char *>(s));
    test9(s + 5, 5, s);
  }
  {
    const char *s = "123";
    test10(bidirectional_iterator<const char *>(s + 1),
           bidirectional_iterator<const char *>(s + 2));
    test10(random_access_iterator<const char *>(s + 1),
           random_access_iterator<const char *>(s + 2));
    test10(s + 1, s + 2);
  }
  {
    const char *s = "123";
    test11(bidirectional_iterator<const char *>(s + 1),
           bidirectional_iterator<const char *>(s + 2));
    test11(random_access_iterator<const char *>(s + 1),
           random_access_iterator<const char *>(s + 2));
    test11(s + 1, s + 2);
  }
  {
    const char *s = "1234567890";
    test12(random_access_iterator<const char *>(s + 5), 5,
           random_access_iterator<const char *>(s + 10));
    test12(s + 5, 5, s + 10);
  }
  {
    const char *s = "1234567890";
    test13(random_access_iterator<const char *>(s + 5), 5,
           random_access_iterator<const char *>(s + 10));
    test13(s + 5, 5, s + 10);
  }
  {
    A a;
    test14(&a + 1, A());
  }
  {
    Derived d;

    test15<bidirectional_iterator<Base *>>(
        bidirectional_iterator<Derived *>(&d));
    test15<random_access_iterator<const Base *>>(
        random_access_iterator<Derived *>(&d));
    test15<Base *>(&d);
  }
  {
    const char *s = "1234567890";
    test16(bidirectional_iterator<const char *>(s),
           bidirectional_iterator<const char *>(s), true);
    test16(bidirectional_iterator<const char *>(s),
           bidirectional_iterator<const char *>(s + 1), false);
    test16(random_access_iterator<const char *>(s),
           random_access_iterator<const char *>(s), true);
    test16(random_access_iterator<const char *>(s),
           random_access_iterator<const char *>(s + 1), false);
    test16(s, s, true);
    test16(s, s + 1, false);
  }
  {
    char s[3] = {0};
    test17(random_access_iterator<const char *>(s),
           random_access_iterator<char *>(s), 0);
    random_access_iterator<char *> inp1(s);
    test17(random_access_iterator<char *>(s),
           random_access_iterator<const char *>(s + 1), 1);
    test17(random_access_iterator<const char *>(s + 1),
           random_access_iterator<char *>(s), -1);
    test17(s, s, 0);
    test17(s, s + 1, 1);
    test17(s + 1, s, -1);
  }
  {
    const char *s = "1234567890";
    test18(random_access_iterator<const char *>(s),
           random_access_iterator<const char *>(s), false);
    test18(random_access_iterator<const char *>(s),
           random_access_iterator<const char *>(s + 1), true);
    test18(random_access_iterator<const char *>(s + 1),
           random_access_iterator<const char *>(s), false);
    test18(s, s, false);
    test18(s, s + 1, true);
    test18(s + 1, s, false);
  }
  {
    const char *s = "1234567890";
    test19(random_access_iterator<const char *>(s),
           random_access_iterator<const char *>(s), true);
    test19(random_access_iterator<const char *>(s),
           random_access_iterator<const char *>(s + 1), true);
    test19(random_access_iterator<const char *>(s + 1),
           random_access_iterator<const char *>(s), false);
    test19(s, s, true);
    test19(s, s + 1, true);
    test19(s + 1, s, false);
  }
  {
    const char *s = "1234567890";
    test20(random_access_iterator<const char *>(s + 5), 4, '1');
    test20(s + 5, 4, '1');
  }
  {
    const char *s = "1234567890";
    test21(random_access_iterator<const char *>(s),
         random_access_iterator<const char *>(s), false);
    test21(random_access_iterator<const char *>(s),
         random_access_iterator<const char *>(s + 1), false);
    test21(random_access_iterator<const char *>(s + 1),
         random_access_iterator<const char *>(s), true);
    test21(s, s, false);
    test21(s, s + 1, false);
    test21(s + 1, s, true);
  }
  {
      const char* s = "1234567890";
      test22(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
      test22(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
      test22(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
      test22(s, s, false);
      test22(s, s+1, false);
      test22(s+1, s, true);
  }
  {
      const char* s = "1234567890";
      test23(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), true);
      test23(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
      test23(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), true);
      test23(s, s, true);
      test23(s, s+1, false);
      test23(s+1, s, true);
  }
  {
      B a;
      test24(&a+1, B());
  }
  {
      C l[3] = {C(0), C(1), C(2)};

      auto ri = ranges::rbegin(l);
      CHECK ( (*ri).get() == 2 );  ++ri;
      CHECK ( (*ri).get() == 1 );  ++ri;
      CHECK ( (*ri).get() == 0 );  ++ri;
      CHECK ( ri == ranges::rend(l));
  }
  {
      const char* s = "1234567890";
      test25(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
      test25(s+5, 5, s);
  }

  return test_result();
}
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for FEM2D_PACK_PRB.

  Discussion:

    FEM2D_PACK_PRB tests the FEM2D_PACK library.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    22 January 2013

  Author:

    John Burkardt
*/
{
  int i;

  timestamp ( );
  printf ( "\n" );
  printf ( "FEM2D_PACK_PRB:\n" );
  printf ( "  C version\n" );
  printf ( "  Test the FEM2D_PACK library.\n" );
/*
  test01 ( );
  test02 ( );
*/
  test03 ( );
  test04 ( );
/*
  test05 ( );
  test07 ( );
  test08 ( );
  test09 ( );

  test10 ( );
*/
  test105 ( );
/*
  test11 ( );
*/
  test12 ( );
  test13 ( );
  test135 ( );
  test14 ( );
  test15 ( );
  test16 ( );
  test18 ( );
/*
  test19 ( );

  test20 ( );
  test21 ( );
  test22 ( );
  test23 ( );
*/
  test24 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "FEM2D_PACK_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Beispiel #25
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;
}
NOMIPS16 int main ()
{
  float f1;
  v2sf a, b, c, d, e, f;

  /* Case 1 {diff, diff} */
  /* movt.ps */
  a = (v2sf) {5, 12};
  b = (v2sf) {9, 6};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movt_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_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_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_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_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_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_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_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_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test1 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test2 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test3 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test4 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test5 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test6 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test7 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test8 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test9 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test10 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test11 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test12 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test13 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test14 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test15 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test16 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test17 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test18 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test19 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test20 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test21 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test22 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test23 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test24 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test25 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test26 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test27 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test28 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test29 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test30 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test31 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  /* Test all 16 operators with (b, a) */
  a = (v2sf) {123, 123};
  b = (v2sf) {1000, 1000};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = test0 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test1 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test2 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test3 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test4 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test5 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test6 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test7 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test8 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test9 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test10 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test11 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test12 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test13 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test14 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test15 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test16 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test17 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test18 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test19 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test20 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test21 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test22 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test23 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test24 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test25 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test26 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test27 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test28 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test29 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test30 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test31 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

#ifndef __FAST_MATH__
  /* Test with NaN */
  a = (v2sf) {qnan, qnan};
  b = (v2sf) {1000, 1000};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = test0 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test1 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test2 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test3 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test4 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test5 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test6 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test7 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test8 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test9 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test10 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test11 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test12 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test13 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test14 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test15 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test16 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test17 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test18 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test19 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test20 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test21 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test22 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test23 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test24 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test25 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test26 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test27 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test28 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test29 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test30 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test31 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
#endif

  printf ("Test Passes\n");
  exit (0);
}
Beispiel #27
0
/*!****************************************************************************
 @Function		main
 @Input			argc		Number of arguments
 @Input			argv		Command line arguments
 @Return		int			result code to OS
 @Description	Main function of the program
******************************************************************************/
int main(int argc, char **argv)
{
	int testID = 0, err; //default
	char *extensions;
	unsigned int delta;
	NATIVE_PIXMAP_STRUCT* pNativePixmap = NULL;


	/* Initialise all globals */
	initialise_globals(&gTest);

	/* Pre init step - check the arguments */
	if(argc < 11)
	{
		SGXPERF_ERR_printf("Error: Invalid number of operands \n\n");
		SGXPERF_ERR_printf("%s",helpString);
		exit(-1);
	}
	testID = atol(argv[1]);
	if(testID > MAX_TEST_ID || testID < 0)
	{
		SGXPERF_ERR_printf("Error: No test available with this ID %d\n\n", testID);
		SGXPERF_ERR_printf("%s",helpString);
		exit(-1);
	}
	gTest.inNumberOfObjectsPerSide = atol(argv[7]);
	gTest.inSurfaceType = atol(argv[8]);

	if(argc < 4)
	{
		if(testID > 2) //1 and 2 do not need textures
		{
			SGXPERF_ERR_printf("Error: Invalid number of operands for selected testID %d\n\n", testID);
			SGXPERF_ERR_printf("%s",helpString);
			exit(-1);
		}
	}
	else
	{
		gTest.inTextureWidth = atol(argv[2]);
		gTest.inTextureHeight = atol(argv[3]);
	}
	gTest.inRotationEnabled = 0;
	//Rotation is unused in latest version
	if(argc >= 5)
		gTest.inRotationEnabled = atol(argv[4]);
	gTest.inPixelFormat = 0;
	if(argc >= 6)
		gTest.inPixelFormat = atol(argv[5]);
	if(gTest.inPixelFormat != SGXPERF_RGB565 && gTest.inPixelFormat != SGXPERF_ARGB8888 && gTest.inPixelFormat != SGXPERF_BYTE8)
	{
		SGXPERF_ERR_printf("Error: Unsupported pixel format for texture %d \n\n", gTest.inPixelFormat);
		SGXPERF_ERR_printf("%s",helpString);
		exit(-1);
	}
  
  //read extra params
  gTest.numTestIterations = atol(argv[9]);
  gTest.inFPS =atol(argv[10]); 
  gTest.msToSleep = 1000/gTest.inFPS;
  gTest.cookie = argv[11];
    
	if((gTest.inTextureWidth > 8000) || (gTest.inTextureHeight > 8000))
	{
		SGXPERF_ERR_printf("Error: Width or Height exceeds 8000 \n\n");
		SGXPERF_ERR_printf("%s",helpString);
		exit(-1);
	}
#ifndef _ENABLE_CMEM
	if(testID == 6 || testID == 7 || gTest.inSurfaceType == SGXPERF_SURFACE_TYPE_PIXMAP_16 || 
                                    gTest.inSurfaceType == SGXPERF_SURFACE_TYPE_PIXMAP_32)
	{
		SGXPERF_ERR_printf("ERROR: Cannot run native pixmap tests without CMEM\n");
		exit(-1);
	}
#endif
#ifndef _ENABLE_BUFFERCLASS
	if(testID == 8)
	{
		SGXPERF_ERR_printf("ERROR: Cannot run test8 without BUFFERCLASS driver\n");
		exit(-1);
	}
#endif
	//for pixmap related tests, surface cannot be pixmap
	if(testID == 6 && gTest.inSurfaceType != SGXPERF_SURFACE_TYPE_WINDOW)
	{
		SGXPERF_ERR_printf("ERROR: Cannot run native pixmap eglimage test with pixmap surface\n");
		goto cleanup;
	}

  signal(SIGINT, sgxperf_signal_handler);

#ifdef _ENABLE_CMEM
	//Initialise the CMEM module. 
	//CMEM ko should be inserted before this point
	SGXPERF_printf("Configuring CMEM\n");
	CMEM_init();
#endif
	//Allocate texture for use in GL texturing modes(can also be done from CMEM if memory permits
	gTest._textureData = (unsigned int*)malloc(gTest.inTextureWidth*gTest.inTextureHeight*4 + PAGE_SIZE);
	if(!gTest._textureData)
	{
		SGXPERF_ERR_printf("ERROR: No malloc memory for allocating texture!\n");
		goto cleanup;
	}
	delta =(PAGE_SIZE - ((unsigned int)gTest._textureData &
(PAGE_SIZE-1))); 
	gTest.textureData = (unsigned int*)((char*)gTest._textureData + delta);
	memset(gTest.textureData, 0, gTest.inTextureWidth*gTest.inTextureHeight*4);

	set_texture(gTest.inTextureWidth, gTest.inTextureHeight, (unsigned char*)gTest.textureData, gTest.inPixelFormat);

	//initialise egl
	err = common_eglinit(&gTest, testID, gTest.inSurfaceType, &pNativePixmap);
	if(err)
	{
		SGXPERF_ERR_printf("ERROR: eglinit - err = %d\n", err);
		goto cleanup;
	}

	GLuint uiFragShader, uiVertShader;		// Used to hold the fragment and vertex shader handles
	GLuint uiProgramObject;					// Used to hold the program handle (made out of the two previous shaders

	// Create the fragment shader object
	uiFragShader = glCreateShader(GL_FRAGMENT_SHADER);

	// Load the source code into it
	if((testID == 3) || (testID == 5) || (testID == 6) || (testID == 7)  || 
        (testID == 14) || (testID == 17))
		glShaderSource(uiFragShader, 1, (const char**)&pszFragTextureShader, NULL);
	else if(testID == 11) //Edge detect with RGB input
		glShaderSource(uiFragShader, 1, (const char**)&pszFragEdgeRGBDetectShader, NULL);
	else if(testID == 12) //Edge detect with YUV input
		glShaderSource(uiFragShader, 1, (const char**)&pszFragEdgeYUVDetectShader, NULL);
	else if(testID == 8) //IMG texture stream2
		glShaderSource(uiFragShader, 1, (const char**)&pszFragIMGTextureStreamShader, NULL);
	else if(testID == 16) //EGLImage streaming
		glShaderSource(uiFragShader, 1, (const char**)&pszFragEGLImageShader, NULL);
	else
		glShaderSource(uiFragShader, 1, (const char**)&pszFragNoTextureShader, NULL);

	// Compile the source code
	glCompileShader(uiFragShader);

	// Check if compilation succeeded
	GLint bShaderCompiled;
    glGetShaderiv(uiFragShader, GL_COMPILE_STATUS, &bShaderCompiled);

	if (!bShaderCompiled)
	{
		// An error happened, first retrieve the length of the log message
		int i32InfoLogLength, i32CharsWritten;
		glGetShaderiv(uiFragShader, GL_INFO_LOG_LENGTH, &i32InfoLogLength);

		// Allocate enough space for the message and retrieve it
		char* pszInfoLog = new char[i32InfoLogLength];
        glGetShaderInfoLog(uiFragShader, i32InfoLogLength, &i32CharsWritten, pszInfoLog);

		// Displays the error
		SGXPERF_ERR_printf("Failed to compile fragment shader: %s\n", pszInfoLog);
		delete [] pszInfoLog;
		goto cleanup;
	}

	// Loads the vertex shader in the same way
	uiVertShader = glCreateShader(GL_VERTEX_SHADER);
	if((testID == 3) || (testID == 5) || (testID == 6) || (testID == 7) || 
        (testID == 8) || (testID == 11) || (testID == 12)
           || (testID == 14) || (testID == 16) || (testID == 17))
		glShaderSource(uiVertShader, 1, (const char**)&pszVertTextureShader, NULL);
	else
	{
		SGXPERF_ERR_printf("INFO: Using no-texture vertex shader\n");
		glShaderSource(uiVertShader, 1, (const char**)&pszVertNoTextureShader, NULL);
	}

	glCompileShader(uiVertShader);
    glGetShaderiv(uiVertShader, GL_COMPILE_STATUS, &bShaderCompiled);

	if (!bShaderCompiled)
	{
		int i32InfoLogLength, i32CharsWritten;
		glGetShaderiv(uiVertShader, GL_INFO_LOG_LENGTH, &i32InfoLogLength);
		char* pszInfoLog = new char[i32InfoLogLength];
        glGetShaderInfoLog(uiVertShader, i32InfoLogLength, &i32CharsWritten, pszInfoLog);
		SGXPERF_ERR_printf("Failed to compile vertex shader: %s\n", pszInfoLog);
		delete [] pszInfoLog;
		goto cleanup;
	}

	// Create the shader program
    uiProgramObject = glCreateProgram();

	// Attach the fragment and vertex shaders to it
    glAttachShader(uiProgramObject, uiFragShader);
    glAttachShader(uiProgramObject, uiVertShader);

	// Bind the custom vertex attribute "myVertex" to location VERTEX_ARRAY
	glBindAttribLocation(uiProgramObject, VERTEX_ARRAY, "inVertex");
	glBindAttribLocation(uiProgramObject, TEXCOORD_ARRAY, "inTexCoord");

	// Link the program
    glLinkProgram(uiProgramObject);

	// Check if linking succeeded in the same way we checked for compilation success
    GLint bLinked;
    glGetProgramiv(uiProgramObject, GL_LINK_STATUS, &bLinked);

	if (!bLinked)
	{
		int ui32InfoLogLength, ui32CharsWritten;
		glGetProgramiv(uiProgramObject, GL_INFO_LOG_LENGTH, &ui32InfoLogLength);
		char* pszInfoLog = new char[ui32InfoLogLength];
		glGetProgramInfoLog(uiProgramObject, ui32InfoLogLength, &ui32CharsWritten, pszInfoLog);
		SGXPERF_ERR_printf("Failed to link program: %s\n", pszInfoLog);
		delete [] pszInfoLog;
		goto cleanup;
	}

	// Actually use the created program
	glUseProgram(uiProgramObject);
#ifdef _ENABLE_TEST16
	if(testID == 16)
	{
		int sampler = glGetUniformLocation(uiProgramObject, "yuvTexSampler");
		glUniform1i(sampler, 0);
	}
#endif
	//set rotation variables to init
	gTest.matrixLocation = glGetUniformLocation(uiProgramObject, "MVPMatrix");
	memset(gTest.mat_final, 0, sizeof(gTest.mat_final));
	gTest.mat_final[0] = gTest.mat_final[5] = gTest.mat_final[10] = gTest.mat_final[15] = 1.0;
	glUniformMatrix4fv( gTest.matrixLocation, 1, GL_FALSE, gTest.mat_final);
	
	/* Set rowsize for edge detect */
	if(testID == 11)
	{
		glUniform1f(glGetUniformLocation(uiProgramObject, "rowSize"), 256.0);
		glUniform1f(glGetUniformLocation(uiProgramObject, "columnSize"), 256.0);
	}
	else if(testID == 12)
	{
		glUniform1f(glGetUniformLocation(uiProgramObject, "rowSize"), 128.0);
		glUniform1f(glGetUniformLocation(uiProgramObject, "columnSize"), 160.0);
	}
	/* Set clear */
	glClearColor(0.2f, 0.8f, 1.0f, 1.0f); // blueish greenish red :)
	glClear(GL_COLOR_BUFFER_BIT);

		/*
		Do various tests
		*/
		switch(testID)
		{
			case 0:
				extensions = (char*)glGetString(GL_EXTENSIONS);
				SGXPERF_ERR_printf("\nTESTID = 0: GL SUPPORTED EXTENSIONS = \n%s\n", extensions);
                                extensions = (char*)eglQueryString(gTest.eglDisplay, EGL_EXTENSIONS);
                                SGXPERF_ERR_printf("\nTESTID = 0: EGL SUPPORTED EXTENSIONS = \n%s\n", extensions);
				break;
			case 1:
				/* Fill entire screen with single colour, no objects */
				test1(&gTest);
				break;
			case 2:
				/* Draw a coloured rectangle filling entire screen */
				test2(&gTest);
				break;
			case 3:
				/* Move a coloured rectangle of half screen size to another half with same parameters */
				test3(&gTest);
				break;
			case 4:
				/* Alpha blending full surface texture */
				test4(&gTest);	
				break;
			case 5:
				/* Alpha blending full surface WITHOUT texture */
				test5(&gTest);
				break;
			case 8:
#ifdef _ENABLE_TEST8
				/* GL_IMG_texture_stream */
				test8(&gTest);
#endif
				break;
			case 10:
				/* PVR2D test */
				test10(&gTest);
				break;
			case 11:
				/* Edge detection test - test3 with new shader */
				test3(&gTest);
				break;
#ifdef _ENABLE_TEST8
			case 12:
				/* Edge detection test - test8 with new shader */
				test8(&gTest);
				break;
#endif
			case 13:
				/* Line drawing */
				test13(&gTest);
				break;
#ifdef _ENABLE_TEST14				
			case 14:
				/* Context Switch */
				test14(&gTest);
				break;
#endif				
#ifdef _ENABLE_TEST15
			case 15:
				/* YUV-RGB conversion with PVR2D */
				test15(&gTest);
				break;
#endif
#ifdef _ENABLE_TEST16
			case 16:
				/* YUV-Streaming with EGLImage */
				test16(&gTest);
				break;
#endif
#ifdef _ENABLE_TEST17
			case 17:
				/* FBO */
				test17(&gTest);
				break;
#endif
			default:
				/* Sorry guys, we tried ! */
				SGXPERF_ERR_printf("No matching test code\n");
				break;
		}
#ifdef _ENABLE_CMEM
	/* PIXMAP loopback test  */
	if(gTest.inSurfaceType == SGXPERF_SURFACE_TYPE_PIXMAP_16 || gTest.inSurfaceType == SGXPERF_SURFACE_TYPE_PIXMAP_32) 
	{
#if 1
		/* Use this for checking out the output in the pixmap */
		/* For DEBUGGING ONLY */
		FILE *fp = fopen("pixmap.raw", "wb");
		int numbytes;
		if(gTest.inSurfaceType == SGXPERF_SURFACE_TYPE_PIXMAP_32) numbytes = 4; //ARGB8888
		if(gTest.inSurfaceType == SGXPERF_SURFACE_TYPE_PIXMAP_16) numbytes = 2; //RGB565
		SGXPERF_ERR_printf("Writing pixmap data to file pixmap.raw\n");
		fwrite((void*)pNativePixmap->lAddress, 1, gTest.inTextureWidth*gTest.inTextureHeight*numbytes, fp);
		fclose(fp);
#endif
	}
#endif //CMEM needed for pixmap loopback
	// Frees the OpenGL handles for the program and the 2 shaders
	glDeleteProgram(uiProgramObject);
	glDeleteShader(uiFragShader);
	glDeleteShader(uiVertShader);

cleanup:
	if(gTest._textureData) 
		free(gTest._textureData);
	common_egldeinit(&gTest, testID, pNativePixmap);
#ifdef _ENABLE_CMEM
	CMEM_exit();
#endif

	return 0;
}
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);
}