// runTests.h  Class for Test-Driven Development
// P. Conrad for CISC220, 06J

// A barebones class for doing test-driven development (TDD)
// in the stule of "Agile" or "eXtreme Programming".
// Inspired by suites such as JUnit for Java TDD

#ifndef RUNTESTS_H
#define RUNTESTS_H

#include <iostream>
#include <cstdlib>


#include <string>
using std::string;

class RunTests_C
{

 public:

  RunTests_C () {run = passed = failed = 0;}
  int getPassed() const {return passed;}
  int getFailed() const {return failed;}
  int getRun() const {return run;}

  void print(std::ostream & out = std::cout) const;

  void assertEquals(const char * const s1,
		    string s2);

  void assertEquals(string s1,
		    const char * const s2);

  void assertEquals(const char * const s1,
		    const char * const s2);

  template<typename T> void assertEquals(T x, T y);

  
  
  // exit ends the program with the status code of the number
  // of failed tests.. if that is zero, then test is a success

  void finish() const { exit (failed); }

 private:
  
  int run; // number of tests run
  int passed;  // number of tests passed
  int failed; // number of tests failed

  void generateInstances(); // a hack to generate functions

};


#endif // RUNTESTS_H

