Exemple #1
0
TEST(numCols, stringTest) {
    int r = 5;
    int c = 10;
    TwoDArray<string>* a = new TwoDArray<string>(r, c);
    EXPECT_EQ(10, a->getNumCols());
    delete a;
}
Exemple #2
0
TEST(numCols, doubleTest) {
    int r = 5;
    int c = 10;
    TwoDArray<double>* a = new TwoDArray<double>(r, c);
    EXPECT_EQ(10, a->getNumCols());
    delete a;
}
TEUCHOS_UNIT_TEST(Teuchos_TwoDArray, symmetrySerialization){
  TwoDArray<int> simpleArray = getSimpleTestTwoDArray();
  simpleArray.setSymmetrical(true);
  std::string arrayString = TwoDArray<int>::toString(simpleArray);
  TwoDArray<int> readIn = TwoDArray<int>::fromString(arrayString);
  TEST_ASSERT(readIn.isSymmetrical());
}
TEUCHOS_UNIT_TEST(Teuchos_TwoDArray, symmetryTest){
  TwoDArray<int> simpleArray = getSimpleTestTwoDArray();
  TEST_ASSERT(!simpleArray.isSymmetrical());
  simpleArray.setSymmetrical(true);
  TEST_ASSERT(simpleArray.isSymmetrical());

}
Exemple #5
0
TEST(numCols, integerTest) {
    int r = 5;
    int c = 10;
    TwoDArray<int>* a = new TwoDArray<int>(r, c);
    EXPECT_EQ(10, a->getNumCols());
    delete a;
}
TEUCHOS_UNIT_TEST(Teuchos_TwoDArrays, emptyTest){
  TwoDArray<int> emptyArray;
  TEST_EQUALITY_CONST(emptyArray.getNumRows(), 0)
  TEST_EQUALITY_CONST(emptyArray.getNumCols(), 0)
  TEST_EQUALITY_CONST(emptyArray.getDataArray().size(), 0)
  TEST_ASSERT(emptyArray.isEmpty());
}
Exemple #7
0
TEST(constructor, integerTest) {
    int r = 10;
    int c = 10;
    TwoDArray<int>* a = new TwoDArray<int>(r, c);
    EXPECT_EQ(r, a->getNumRows());
    EXPECT_EQ(c, a->getNumCols());
    delete a;
}
Exemple #8
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;
}
Exemple #9
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;
}
Exemple #10
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;
}
Exemple #11
0
TEST(constructor, doubleTest) {
    int r = 10;
    int c = 10;
    TwoDArray<double>* a = new TwoDArray<double>(r, c);
    EXPECT_EQ(r, a->getNumRows());
    EXPECT_EQ(c, a->getNumCols());
    delete a;
}
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;
}
Exemple #13
0
TEST(constructor, stringTest) {
    int r = 10;
    int c = 10;
    TwoDArray<string>* a = new TwoDArray<string>(r, c);
    EXPECT_EQ(r, a->getNumRows());
    EXPECT_EQ(c, a->getNumCols());
    delete a;
}
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;
}
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;
}
TEST(TwoDArray, PrintString) {
    TwoDArray<string>* tdS = new TwoDArray<string>(5, 5, "default");
    for (int i = 0; i < 5; i++) {
	  tdS->insert(i, i, "hello");
    }
    std::cout << "TDArray String print" << std::endl;
    tdS->print();
    delete tdS;
}
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;
}
TEST(TwoDArray, PrintDouble) {
    TwoDArray<double>* tdD = new TwoDArray<double>(5, 5, 0.00);
    for (int i = 0; i < 5; i++) {
	  tdD->insert(i, i, 7.77);
    }
    std::cout << "TDArray Double print" << std::endl;
    tdD->print();
    delete tdD;
}
TEST(TwoDArray, PrintInt) {
    TwoDArray<int>* tdInt = new TwoDArray<int>(5, 5, 0);
    for (int i = 0; i < 5; i++) {
	  tdInt->insert(i, i, 7);
    }
    std::cout << "TDArray Integer print" << std::endl;
    tdInt->print();
    delete tdInt;
}
Exemple #20
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;
}
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;
}
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;
}
Exemple #23
0
TEST(insert, stringTest) {
    int r = 10;
    int c = 10;
    TwoDArray<string>* a = new TwoDArray<string>(r, c);
    a->insert(0, 0, "hey");
    a->insert(0, 9, "whats");
    a->insert(9, 9, "up");
    a->insert(4, 4, "yooooooooooo");
    delete a;
}
Exemple #24
0
TEST(insert, doubleTest) {
    int r = 10;
    int c = 10;
    TwoDArray<double>* a = new TwoDArray<double>(r, c);
    a->insert(0, 0, 4089.7678);
    a->insert(0, 9, 900.435468);
    a->insert(9, 9, 92939.765);
    a->insert(4, 4, 567658.12);
    delete a;
}
Exemple #25
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;
}
Exemple #26
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;
}
TEST(TwoDArray, Print) {
	TwoDArray<int>* newArray = new TwoDArray<int>(10,10,0);
	newArray->insert(1,2,1);
	newArray->insert(9,8,2);
	newArray->insert(7,2,3);
	newArray->insert(6,4,4);
	newArray->insert(0,8,5);
	newArray->print();
	delete newArray;
}
Exemple #28
0
TEST(insert, integerTest) {
    int r = 10;
    int c = 10;
    TwoDArray<int>* a = new TwoDArray<int>(r, c);
    a->insert(0, 0, 400);
    a->insert(0, 9, 900);
    a->insert(9, 9, 92939);
    a->insert(4, 4, 567658);
    delete a;
}
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;
}
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;
}