diff options
author | Arnstein Ressem <aressem@gmail.com> | 2016-08-15 15:38:23 +0200 |
---|---|---|
committer | Vegard Sjonfjell <vegardsjo@gmail.com> | 2016-08-15 15:38:23 +0200 |
commit | d15dc62521c5cf26455216fa5eb3c3fe0b5c8ada (patch) | |
tree | 195f7d2b2392d07ec6e1c2b9dc14a7a965ecc65c /searchlib/src/tests/fef/table/table_test.cpp | |
parent | e534ad2c12af07da88b8264c2be189f5f686e927 (diff) |
Aressem/cmake out of source test for script (#409)
* First script runs out of source.
* Call scripts from source directory.
* One more test passing.
* Searchcore tests pass out of source.
* Searchlib tests run out of source:
Diffstat (limited to 'searchlib/src/tests/fef/table/table_test.cpp')
-rw-r--r-- | searchlib/src/tests/fef/table/table_test.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/searchlib/src/tests/fef/table/table_test.cpp b/searchlib/src/tests/fef/table/table_test.cpp index 2d05e0c7310..74fb37ab672 100644 --- a/searchlib/src/tests/fef/table/table_test.cpp +++ b/searchlib/src/tests/fef/table/table_test.cpp @@ -25,10 +25,22 @@ private: void testFunctionTableFactory(); void testTableManager(); + const std::string _srcDir; + const std::string _tables1Dir; + const std::string _tables2Dir; public: + TableTest(); int Main(); }; +TableTest::TableTest() : + vespalib::TestApp(), + _srcDir(getenv("SOURCE_DIRECTORY") ? getenv("SOURCE_DIRECTORY") : "."), + _tables1Dir(_srcDir + "/tables1"), + _tables2Dir(_srcDir + "/tables2") +{ +} + bool TableTest::assertTable(const Table & act, const Table & exp) { @@ -72,12 +84,12 @@ void TableTest::testFileTableFactory() { { - FileTableFactory ftf("tables1"); + FileTableFactory ftf(_tables1Dir); EXPECT_TRUE(assertCreateTable(ftf, "a", Table().add(1.5).add(2.25).add(3))); EXPECT_TRUE(ftf.createTable("b").get() == NULL); } { - FileTableFactory ftf("tables1/"); + FileTableFactory ftf(_tables1Dir); EXPECT_TRUE(ftf.createTable("a").get() != NULL); } } @@ -114,8 +126,8 @@ TableTest::testTableManager() { { TableManager tm; - tm.addFactory(ITableFactory::SP(new FileTableFactory("tables1"))); - tm.addFactory(ITableFactory::SP(new FileTableFactory("tables2"))); + tm.addFactory(ITableFactory::SP(new FileTableFactory(_tables1Dir))); + tm.addFactory(ITableFactory::SP(new FileTableFactory(_tables2Dir))); { const Table * t = tm.getTable("a"); // from tables1 |