MCPcopy Create free account
hub / github.com/ddnet/ddnet / TEST

Function TEST

src/test/test.cpp:154–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154TEST(TestInfo, Sort)
155{
156 std::vector<CTestInfoPath> vEntries;
157 vEntries.resize(3);
158
159 const char aBasePath[] = "test_dir";
160 const char aSubPath[] = "test_dir/subdir";
161 const char aFilePath[] = "test_dir/subdir/file.txt";
162
163 vEntries[0].m_IsDirectory = true;
164 str_copy(vEntries[0].m_aData, aBasePath);
165
166 vEntries[1].m_IsDirectory = true;
167 str_copy(vEntries[1].m_aData, aSubPath);
168
169 vEntries[2].m_IsDirectory = false;
170 str_copy(vEntries[2].m_aData, aFilePath);
171
172 // Sorts directories after files.
173 std::sort(vEntries.begin(), vEntries.end());
174
175 EXPECT_FALSE(vEntries[0].m_IsDirectory);
176 EXPECT_EQ(str_comp(vEntries[0].m_aData, aFilePath), 0);
177 EXPECT_TRUE(vEntries[1].m_IsDirectory);
178 EXPECT_EQ(str_comp(vEntries[1].m_aData, aSubPath), 0);
179 EXPECT_TRUE(vEntries[2].m_IsDirectory);
180 EXPECT_EQ(str_comp(vEntries[2].m_aData, aBasePath), 0);
181}

Callers

nothing calls this directly

Calls 4

str_compFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
str_copyFunction · 0.50

Tested by

no test coverage detected