Listing 2 (testbool.cpp)

/********************************************************************/
/*             Test the boolean class.                              */
/********************************************************************/

#include <iostream.h>
#include <boolean.hpp>

char *test(int i)      {return i ? "okay.\n" : "not okay.\n"; }

main()
{

  boolean b1,b2;

  cout << "Testing boolean class\n";
  cout << "Constructed value and int() is " << test(b1 == FALSE);
  cout << "Comparison is " << test(b1 == b2);
  b1 = 1;
  cout << "Operator() is " << test(b1 == true);
  b1 = ~b2;
  cout << "Operator~() is " << test(b1 == true);
  b1++;
  cout << "Operator++() is " << test(b1 == false);
  b1--;
  cout << "Operator--() is " << test(b1 == true);
  cout << "Make_string() is " << bl.make_string() << "ly okay.\n";

  true = false;    // This only produces warning message.
}