#include <String.h>
int main(int argc, char **argv)
{
	int bugs=0;
	String s="Microsoft sucks! Red Hat doesn't suck!";
	String t="Microsoft sucks! Destroy Microsoft! Microsoft must die!";
	String u="Microsoft sucks!";
	if(s.left(16)!="Microsoft sucks!") {
		cerr << "left() seems to be broken." << endl;
		bugs++;
	}
	if(s.right(21) != "Red Hat doesn't suck!") {
		cerr << "right() seems to be broken." << endl;
		bugs++;
	}
	if(s.mid(18) != 'R') {
		cerr << "mid() with one parameter seems to be broken." << endl;
		bugs++;
	}
	if(s.mid(18, 7) != "Red Hat") {
		cerr << "mid() with 2 parameters seems to be broken." << endl;
		bugs++;
	}
	if(s.regex("Red ?[Hh]at|RED ?HAT")!="Red Hat") {
		cerr << "regex() seems to be broken." << endl;
		bugs++;
	}
	if(!s.contains("Red Hat")) {
		cerr << "contains() seems to be broken." << endl;
		bugs++;
	}
	if(t.replace("Microsoft", "Windows", false) != "Windows sucks! Destroy Microsoft! Microsoft must die!") {
		cerr << "replace() [once] seems to be broken." << endl;
		bugs++;
	}
	if(t.replace("Microsoft", "Windows") != "Windows sucks! Destroy Windows! Windows must die!") {
		cerr << "replace() [all] seems to be broken." << endl;
		bugs++;
	}
	if(u.replace("Microsoft", "Windows") != "Windows sucks!") {
		cerr << "replace() [all, test case 2] seems to be broken." << endl;
		bugs++;
	}
	
	if(bugs==0)
		cout << "No bugs in String class detected." << endl;
	return bugs;
}
