示例#1
0
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

StringHashMap<int>* map_ptr;
CHECK(StringHashMap() throw())
	map_ptr = new StringHashMap<int>;
	TEST_NOT_EQUAL(map_ptr, 0)
RESULT

CHECK(~StringHashMap() throw())
	delete map_ptr;
RESULT

CHECK(Size getSize() const throw())
	StringHashMap<int> hm;
	TEST_EQUAL(hm.getSize(), 0)
RESULT

CHECK((std::pair<Iterator, bool> insert(const ValueType& obj) throw()))
	StringHashMap<int> hm;
	TEST_EQUAL(hm.getSize(), 0)
	pair<String, int> p("a", 0);
	hm.insert(p);
	TEST_EQUAL(hm.getSize(), 1)
	hm.insert(p);
	TEST_EQUAL(hm.getSize(), 1)
	pair<String, int> p2("b", 1);
	hm.insert(p2);
	TEST_EQUAL(hm.getSize(), 2)
	TEST_EQUAL(hm.has("a"), true)
	TEST_EQUAL(hm.has("b"), true)