Skip to content

Commit

Permalink
added a couple more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gf712 committed May 14, 2019
1 parent d5b232e commit 4162485
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/unit/io/ARFFFile_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ TEST(ARFFFileTest, Parse_numeric)
auto ss = std::make_shared<std::istringstream>(test);
auto s = std::shared_ptr<std::istream>(ss);

SGVector<float64_t> solution{50, 45, 5.1, 4.13};

auto parser = std::make_unique<ARFFDeserializer>(s);
parser->read();
auto result = parser->get_features();
Expand Down Expand Up @@ -140,22 +138,22 @@ TEST(ARFFFileTest, Parse_nominal)
std::string test = "@relation test_nominal \n"
"% \n"
"% \n"
"@attribute VAR1 {\"a\", b} \n"
"@attribute VAR1 {\"a\", b, \"c 1\", \'¯\\_(ツ)_/¯\'} \n"
"@attribute VAR2 numeric \n"
"% \n"
"% \n"
"@data \n"
"\"a\", 50 \n"
"b, 26 \n"
"\"b\", 34 \n"
"\"a\", 41 \n"
"\"b\", 44 \n"
"\'c 1\', 41 \n"
"\"¯\\_(ツ)_/¯\", 44 \n"
"a, 45 ";

auto ss = std::make_shared<std::istringstream>(test);
auto s = std::shared_ptr<std::istream>(ss);

SGVector<float64_t> solution1{0, 1, 1, 0, 1, 0};
SGVector<float64_t> solution1{0, 1, 1, 2, 3, 0};
SGVector<float64_t> solution2{50, 26, 34, 41, 44, 45};

auto parser = std::make_unique<ARFFDeserializer>(s);
Expand All @@ -164,10 +162,10 @@ TEST(ARFFFileTest, Parse_nominal)
ASSERT_EQ(result->get_num_feature_obj(), 2);

auto col1 =
dynamic_cast<CDenseFeatures<float64_t>*>(result->get_feature_obj(0));
dynamic_cast<CDenseFeatures<float64_t>*>(result->get_feature_obj(0));
auto mat1 = col1->get_feature_matrix();
auto col2 =
dynamic_cast<CDenseFeatures<float64_t>*>(result->get_feature_obj(1));
dynamic_cast<CDenseFeatures<float64_t>*>(result->get_feature_obj(1));
auto mat2 = col2->get_feature_matrix();
ASSERT_EQ(mat1.size(), 6);
for (int i = 0; i < 6; ++i)
Expand Down

0 comments on commit 4162485

Please sign in to comment.