Пример #1
0
Test(arrayTest, remove) {
  TwoDArray<int>* i = new TwoDArray<int>(5, 5, 0);
  TwoDArray<double>* d = new TwoDArray<int>(5, 5, 0);
  TwoDArray<std::string>* s = new TwoDArray<std::string>(5, 5, "o");
  
  i->insert(2, 2, 7);
  d->insert(4, 4, 3.145);
  s->insert(0, 0, "Hello");
  i->insert(3, 3, 9);
  
  i->remove(2, 2);
  d->remove(4, 4);
  s->remove(0, 0);

  s->insert(0, 0, "y");

  EXPECT_EQ(0, i->access(2, 2));
  EXPECT_EQ(0, d->access(4, 4));
  EXPECT_EQ("y", s->access(0, 0));
  EXPECT_EQ(9, i->insert(3, 3));

  delete i;
  delete d;
  delete s;
}
Пример #2
0
TEST(TwoDArrayTest, remove) {
  TwoDArray<int>* td = new TwoDArray<int>(10, 10, 42);
  td->insert(5, 5, 12);
  
  td->remove(5, 5);
  EXPECT_EQ(42, td->access(5,5));
  delete td;
}
Пример #3
0
TEST(remove, integerTest) {
    int r = 10;
    int c = 10;
    TwoDArray<int>* a = new TwoDArray<int>(r, c);
    a->insert(0, 0, 400);
    a->remove(0, 0);
    ASSERT_TRUE(a->access(0, 0) != 400);
    delete a;
}
Пример #4
0
TEST(TwoDArray, Remove) {
	TwoDArray<int>* newInt = new TwoDArray<int>(5,5,0);
	newInt->insert(2,3,4);
	newInt->remove(2,3);
	EXPECT_EQ(0, newInt->access(2,3));
	delete newInt;

	TwoDArray<double>* newDouble = new TwoDArray<double>(3,4,1.0);
	newDouble->insert(2,1,4.4);
	newDouble->remove(2,1);
	EXPECT_EQ(1.0, newDouble->access(2,3));
	delete newDouble;

	TwoDArray<std::string>* newString = new TwoDArray<std::string>(100,200,"empty");
	newString->insert(48, 68, "hello");
	newString->remove(2,3);
	EXPECT_EQ("hello", newString->access(48,68));
	delete newString;
}
Пример #5
0
TEST(TwoDArrayRemove, RemoveDouble) {
    TwoDArray<double>* tDDouble = new TwoDArray<double>(10, 10, 0.0);
    
    for (int i=0; i<10; i++) {
	  tDDouble->insert(i, i, 7);
    }
    tDDouble->remove(7, 5);
    EXPECT_EQ(0.0, tDDouble->access(7, 5));
    delete tDDouble;
}
Пример #6
0
TEST(TwoDArrayRemove, RemoveInt) {
    TwoDArray<int>* tDInt = new TwoDArray<int>(10, 10, 0);
    
    for (int i=0; i<10; i++) {
	  tDInt->insert(i, i, 7);
    }
    tDInt->remove(7, 5);
    EXPECT_EQ(0, tDInt->access(7, 5));
    delete tDInt;
}
Пример #7
0
TEST(remove, stringTest) {
    int r = 10;
    int c = 10;
    TwoDArray<string>* a = new TwoDArray<string>(r, c);
    a->insert(5, 4, "yay");
    a->remove(5, 4);
    string d;
    ASSERT_TRUE(a->access(0, 0) != "yay");
    delete a;
}
Пример #8
0
TEST(remove, doubleTest) {
    int r = 10;
    int c = 10;
    TwoDArray<double>* a = new TwoDArray<double>(r, c);
    a->insert(9, 9, 400.2);
    a->remove(9, 9);
    double d;
    ASSERT_TRUE(a->access(0, 0) != 400.2);
    delete a;
}
Пример #9
0
int main(){

	TwoDArray<int>* newArray = new TwoDArray<int>(10, 10, 0);

	newArray->insert(1,1,5);
	cout << newArray->access(1,1) << endl;
	newArray->remove(1,1);
	cout << newArray->access(1,1) << endl;
	newArray->print();
	delete newArray;

	TwoDArray<std::string>* nextArray = new TwoDArray<std::string>(5,5, "hi");
	nextArray->insert(2,2, "bye");
	nextArray->print();
	delete nextArray;

}