Esempio n. 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;
}
Esempio n. 2
0
TEST(TwoDArrayTest, access) {
  TwoDArray<int>* td = new TwoDArray<int>(100, 100, 42);
  td->insert(25, 25, 1);
  td->insert(25, 26, 2);
  td->insert(26, 25, 3);
  td->insert(26, 26, 4);
  
  EXPECT_EQ(42, td->access(0, 0));
  EXPECT_EQ(4, td->access(26, 26));
  delete td;
}
Esempio n. 3
0
TEST(TwoDArrayAccess, AccessString) {
    TwoDArray<string>* tDString = new TwoDArray<string>(12, 12, "9");
    
    for (int i = 0; i < 10; i++) {
	  for(int j = 0; j < 10; j++) {
		tDString->access(i, j);
	  }
    }
    EXPECT_EQ("9", tDString->access(7, 7));
    delete tDString;
}
Esempio n. 4
0
TEST(TwoDArrayAccess, AccessDouble) {
    TwoDArray<double>* tDDouble = new TwoDArray<double>(11, 11, 8.8);
    
    for (int i = 0; i < 10; i++) {
	  for(int j = 0; j < 10; j++) {
		tDDouble->access(i, j);
	  }
    }
    EXPECT_EQ(8.8, tDDouble->access(7, 7));
    delete tDDouble;
}
Esempio n. 5
0
TEST(TwoDArrayAccess, AccessInt) {
    TwoDArray<int>* tDInt = new TwoDArray<int>(10, 10, 7);
    
    for (int i = 0; i < 10; i++) {
	  for(int j = 0; j < 10; j++) {
		tDInt->access(i, j);
	  }
    }
    EXPECT_EQ(7, tDInt->access(7, 7));
    delete tDInt;
}
Esempio n. 6
0
TEST(TwoDArrayTest, insert) {
  TwoDArray<int>* td = new TwoDArray<int>(10, 10, 0);
  td->insert(5, 4, 10);
  td->insert(5, 5, 9);
  td->insert(5, 6, 8);


  EXPECT_EQ(10, td->access(5, 4));
  EXPECT_EQ(8, td->access(5, 6));
  delete td;
}
Esempio n. 7
0
TEST(TwoDArray, Insert) {
	TwoDArray<int>* newInt = new TwoDArray<int>(10,10,0);
	newInt->insert(5,5,5);
	EXPECT_EQ(5, newInt->access(5,5));
	delete newInt;

	TwoDArray<std::string>* newString = new TwoDArray<std::string>(10,10,"null");
	newString->insert(5,5,"yo");
	EXPECT_EQ("yo", newString->access(5,5));
	delete newString;

	TwoDArray<double>* newDouble = new TwoDArray<double>(10,10,0.0);
	newDouble->insert(5,5,5.5);
	EXPECT_EQ(5.5, newDouble->access(5,5));
	delete newDouble;
}
Esempio n. 8
0
TEST(TwoDArrayTest, InsertInt) {
    TwoDArray<int>* tDInt = new TwoDArray<int>(3, 3, 0);
    for (int i=0; i < 3; i++) {
	  tDInt->insert(i, i, 3);
    }
    EXPECT_EQ(3, tDInt->access(1, 1));
    delete tDInt;
}
Esempio n. 9
0
TEST(access, stringTest) {
    int r = 10;
    int c = 10;
    TwoDArray<string>* a = new TwoDArray<string>(r, c);
    a->insert(9, 9, "yarrr");
    EXPECT_EQ("yarrr", a->access(9, 9));
    delete a;
}
Esempio n. 10
0
TEST(access, doubleTest) {
    int r = 10;
    int c = 10;
    TwoDArray<double>* a = new TwoDArray<double>(r, c);
    a->insert(5, 4, 423.633);
    EXPECT_EQ(423.633, a->access(5, 4));
    delete a;
}
Esempio n. 11
0
TEST(arrayTest, insert) {
  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");

  EXPECT_EQ(7, i->access(2, 2));
  EXPECT_EQ(3.145, d->access(4, 4));
  EXPECT_EQ("Hello", s->access(0, 0));

  delete i;
  delete d;
  delete s;
}
Esempio n. 12
0
TEST(access, integerTest) {
    int r = 10;
    int c = 10;
    TwoDArray<int>* a = new TwoDArray<int>(r, c);
    a->insert(0, 0, 400);
    EXPECT_EQ(400, a->access(0, 0));
    delete a;
}
Esempio n. 13
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;
}
Esempio n. 14
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;

}
Esempio n. 15
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;
}
Esempio n. 16
0
TEST(TwoDArrayTest, InsertStirng) {
    TwoDArray<string>* tDString = new TwoDArray<string>(3, 3, "default");

    for (int i=0; i < 3; i++) {
	  tDString->insert(i, i, "Integer");
    }
    EXPECT_EQ("Integer", tDString->access(1, 1));
    delete tDString;
}
Esempio n. 17
0
TEST(TwoDArrayTest, InsertDoulbe) {
    TwoDArray<double>* tDDouble = new TwoDArray<double>(3, 3, 0.0);

    for (int i=0; i < 3; i++) {
	  tDDouble->insert(i, i, 3.3);
    }
    EXPECT_EQ(3.3, tDDouble->access(1, 1));
    delete tDDouble;
}
Esempio n. 18
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;
}
Esempio n. 19
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;
}
Esempio n. 20
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;
}
Esempio n. 21
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;
}
Esempio n. 22
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;
}
Esempio n. 23
0
TEST(TwoDArray, Access) {
	TwoDArray<int>* newInt = new TwoDArray<int>(24,67,5);
	EXPECT_EQ(5, newInt->access(10,10));
	newInt->insert(15,17,100);
	EXPECT_EQ(100, newInt->access(15,17));
	delete newInt;

	TwoDArray<double>* newDouble = new TwoDArray<double>(33,54,5.6);
	EXPECT_EQ(5.6, newDouble->access(12,24));
	newDouble->insert(13,15,7.8);
	EXPECT_EQ(7.8, newDouble->access(13,15));
	delete newDouble;
	
	TwoDArray<std::string>* newString = new TwoDArray<std::string>(20,20,"null");
	EXPECT_EQ("null", newString->access(10,10));
	newString->insert(15,17,"howdy");
	EXPECT_EQ("howdy", newString->access(15,17));
	delete newString;
}