#include #include "treemap.h" using namespace std; int main() { TreeMap dict; dict["apple"] = "A yummy fruit."; dict["pear"] = "A funny shaped fruit."; dict["dog"] = "Man's best friend."; dict["ape"] = "A hairy beast."; if (dict["dog"] != "Man's best friend.") cout << "Bad test!" << endl; dict.remove("apple"); if (dict.has_key("apple")) cout << "Bad test!" << endl; if (dict.size() != 3) cout << "Bad test!" << endl; dict.remove("dog"); if (dict.has_key("dog")) cout << "Bad test!" << endl; if (dict.size() != 2) cout << "Bad test!" << endl; TreeMap copyDict(dict); copyDict["test"] = "This is a test"; if (dict.has_key("test")) cout << "Bad test!" << endl; copyDict = dict; if (copyDict.has_key("test")) cout << "Bad test!" << endl; }