| 14 | using namespace openstudio::model; |
| 15 | |
| 16 | TEST_F(ModelFixture, PythonPluginSearchPaths_GettersSetters) { |
| 17 | Model m; |
| 18 | PythonPluginSearchPaths pythonPluginSearchPaths = m.getUniqueModelObject<PythonPluginSearchPaths>(); |
| 19 | |
| 20 | // Add Current Working Directory to Search Path: Required Boolean |
| 21 | EXPECT_TRUE(pythonPluginSearchPaths.setAddCurrentWorkingDirectorytoSearchPath(true)); |
| 22 | EXPECT_TRUE(pythonPluginSearchPaths.addCurrentWorkingDirectorytoSearchPath()); |
| 23 | EXPECT_TRUE(pythonPluginSearchPaths.setAddCurrentWorkingDirectorytoSearchPath(false)); |
| 24 | EXPECT_FALSE(pythonPluginSearchPaths.addCurrentWorkingDirectorytoSearchPath()); |
| 25 | |
| 26 | // Add Input File Directory to Search Path: Required Boolean |
| 27 | EXPECT_TRUE(pythonPluginSearchPaths.setAddInputFileDirectorytoSearchPath(true)); |
| 28 | EXPECT_TRUE(pythonPluginSearchPaths.addInputFileDirectorytoSearchPath()); |
| 29 | EXPECT_TRUE(pythonPluginSearchPaths.setAddInputFileDirectorytoSearchPath(false)); |
| 30 | EXPECT_FALSE(pythonPluginSearchPaths.addInputFileDirectorytoSearchPath()); |
| 31 | |
| 32 | // Add epin Environment Variable to Search Path: Required Boolean |
| 33 | EXPECT_TRUE(pythonPluginSearchPaths.setAddepinEnvironmentVariabletoSearchPath(true)); |
| 34 | EXPECT_TRUE(pythonPluginSearchPaths.addepinEnvironmentVariabletoSearchPath()); |
| 35 | EXPECT_TRUE(pythonPluginSearchPaths.setAddepinEnvironmentVariabletoSearchPath(false)); |
| 36 | EXPECT_FALSE(pythonPluginSearchPaths.addepinEnvironmentVariabletoSearchPath()); |
| 37 | |
| 38 | // Search Paths |
| 39 | EXPECT_TRUE(pythonPluginSearchPaths.searchPaths().empty()); |
| 40 | |
| 41 | EXPECT_TRUE(pythonPluginSearchPaths.addSearchPath("/example/search/path/1")); |
| 42 | ASSERT_EQ(1u, pythonPluginSearchPaths.searchPaths().size()); |
| 43 | EXPECT_EQ("/example/search/path/1", pythonPluginSearchPaths.searchPaths()[0]); |
| 44 | |
| 45 | EXPECT_TRUE(pythonPluginSearchPaths.addSearchPath("/example/search/path/1")); |
| 46 | ASSERT_EQ(1u, pythonPluginSearchPaths.searchPaths().size()); |
| 47 | EXPECT_TRUE(pythonPluginSearchPaths.addSearchPath("/example/search/path/2")); |
| 48 | ASSERT_EQ(2u, pythonPluginSearchPaths.searchPaths().size()); |
| 49 | EXPECT_EQ("/example/search/path/1", pythonPluginSearchPaths.searchPaths()[0]); |
| 50 | EXPECT_EQ("/example/search/path/2", pythonPluginSearchPaths.searchPaths()[1]); |
| 51 | |
| 52 | std::vector<std::string> searchPaths({"path/3", "path/4", "path/5", "path/5"}); |
| 53 | EXPECT_TRUE(pythonPluginSearchPaths.setSearchPaths(searchPaths)); |
| 54 | ASSERT_EQ(3u, pythonPluginSearchPaths.searchPaths().size()); |
| 55 | EXPECT_EQ("path/3", pythonPluginSearchPaths.searchPaths()[0]); |
| 56 | EXPECT_EQ("path/4", pythonPluginSearchPaths.searchPaths()[1]); |
| 57 | EXPECT_EQ("path/5", pythonPluginSearchPaths.searchPaths()[2]); |
| 58 | |
| 59 | pythonPluginSearchPaths.clearSearchPaths(); |
| 60 | EXPECT_EQ(0u, pythonPluginSearchPaths.searchPaths().size()); |
| 61 | } |
nothing calls this directly
no test coverage detected