<repo_name>aaliszt/CS-II-Data-Structures<file_sep>/Assembler/postfix.cpp
// <NAME>
// CS23001
// postfix.cpp
// Description: Reads in infix expressions from a file and converts them to postfix,
// then puts them in an specified output file or displays them to the screen.

#include <iostream>
#include <fstream>
#include <cstdlib>
#include "stack.hpp"
#include "string/string.hpp"

//Infix to Postfix
//Converts fully parenthesized infix expressions to postfix expressions
String infixToPostfix(String str){
	
	std::vector<String> vec = str.split(' ');
	Stack<String> stk;
	String right = "";
	String oper = "";
	String left = "";
	for(int i = 0; i < (int)vec.size(); ++i){
		if(vec[i] == ")"){
			right = stk.pop();
			oper = stk.pop();
			left = stk.pop();
			stk.push(left + right + oper);
			right = ""; // Reset the strings to be blank
			left = "";
			oper = "";
		}
		if(vec[i] != "(" && vec[i] != ";" && vec[i] != ")") // Do not push and left or right parenthesis onto the stack
			stk.push(vec[i] + " ");                     // Also ignore the semicolon at the end of the expression
	}
	return stk.pop();
}

int main(int args, char* argv[]){
	if(args != 3 && args != 2){// If there ar not two or three arguments the command line input was invalid
		std::cout << "Error: Invalid input, try \"postfix input output(optional)\", exiting." << std::endl;
		exit(1);
	}
	
	std::ifstream inputFile(argv[1]);
	if(!inputFile.is_open()){
		std::cout << "Input file did not open properly, exiting." << std::endl;
		exit(1);
	}

	if(args == 2){// If no output file is specified output defaults to the screen
		String temp = "";
		String str = "";
		String result = "";
		while(!inputFile.eof()){
			inputFile >> temp;
			if(inputFile.eof()) break;

			if(temp == ";"){ 
				str = str + " ;";
				std::cout << "Infix: " << str << std::endl; // Infix expression
				result = infixToPostfix(str); 
				std::cout << "Postfix: " << result << std::endl << std::endl;  // Postfix expression
				str = ""; 
			}
			else                            // Add the entire line to the string
				str = str + temp + " "; // Add spaces back in so the String can be split
		}
	}
	else{// If there were not two arguments there must be three
		std::ofstream outputFile(argv[2]);
		if(!outputFile.is_open()){
			std::cout << "Output file did not open properly, exiting." << std::endl;
			exit(1);
		}
		
		String temp = "";
		String str = "";
		String result = "";
		while(!inputFile.eof()){
			inputFile >> temp;
			if(inputFile.eof()) break;

			if(temp == ";"){
				str = str + " ;";
				outputFile << "Infix: " << str << std::endl;
				result = infixToPostfix(str);
				outputFile << "Postfix: " << result << std::endl << std::endl;
				str = "";
			}
			else
				str = str + temp + " ";
		}	
	}
	inputFile.close();
	return 0;
}
<file_sep>/Big Integer/bigint.hpp
/**
 * <NAME>
 * bigint.hpp
 * CS 23001
 */
// Layout for the bigint class, provides function prototypes for
// member functions and member variables of the bigint class.

#ifndef BIGINT_HPP
#define BIGINT_HPP

#include <iostream>

static const int MAX_SIZE = 200;

class bigint{
public:
	// Constructors
	bigint();
	bigint(int);
	bigint(const char[]);

	// Operators
	bool operator==(const bigint&)const;
	int operator[](int)const;
	bigint operator+(const bigint&)const;
	bigint operator*(const bigint&)const;
	bigint timesDigit(int)const;
	bigint times10(int)const;
	friend std::ostream& operator<<(std::ostream&, const bigint&);
	friend std::istream& operator>>(std::istream&, bigint&); 

private:
	int bigintArray[MAX_SIZE];
};

#endif

<file_sep>/String/test_find.cpp
// <NAME>
// TESTS: findstr, findchar

#include <iostream>
#include "string.hpp"
#include <cassert>

int main(){
	{
		// SETUP
		String s("a");
		bool found = false;

		// TEST
		found = s.findstr("a");
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("aa");
		bool found = false;

		// TEST
		found = s.findstr("a");
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("aaaa");
		bool found = false;

		// TEST
		found = s.findstr("aaaa");
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("Find somthing in this string this string pls pls.");
		bool found = false;

		// TEST
		found = s.findstr(" pls");
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("I can't be what you want from me - well alright.");
		bool found = false;

		// TEST
		found = s.findstr("I can");
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("aaaa");
		bool found = false;

		// TEST
		found = s.findstr("aaaaaaaa");
	
		// VERIFY 
		assert(found == false);
	}
	{
		// SETUP
		String s("Don't need em");
		bool found = false;

		// TEST
		found = s.findstr("needs");
	
		// VERIFY 
		assert(found == false);
	}
	{
		// SETUP
		String s("Fuck the fame and all the hype G I just wanna know if my father would ever like me.");
		bool found = false;

		// TEST
		found = s.findstr("likes");
	
		// VERIFY 
		assert(found == false);
	}
	{
		// SETUP
		String s("a");
		bool found = false;

		// TEST
		found = s.findchar('a');
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("Plausible");
		bool found = false;

		// TEST
		found = s.findchar('e');
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("LMAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");
		bool found = false;

		// TEST
		found = s.findchar('Z');
	
		// VERIFY 
		assert(found == false);
	}
	{
		// SETUP
		String s("What the?!");
		bool found = false;

		// TEST
		found = s.findchar(' ');
	
		// VERIFY 
		assert(found == true);
	}
	{
		// SETUP
		String s("HA-HAAAAAAAAAAAAA");
		bool found = false;

		// TEST
		found = s.findchar(' ');

		// VERIFY
		assert(found == false);
	}
	std::cout << "Done testing find methods." << std::endl;
}
<file_sep>/String/test_ctor_chararray.cpp
// <NAME>
// TEST: Char array constructor

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// SETUP
		const char s[1] = { '\0' };
		
		// TEST
		String str(s);

		// VERIFY
		assert(str == '\0');
	}
	{
		// SETUP
		
		// TEST
		String str("a");

		// VERIFY
		assert(str == "a");
		std::cout << "a == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("abc");

		// VERIFY
		assert(str == "abc");
		std::cout << "abc == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("abc123");
		
		// VERIFY
		assert(str == "abc123");
		std::cout << "abc123 == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("abcdefghijklmnopqrstuvwxyz12345678910");
		
		// VERIFY
		assert(str == "abcdefghijklmnopqrstuvwxyz12345678910");
		std::cout << "abcdefghijklmnopqrstuvwxyz12345678910 == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("I don't like Strings.");
		
		// VERIFY
		assert(str == "I don't like Strings.");
		std::cout << "I dont't like Strings. == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("A          A");
		
		// VERIFY
		assert(str == "A          A");
		std::cout << "A          A == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("          ");
		
		// VERIFY
		assert(str == "          ");
	}
	{
		// SETUP
		
		// TEST
		String str("<NAME> - BACK AT IT AGAIN WITH THE WHITE VANS");
		
		// VERIFY
		assert(str == "<NAME> - BACK AT IT AGAIN WITH THE WHITE VANS");
		std::cout << "<NAME> - BACK AT IT AGAIN WITH THE WHITE VANS  == " << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA");
		
		// VERIFY
		assert(str == "HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA");
		std::cout << "HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA == " << std::endl << str << std::endl;
	}
	{
		// SETUP
		
		// TEST
		String str("156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Character");
		// VERIFY
		assert(str == "156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Characters!!!156Character");
		
	}
	{
		// SETUP
		
		// TEST
		String str("microprogrammingmissapropriatingmarginalizationsmasculinizationsmicrocrystallineminiaturizationsmultiprogrammingnewsworthinessesnoncommunicatingnondeterministicnoninstitutionalintramolecularlyinterhemeshpericinterjectionallyintermidiatenessinterconnection");
		// VERIFY
		assert(str == "microprogrammingmissapropriatingmarginalizationsmasculinizationsmicrocrystallineminiaturizationsmultiprogrammingnewsworthinessesnoncommunicatingnondeterministicnoninstitutionalintramolecularlyinterhemeshpericinterjectionallyintermidiatenessinterconnection");

	}

	std::cout << "Done testing char array ctor." << std::endl;
}
<file_sep>/String/test_ctor_char.cpp
// <NAME> 
// TESTS: Character constructor

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// SETUP
		char ch = '\0';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == '\0');	
	}
	{
		// SETUP
		char ch = 'a';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == 'a');
		std::cout << "a == " << str << std::endl;	
	}
	{
		// SETUP
		char ch = '1';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == '1');
		std::cout << "1 == " << str << std::endl;
	}
	{
		// SETUP
		char ch = ' ';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == ' ');	
	}
	{
		// SETUP
		char ch = '0';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == '0');	
		std::cout << "0 == " << str << std::endl;
	}
	{
		// SETUP
		char ch = '\t';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == '\t');	
	}
	{
		// SETUP
		char ch = '\n';

		// TESTS
		String str(ch);
		
		// VERIFY
		assert(str == '\n');	
	}
	std::cout << "Done testing char ctor." << std::endl;
}
<file_sep>/Big Integer/add.cpp
/**
 * <NAME>
 * add.cpp
 * CS 23001
 */
// Reads data from files into bigints

#include <iostream>
#include <fstream>
#include <cstdlib>
#include "bigint.hpp"

int main(){
	std::ifstream in("data1-1.txt");
	if(!in.is_open()){
		std::cerr << "Could not open data1-1.txt, exiting." << std::endl;
		exit(1);
	}
	
	bigint numOne;
	bigint numTwo;
	bigint result;
	
	while(!in.eof()){	
		in >> numOne;
		if(in.eof()) break; // Stops output of random data due to whitespace before the eof
		in >> numTwo;
	
		std::cout << "Bigint one is: " << numOne << std::endl << std::endl;
		std::cout << "Bigint two is: " << numTwo << std::endl;

		result = numOne + numTwo;

		std::cout <<"Sum of addition: " << result << std::endl << std::endl;
	}
	in.close();
	return 0;
}
<file_sep>/Assembler/test_push.cpp
// <NAME>
// TESTS: Push & Pop 

#include "string/string.hpp"
#include "stack.hpp"
#include <iostream>

int main(){
	{
		//SETUP
		Stack<int> s;
		
		//TEST
		s.push(1);
	
		//VERIFY
		assert(!s.isEmpty());
		assert(1 == s.pop());	
	}
	{
		//SETUP
		Stack<int> s;
		
		//TEST
		s.push(1);
		s.push(2);
		s.push(3);
	
		//VERIFY
		assert(!s.isEmpty());
		assert(3 == s.pop());	
		assert(2 == s.pop());	
		assert(1 == s.pop());	
	}
	{
		//SETUP
		Stack<String> s;
		
		//TEST
		s.push("");
	
		//VERIFY
		assert(!s.isEmpty());
		assert("" == s.pop());	
	}
	{
		//SETUP
		Stack<String> s;
		
		//TEST
		s.push("a");
	
		//VERIFY
		assert(!s.isEmpty());
		assert("a" == s.pop());	
	}
	{
		//SETUP
		Stack<String> s;
		
		//TEST
		s.push("Stack!");
		s.push(" ");
		s.push("a");
		s.push(" ");
		s.push("am");
		s.push(" ");
		s.push("I");
		s.push(" ");
		s.push("Hi");
	
		//VERIFY
		assert(!s.isEmpty());
		assert("Hi" == s.pop());	
		assert(" " == s.pop());	
		assert("I" == s.pop());	
		assert(" " == s.pop());	
		assert("am" == s.pop());	
		assert(" " == s.pop());	
		assert("a" == s.pop());	
		assert(" " == s.pop());	
		assert("Stack!" == s.pop());	
	}
	{
		//SETUP
		Stack<double> d;
		
		//TEST
		d.push(1.1);
		d.push(1.2);
		d.push(1.3);
		d.push(1.4);
		d.push(1.5);
		d.push(3.1415926535);
	
		//VERIFY
		assert(!d.isEmpty());
		assert(3.1415926535 == d.pop());
		assert(1.5 == d.pop());	
		assert(1.4 == d.pop());	
		assert(1.3 == d.pop());	
		assert(1.2 == d.pop());	
		assert(1.1 == d.pop());		
	}
	{
		//SETUP
		Stack<char> s;
		
		//TEST
		s.push('a');
		s.push('b');
		s.push('x');
		s.push('y');
	
		//VERIFY
		assert(!s.isEmpty());
		assert('y' == s.pop());	
		assert('x' == s.pop());	
		assert('b' == s.pop());	
		assert('a' == s.pop());	
	}
	{
		//SETUP
		Stack<String> s;
		
		//TEST
		s.push("");
		s.pop();
		s.push("");
		s.push("a");
		//VERIFY
		assert(!s.isEmpty());
		assert("a" == s.pop());
		assert("" == s.pop());	
	}
	{
		//SETUP
		Stack<String> s;
		
		//TEST
		s.push("a");
		s.push("b");
		s.push("c");
		s.push("d");
		s.push("e");
		assert(s.pop() == "e");
		assert(s.pop() == "d");
		assert(s.pop() == "c");
		s.push("f");
		s.push("g");
		assert(s.pop() == "g");
	
		//VERIFY
		assert(!s.isEmpty());
		assert("f" == s.pop());
		assert("b" == s.pop());
		assert("a" == s.pop());	
	}
	{
		//SETUP
		Stack<int> s;
		
		//TEST
		s.push(0);
	
		//VERIFY
		assert(!s.isEmpty());
		assert(0 == s.pop());	
	}
	std::cout << "Done testing push." << std::endl;
}
<file_sep>/Big Integer/test_times_single_digit.cpp
// bigint Test Program
//
// Tests:  times_10, uses ==
//
#include <iostream>
#include <cassert>
#include "bigint.hpp"

//===========================================================================
int main () {
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(0);

        // Test 
        bi = bi.timesDigit(0);

        // Verify
        assert(bi == 0);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi("1235134523435");

        // Test 
        bi = bi.timesDigit(0);

        // Verify
        assert(bi == 0);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(2345256);

        // Test 
        bi = bi.timesDigit(1);

        // Verify
        assert(bi == 2345256);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(25);

        // Test 
        bi = bi.timesDigit(2);

        // Verify
        assert(bi == 50);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(36);

        // Test 
        bi = bi.timesDigit(9);

        // Verify
        assert(bi == 324);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(25000);

        // Test 
        bi = bi.timesDigit(2);

        // Verify
        assert(bi == 50000);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(2354123);

        // Test 
        bi = bi.timesDigit(9);

        // Verify
        assert(bi == 21187107);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi(9);

        // Test 
        bi = bi.timesDigit(9);

        // Verify
        assert(bi == 81);
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi("124356798");

        // Test 
        bi = bi.timesDigit(2);

        // Verify
        assert(bi == "248713596");
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi("999999999");

        // Test 
        bi = bi.timesDigit(5);

        // Verify
        assert(bi == "4999999995");
    }
    {
        //------------------------------------------------------
        // Setup fixture
        bigint bi("126372839384657");

        // Test 
        bi = bi.timesDigit(8);

        // Verify
        assert(bi == "1010982715077256");
    }


    //Add test cases as needed.
    
    std::cout << "Done testing bigint * single digit" << std::endl;

}
<file_sep>/Profiler/profile_report/logentry.hpp
#ifndef CS_LOGENTRY_H_
#define CS_LOGENTRY_H_

// File:        logentry.hpp 
// Date:        3 / 24 / 2016
// Author: 	<NAME>       
// Description: Class definition for a log entry.

#include <iostream>
#include <vector>
#include "string.hpp" 

////////////////////////////////////////////////////////////
class Date { 
public:
            Date(){ day = "", month = "", year = 0; }
            Date(String);

            String getDay()const{ return day; }
            String getMonth()const{ return month; }
            int getYear()const{ return year; }	
private:
    String  day, month;
    int     year;
};

////////////////////////////////////////////////////////////
class Time {
  public:
            Time() { hour = 0, minute = 0, second = 0; }
            Time(String);

            int getHour()const{ return hour; }
            int getMinute()const{ return minute; }
            int getSecond()const{ return second; }
  private:
    int     hour, minute, second;
};

////////////////////////////////////////////////////////////
class LogEntry {
public:
            LogEntry() { host = "", date = Date(), time = Time(), request = "", status = "", number_of_bytes = 0; };
            LogEntry(String);

            int getBytes()const{ return number_of_bytes; }
            String getHost()const{ return host; }
            bool isEmpty()const { return (host == "" && request == "" && status == ""); }
            friend  std::ostream& operator<<(std::ostream&, const LogEntry&);

private:
    String  host;
    Date    date;
    Time    time;
    String  request;
    String  status;
    int     number_of_bytes;
};

// Free functions

std::vector<LogEntry>   parse       (std::istream&);
void                    output_all  (std::ostream&, const std::vector<LogEntry> &);
void                    by_host     (std::ostream&, const std::vector<LogEntry> &);
int                     byte_count  (const std::vector<LogEntry>&);
int			stoi        (String, int);

#endif

<file_sep>/String/oldstring.cpp
// <NAME>
// CS 23001
// string.cpp
// Defines funtions from string.hpp

#include <iostream>
#include "string.hpp"
#include <cassert>

// Default Constructor
// Initializes the char array to 0
String::String(){ str[0] = '\0'; }

// Character Constructor
// Initializes the char array to a single char
String::String(char ch){ str[0] = ch; str[1] = '\0'; }

// Character Array Constructor
// Initializes the char array to another char array
String::String(const char s[]){
	int i = 0;
	while(s[i] != '\0'){
		str[i] = s[i];
		++i;

		if(i >= capacity()-1)// If we reach capacity()-1 (255) then we are at the last index and need to add a null terminator
			break;
	}
	str[i] = '\0';
}

// Output Operator
// Displays the String
std::ostream& operator<<(std::ostream& out, const String &rhs){
	out << rhs.str;
	return out;
}

// Input Operator
// Reads input one word at a time
std::istream& operator>>(std::istream &in, String &rhs){
	char temp[STRING_CAPACITY];
	in >> temp;
	rhs = String(temp);
	return in;
}

// Addtition Operators
// Combines two Strings
String String::operator+(const String &rhs)const{
	if(length() == capacity()-1)// If this is at capacity we cannot add to it
		return *this;
	if(rhs.length() == capacity()-1)// If rhs is at capacity we cannot add to it
		return rhs;

	String result(str);
	int offset = length();
	int i = 0;

	while(rhs.str[i] != '\0' && i < capacity()){
		result.str[offset + i] = rhs.str[i]; // Starts at the end of this and adds rhs  
		++i;
	}

	result.str[offset + i] = '\0';
	return result;
}
String operator+(const char lhs[], const String &rhs){ return String(lhs) + rhs; }
String operator+(const char lhs, const String &rhs){ return String(lhs) + rhs; }

// Substring
// Returns a substring between a given starting and ending index
String String::substr(int start, int end)const{
	String result;
	assert(0 <= start);
	assert(start <= end);
	assert(end < length());
	
	for(int i = start; i <= end; ++i)
		result.str[i - start] = str[i]; // Gets the substring out of string
	
	result.str[end - start + 1] = '\0';
	return result;
}

// Find String 
// Looks for a substring inside a String and return true if found
bool String::findstr(const String &find)const{
	if(find.length() == 1 && str[0] == find.str[0])// If find is one char and == this then just return true
		return true;

	char start = find.str[0];
	char end = find.str[find.length()-1];
	bool search = false;
	bool found = false;
	int startI = 0;
	
	for(int i = 0; i < length(); ++i){
		if(str[i] == start) // If find the first char we must start looking at the next chars
			search = true;

		if(search && str[i] != find.str[startI]){// If we are looking at the substring and the chars do not match then our search was not succesful
			search = false;
			startI = 0;
		}

		if(search && str[i] == find.str[startI]) // Increment startI if we find another char consistent with find
			++startI;

		if(search && str[i] == end && startI == find.length())// If we reach the last char in find then we have found the substring in this
			return true;
	}
	return found;
}		

// Find Char
// Looks for a character in a String and returns true if found
bool String::findchar(const char &find)const{
	for(int i = 0; i < length(); ++i){
		if(str[i] == find)
			return true;
	}
	return false;
}

// Equality Operators
// Checks if two String's are equal
bool String::operator==(const String &rhs)const{
	int i = 0;
	while((str[i] != '\0') && (str[i] == rhs.str[i]))
		++i;
	return str[i] == rhs.str[i];
}
bool operator==(const char s[], const String &lhs){ return lhs == s; }
bool operator==(const char ch, const String &lhs){ return lhs == ch; }

// Subscript Operators
// Returns the value at index i in str
char String::operator[](int i)const{
	assert(i >= 0);
	assert(i <= STRING_CAPACITY);
	return str[i];
}
char& String::operator[](int i){return str[i]; }

// Other Relational Operators
// Compares Strings 
bool String::operator<(const String &rhs)const{
	int i = 0;
	while((str[i] != '\0') && (rhs.str[i] != '\0') && (str[i] == rhs.str[i]))
		++i;
	return str[i] < rhs.str[i];
}
bool operator<(const char s[], const String &s1){ return !(s1 < s); }
bool operator<(const char ch, const String &s1){ return !(s1 < ch); }
bool operator<=(const String &lhs, const String &rhs){ return ((lhs == rhs) || (lhs < rhs)); }
bool operator!=(const String &lhs, const String &rhs){ return !(lhs == rhs); }
bool operator>=(const String &lhs, const String &rhs){ return ((lhs == rhs) || !(lhs < rhs)); }
bool operator>(const String &lhs, const String &rhs){ return !(lhs < rhs); }

// Length
// Returns the length of the String
int String::length()const{
	int L = 0;
	while(str[L] != '\0')
		++L;
	return L;
}

// Capacity
// Returns the capacity of the String
int String::capacity()const{ return STRING_CAPACITY; }
<file_sep>/Big Integer/test_subscript.cpp
// bigint Test Program
//
// Tests:  subscript, uses ==
//
#include <iostream>
#include <cassert>
#include "bigint.hpp"

//===========================================================================
int main () {
    
    {
        // Setup
        bigint bi(4);

        // Test 
        int digit = bi[0];

        // Verify
        assert(bi    == 4);
        assert(digit == 4);
    }
    {
        // Setup
        bigint bi(4000);

        // Test 
        int digit = bi[2];

        // Verify
        assert(bi    == 4000);
        assert(digit == 0);
    }
    {
        // Setup
        bigint bi;

        // Test 
        int digit = bi[0];

        // Verify
        assert(bi    == 0);
        assert(digit == 0);
    }
    {
        // Setup
        bigint bi("12351345324");

        // Test 
        int digit = bi[10];

        // Verify
        assert(bi    == "12351345324");
        assert(digit == 1);
    }
    {
        // Setup
        bigint bi("1238345837");

        // Test 
        int digit = bi[6];

        // Verify
        assert(bi    == "1238345837");  //Wrong.  Add test cases.
        assert(digit == 8);
    }
    
    //Add test cases!!

    std::cout << "Done testing subscript." << std::endl;
}

<file_sep>/Assembler/test_pop.cpp
// <NAME>
// TESTS: PoP & Push

#include "string/string.hpp"
#include "stack.hpp"
#include <iostream>

int main(){
	{
		//SETUP
		Stack<int> s;
		s.push(1);

		//TEST
		int i = s.pop();

		//VERIFY
		assert(i == 1);	
	}
	{
		//SETUP
		Stack<int> s;
		s.push(1);
		s.push(2);
		s.push(3);

		//TEST
		int i = s.pop();
		int j = s.pop();
		int k = s.pop();

		//VERIFY
		assert(i == 3);
		assert(j == 2);
		assert(k == 1);	
	}
	{
		//SETUP
		Stack<int> s;
		for(int i = 0; i < 100; ++i)
			s.push(i);

		//TEST
		for(int i = 0; i < 100; ++i){
			int num = s.pop();
			assert(num == 99 - i);
		}
	}
	{
		//SETUP
		Stack<String> s;
		s.push("a");

		//TEST
		String str = s.pop();

		//VERIFY
		assert(str == "a");	
	}
	{
		//SETUP
		Stack<String> s;
		s.push("a");
		s.push("b");
		s.push("c");

		//TEST
		String str1 = s.pop();
		String str2 = s.pop();
		String str3 = s.pop();

		//VERIFY
		assert(str1 == "c");	
		assert(str2 == "b");	
		assert(str3 == "a");
	}	
	{
		//SETUP
		Stack<String> s;
		for(int i = 0; i < 100; ++i)
			s.push("abc123");

		//TEST
		for(int i = 0; i < 100; ++i){
			String str = s.pop();
			assert(str == "abc123");
		}
	}
	{
		//SETUP
		Stack<String> s;
		s.push("a");
		s.push("ab");
		s.push("abc");
		s.push("abcd");
		s.push("abcde");
		s.push("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789");

		//TEST
		String str1 = s.pop();
		String str2 = s.pop();
		String str3 = s.pop();
		String str4 = s.pop();
		String str5 = s.pop();
		String str6 = s.pop();

		//VERIFY
		assert(str6 == "a");	
		assert(str5 == "ab");	
		assert(str4 == "abc");	
		assert(str3 == "abcd");	
		assert(str2 == "abcde");	
		assert(str1 == "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789");
	}
	std::cout << "Done testing pop." << std::endl;
}
<file_sep>/Assembler/assembler.cpp
// <NAME>
// CS23001
// assembler.cpp
// Description: Reads in infix expressions from a file and converts them to postfix,
// then uses that postfix to produce assembly text, finally puts them in an specified 
// output file or displays them to the screen.

#include <iostream>
#include <fstream>
#include <cstdlib>
#include "stack.hpp"
#include "string/string.hpp"

//Infix to Postfix
//Converts fully parenthesized infix expressions to postfix expressions
String infixToPostfix(String str){
	
	std::vector<String> vec = str.split(' ');
	Stack<String> stk;
	String right = "";
	String oper = "";
	String left = "";
	for(int i = 0; i < (int)vec.size(); ++i){ // Loop through every token
		if(vec[i] == ")"){
			right = stk.pop();
			oper = stk.pop();
			left = stk.pop();
			stk.push(left + right + oper);
			right = ""; // Reset the strings to be blank
			left = "";
			oper = "";
		}
		if(vec[i] != "(" && vec[i] != ";" && vec[i] != ")") // Do not push and left or right parenthesis onto the stack
			stk.push(vec[i] + " ");                     // Also ignore the semicolon at the end of the expression
	}
	return stk.pop();
}

//Evaluate
//Outputs assembly to an ofstream
String evaluate(String L, String t, String R, int num, std::ostream& out){
	char ch = num + '0'; // Converts int to a char
	String result = "TMP" + String(ch); // Result is TMPn

	out << "    LD      " << L << std::endl;

	if(t == "+")					// If token was add "+"
		out << "    AD      " << R << std::endl;
	else if(t == "-")				// If token was subtract "-"
 		out << "    SB      " << R << std::endl;
	else if(t == "*")				// If token was multiply "*"
		out << "    ML      " << R << std::endl;
	else                                            // If token was divide "/"
		out << "    DV      " << R << std::endl;

	out << "    ST      " << result << std::endl;
	return result;	
}

//Postfix to Assembly
//Converts Postfix expressions to assembly
String postfixToAssembly(String str, std::ostream& out){
	std::vector<String> vec = str.split(' ');
	Stack<String> stk;
	String token = "";
	String right = "";
	String left = "";
	int tempNum = 1;

	for(int i = 0; i < (int)vec.size(); ++i){
		token = vec[i];
		if(token != "+" && token != "-" && token != "*" && token != "/")
			stk.push(token);
		else{
			right = stk.pop();
			left = stk.pop();
			stk.push(evaluate(left, token, right, tempNum, out));
			++tempNum;  // Increment tempNum to keep tract of new temporary value
			right = "";
			left = "";
		}
	}
	return stk.pop();
}		

int main(int args, char* argv[]){
	if(args != 3 && args != 2){// If there ar not two or three arguments the command line input was invalid
		std::cout << "Error: Invalid input, try \"postfix input output(optional)\", exiting." << std::endl;
		exit(1);
	}
	
	std::ifstream inputFile(argv[1]);
	if(!inputFile.is_open()){
		std::cout << "Input file did not open properly, exiting." << std::endl;
		exit(1);
	}

	if(args == 2){// If no output file is specified output defaults to the screen
		String temp = "";
		String str = "";
		String result = "";
		while(!inputFile.eof()){
			inputFile >> temp;
			if(inputFile.eof()) break;

			if(temp == ";"){ 
				str = str + " ;";
				std::cout << "Infix: " << str << std::endl; // Infix expression
				result = infixToPostfix(str); 
				std::cout << "Postfix: " << result << std::endl << std::endl;  // Postfix expression
				postfixToAssembly(result, std::cout); // Assembly 
				str = ""; 
			}
			else                            // Add the entire line to the string
				str = str + temp + " "; // Add spaces back in so the String can be split
		}
	}
	else{// If there were not two arguments there must be three
		std::ofstream outputFile(argv[2]);
		if(!outputFile.is_open()){
			std::cout << "Output file did not open properly, exiting." << std::endl;
			exit(1);
		}
		
		String temp = "";
		String str = "";
		String result = "";

		while(!inputFile.eof()){
			inputFile >> temp;
			if(inputFile.eof()) break;

			if(temp == ";"){
				str = str + " ;";
				outputFile << "Infix: " << str << std::endl;
				result = infixToPostfix(str);
				outputFile << "Postfix: " << result << std::endl << std::endl;
				postfixToAssembly(result, outputFile);			
				str = "";
			}
			else
				str = str + temp + " ";
		}	
	}
	inputFile.close();
	return 0;
}
<file_sep>/String/oldstring.hpp
// <NAME>
// CS 23001
// string.hpp
// Interface definition of String class

#ifndef STRING_HPP
#define STRING_HPP

#include <iostream>

const int STRING_CAPACITY = 256;

class String {
public:
    String        ();
    String        (char);
    String        (const char[]);
    
    String  substr        (int, int)                const;
    bool    findstr       (const String&)	    const;
    bool    findchar      (const char&)             const;
    char&   operator[]    (int);
    char    operator[]    (int)                     const;
    int     capacity      ()                        const;
    int     length        ()                        const;
    bool    operator==    (const String&)           const;
    bool    operator<     (const String&)           const;
    String  operator+     (const String&)           const;

    friend std::istream& operator>>(std::istream&, String&);
    friend std::ostream& operator<<(std::ostream&, const String&);

private:
    char str[STRING_CAPACITY];
};


String  operator+       (const char[],  const String&);
String  operator+       (char,          const String&);
bool    operator==      (const char[],  const String&);
bool    operator==      (char,          const String&);
bool    operator<       (const char[],  const String&);
bool    operator<       (char,          const String&);
bool    operator<=      (const String&, const String&);
bool    operator!=      (const String&, const String&);
bool    operator>=      (const String&, const String&);
bool    operator>       (const String&, const String&);

#endif

<file_sep>/String/test_substring.cpp
// <NAME>
// TESTS: Substring

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// SETUP
		String s("a");
		String sub;

		// TESTS
		sub = s.substr(0,0);

		// VERIFY
		assert(sub == "a");
	}
	{
		// SETUP
		String s("abc");
		String sub;

		// TESTS
		sub = s.substr(0,2);

		// VERIFY
		assert(sub == "abc");
	}
	{
		// SETUP
		String s("abcdefghijklmnop");
		String sub;

		// TESTS
		sub = s.substr(3,6);

		// VERIFY
		assert(sub == "defg");
	}
	{
		// SETUP
		String s("Cat Bat Mat Rat Vat Fat Dat Pat Sat Nat");
		String sub;

		// TESTS
		sub = s.substr(24, 34);

		// VERIFY
		assert(sub == "Dat Pat Sat");
	}
	{
		// SETUP
		String s("BOOOOOOOOOOOOOOOOM");
		String sub;

		// TESTS
		sub = s.substr(17, 17);

		// VERIFY
		assert(sub == "M");
	}
	std::cout << "Done testing substring." << std::endl;
}
<file_sep>/String/test_input.cpp
// <NAME>
// TESTS: Input operator

#include "string.hpp"
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cassert>

int main(){
	std::ifstream in("input.txt");
	if(!in.is_open()){
		std::cerr << "Could not open input.txt, exiting." << std::endl;
		exit(1);
	}
	
	String s1;

	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "This");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "is");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "a");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "text");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "file");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "that");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "tests");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "the");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "input");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "method");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "of");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "string.hpp");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "and");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "checks");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "if");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "it");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "reads");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "in");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "one");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "word");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "at");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "a");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "time.");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "It");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "should");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "skip");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "all");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "spaces");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "and");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "read");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "in");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "each");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "word.");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "Here");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "is");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "a");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "316");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "character");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "string");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "with");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "no");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "spaces:");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789EndofLongString.");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "Here");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "is");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "a");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "string");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "that");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "is");
	}
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "703");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "characters:");
	} 	
	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789END");
	} 	
 	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "Test");
	}
 	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "TEST");
	}
 	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "Test...");
	}
 	if(!in.eof())
	{
		in >> s1;
		assert(s1 == "ENDOFFILE.");
	}
	std::cout << "Done testing input." << std::endl;
	in.close();
	return 0;
}
<file_sep>/String/logentry.cpp
// File:        logentry.cpp  
// Date:        3 / 24 / 2016
// Author:     	<NAME> 
// Description: Class implementation for a log entry.

#include <iostream>
#include <vector>
#include <cassert>
#include "string.hpp" 
#include "logentry.hpp"

//////////////////////////////////////////////////////////
// REQUIRES: str contains an int, and size = length of str
// ENSURES: the int value in str is returned as an int 
int stoi(String str, int size){
	int val = 0;
	int temp = 0;
	for(int i = 0; i < size; ++i){         // While i < str.length() convert the characters in str to ints
		temp = int(str[i]) - int('0'); // Converts individual character to int
		val = val * 10;                // Add another digit when val has more than one digit
		val += temp;                   // Add the most recent int to the end of val
	}
	return val;
} 
		
//////////////////////////////////////////////////////////
// REQUIRES: String s contains a valid date
// ENSURES: day, month, and year are initialized to the values in s
Date::Date(String s) {
	std::vector<String> vec = s.split(':'); 
	String temp = vec[0]; 				// Front of vec contains date
	std::vector<String> vec2 = temp.split('[');     // Remove excess [
	String date = vec2[0];		                // Now we have the date with some '/' characters
	std::vector<String> vec3 = date.split('/');     // Split at each /    
	day = vec3[0];                                  // Then put each member of vec3 with the proper variable
	month = vec3[1];
	year = stoi(vec3[2], vec3[2].length());
}

//////////////////////////////////////////////////////////
// REQUIRES: String s contains a valid time
// ENSURES: hour, minute, and second are initialized to the values in s
Time::Time(String s) {
	std::vector<String> vec = s.split(':');
	hour = stoi(vec[1], vec[1].length());    // Back of vec has time, convert each String to an int
	minute = stoi(vec[2], vec[2].length());  // and assign the to the proper variables 
	second = stoi(vec[3], vec[3].length());
}	

////////////////////////////////////////////////////////// 
// REQUIRES: 
// ENSURES: All LogEntry member variables are initialized to the values in s, or LogEntry is empty(if s is invalid)
LogEntry::LogEntry(String s) {
	std::vector<String> vec = s.split(' ');
	
	if(vec.size() != 10){ // If size != 10 the logEntry is invalid
		host = "";    // Set all members to their default values
		date = Date();
		time = Time();
		request = "";
		status = "";
		number_of_bytes = 0;
	}
	else{
		host = vec[0];
		date = Date(vec[3]); // vec[3] contains both time and date
		time = Time(vec[3]); // send each to their String ctor to be spilt an initialized
	
		String front = vec[5];                    // vec[5] == Front of request
		std::vector<String> f = front.split('"'); // Remove the quotation mark from the front of the request
		request = request + f[0] + " " + vec[6];  // Store the request with proper spacing
		String back = vec[7];                     // vec[7] == End of request
		std::vector<String> b = back.split('"');  // Remove the quotation mark from the end of the request
		request = request + " " + b[0];           // Store the request with proper spacing
	
		status = vec[8];    // vec[8] contains status number
	
		if(vec[9] == '-') // '-' represents 0 bytes
			number_of_bytes = 0;
		else
			number_of_bytes = stoi(vec[9], vec[9].length());
	}
}

//////////////////////////////////////////////////////////
// REQUIRES: LogEntry is valid
// ENSURES: LogEntry is put into out with the same format as the input file
std::ostream& operator<<(std::ostream& out, const LogEntry& log){
	if(log.isEmpty())//If log is empty then it was not valid(output nothing)
		return out;
	
	// Writes LogEntry to out with the same format as the input files 
	out << log.host;
	out << " - - ";
	out << "[" << log.date.getDay() << "/" << log.date.getMonth() << "/" << log.date.getYear();
	out << ":" << log.time.getHour() << ":" << log.time.getMinute() << ":" << log.time.getSecond() << " ";
	out << "-0400] \"" << log.request << "\" " << log.status << " " << log.number_of_bytes;
	out << std::endl;
	return out;
}

////////////////////////////////////////////////////////// 
// REQUIRES:
// ENSURES: returns a vector of LogEntrys from in
std::vector<LogEntry> parse(std::istream& in) {
	std::vector<LogEntry> result;
	String line;
	char ch;
	LogEntry log;

	while(!in.eof()){ // Read in all LogEntrys
		in.get(ch);	
		if(in.eof()) break;
		
		if(ch == '\n'){// If we are starting a new line then we must add the previous line to the vector
			log = LogEntry(line);
			result.push_back(log);
			line = "";
		}
		else
			line = line + ch;
	}
	return result;
}

////////////////////////////////////////////////////////// 
// REQUIRES: 
// ENSURES: All LogEntrys in vec are output(one per line)
void output_all(std::ostream& out, const std::vector<LogEntry> &vec) {
	for(int i = 0; i < (int)vec.size(); ++i)
		out << vec[i];   
}

////////////////////////////////////////////////////////// 
// REQUIRES: 
// ENSURES: All hosts of LogEntrys in vec are output(one per line)
void by_host(std::ostream& out, const std::vector<LogEntry> &vec) {
	for(int i = 0; i < (int)vec.size(); ++i){
		if(vec[i].getHost() != "") 	// Ignore invalid LogEntries
			out << vec[i].getHost() << std::endl;
	}
}

////////////////////////////////////////////////////////// 
// REQUIRES: 
// ENSURES: count = total number of bytes of all LogEntrys in vec
int byte_count(const std::vector<LogEntry> &vec) {
	int count = 0;
	for(int i = 0; i < (int)vec.size(); ++i)
		count = count + vec[i].getBytes();

	return count;
}

<file_sep>/Profiler/ASTree.cpp
/*
 *  ASTree.cpp
 *  Abstract Syntax Tree
 *
 *  Created by <NAME>
 *  Copyright 2016 Kent State University. All rights reserved.
 *
 *  Modified by: <NAME>
 *
 */

#include "ASTree.hpp"


/////////////////////////////////////////////////////////////////////
// Copy constructor for srcML
//
srcML::srcML(const srcML& actual) {
    tree = new AST(*(actual.tree));
}

/////////////////////////////////////////////////////////////////////
// Constant time swap for srcML
//
void srcML::swap(srcML& b) {
    std::string t_header = header;
    header = b.header;
    b.header = t_header;
    
    AST *temp = tree;
    tree = b.tree;
    b.tree = temp;
}

/////////////////////////////////////////////////////////////////////
// Assignment for srcML
//
srcML& srcML::operator=(srcML rhs) {
    swap(rhs);
    return *this;
}

/////////////////////////////////////////////////////////////////////
// Reads in and constructs a srcML object.
//
std::istream& operator>>(std::istream& in, srcML& src){
    char ch;
    if (!in.eof()) in >> ch;
    src.header = readUntil(in, '>');
    if (!in.eof()) in >> ch;
    if (src.tree) delete src.tree;
    src.tree = new AST(category, readUntil(in, '>'));
    src.tree->read(in);
    return in;
}

/////////////////////////////////////////////////////////////////////
// Prints out a srcML object
//
std::ostream& operator<<(std::ostream& out, const srcML& src){
    src.tree->print(out);
    return out;
}

/////////////////////////////////////////////////////////////////////
//  Adds in the includes and profile variables
//
void srcML::mainHeader(std::vector<std::string>& profileNames) {
    tree->mainHeader(profileNames);
}

/////////////////////////////////////////////////////////////////////
//  Adds in the includes and profile variables
//
void srcML::fileHeader(const std::string& profileName) {
    tree->fileHeader(profileName);
}

/////////////////////////////////////////////////////////////////////
// Adds in the report to the main.
//
void srcML::mainReport(std::vector<std::string>& profileNames) {
        tree->mainReport(profileNames);
}

/////////////////////////////////////////////////////////////////////
//  Inserts a filename.count() into each function body.
//
void srcML::funcCount(const std::string& profilename) {
    tree->funcCount(profilename);
}

/////////////////////////////////////////////////////////////////////
// Inserts a filename.count() for each statement.
//
void srcML::lineCount(const std::string& profilename) {
    tree->lineCount(profilename);
}

/////////////////////////////////////////////////////////////////////
// Constructs a category, token, or whitespace node for the tree.
//
AST::AST(nodes t, const std::string& s) {
    nodeType = t;
    switch (nodeType) {
        case category:
            tag = s;
            break;
        case token:
            text = unEscape(s);
            break;
        case whitespace:
            text = s;
            break;
    }
}

/////////////////////////////////////////////////////////////////////
/// Destructor for AST
///
AST::~AST(){
	for(std::list<AST*>::iterator i = child.begin(); i != child.end(); ++i)
		delete *i;
}

/////////////////////////////////////////////////////////////////////
// Copy Constructor for AST
//
AST::AST(const AST& actual) {
	text = actual.text;
	tag = actual.tag;
	closeTag = actual.closeTag;
	nodeType = actual.nodeType;
	for (std::list<AST*>::const_iterator i = actual.child.begin(); i != actual.child.end(); ++i) 
			child.push_back(new AST(*(*i)));
}

/////////////////////////////////////////////////////////////////////
// Constant time swap for AST
//
void AST::swap(AST& rhs) {
	std::string tempTxt = rhs.text;
	rhs.text = text;
	text = tempTxt;

	std::string tempTag = rhs.tag;
	rhs.tag = tag;
	tag = tempTag;

	std::string tempC = rhs.closeTag;
	rhs.closeTag = closeTag;
	closeTag = tempC;

	nodes tempN = rhs.nodeType;
	rhs.nodeType = nodeType;
	nodeType = tempN;

	std::list<AST*> temp = child;
	child = rhs.child;
	rhs.child = temp;
}

/////////////////////////////////////////////////////////////////////
// Assignment for AST
//
AST& AST::operator=(AST rhs) {
    swap(rhs);
    return *this;
}

/////////////////////////////////////////////////////////////////////
// Returns a pointer to child[i] where (child[i]->tag == tagName)
//
// IMPORTANT for part 3
AST* AST::getChild(std::string tagName) {
    std::list<AST*>::iterator ptr = child.begin();
    while (((*ptr)->tag != tagName) && (ptr != child.end())) {
         ++ptr;
    }
    return *ptr;
}

/////////////////////////////////////////////////////////////////////
// Returns the full name of a <name> node.
//
// IMPORTANT for part 3
//
std::string AST::getName() const {
    std::string result;
    if (child.front()->tag != "name") {
        result = child.front()->text;   //A simple name (e.g., main)
    } else {                            //A complex name (e.g., stack::push).
        result = child.front()->child.front()->text;
        result += "::";
        result += child.back()->child.front()->text;
    }
    return result;
}

/////////////////////////////////////////////////////////////////////
//  Adds in the includes and profile variables in a main file.
//
void AST::mainHeader(std::vector<std::string>& profileNames) {
	for(std::list<AST*>::iterator it = child.begin(); it != child.end(); ++it){
		if((*it)->tag == "function"){// When we find the first function tag stop and insert code
			child.insert(it, new AST(token, "\n"));
			child.insert(it, new AST(token, "#include \"profile.hpp\"\n")); // Add include derective

			for(int i = 0; i < (int)profileNames.size(); ++i){// Go through filenames and insert code to create profile objects
				std::string filename = profileNames[i];
	
				for(int j = 0; j < (int)filename.size(); ++j){// Replace _ with . in filenames
					if(filename[j] == '_' && filename[j+1] == 'c')
						filename[j] = '.';
				}
				child.insert(it, new AST(token, "profile " + profileNames[i] + "(\"" + filename + "\");" + "\n"));
			}
			child.insert(it, new AST(token, "\n"));
			break;// Leave the loop after we insert the code(stops multiple insertion)
		}
	}
}

/////////////////////////////////////////////////////////////////////
//  Adds in the includes and profile variables for non-main files
//
void AST::fileHeader(const std::string& profileName) {
	for(std::list<AST*>::iterator it = child.begin(); it != child.end(); ++it){
		if((*it)->tag == "function"){
			child.insert(it, new AST(token, "\n"));
			child.insert(it, new AST(token, "#include \"profile.hpp\"\n")); // Add include derective
			child.insert(it, new AST(token, "extern profile " + profileName + ";" + "\n"));// Add extern statement
			child.insert(it, new AST(token, "\n"));
			break;//Leave loop after inserting code
		}
	}
}

/////////////////////////////////////////////////////////////////////
// Adds in the report to the main.
// Assumes only one return at end of main body.
//
void AST::mainReport(std::vector<std::string>& profileNames) {
	for(std::list<AST*>::iterator i = child.begin(); i != child.end(); ++i){
		if((*i)->tag == "function" && (*i)->getChild("name")->getName() == "main"){ // If we reach a function named main 
			AST* main = (*i)->getChild("block");
			std::list<AST*>::iterator it = main->getChild("return")->child.begin(); // Put an iterator at the front of the return block in main
			for(int n = 0; n < (int)profileNames.size(); ++n)
				child.insert(it, new AST(token, "std::cout << " + profileNames[n] + " << std::endl;\n    "));
		}
	}
}

/////////////////////////////////////////////////////////////////////
// Adds in a line to count the number of times each function is executed.
//  Assumes no nested functions.
//
void AST::funcCount(const std::string& profileName) {
	for(std::list<AST*>::iterator i = child.begin(); i != child.end(); ++i){
		if((*i)->tag == "function" || (*i)->tag == "constructor" || (*i)->tag == "destructor"){ // If we reach a function, constructor, or destructor we must add code 
			std::string funcName = (*i)->getChild("name")->getName(); // Get function name
			AST* body = (*i)->getChild("block"); // Get a pointer to the main block of the function
			std::list<AST*>::iterator it = body->child.begin(); // Put an iterator at the start of the main block
			child.insert(++it, new AST(token, " " + profileName + ".count(__LINE__, \"" + funcName + "\");"));
		}
	}
}

/////////////////////////////////////////////////////////////////////
// Adds in a line to count the number of times each statement is executed.
//   No breaks, returns, throw etc.
//   Assumes all construts (for, while, if) have { }.
//
void AST::lineCount(const std::string& profileName) {    
    // Recursively check for expr_stmt
	for(std::list<AST*>::iterator i = child.begin(); i != child.end(); ++i){
		if((*i)->tag == "expr_stmt"){ // When we reach an expression statment we must insert
			std::list<AST*>::iterator it = i; // Copy iterator i to prevent double insertion
			child.insert(++it, new AST(token, " " + profileName + ".count(__LINE__);"));
		}
		else // If we are not at an expression statment continue recursing
			(*i)->lineCount(profileName);
	}
}

/////////////////////////////////////////////////////////////////////
// Read in and construct AST
// REQUIRES: '>' was previous charater read 
//           && this == new AST(category, "TagName")
//
//
std::istream& AST::read(std::istream& in) {
    AST *subtree;
    std::string temp, Lws, Rws;
    char ch;
    if (!in.eof()) in.get(ch);
    while (!in.eof()) {
        if (ch == '<') {                      //Found a tag
            temp = readUntil(in, '>');
            if (temp[0] == '/') {
                closeTag = temp;
                break;                        //Found close tag, stop recursion
            }
            subtree = new AST(category, temp);               //New subtree
            subtree->read(in);                               //Read it in
            in.get(ch);
            child.push_back(subtree);                        //Add it to child
        } else {                                             //Found a token
            temp = std::string(1, ch) + readUntil(in, '<');  //Read it in.
            std::vector<std::string> tokenList = tokenize(temp);
            for (std::vector<std::string>::const_iterator i=tokenList.begin();
                 i != tokenList.end(); ++i) {
                if (isspace((*i)[0])) {
                    subtree = new AST(whitespace, *i);
                } else {
                    subtree = new AST(token, *i);
                }
                child.push_back(subtree);
            }
            ch = '<';
        }
    }
    return in;
}

/////////////////////////////////////////////////////////////////////
// Print an AST 
// REQUIRES: indent >= 0
//
std::ostream& AST::print(std::ostream& out) const {
    for (std::list<AST*>::const_iterator i = child.begin();
         i != child.end(); ++i) {
        switch ((*i)->nodeType) {
            case category:
                (*i)->print(out);
                break;
            case token:
                out << (*i)->text;
                break;
            case whitespace:
                out << (*i)->text;
                break;
        }
    }
    return out;
}

    
    
    

/////////////////////////////////////////////////////////////////////
// Utilities
//

// IMPORTANT for part 3
bool isStopTag(std::string tag) {
    if (tag == "decl_stmt"            ) return true;
    if (tag == "argument_list"        ) return true;
    if (tag == "init"                 ) return true;
    if (tag == "condition"            ) return true;
    if (tag == "cpp:include"          ) return true;
    if (tag == "macro"                ) return true;
    if (tag == "comment type\"block\"") return true;
    if (tag == "comment type\"line\"" ) return true;
    return false;
}

//For reading

/////////////////////////////////////////////////////////////////////
// Reads until a key is encountered.  Does not include ch.
// REQUIRES: in.open()
// ENSURES: RetVal[i] != key for all i.
//
std::string readUntil(std::istream& in, char key) {
    std::string result;
    char ch;
    in.get(ch);
    while (!in.eof() && (ch != key)) {
        result += ch;
        in.get(ch);
    }
    return result;
}

/////////////////////////////////////////////////////////////////////
// Converts escaped XML charaters back to charater form
// REQUIRES: s == "&lt;"
// ENSURES:  RetVal == "<"
//
std::string unEscape(std::string s) {
    std::size_t pos = 0;
    while ((pos = s.find("&gt;"))  != s.npos) { s.replace(pos, 4, ">");}
    while ((pos = s.find("&lt;"))  != s.npos) { s.replace(pos, 4, "<");}
    while ((pos = s.find("&amp;")) != s.npos) { s.replace(pos, 5, "&");}
    return s;
}

/////////////////////////////////////////////////////////////////////
// Given: s == "   a + c  "
// RetVal == {"   ", "a", " ", "+", "c", " "}  
//
std::vector<std::string> tokenize(const std::string& s) {
    std::vector<std::string> result;
    std::string temp = "";
    unsigned i = 0;
    while (i < s.length()) {
        while (isspace(s[i]) && (i < s.length())) {
            temp.push_back(s[i]);
            ++i;
        }
        if (temp != "") {
            result.push_back(temp);
            temp = "";
        }
        while (!isspace(s[i]) && (i < s.length())) {
            temp.push_back(s[i]);
            ++i;
        }
        if (temp != "") {
            result.push_back(temp);
            temp = "";
        }
    }
    return result;
}
<file_sep>/String/test_resize.cpp
// <NAME>
// TESTS: resetCapacity

#include <iostream>
#include <cassert>
#include "string.hpp"

int main(){
	{
		// SETUP
		String s;

		// TEST
		s.resetCapacity(0);

		// VERIFY
		assert(0 == s.capacity());
	}
	{
		// SETUP
		String s("abc");

		// TEST
		s.resetCapacity(1);

		// VERIFY
		assert(1 == s.capacity());
		assert(s == "");
	}
	{
		// SETUP
		String s("abc");

		// TEST
		s.resetCapacity(2);

		// VERIFY
		assert(2 == s.capacity());
		assert(s == "a");
	}
	{
		// SETUP
		String s;

		// TEST
		s.resetCapacity(300);

		// VERIFY
		assert(300 == s.capacity());
	}
	{
		// SETUP
		String s("a");

		// TEST
		s.resetCapacity(1);

		// VERIFY
		assert(1 == s.capacity());
		assert(s == "");
	}
	{
		// SETUP
		String s("abc");

		// TEST
		s.resetCapacity(300);

		// VERIFY
		assert(300 == s.capacity());
		assert(s == "abc");
	}
	{
		// SETUP
		String s("abc");

		// TEST
		s.resetCapacity(2);

		// VERIFY
		assert(2 == s.capacity());
		assert(s == "a");
	}
	{
		// SETUP
		String s("abc");

		// TEST
		s.resetCapacity(1);

		// VERIFY
		assert(1 == s.capacity());
		assert(s == "");
	}
	{
		// SETUP
		String s("AYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY LMAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");

		// TEST
		s.resetCapacity(4);

		// VERIFY
		assert(4 == s.capacity());
		assert(s == "AYY");
	}
	{
		// SETUP
		String s("Gotem");

		// TEST
		s.resetCapacity(256);

		// VERIFY
		assert(256 == s.capacity());
		assert(s == "Gotem");
	}
	{
		// SETUP
		String s("                                                                                                                                                             ");

		// TEST
		s.resetCapacity(5);

		// VERIFY
		assert(5 == s.capacity());
		assert(s == "    ");
	}
	{
		// SETUP
		String s("HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA123456");
		// TEST
		s.resetCapacity(256);

		// VERIFY
		assert(s == "HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA12345");
		assert(256 == s.capacity());
	}
	{
		// SETUP
		String s("HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA12345");

		// TEST
		s.resetCapacity(256);

		// VERIFY
		assert(256 == s.capacity());
		assert(s == "HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA12345");
	}
	{
		// SETUP
		String s("HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA123456789");

		// TEST
		s.resetCapacity(260);

		// VERIFY
		assert(260 == s.capacity());
		assert(s == "HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA123456789");
	}
	{
		// SETUP
		String s("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");

		// TEST
		s.resetCapacity(0);

		// VERIFY
		assert(0 == s.capacity());
	}
	std::cout << "Done testing resetCapacity." << std::endl;
}

<file_sep>/String/test_length.cpp
// <NAME>
// TESTS: Length method

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// TEST
		String s;

		// VERIFY
		assert(0 == s.length());
	}
	{
		// TEST
		String s("5");

		// VERIFY
		assert(1 == s.length());
	}
	{
		// TEST
		String s("abcde");

		// VERIFY
		assert(5 == s.length());
	}
	{
		// TEST
		String s("          ");

		// VERIFY
		assert(10 == s.length());
	}
	{
		// TEST
		String s("abcdefghijklmnopqrstuvwxyz1234567890");

		// VERIFY
		assert(36 == s.length());
	}
	{
		// TEST
		String s;

		// VERIFY
		assert(256 == s.capacity());
	}
	std::cout << "Done testing length." << std::endl;
}
<file_sep>/String/test_equal.cpp
// <NAME>
// TESTS: Equality operator

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// SETUP
		const char s1[1] = { '\0' };
		String s2;

		//VERIFY
		assert(s1 == s2);
		assert(s2 == s1);
	}
	{
		// SETUP
		const char s1[6] = { '1', '2', '3', '4', 'a'};
		String s2(s1);

		//VERIFY
		std::cout << "1234a == " << s2 << std::endl;
		assert(s1 == s2);
		assert(s2 == s1);
	}
	{
		// SETUP
		const char s1[2] = { 'e' };
		String s2(s1);

		//VERIFY
		std::cout << "e == " << s2 << std::endl;
		assert(s1 == s2);
		assert(s2 == s1);
	}
	{
		// SETUP
		const char s1[9] = { 'e', '3', '1', 'q', 'x', 'y', '/', ' ' };
		String s2(s1);

		//VERIFY
		std::cout << "e31qxy/  == " << s2 << std::endl;
		assert(s1 == s2);
		assert(s2 == s1);
	}
	{
		// SETUP
		char ch = '\0';
		String s;

		// VERIFY
		assert(ch == s);
		assert(s == ch);
	}
	{
		// SETUP
		char ch = ' ';
		String s(ch);

		// VERIFY
		assert(ch == s);
		assert(s == ch);
	}
	{
		// SETUP
		char ch = '%';
		String s(ch);

		// VERIFY
		assert(ch == s);
		assert(s == ch);
		std::cout << "% == " << s << std::endl;
	}
	{
		// SETUP
		char ch = 'z';
		String s(ch);

		// VERIFY
		assert(ch == s);
		assert(s == ch);
		std::cout << "z == " << s << std::endl;
	}
	{
		// SETUP
		char ch = '0';
		String s(ch);

		// VERIFY
		assert(ch == s);
		assert(s == ch);
		std::cout << "0 == " << s << std::endl;
	}
	std::cout << "Done testing equality." << std::endl;

}
<file_sep>/README.md
# <NAME>
# Kent State University
# Projects Completed for Course
# CS II Data Structures | Spring 2016
<file_sep>/Big Integer/bigint.cpp
/**
 * <NAME>
 * bigint.cpp
 * CS23001
 */
// Defines member funtions of the bigint class

#include "bigint.hpp"
#include <iostream>

// Default Constructor
// Initializes the bigint to 0
bigint::bigint(){
	for(int i = 0; i < MAX_SIZE; ++i)
		bigintArray[i] = 0;
}

// Int Constructor
// Takes an int and puts it into a bigint  
bigint::bigint(int num){
	int temp = num;
	for(int i = 0; i < MAX_SIZE; ++i){
		bigintArray[i] = temp % 10; // Gets the last digit in the int and adds it
		temp /= 10; 		   // to the bigint then removes the last digit from the int
	}
}	

// Character String Constructor 
// Takes a string of characters and puts them into a bigint
bigint::bigint(const char charArray[]){

	int size = 0;
	while(charArray[size] != '\0') // Gets the size of the character array
		++size;

	for(int i = 0; i < size; ++i)
		bigintArray[i] = int(charArray[size - 1 - i]) - int('0'); // Puts the charater array into the bigint
		
	for(int i = size; i < MAX_SIZE; ++i)
		bigintArray[i] = 0; // Fills the rest of the bigint with zeros
}

// Addition Operator
// Adds two bigint's together and returns the resulting bingint
bigint bigint::operator+(const bigint& rhs)const{
	bigint result;
	int digitSum = 0;
	bool carryOne = false;
	
	for(int i = 0; i < MAX_SIZE; ++i){
		if(carryOne) // If carryOne is true the previous digitSum was >= 10 thus we must carry a one to this sum
			digitSum = bigintArray[i] + rhs.bigintArray[i] + 1;
		else
			digitSum = bigintArray[i] + rhs.bigintArray[i];

		result.bigintArray[i] = digitSum % 10; 

		if(digitSum >= 10)// If digitSum >= 10 then we must carry a 1 to the next digitSum
			carryOne = true;
		else
			carryOne = false;
	}
	return result;
}

// Multiplication Operator
// Multiplies two bigint's together and returns the resulting bigint
bigint bigint::operator*(const bigint& rhs)const{
	bigint product;
	bigint temp;
	for(int i = 0; i < MAX_SIZE; ++i){
		temp = this->timesDigit(rhs.bigintArray[i]);
		product = product + temp.times10(i);
	}
	return product;
}

// Times Digit
// Multiplies a bigint by a single digit int
bigint bigint::timesDigit(int num)const{
	bigint result;
	
	if(num == 0)
		return result;
	if(num == 1)
		return *this;

	int carry = 0;
	int product = 0;
	for(int i = 0; i < MAX_SIZE; ++i){
		if(carry != 0)// When carry is greater than zero we must add to the next multiplication
			product = bigintArray[i] * num + carry;
		else
			product = bigintArray[i] * num;
		
		result.bigintArray[i] = product % 10;// Gets the last digit of product
		carry = product / 10;// Gets the first digit of product
	}
	return result;
}

// Times Ten
// Multiplies a bigint by 10^i
bigint bigint::times10(int num)const{
	bigint product;
	
	if(num == 0)// 10^0 = 1
		return *this;

	for(int i = 0; i < MAX_SIZE; ++i){
		if(i < num)// When i < num we must insert zeros
			product.bigintArray[i] = 0;
		else// Otherwise we must put the bigint back into the array
			product.bigintArray[i] = this->bigintArray[i - num]; 
	}
	return product;
}

// Equality Operator	 
// Checks if two bigints are equal and returns true if so otherwise returns false
bool bigint::operator==(const bigint& rhs)const{
	for(int i = 0; i < MAX_SIZE; ++i){
		if(bigintArray[i] != rhs.bigintArray[i])
			return false;
	}
	return true;
}

// Subscript Operator
// Returns the digit at index i in bigintArray
int bigint::operator[](int i)const{ return bigintArray[i]; }

// Output operator
// Writes bigints to an output stream
std::ostream& operator<<(std::ostream& os, const bigint& bi){

	int digits = 0;
	bool atNum = false;

	for(int i = MAX_SIZE-1; i > -1; --i){
		if(bi.bigintArray[i] != 0) // If we have reached a nonzero digit we are at the number
			atNum = true;	   // that needs to be put into the output stream
		if(atNum){
			os << bi.bigintArray[i];
			++digits; // When we begin adding to the output stream we must
		}		  // keep track of the number of digits in the stream.
		if(digits == 50){ // When the number of digits is 50 we must start a new line.
			os << std::endl;
			digits = 0;
		}
	}

	if(!atNum)// If no nonzero digits where found then bigint is zero
		os << 0;
	
	return os; 		
}

// Input Operator
// Takes data from an input stream and puts it into a bigint
std::istream& operator>>(std::istream& is, bigint& bi){
	char temp[MAX_SIZE];
	
	for(int i = 0; i < MAX_SIZE; ++i){
		char ch;
		is >> ch;
		if(ch != ';')
			temp[i] = ch;
		else{ //If we are at the end of the number we must break out of the loop
			temp[i] = '\0';
			break;
		}
	}
	bi = bigint(temp);
	return is;
}
<file_sep>/Assembler/stack.hpp
// <NAME>
// CS23001
// stack.hpp
// Description: Template defenition for a dynamic stack
// CLASS INV: TOS -> A -> B -> ... -> 0

#include <new>

#ifndef STACK_HPP
#define STACK_HPP

#include "node.hpp"
#include <cassert>

template<typename T>
class Stack{
public:
	Stack(): tos(0){};
	~Stack();
	Stack(Stack<T>&&);
	Stack(const Stack<T>&);
	Stack<T>& operator=(const Stack<T>&);
	Stack<T>& operator=(Stack<T>&&);	

	void swap(Stack<T>&);
	bool isEmpty() const{ return tos == 0; }
	bool isFull() const;
	T pop();
	void push(const T&);
private:
	node<T> *tos;

};

// FUNCTION DEFENITIONS

// POP
// REQUIRES: Stack cannot be empty
// ENSURES: tos is removed, and new tos is set
template<typename T>
T Stack<T>::pop(){
	assert(tos != 0);    // Check stack isn't empty
	T result = tos->data;
	node<T> *temp = tos; // Keep track of old tos to de-allocate(avoid mem-leak)
	tos = tos->next; 
	delete temp;          
	return result;
}

// PUSH
// REQUIRES: tos -> A -> B -> ... -> 0
// ENSURES: tos -> x -> A -> B -> ... -> 0
template<typename T>
void Stack<T>::push(const T& x){
	assert(!isFull());
	node<T> *temp = new node<T>(x);
	temp->next = tos;    // Make temp's next point to tos 
	tos = temp;          // temp is the new tos
}

// DESTRUCTOR
// REQUIRES:
// ENSURES: All memony in the stack is de-allocated
template<typename T>
Stack<T>:: ~Stack(){
	node<T> *temp;
	while(tos != 0){ // While we are not at the bottom of the stack
		temp = tos;
		tos = tos->next;
		delete temp;
	}
}

// COPY CONSTRUCTOR
// REQUIRES:
// ENSURES: temp is an exact copy of actual
template<typename T>
Stack<T>::Stack(const Stack<T>& actual){
	node<T> *temp = actual.tos, *bottom = 0;
	tos = 0;
	while(temp != 0){
		if(tos == 0){				// If we are at the tos
			tos = new node<T>(temp->data);
			bottom = tos;
		}
		else{  // If we have more than one node
			bottom->next = new node<T>(temp->data);
			bottom = bottom->next; 
		}
		temp = temp->next; // Increment temp
	}
}

// ASSIGNMENT OPERATOR
// REQUIRES:
// ENSURES: rhs is copied to this
template<typename T>
Stack<T>& Stack<T>::operator=(const Stack<T>& rhs){
	if(tos == rhs.tos)     // If stacks are the same return 
		return *this;
 
	node<T> *temp;
	while(tos != 0){      // Deallocate everything in this
		temp = tos;
		tos = tos->next;
		delete temp;
	}

	temp = rhs.tos;
	node<T> *bottom = 0;
	while(temp != 0){     // Copy rhs to this
		if(tos == 0){
			tos = new node<T>(temp->data);
			bottom = tos;
		}
		else{
			bottom->next = new node<T>(temp->data);
			bottom = bottom->next;
		}
		temp = temp->next;
	}
	return *this;
}

// SWAP
// REQUIRES:
// ENSURES: this = rhs, rhs = temp(this)
template<typename T>
void Stack<T>::swap(Stack<T> & rhs){
	node<T> *temp = tos;
	tos = rhs.tos;
	rhs.tos = temp;
}

// MOVE ASSIGNMENT
// REQUIRES:
// ENSURES: this = rhs, rhs = this
template<typename T>
Stack<T>& Stack<T>::operator=(Stack<T>&& rhs){
	swap(rhs);
	return *this;
}

// MOVE CONSTRUCTOR
// REQUIRES:
// ENSURES:
template<typename T>
Stack<T>::Stack(Stack<T>&& actual){
	tos = actual.tos;
	actual.tos = 0;
}

// ISFULL
// REQUIRES:
// ENSURES: returns true if stack is full, false otherwise
template<typename T>
bool Stack<T>::isFull()const{
	node<T> *temp = new(std::nothrow)node<T>();
	if(temp != 0){      // If there was enough memory for one more node object
		delete temp;
		return false;
	}
	else		    // No memory left
		return true;
}

#endif
<file_sep>/String/test_add.cpp
// <NAME>
// TESTS: Addition

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// SETUP
		String lhs;
		String rhs;
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == '\0');
	}
	{
		// SETUP
		String lhs("a");
		String rhs("a");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "aa");
		std::cout << lhs << " + " << rhs << " = " << result << std::endl;
	}
	{
		// SETUP
		String lhs;
		String rhs('a');
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == 'a');
		std::cout << lhs << " + " << rhs << " = " << result << std::endl;
	}
	{
		// SETUP
		String lhs("abc");
		String rhs("def");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "abcdef");
		std::cout << lhs << " + " << rhs << " = " << result << std::endl;
	}
	{
		// SETUP
		String lhs("   ");
		String rhs("   ");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "      ");
	}
	{
		// SETUP
		String lhs("DANK");
		String rhs(" MEMES");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "DANK MEMES");
		std::cout << lhs << " + " << rhs << " = " << result << std::endl;
	}
	{
		// SETUP
		String lhs("Flowy, Toriel, Sans, Payparus, Undyne, Alphys, ");
		String rhs("Mettaton, Asgore, <NAME>.");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "Flowy, Toriel, Sans, Payparus, Undyne, Alphys, Mettaton, Asgore, Asriel, Chara.");
		std::cout << lhs << " + " << rhs << " = " << result << std::endl;
	}
	{
		// SETUP
		String lhs("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");
		String rhs("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");

	}
	{
		// SETUP
		String lhs("Wow that passes.");
		String rhs(" ~!@#$%^&*())?GHDFBN:_SE+GH'dghokwet][]");
		String result;
		
		// TEST
		result = lhs + rhs;

		// VERIFY
		assert(result == "Wow that passes. ~!@#$%^&*())?GHDFBN:_SE+GH'dghokwet][]");
		std::cout << lhs << " + " << rhs << " = " << result << std::endl;
	}
	{
		// SETUP
		String lhs("And so I cry somtimes when I'm lying in bed Just to get it all out what's in my head and I, I am feeling a little peculiar And so I wake in the morning and I step outside And I take A deep breath and I get real high And I scream from the top of my lungs, What's goin on");
		String rhs(" And I say HEYAYAYAYAYAY HEYAYA I said hey, what's goin' on And I say HEYAYAYAYA HEYAYA I said hey, what's goin' on");
		String result;
		
		// TEST
		result = lhs + rhs;
		
		// VERIFY
		assert(result == "And so I cry somtimes when I'm lying in bed Just to get it all out what's in my head and I, I am feeling a little peculiar And so I wake in the morning and I step outside And I take A deep breath and I get real high And I scream from the top of my lungs, What's goin on And I say HEYAYAYAYAYAY HEYAYA I said hey, what's goin' on And I say HEYAYAYAYA HEYAYA I said hey, what's goin' on");
		
	}
	{
		// SETUP
		char ch = '1';
		const String s;
		String result;

		// TEST
		result = ch + s;
		
		// VERIFY
		assert(result == '1');
		result = s + ch;
		assert(result == '1');
	}
	{
		// SETUP
		const char ch = '1';
		const String s('a');
		String result;

		// TEST
		result = ch + s;
	
		// VERIFY
		assert(result == "1a");
		result = s + ch;
		assert(result == "a1");
	}
	{
		// SETUP
		char ch = '0';
		const String s(" TESTS");
		String result;

		// TEST
		result = ch + s;
		
		// VERIFY
		assert(result == "0 TESTS");
		result = s + ch;
		assert(result == " TESTS0");
	}
	{
		// SETUP
		const char c[DEFAULT_STRING_CAPACITY] = { 'a' };
		String s;
		String result;
		
		// TEST
		result = c + s;

		// VERIFY
		assert(result == 'a');
		result = s + c;
		assert(result == 'a');
	}
	{
		// SETUP
		const char c[DEFAULT_STRING_CAPACITY] = { 'a' };
		String s("1");
		String result;
		
		// TEST
		result = c + s;

		// VERIFY
		assert(result == "a1");
		result = s + c;
		assert(result == "1a");
	}
	{
		// SETUP
		const char c[DEFAULT_STRING_CAPACITY] = { 'a', 'b', 'c' };
		String s("def");
		String result;
		
		// TEST
		result = c + s;

		// VERIFY
		assert(result == "abcdef");
		result = s + c;
		assert(result == "defabc");
	}	 
	std::cout << "Done testing addition." << std::endl;
}

<file_sep>/Big Integer/test_add.cpp
// bigint Test Program
//
// Tests:  int constructor, uses ==
//
#include <iostream>
#include <cassert>
#include "bigint.hpp"


//===========================================================================
int main () {
    {
        //------------------------------------------------------
        // Setup fixture
        bigint left(0);
        bigint right(0);
        bigint result;

        // Test 
        result = left + right;

        // Verify
        assert(left   == 0);
        assert(right  == 0);
        assert(result == 0);
    }

    {
      //------------------------------------------------------
      // Setup fixture
      bigint left(1);
      bigint right(0);
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left   == 1);
      assert(right  == 0);
      assert(result == 1);
    }
    {
      //------------------------------------------------------
      // Setup fixture
      bigint left(1);
      bigint right(1);
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left   == 1);
      assert(right  == 1);
      assert(result == 2);
    }
    {
      //------------------------------------------------------
      // Setup fixture
      bigint left(9);
      bigint right(9);
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left   == 9);
      assert(right  == 9);
      assert(result == 18);
    }
    {
      //------------------------------------------------------
      // Setup
      bigint left(19);
      bigint right(19);
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left   == 19);
      assert(right  == 19);
      assert(result == 38);
    }
    {
      //------------------------------------------------------
      // Setup
      bigint left(199);
      bigint right(199);
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left ==  199);
      assert(right  == 199);
      assert(result == 398);
    }
    {
      //------------------------------------------------------
      // Setup
      bigint left(11111);
      bigint right("99999999999999999999999999999999999999999999999999");
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left   == 11111);
      assert(right == "99999999999999999999999999999999999999999999999999");
      assert(result == "100000000000000000000000000000000000000000000011110");
    }
    {
      //------------------------------------------------------
      // Setup
      bigint left("1879465321012279853475324858234852345723845823458");
      bigint right("123514959195931495934959234959293459923459923495");
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left == "1879465321012279853475324858234852345723845823458");
      assert(right == "123514959195931495934959234959293459923459923495");
      assert(result == "2002980280208211349410284093194145805647305746953");
    }
    {
      //------------------------------------------------------
      // Setup
      bigint left("6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666");
      bigint right("55555555555555555555555555555555555555555555555555");
      bigint result;

      // Test
      result = left + right;

      // Verify
      assert(left ==   "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666");
      assert(right ==  "55555555555555555555555555555555555555555555555555");
      assert(result == "6666666666666666666666666666666666666666666666666722222222222222222222222222222222222222222222222221");
    }

    //Add test cases as needed.
    
    std::cout << "Done with testing addition." << std::endl;
}

<file_sep>/Assembler/test_default_ctor.cpp
// <NAME>
// TESTS: Default Constructor & IsEmpty

#include "string/string.hpp"
#include "stack.hpp"
#include <iostream>

int main(){
	{
		//TEST
		Stack<int> s;
	
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<String> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<char> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<double> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<bool> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<long> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<float> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	{
		//TEST
		Stack<short> s;
		
		//VERIFY
		assert(s.isEmpty());
	}
	std::cout << "Done testing default constructor." << std::endl;	
}
<file_sep>/String/test_relationaloperators.cpp
// <NAME>
// TESTS: <, <=, >, >=, !=

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// TEST
		String s1('a');
		String s2('c');

		// VERIFY
		assert(s1 < s2);
	}	
	{
		// TEST
		String s1("accept");
		String s2("access");
		String s3("acceptance");

		// VERIFY
		assert(s1 < s2);
		assert(s3 < s2);
		assert(s1 < s3);
	}	
	{
		// TEST
		String s1("aa");
		String s2("aaa");

		// VERIFY
		assert(s1 < s2);
	}
	{
		// TEST
		String s1("9");
		String s2("10");

		// VERIFY
		assert(s2 < s1);
	}	
	{
		// TEST
		String s1("a");
		String s2("A");

		// VERIFY
		assert(s2 < s1);
	}
	{
		// TEST
		const char s1('a');
		String s2('c');

		// VERIFY
		assert(s1 < s2);
	}	
	{
		// TEST
		const char s1[7] = {'a', 'c', 'c', 'e', 's', 's'};
		String s2("accept");

		// VERIFY
		assert(s2 < s1);
	}	
	{
		// TEST
		const char s1[3] = { 'a', 'a'};
		String s2("aaa");

		// VERIFY
		assert(s1 < s2);
	}
	{
		// TEST
		const char ch = 'a';
		String s('c');

		// VERIFY
		assert(ch < s);
	}
	{
		// TEST
		const char ch = '1';
		String s('9');

		// VERIFY
		assert(ch < s);	
	}
	{
		// TEST
		String lhs("a");
		String rhs("a");

		// VERIFY
		assert(lhs <= rhs);	
	}
	{
		// TEST
		String lhs("abc");
		String rhs("abc");

		// VERIFY
		assert(lhs <= rhs);	
	}
	{
		// TEST
		String lhs("a");
		String rhs("c");

		// VERIFY
		assert(lhs <= rhs);	
	}
	{
		// TEST
		String lhs("a");
		String rhs("c");

		// VERIFY
		assert(lhs != rhs);	
	}
	{
		// TEST
		String lhs("a");
		String rhs(" a");

		// VERIFY
		assert(lhs != rhs);	
	}
	{
		// TEST
		String lhs;
		String rhs("c");

		// VERIFY
		assert(lhs != rhs);	
	}
	{
		// TEST
		String lhs("a b c");
		String rhs("abc");

		// VERIFY
		assert(lhs != rhs);	
	}
	{
		// TEST
		String lhs("access");
		String rhs("accept");

		// VERIFY
		assert(lhs != rhs);	
	}
	{
		// TEST
		String lhs("c");
		String rhs("a");

		// VERIFY 
		assert(lhs >= rhs);
	}
	{
		// TEST
		String lhs("a");
		String rhs("a");

		// VERIFY 
		assert(lhs >= rhs);
	}
	{
		// TEST
		String lhs("abc");
		String rhs("abc");

		// VERIFY 
		assert(lhs >= rhs);
	}
	{
		// TEST
		String lhs("access");
		String rhs("accept");

		// VERIFY 
		assert(lhs >= rhs);
	}
	{
		// TEST
		String lhs("c");
		String rhs("a");
		
		// VERIFY
		assert(lhs > rhs);
	}
	{
		// TEST
		String lhs("c");
		String rhs("a");
		
		// VERIFY
		assert(lhs > rhs);
	}
	{
		// TEST
		String lhs("access");
		String rhs("accept");
		
		// VERIFY
		assert(lhs > rhs);
	}
	{
		// TEST
		String lhs("9");
		String rhs("0");
		
		// VERIFY
		assert(lhs > rhs);
	}

		
	std::cout << "Done testing relational operators." << std::endl;
}
<file_sep>/String/test_default_ctor.cpp
// String class test program
// TESTS: Default Constuctor

#include <iostream>
#include <cassert>
#include "string.hpp"

int main(){
	{
		//SETUP
		
		//TEST
		String str;
	
		//VERIFY
		assert(str == '\0');
	}
	std::cout << "Done testing default ctor." << std::endl;
}
<file_sep>/Assembler/node.hpp
// <NAME>
// CS23001
// node.hpp
// Description: Defenition for node object

#ifndef NODE_HPP
#define NODE_HPP

template <typename T>
class node{
public:
	T data;
	node<T> *next;
	node(): next(0){};
	node(const T& x): data(x), next(0){};
};

#endif
<file_sep>/String/test_cap_ctor.cpp
// <NAME>
// TESTS: Capacity Constructors

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// SETUP
		String s(1);
		
		// VERIFY
		assert( 1 == s.capacity());
	}
	{
		// SETUP
		String s(1);
		
		// VERIFY
		assert( 1 == s.capacity());
		assert(s == '\0');
	}
	{
		// SETUP
		String s(56);
		
		// VERIFY
		assert( 56 == s.capacity());
		assert(s == '\0');
	}
	{
		// SETUP
		String s(300);
		
		// VERIFY
		assert( 300 == s.capacity());
		assert(s == '\0');
	}
	{
		// SETUP
		String s(1000);
		
		// VERIFY
		assert( 1000 == s.capacity());
		assert(s == '\0');
	}
	std::cout << "Done testing capacity constructors." << std::endl;
}
<file_sep>/String/test_split.cpp
// <NAME>
// TESTS: Split

#include <iostream>
#include <cassert>
#include "string.hpp"

int main(){
	{
		//SETUP
		String s;
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == s);
		assert(result.size() == 1);
	}
	{
		//SETUP
		String s("computer");
		std::vector<String> result;
			
		//TEST
		result = s.split('p');
		//VERIFY
		assert(result[0] == "com");
		assert(result[1] == "uter");
		assert(result.size() == 2);
	}
	{
		//SETUP
		String s("abc ef gh");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "abc");
		assert(result[1] == "ef");
		assert(result[2] == "gh");
		assert(result.size() == 3);
	}
	{
		//SETUP
		String s("abc  ef  gh");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "abc");
		assert(result[1] == "ef");
		assert(result[2] == "gh");
		assert(result.size() == 3);
	}
	{
		//SETUP
		String s("ab c de");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "ab");
		assert(result[1] == "c");
		assert(result[2] == "de");
		assert(result.size() == 3);
	}
	{
		//SETUP
		String s("ab  c  de");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "ab");
		assert(result[1] == "c");
		assert(result[2] == "de");
		assert(result.size() == 3);
	}
	{
		//SETUP
		String s("c");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "c");
		assert(result.size() == 1);
	}	
	{
		//SETUP
		String s("  ab c");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "ab");
		assert(result[1] == "c");
		assert(result.size() == 2);
	}			
	{
		//SETUP
		String s("abc   ");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "abc");
		assert(result.size() == 1);
	}			
	{
		//SETUP
		String s("a b c ");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "a");
		assert(result[1] == "b");
		assert(result[2] == "c");
		assert(result.size() == 3);
	}			
	{
		//SETUP
		String s("     ");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result.size() == 0);
	}			
	{
		//SETUP
		String s("abc");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "abc");
		assert(result.size() == 1);
	}			
	{
		//SETUP
		String s("S Sp Spa Spac Space Spac");
		std::vector<String> result;
		
		//TEST
		result = s.split(' ');

		//VERIFY
		assert(result[0] == "S");
		assert(result[1] == "Sp");
		assert(result[2] == "Spa");
		assert(result[3] == "Spac");
		assert(result[4] == "Space");
		assert(result[5] == "Spac");
		assert(result.size() == 6);
	}			
	std::cout << "Done testing split." << std::endl;
}

<file_sep>/String/test_subscript.cpp
// <NAME>
// TESTS: Subscript operator

#include "string.hpp"
#include <iostream>
#include <cassert>

int main(){
	{
		// TEST
		String s;
		
		// VERIFY
		assert(s[0] == '\0');
	}
	{
		// TEST
		String s('a');
		
		// VERIFY
		assert(s[0] == 'a');
	}
	{
		// TEST
		String s("abc123");
		
		// VERIFY
		assert(s[5] == '3');
	}
	{
		// TEST
		String s("     ");
		
		// VERIFY
		assert(s[3] == ' ');
	}
	{
		// TEST
		String s("1000000000000000000000000000000000000000000000000000000000001");
		
		// VERIFY
		assert(s[60] == '1');
	}
	{
		// TEST
		String s("Tests tests   tests test   test test. test %#$%#$%#$%#%#$%");
		
		// VERIFY
		assert(s[27] == 't');
	}
	{
		// TEST
		String s("WOOOOOOOOOOOOOOOOOOoooOOOoOOOoooOOoooOOOoOOOooooOOOOOOOoOOOOOOooooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOoooOooOOOOOOOOOOooOOOOOOOOOOOOOOOOOOOOOOOOoO");
		
		// VERIFY
		assert(s[100] == 'o');
	}
	std::cout << "Done testing subscript." << std::endl;
}
<file_sep>/String/string.cpp
// <NAME>
// CS 23001
// string.cpp
// Defines funtions from string.hpp

#include <iostream>
#include "string.hpp"
#include <cassert>

// Default Constructor
// Initializes the pointer s and Capacity to 256
String::String(){ 
	Capacity = DEFAULT_STRING_CAPACITY;
	s = new char[Capacity]; 
	s[0] = '\0';
}

// Character Constructor
// Initializes the pointer s to a character and Capacity to 256
String::String(char ch){
	Capacity = DEFAULT_STRING_CAPACITY;
	s = new char[Capacity];
	s[0] = ch;
	s[1] = '\0';
}

// Character Array Constructor
// Initializes the pointer s to a character array and Capacity to 256
String::String(const char *str){
	Capacity = DEFAULT_STRING_CAPACITY;
	s = new char[Capacity];

	int i = 0;
	while(str[i] != '\0'){
		s[i] = str[i];
		++i;
		if(i >= capacity()-1)
			resetCapacity(capacity()*2);
			
	}
	s[i] = '\0';
}

// Capacity and Character Array Constructor
// Initializes s to a character array and Capacity to a given Capacity n
String::String(int n, const char *str){
	assert(n > 0); // A pointer to an array of size 0 is undefined
	Capacity = n;
	s = new char[Capacity];
	
	int i = 0;
	while(str[i] != '\0'){
		s[i] = str[i];
		++i;
	}
	s[i] = '\0';
}

// Capacity Constructor
// Initializes string to a given Capacity n
String::String(int n){
	assert(n > 0); // A pointer to an array of size 0 is undefined
	Capacity = n;
	s = new char[Capacity];
	s[0] = '\0';
}

// Destructor
// Deallocates memory in String
String::~String(){ delete[] s; }

// Copy Constructor
// Makes temporary copies of this
String::String(const String& actual){
	Capacity = actual.Capacity;
	s = new char[Capacity];
	for(int i = 0; i < Capacity; ++i)
		s[i] = actual.s[i];
}

// Assignment operator
// Sets this equal to rhs
String& String::operator=(String rhs){
	swap(rhs);
	return *this;
}

// Swap
// Constant time swap
void String::swap(String& rhs){
	char *temp = s;
	s = rhs.s;
	rhs.s = temp;
	int ctemp = Capacity;
	Capacity = rhs.Capacity;
	rhs.Capacity = ctemp;
}

// resetCapacity
// Changes the capacity of s to n
void String::resetCapacity(int n){
	assert(n > -1);

	char *temp = new char[n];
	Capacity = n;

	if(n == 0){// If n is zero return an empty character array
		delete[] s;
		s = temp;
	}
	else{
		int i = 0;
		while(s[i] != '\0' && i < n - 1){
			temp[i] = s[i];
			++i;
		}
		temp[i] = '\0';
		delete[] s;
		s = temp;
	}	 
}

// Output Operator
// Displays the String
std::ostream& operator<<(std::ostream& out, const String &rhs){
	out << rhs.s;
	return out;
}

// Input Operator
// Reads input one word at a time
std::istream& operator>>(std::istream &in, String &rhs){

	char ch = '@';
	int newCap = 0;
	rhs = "";

	while(ch != ' ' && ch != '\n' && ch != '\t' && ch != '\v' && ch != '\r' && ch != '\f' && !in.eof()){// Run while ch != whitespace and end of file
		in.get(ch);
		if((ch == ' ' || ch == '\n' || ch== '\t') && rhs == ""){// Ensures that rhs is never null, moves past extra spaces 
			while(ch == ' ' || ch == '\n' || ch == '\t')
				in.get(ch);
		}
		if(rhs.length() >= rhs.capacity()){// Resize input when it reached capacity
			newCap = rhs.capacity() * 2;
			rhs.resetCapacity(newCap);
		}
		if(ch != ' ' && ch != '\n' && ch != '\t' && ch != '\r' && ch != '\f' && ch != '\v')// Add ch to temp if it is not whitespace
			rhs = rhs + ch;
	}
	rhs[rhs.capacity()-1] = '\0';
	return in;
}

// Addtition Operators
// Combines two Strings
String String::operator+(const String &rhs)const{
	int newCap = DEFAULT_STRING_CAPACITY;
	if(DEFAULT_STRING_CAPACITY <= length() + rhs.length()){// If the combined lengths are greater than the default cap, result needs a new capacity
		while(newCap <= length() + rhs.length())
			newCap = newCap + DEFAULT_STRING_CAPACITY;
	}
	
	String result(newCap, s);
	int offset = length();
	int i = 0;

	while(rhs.s[i] != '\0'){
		result.s[offset + i] = rhs.s[i]; // Starts at the end of this and adds rhs  
		++i;
	}

	result.s[offset + i] = '\0';
	return result;
}
String operator+(const char lhs[], const String &rhs){ return String(lhs) + rhs; }
String operator+(const char lhs, const String &rhs){ return String(lhs) + rhs; }

// Substring
// Returns a substring between a given starting and ending index
String String::substr(int start, int end)const{
	String result;
	assert(0 <= start);
	assert(start <= end);
	assert(end < length());
	
	for(int i = start; i <= end; ++i)
		result.s[i - start] = s[i]; // Gets the substring out of string
	
	result.s[end - start + 1] = '\0';
	return result;
}

// Find String 
// Looks for a substring inside a String and return true if found
bool String::findstr(const String &find)const{
	if(find.length() == 1 && s[0] == find.s[0])// If find is one char and == this then just return true
		return true;

	char start = find.s[0];
	char end = find.s[find.length()-1];
	bool search = false;
	bool found = false;
	int startI = 0;
	
	for(int i = 0; i < length(); ++i){
		if(s[i] == start) // If find the first char we must start looking at the next chars
			search = true;

		if(search && s[i] != find.s[startI]){// If we are looking at the substring and the chars do not match then our search was not succesful
			search = false;
			startI = 0;
		}

		if(search && s[i] == find.s[startI]) // Increment startI if we find another char consistent with find
			++startI;

		if(search && s[i] == end && startI == find.length())// If we reach the last char in find then we have found the substring in this
			return true;
	}
	return found;
}		

// Find Char
// Looks for a character in a String and returns true if found
bool String::findchar(const char &find)const{
	for(int i = 0; i < length(); ++i){
		if(s[i] == find)
			return true;
	}
	return false;
}

// Equality Operators
// Checks if two String's are equal
bool String::operator==(const String &rhs)const{
	int i = 0;
	while((s[i] != '\0') && (s[i] == rhs.s[i]))
		++i;
	return s[i] == rhs.s[i];
}
bool operator==(const char s[], const String &lhs){ return lhs == s; }
bool operator==(const char ch, const String &lhs){ return lhs == ch; }

// Subscript Operators
// Returns the value at index i in the array
char String::operator[](int i)const{
	assert(i >= 0);
	assert(i < length());
	return s[i];
}
char& String::operator[](int i){return s[i]; }

// Other Relational Operators
// Compares Strings 
bool String::operator<(const String &rhs)const{
	int i = 0;
	while((s[i] != '\0') && (rhs.s[i] != '\0') && (s[i] == rhs.s[i]))
		++i;
	return s[i] < rhs.s[i];
}
bool operator<(const char s[], const String &s1){ return !(s1 < s); }
bool operator<(const char ch, const String &s1){ return !(s1 < ch); }
bool operator<=(const String &lhs, const String &rhs){ return ((lhs == rhs) || (lhs < rhs)); }
bool operator!=(const String &lhs, const String &rhs){ return !(lhs == rhs); }
bool operator>=(const String &lhs, const String &rhs){ return ((lhs == rhs) || !(lhs < rhs)); }
bool operator>(const String &lhs, const String &rhs){ return !(lhs < rhs); }

// Length
// Returns the length of the String
int String::length()const{
	int L = 0;
	while(s[L] != '\0')
		++L;
	return L;
}

// Capacity
// Returns the Capacity of the String
int String::capacity()const{ return Capacity; }

// Split
// Returns a vector of Strings split at a given char
std::vector<String> String::split(char ch) const{
	std::vector<String> vecS;

	if(!(findchar(ch))){ // If ch is not in the string, return the string
		vecS.push_back(*this);
		return vecS;
	}
	
	String temp;
		
	for(int i = 0; i < length(); ++i){
	
		if(s[i] != ch){ //If we are not at ch add the character to the temporary string
			temp = temp + s[i];
		}
		if(s[i] == ch && temp != '\0'){ // If we are at ch and the temporary string is not null 
			vecS.push_back(temp);   // Add the temp string to the vector
			temp = "";              // Reset the temp string to an empty string
		}
	}

	if(temp != '\0')//Add temp to the vector when we reach the end of the string 
		vecS.push_back(temp);
	
	return vecS;
}
<file_sep>/Assembler/test_assignment.cpp
// <NAME>
// TESTS: Assignmnet operator

#include "stack.hpp"
#include "string/string.hpp"
#include <iostream>

int main(){
	{
		//SETUP
		Stack<int> s1;
		Stack<int> s2;

		//TEST
		s1 = s2;
		assert(s1.isEmpty());
		assert(s2.isEmpty());
		s2 = s1;
		assert(s1.isEmpty());
		assert(s2.isEmpty());		
	}
	{
		//SETUP
		Stack<int> s1;
		Stack<int> s2;
		s1.push(1);

		//TEST
		s2 = s1;
		assert(s2.pop() == 1);
		assert(s2.isEmpty());
		s1 = s2;
		assert(s1.isEmpty());
		assert(s2.isEmpty());		
	}
	{
		//SETUP
		Stack<int> s1;
		Stack<int> s2;
		s1.push(1);
		s1.push(10);
		s1.push(100);
		s2.push(1);

		//TEST
		s2 = s2;
		assert(s2.pop() == 1);
		assert(s2.isEmpty());
		s2 = s1;
		assert(s2.pop() == 100);
		assert(s2.pop() == 10);
		assert(s2.pop() == 1);
		assert(s2.isEmpty());
		s1 = s2;
		assert(s1.isEmpty());
		assert(s2.isEmpty());		
	}
	{
		//SETUP
		Stack<String> s1;
		Stack<String> s2;

		//TEST
		s1 = s2;
		assert(s1.isEmpty());
		assert(s2.isEmpty());
		s2 = s1;
		assert(s1.isEmpty());
		assert(s2.isEmpty());				
	}
	{
		//SETUP
		Stack<String> s1;
		Stack<String> s2;
		s1.push("");		
		s2.push("");

		//TEST
		s1 = s2;
		assert(s2.pop() == "");
		assert(s2.isEmpty());
		s1 = s2;
		assert(s1.isEmpty());
		assert(s2.isEmpty());				
	}
	{
		//SETUP
		Stack<String> s1;
		Stack<String> s2;
		s1.push("a");
		s1.push("ab");
		s1.push("abc");
		s1.push("abcd");
	
		//TEST
		s2 = s1;
		assert(s2.pop() == "abcd");
		assert(s2.pop() == "abc");
		assert(s2.pop() == "ab");
		assert(s2.pop() == "a");
		assert(s2.isEmpty());
		s2.push("word");
		s2 = s1;
		assert(s2.pop() == "abcd");
		assert(s2.pop() == "abc");
		assert(s2.pop() == "ab");
		assert(s2.pop() == "a");
		assert(s2.isEmpty());
		s1 = s2;
		assert(s1.isEmpty());
		assert(s2.isEmpty());				
	}
	std::cout << "Done testing assignment." << std::endl;
}
<file_sep>/Big Integer/multiply.cpp
/**
 * <NAME>
 * multiply.cpp
 * CS 23001
 */
// Reads data from files to bigints and multiplies them

#include <iostream>
#include <fstream>
#include <cstdlib>
#include "bigint.hpp"

int main(){
	std::ifstream in("data1-2.txt");
	if(!in.is_open()){
		std::cerr << "Could not open file data1-2.txt, exiting." << std::endl;
		exit(1);
	}
	
	bigint numOne;
	bigint numTwo;
	bigint product;
	
	while(!in.eof()){
		in >> numOne;
		if(in.eof()) break;// Stops output of random data due to whitespace in the end of the file
		in >> numTwo;
		
		std::cout << std::endl;
		std::cout << "Bigint one is: " << numOne << std::endl << std::endl;
		std::cout << "Bigint two is: " << numTwo << std::endl;
		
		product = numOne * numTwo;

		std::cout << "The product is: " << product << std::endl;
	}
	in.close();
	return 0;
}
<file_sep>/String/test_ctor_charcap.cpp
// <NAME>
// TESTS: Cap/Character Array Constructor

#include <iostream>
#include "string.hpp"
#include <cassert>

int main(){
	{
		// SETUP
		String s(1, "");
	
		// VERIFY
		assert(s == '\0');
		assert(1 == s.capacity());
	}
	{
		// SETUP
		String s(2, "a");
	
		// VERIFY
		assert(s == "a");
		assert(2 == s.capacity());
	}
	{
		// SETUP
		String s(4, "abc");
	
		// VERIFY
		assert(s == "abc");
		assert(4 == s.capacity());
	}
	{
		// SETUP
		String s(481, "Leedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle Lee");
		
		// VERIFY
		assert(s == "Leedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle LeeLeedle Leedle Leedle Lee");
		assert(481 == s.capacity());
	}
	std::cout << "Done testing char cap ctor."  << std::endl;
}
