Click here to view your grades.

Grading details:

Assignment 4: Test code

Assignment 3: Test code

Assignment 2:


The following was used to test your code.
// BEGIN Test.cpp

// Commenting 10pts
// (style similar or better than what's recommended in http://www.cs.uh.edu/~svenkat/C++CodingStandard)

#define TEST1 20pts
#define TEST2 20pts
#define TEST3 20pts
#define TEST4 20pts
#define TEST5 5pts
#define TEST6 5pts

#include <iostream>
using namespace std;

#include "String.h"

#ifdef TEST1
void test1()
{
	const String string1 = "hello ";
	const String string2 = "there";

	cout << string1 + string2 << endl;
}
#endif

#ifdef TEST2
void test2()
{
	String string1 = "hello";
	String string2 = "there";

	cout << string1 + " " + string2 << endl;

	String string3;
	cout << string1 + string3 + string2 << endl;
}
#endif

#ifdef TEST3
void test3()
{
	const String ha = "ha";
	try
	{
		cout << "ha[0] is ";
		cout.flush();
		cout << ha[0] <<  endl;
	}
	catch(OutOfRange ex)
	{
		cout << "Error: " << ex.getError() << endl;
	}

	try
	{
		cout << "ha[15] is ";
		cout.flush();
		cout << ha[15] <<  endl;
	}
	catch(OutOfRange ex)
	{
		cout << "Error: " << ex.getError() << endl;
	}
}
#endif

#ifdef TEST4
void test4()
{
	const String s1;

	String temp = "hi";
	temp [1] = 'o';
	cout << temp << endl;
}
#endif

#ifdef TEST5
void test5()
{
	const String s1;

	cout << "Is s1 empty? " << !s1 << endl;
}
#endif

#ifdef TEST6
void test6()
{
	const String ha = "ha";
	try
	{
		cout << "ha[0] is ";
		cout.flush();
		cout << ha[0] <<  endl;
	}
	catch(const OutOfRange ex)
	{
		cout << "Error: " << ex.getError() << endl;
	}
}
#endif

void main()
{
	cout << "Test1 ---------------------------------" << endl;
#ifdef TEST1
	test1();
#endif

	cout << "Test2 ---------------------------------" << endl;
#ifdef TEST2
	test2();
#endif

	cout << "Test3 ---------------------------------" << endl;
#ifdef TEST3
	test3();
#endif

	cout << "Test4 ---------------------------------" << endl;
#ifdef TEST4
	test4();
#endif

	cout << "Test5 ---------------------------------" << endl;
#ifdef TEST5
	test5();
#endif
}
// END Test.cpp

Assignment 1:

Commenting 20
Good separation of interface from implementation 20
Correctness 20
(using object to access static members will result in loss of 4 pts)
Static member initialization 20
Object members (no unnecessary members or code or forgetting const ) 20