Ejemplo n.º 1
0
void check(E *e)
{
  int caught;
  
  caught = 0;
  try { fne(e); }
  catch(A *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(B *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort (); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(C *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(D *p) { caught = 1; if (p != e) abort ();}
  catch(...) { abort (); }
  if (!caught) abort();

  return;
}
Ejemplo n.º 2
0
void
test (void)
{
  int i, j, *res = correct_results;

  for (i = 0; i < 8; i++)
    {
      float arg0 = args[i];
      for (j = 0; j < 8; j++)
	{
	  float arg1 = args[j];

	  if (feq (arg0, arg1) != *res++)
	    abort ();
	  if (fne (arg0, arg1) != *res++)
	    abort ();
	  if (flt (arg0, arg1) != *res++)
	    abort ();
	  if (fge (arg0, arg1) != *res++)
	    abort ();
	  if (fgt (arg0, arg1) != *res++)
	    abort ();
	  if (fle (arg0, arg1) != *res++)
	    abort ();
	}
    }
}
Ejemplo n.º 3
0
void check(E *e)
{
  int caught;
  
  // try with whole object
  caught = 0;
  try { fne(e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(D *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(B *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(C *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(AA *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  // try with D oject
  caught = 0;
  try { fnd((D *)e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(D *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnd((D *)e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(B *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnd((D *)e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(C *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnd((D *)e); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(AA *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  // try with an A object
  caught = 0;
  try { fna((B *)e); }
  catch(B *p) { abort(); } // throw type is static type
  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fna((C *)e); }
  catch(C *p) { abort(); } // throw type is static type
  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fna((AA *)e); }
  catch(AA *p) { abort(); } // throw type is static type
  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  // try with B object
  caught = 0;
  try { fnb((B *)e); }
  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnb((B *)e); }
  catch(B *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnb((B *)e); }
  catch(C *p) { abort(); }
  catch(D *p) { abort(); }
  catch(...) { caught =1; }
  if (!caught) abort();
  
  // try with C object
  caught = 0;
  try { fnc((C *)e); }
  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnc((C *)e); }
  catch(C *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnc((C *)e); }
  catch(B *p) { abort(); }
  catch(D *p) { abort(); }
  catch(...) { caught =1; }
  if (!caught) abort();
  
  // try with AA object
  caught = 0;
  try { fnaa((AA *)e); }
  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnaa((AA *)e); }
  catch(AA *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnaa((AA *)e); }
  catch(C *p) { abort(); }
  catch(B *p) { abort(); }
  catch(D *p) { abort(); }
  catch(...) { caught =1; }
  if (!caught) abort();
  
  return;
}
Ejemplo n.º 4
0
void check(F *f)
{
  int caught;
  
  // try with whole object
  caught = 0;
  try { fnf(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(F *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnf(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(E *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnf(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(D *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnf(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(B *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnf(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(C *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  // try with D object
  caught = 0;
  try { fnd(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(D *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnd(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(B *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fnd(f); }
  catch(A *p) { abort(); } // A is ambiguous
  catch(C *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  // try with E object
  caught = 0;
  try { fne(f); }
  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(f); }
  catch(E *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(f); }
  catch(F *p) { abort(); }
  catch(...) { caught = 1; }
  if (!caught) abort();

  // try with an A object
  caught = 0;
  try { fna((B *)f); }
  catch(B *p) { abort(); } // throw type is static type
  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fna((C *)f); }
  catch(C *p) { abort(); } // throw type is static type
  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fna((E *)f); }
  catch(E *p) { abort(); } // throw type is static type
  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  // try with B object
  caught = 0;
  try { fnb((B *)f); }
  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnb((B *)f); }
  catch(B *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnb((B *)f); }
  catch(C *p) { abort(); }
  catch(D *p) { abort(); }
  catch(...) { caught =1; }
  if (!caught) abort();
  
  // try with C object
  caught = 0;
  try { fnc((C *)f); }
  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnc((C *)f); }
  catch(C *p) { caught = 1; if (p != f) abort();}
  catch(...) { abort(); }
  if (!caught) abort();
  
  caught = 0;
  try { fnc((C *)f); }
  catch(B *p) { abort(); }
  catch(D *p) { abort(); }
  catch(...) { caught =1; }
  if (!caught) abort();
  
  return;
}