Ejemplo n.º 1
0
int main(int argc, char** argv)
{
  int regressLevel = 2;
  if (argc > 1) regressLevel = atoi(argv[1]);
  printf("Running C API test, regress level = %d\n", regressLevel);
  printf("\ntest1() {\n");
  test1();
  check_error("test1");
  printf("\n}\ntest2() {\n");
  test2();
  check_error("test2");
/* TODO: implement parseExpr */
/*   test3(); */
/*   check_error("test3"); */

  printf("\n}\ntest4() {\n");
  test4(regressLevel);
  check_error("test4");
  printf("\n}\ntest5() {\n");
  test5();
  check_error("test5");
  if (regressLevel > 0) {
    printf("\n}\ntest6() {\n");
    test6();
    check_error("test6");
  }
  printf("\n}\ntest7() {\n");
  test7();
  check_error("test7");
  if (regressLevel > 0) {
    printf("\n}\ntest8() {\n");
    test8();
    check_error("test8");
    printf("\n}\ntest9() {\n");
    test9();
    check_error("test9");
  }
  printf("\n}");
  printf("\ntest10() {\n");
  test10();
  printf("\n}");
  printf("\ntest11() {\n");
  test11();
  printf("\n}\n");
  return 0;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
int main() {
  test1();
  test2();
  test3();
  test4();
  test5();
  test6();
  test7();
  test8();
  test9();
  test10();
  test11();
  test12();
  test13();

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

  return CORRECT;
}
Ejemplo n.º 5
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;
}
Ejemplo n.º 6
0
int main(void)
{
  char * stars = "*****************************************************\n";

  printf("%s*\n* Singly Linked Lists\n*\n%s", stars, stars);
  test1();
  test2();
  test3();
  test4();
  test5();
  test6();
  printf("%s*\n* Doubly Linked Lists\n*\n%s", stars, stars);
  test7();
  test8();
  test9();
  printf("%s*\n* Circular Linked Lists\n*\n%s", stars, stars);
  test10();
  test11();
  test12();
}
Ejemplo n.º 7
0
int main(void)
{
   test01();
   test02();
   test03();
   test04();
   test05();
   test06();
   test07();
   test08();
   test09();
   test10();
   test11();
   test12();
   test13();
   test14();
   test15();
   test16();
   test17();
   return 0;
}
Ejemplo n.º 8
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();
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
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;
}
Ejemplo n.º 11
0
int __cdecl main(int argc, char *argv[]) 
{
    WCHAR szwInsert[] = {'I','N','S','E','R','T','\0'};
    WCHAR szwFoo[] = {'f','o','o','\0'};
    WCHAR szwBar[] = {'b','a','r','\0'};

    /*
     * Initialize the PAL and return FAILURE if this fails
     */

    if(0 != (PAL_Initialize(argc, argv)))
    {
        return FAIL;
    }

    if(test1(0,szwInsert) ||                        /* Test %s */
       test2(0,40) ||                               /* Test %i */ 
       test3(0,'a') ||                              /* Test %c */
       test4(0,'a') ||                              /* Test %C */
       test5(0,57) ||                               /* Test %d */
       test6(0,'a','b') ||                          /* Test %hc, %hC */
       test7(0,90,"foo","bar") ||                   /* Test %hd,hs,hS */
       test8(0,'a','b',50,100) ||                   /* Test %lc, lC, ld, li */
       test9(0,szwFoo,szwBar,56) ||                 /* Test %ls,lS,lu  */
       test10(0,0x123ab,0x123cd) ||                 /* Test %lx, %lX */
       test11(0,(void *)0x123ab,"foo") ||           /* Test %p, %S */
       test12(0,100,0x123ab,0x123cd))               /* Test %u,x,X */
    {
        
      
    }
  
    PAL_Terminate();
    return PASS;
 
}
Ejemplo n.º 12
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;
}
Ejemplo n.º 13
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);
}
Ejemplo n.º 14
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);
}
Ejemplo n.º 15
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
}
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);
}
Ejemplo n.º 17
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);
}
Ejemplo n.º 19
0
int main(int argc, char ** argv) {

    test11();
    test12();

/* 	char * test;
	
	if (argc <2) {
		printf("Usage: test_resizable_table test1|test2|...test16\n");
		exit(1);
	}

	test = argv[1];
	printf("Running %s\n", test);
	if (strcmp(test, "test1")==0) {
		test1();
	}
	else if (strcmp(test, "test2")==0) {
		test2();
	}
	else if (strcmp(test, "test3")==0) {
		test3();
	}
	else if (strcmp(test, "test4")==0) {
		test4();
	}
	else if (strcmp(test, "test5")==0) {
		test5();
	}
	else if (strcmp(test, "test6")==0) {
		test6();
	}
	else if (strcmp(test, "test7")==0) {
		test7();
	}
	else if (strcmp(test, "test8")==0) {
		test8();
	}
	else if (strcmp(test, "test9")==0) {
		test9();
	}
	else if (strcmp(test, "test10")==0) {
		test10();
	}
    else if (strcmp(test, "test10b")==0) {
		test10b();
	}
    else if (strcmp(test, "test10c")==0) {
		test10c();
	}
	else if (strcmp(test, "test11")==0) {
		test11();
	}
	else if (strcmp(test, "test12")==0) {
		test12();
	}
	else if (strcmp(test, "test13")==0) {
		test13();
	}
	else if (strcmp(test, "test14")==0) {
		test14();
	}
	else if (strcmp(test, "test15")==0) {
		test15();
	}
	else if (strcmp(test, "test16")==0) {
		test16();
	}
	else {
		printf("Test not found!!n");
		exit(1);
	} */

	return 0;

}
Ejemplo n.º 20
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 ();
    }
}
Ejemplo n.º 21
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();
}
Ejemplo n.º 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);
}
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);
}
Ejemplo n.º 24
0
int main (int argc, char* argv[])
{
    opal_init(&argc, &argv);

    test_out = stderr;

    /* run the tests */

    fprintf(test_out, "executing test1\n");
    if (test1()) {
        fprintf(test_out, "Test1 succeeded\n");
    }
    else {
      fprintf(test_out, "Test1 failed\n");
    }

    fprintf(test_out, "executing test2\n");
    if (test2()) {
        fprintf(test_out, "Test2 succeeded\n");
    }
    else {
      fprintf(test_out, "Test2 failed\n");
    }

    fprintf(test_out, "executing test3\n");
    if (test3()) {
        fprintf(test_out, "Test3 succeeded\n");
    }
    else {
      fprintf(test_out, "Test3 failed\n");
    }

    fprintf(test_out, "executing test4\n");
    if (test4()) {
        fprintf(test_out, "Test4 succeeded\n");
    }
    else {
      fprintf(test_out, "Test4 failed\n");
    }

    fprintf(test_out, "executing test5\n");
    if (test5()) {
        fprintf(test_out, "Test5 succeeded\n");
    }
    else {
      fprintf(test_out, "Test5 failed\n");
    }

    fprintf(test_out, "executing test6\n");
    if (test6()) {
        fprintf(test_out, "Test6 succeeded\n");
    }
    else {
      fprintf(test_out, "Test6 failed\n");
    }

    fprintf(test_out, "executing test7\n");
    if (test7()) {
        fprintf(test_out, "Test7 succeeded\n");
    }
    else {
      fprintf(test_out, "Test7 failed\n");
    }

    fprintf(test_out, "executing test8\n");
    if (test8()) {
        fprintf(test_out, "Test8 succeeded\n");
    }
    else {
      fprintf(test_out, "Test8 failed\n");
    }

    fprintf(test_out, "executing test9\n");
    if (test9()) {
        fprintf(test_out, "Test9 succeeded\n");
    }
    else {
      fprintf(test_out, "opal_dss test9 failed\n");
    }

    fprintf(test_out, "executing test10\n");
    if (test10()) {
        fprintf(test_out, "Test10 succeeded\n");
    }
    else {
      fprintf(test_out, "opal_dss test10 failed\n");
    }

    fprintf(test_out, "executing test11\n");
    if (test11()) {
        fprintf(test_out, "Test11 succeeded\n");
    }
    else {
      fprintf(test_out, "opal_dss test11 failed\n");
    }

    fprintf(test_out, "executing test12\n");
    if (test12()) {
        fprintf(test_out, "Test12 succeeded\n");
    }
    else {
      fprintf(test_out, "opal_dss test12 failed\n");
    }

    fclose(test_out);

    opal_finalize();

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