Skip to content

Commit d679874

Browse files
committed
fix: update path dependant on os
1 parent 7be1b98 commit d679874

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

tests/markov_chain_tests.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,21 @@ TEST(MarkovTextModelTest, CharacterLevelGeneration) {
7272
TEST(MarkovTextModelTest, TrainOnWarAndPeaceWordLevel) {
7373
using namespace ptm;
7474

75-
std::ifstream in("war_and_peace.txt");
76-
ASSERT_TRUE(in.good()) << "Не удалось открыть файл tests/war_and_peace_ru.txt";
75+
auto path = std::filesystem::current_path();
76+
path = path.parent_path();
77+
78+
#ifndef _MSC_VER
79+
path = path.parent_path();
80+
#endif
81+
82+
path.append("tests");
83+
path.append("war_and_peace.txt");
84+
85+
std::ifstream in(path);
86+
87+
#ifdef _MSC_VER
88+
in = std::ifstream(path.native());
89+
#endif ASSERT_TRUE(in.good()) << "Не удалось открыть файл war_and_peace.txt";
7790

7891
std::stringstream buffer;
7992
buffer << in.rdbuf();

0 commit comments

Comments
 (0)