Demo 2 Unit Testing:

Unit Testing was performed throughout the creation and implementation of each class. In order to test certain classes that rely upon one another, parts of code were commented out in order to minimize dependencies. As methods and functions were implemented and finalized, further development of each class and their methods took place until the goals for demo 2 were met. Following is a break down of the unit testing for each class:

(DISCLAIMER: All testing was done by creating small test programs, single .cpp files, that simply implement an int main() and instantiate the class being tested and any of its dependencies.  Using cout statements, we looked at the output and compared it to what we expected)
*****************************************************************************
Strategy:

int main() {
	Strategy *a = new Strategy( 5 );
	Strategy *b = new Strategy( a );
	Strategy *c = new Strategy( 5 );
	for (int i=0;i<2048; i++)
		if ( a->st[i] == b->st[i] )
			cout << "true";
		else
			cout << "false";
		if ( c->st[i] == a->st[i] )
			cout << "match";
		else
			cout << "mismatch";
		cout << a->updateScore(10);
		cout << a->getScore();
		cout << a->getBar(3);
		cout << a->getStrat(3);
		cout << a->hash(3);
	return 0;
}

int main2(){
	Strategy * a;
	for(int i=0;i<1000;i++)
	{
		a= new Strategy(5);
		a->getScore();
		a->getBar(20);
		a->updateScore(1);
		delete a;
	}
	cout<<"strat"<<endl;
}
*****************************************************************************
Agent:

int main() {
	Strategy *a = new Strategy (20);
	Strategy *b = new Strategy (20);
	Strategy *c = new Strategy (20);
	Agent anAgent(20, 45, 10);
	Agent anotherAgent(20, 45, 10, a, b, c);
	
	for (int i = 0; i<20; i++) {
		cout << anAgent.isGoingToBar(i) << " " << anotherAgent.isGoingToBar(i) << endl;
	}
	int stm = 0;
	int wins[20] = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
	anAgent.tellWins[wins,stm];
	cout << anAgent.isDead() << " " << anotherAgent.isDead() << endl;
	return 0;
}
int main2(){
	int c[]={1,0,1,1,0,1,0,1,1,0};
	Agent * b;
	for(int i=0;i<1000;i++)
	{
		b= new Agent(10,0,0);
		b->isGoingToBar(20);
		b->tellWins(c,40);
		b->isDead();
		delete b;
	}
	cout<<"Agent"<<endl;
}
*****************************************************************************
Group:

int main() {
	Group * d;
	for(int i=0;i<1000;i++)
	{
	d=new Group(4,5,0,0);
	d->isGoingToBar(20);
	d->getNumPeeps();
	d->isEmpty();
	delete d;
	}
	cout<<"Group"<<endl;
}
*****************************************************************************
Town:

int main() {
	int g[]={1,2,3,4,5};
	Town * t;
	for(int i=0;i<1000;i++)
	{
		t=new Town(5,100,g,true,3,50,50);
		for(j=0;j<1000;j++)
		{
			cout<<i<<" "<<j<<endl;
			t->turn();
		}
		delete t;
	}
	cout<<"Town"<<endl;
}
*****************************************************************************
GUI:
For the GUI, we just needed to test whether or not inputting numbers into the fields would actually store and/or print out the same values. The reason why the GUI could not be made into its own small unit test was because it needs the underlying classes and structure in order to have something to pass the values to. A small unit test would not compile if given the whole GUI to implement.
