/*
 * Test program for the class CoeffInformation
 *
 * $Date$
 * $Revision$
 *
 */

#ifdef NDEBUG
#undef NDEBUG
#endif /* NDEBUG */

#include "WImage/CoeffInformation.hh"
#include <cassert>
#include <iostream>

#if !(defined __WATCOMC__ && __WATCOMC__ < 1230)
using namespace std;
#endif

int
main (void)
{
  cout << "Testing class CoeffInformation...\n";

  CoeffInformation ci1 (1.0, 1, 1, 20);
  CoeffInformation ci2 (-1.0, 1, 2, 21);
  CoeffInformation ci3 (0.0, 1, 3, 22);
  CoeffInformation ci4 (2.0, 1, 4, 23);
  CoeffInformation ci5 (-2.0, 1, 5, 24);
  CoeffInformation ci6 (0.8 * COEFF_EPSILON, 1, 5, 24);
  CoeffInformation ci7 (-0.8 * COEFF_EPSILON, 1, 5, 24);
  
  assert (ci1.svcmp (ci2) == 1);
  assert (ci1.avcmp (ci2) == 0);
  assert (ci1.svcmp (ci3) == 1);
  assert (ci1.avcmp (ci3) == 1);
  assert (ci1.svcmp (ci4) == -1);
  assert (ci1.avcmp (ci4) == -1);
  assert (ci1.svcmp (ci5) == 1);
  assert (ci1.avcmp (ci5) == -1);
  assert (ci2.svcmp (ci5) == 1);
  assert (ci2.avcmp (ci5) == -1);
  assert (ci1.equals (ci1));
  assert (!ci1.equals (ci2));
  assert (ci3.svcmp (ci6) == 0);
  assert (ci6.svcmp (ci3) == 0);
  assert (ci3.svcmp (ci7) == 0);
  assert (ci7.svcmp (ci3) == 0);
  assert (ci1.pcmp (ci2) == -3);
  assert (ci5.pcmp (ci3) == 3);
  assert (ci1.aocmp (ci2) == -3);

  assert (!ci1.equals (ci4));
  ci1.set (ci4);
  assert (ci1.equals (ci4));

  assert (!ci1.equals (ci3));
  ci1.set (0.0, 1, 3, 22);
  assert (ci1.equals (ci3));

  //ci1.dump ("\n", "coeffinfo.txt");
  //ci1.dump ("\n");

  cout << "Test of class CoeffInformation completed successfully.\n";
  return 0;
}
