// testSwap.cc P. Conrad for CISC181
// a testing driver for swap functions


#include <iostream>
#include <cmath> // for fabs
using namespace std;


#include "swap.h"


bool approxEquals(double a, 
		  double b,
		  double tolerance = 1E-5)
{
  // fabs is "floating point absolute value
  // we want the abs value of the difference
  double difference = fabs(a-b);
  if (difference < tolerance )
    return true;
  else
    return false;

}

int main(void)
{
  int x=5; int y=6;


  swap(x,y);

  if (x==6 && y==5)
    cout << "Passed" << endl;
  else
    cout << "Failed" << endl;

  double w=5.1; double z=6.2;

  swap(w,z);

  if (approxEquals(w,6.2) && approxEquals(z,5.1))
    cout << "Passed" << endl;
  else
    cout << "Failed" << endl;

      
  return 0;

}
