MCPcopy Create free account
hub / github.com/Kitware/CMake / testGeneration

Function testGeneration

Tests/CMakeLib/testCMFilesystemPath.cxx:360–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360bool testGeneration()
361{
362 std::cout << "testGeneration()";
363
364 bool result = true;
365
366 {
367 fs::path p("a/./b/..");
368 if (p.lexically_normal().generic_string() != "a/") {
369 result = false;
370 }
371 p = "a/.///b/../";
372 if (p.lexically_normal().generic_string() != "a/") {
373 result = false;
374 }
375 }
376#if defined(_WIN32)
377 {
378 fs::path p("//host/./b/..");
379 if (p.lexically_normal().string() != "\\\\host\\") {
380 result = false;
381 }
382 p = "//host/.///b/../";
383 if (p.lexically_normal().string() != "\\\\host\\") {
384 result = false;
385 }
386 p = "c://a/.///b/../";
387 if (p.lexically_normal().string() != "c:\\a\\") {
388 result = false;
389 }
390 }
391#endif
392
393 {
394 if (fs::path("/a//d").lexically_relative("/a/b/c") != "../../d") {
395 result = false;
396 }
397 if (fs::path("/a//b///c").lexically_relative("/a/d") != "../b/c") {
398 result = false;
399 }
400 if (fs::path("a/b/c").lexically_relative("a") != "b/c") {
401 result = false;
402 }
403 if (fs::path("a/b/c").lexically_relative("a/b/c/x/y") != "../..") {
404 result = false;
405 }
406 if (fs::path("a/b/c").lexically_relative("a/b/c") != ".") {
407 result = false;
408 }
409 if (fs::path("a/b").lexically_relative("c/d") != "../../a/b") {
410 result = false;
411 }
412 }
413 {
414#if defined(_WIN32)
415 if (fs::path("/a/d").lexically_relative("e/d/c") != "/a/d") {
416 result = false;
417 }

Callers

nothing calls this directly

Calls 5

lexically_normalMethod · 0.80
lexically_relativeMethod · 0.80
checkResultFunction · 0.70
stringMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…