Exemplo n.º 1
0
TEST(Vectors, Print) {
	Vectors<std::string>* newVector = new Vectors<std::string>(15,15,"oo");
	newVector->insert(1,2,"xx");
	newVector->insert(9,8,"xx");
	newVector->insert(7,2,"xx");
	newVector->insert(6,4,"xx");
	newVector->insert(0,8,"xx");
	newVector->insert(10,12,"xx");
	newVector->insert(3,5,"xx");
	newVector->print();
	delete newVector;
}
Exemplo n.º 2
0
TEST(Vectors, Insert) {
	Vectors<int>* newInt = new Vectors<int>(10, 10, 0);
	newInt->insert(4,5,5);
	EXPECT_EQ(5, newInt->access(4,5));
	delete newInt;

	Vectors<std::string>* newString = new Vectors<std::string>(9, 18, "empty");
	newString->insert(4,5,"hello");
	EXPECT_EQ("hello", newString->access(4,5));
	delete newString;

	Vectors<double>* newDouble = new Vectors<double>(6, 7, 0.0);
	newDouble->insert(4,5,5.5);
	EXPECT_EQ(5.5, newDouble->access(4,5));
	delete newDouble;
}
Exemplo n.º 3
0
TEST(Vectors, Access) {
	Vectors<std::string>* newVector = new Vectors<std::string>(20,20,"null");
	EXPECT_EQ("null", newVector->access(10,10));
	newVector->insert(15,17,"howdy");
	EXPECT_EQ("howdy", newVector->access(15,17));
	delete newVector;

	Vectors<int>* newInt = new Vectors<int>(20,21,0);
	EXPECT_EQ(0, newInt->access(10,10));
	newInt->insert(15,17,90);
	EXPECT_EQ(90, newInt->access(15,17));
	delete newInt;

	Vectors<double>* newDouble = new Vectors<double>(21,20,0.0);
	EXPECT_EQ(0.0, newDouble->access(10,10));
	newDouble->insert(15,17,4.5);
	EXPECT_EQ(4.5, newDouble->access(15,17));
	delete newDouble;
}
Exemplo n.º 4
0
TEST(Vectors, Remove) {
	Vectors<int>* newVector = new Vectors<int>(5,5,0);
	newVector->insert(2,3,4);
	newVector->remove(2,3);
	EXPECT_EQ(0, newVector->access(2,3));
	delete newVector;
	
	Vectors<double>* newDouble = new Vectors<double>(5,5,0.0);
	newDouble->insert(2,3,4.4);
	newDouble->remove(2,3);
	EXPECT_EQ(0.0, newDouble->access(2,3));
	delete newDouble;
	
	Vectors<std::string>* newString = new Vectors<std::string>(5,5,"empty");
	newString->insert(2,3,"yes");
	newString->remove(2,3);
	EXPECT_EQ("empty", newString->access(2,3));
	delete newString;
}
Exemplo n.º 5
0
int main(){
	Vectors<int>* newVector = new Vectors<int>(10,10,0);
	for (int i=0; i<10; ++i){
		for (int j=0; j<10; ++j){
			newVector->insert(i, j, 5);
		}
	}
	newVector->print();
	
	for (int i=0; i<10; ++i){
		for (int j=0; j<10; ++j){
			newVector->remove(i, j);
		}
	}
	newVector->print();
	delete newVector;
	return 0;
}