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

Function testFindPackageCommand

Tests/CMakeLib/testFindPackageCommand.cxx:17–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 failed = 1
16
17int testFindPackageCommand(int /*unused*/, char* /*unused*/[])
18{
19 int failed = 0;
20
21 // ----------------------------------------------------------------------
22 // Test cmFindPackage::Sort
23 std::vector<std::string> testString;
24 testString.push_back("lib-0.0");
25 testString.push_back("lib-1.2");
26 testString.push_back("lib-2.0");
27 testString.push_back("lib-19.0.1");
28 testString.push_back("lib-20.01.1");
29 testString.push_back("lib-20.2.2a");
30
31 cmFindPackageCommand::Sort(testString.begin(), testString.end(),
32 cmFindPackageCommand::Natural,
33 cmFindPackageCommand::Asc);
34 if (!(testString[0] == "lib-0.0" && testString[1] == "lib-1.2" &&
35 testString[2] == "lib-2.0" && testString[3] == "lib-19.0.1" &&
36 testString[4] == "lib-20.01.1" && testString[5] == "lib-20.2.2a")) {
37 cmFailed("cmSystemTools::Sort fail with Natural ASC");
38 }
39
40 cmFindPackageCommand::Sort(testString.begin(), testString.end(),
41 cmFindPackageCommand::Natural,
42 cmFindPackageCommand::Dec);
43 if (!(testString[5] == "lib-0.0" && testString[4] == "lib-1.2" &&
44 testString[3] == "lib-2.0" && testString[2] == "lib-19.0.1" &&
45 testString[1] == "lib-20.01.1" && testString[0] == "lib-20.2.2a")) {
46 cmFailed("cmSystemTools::Sort fail with Natural ASC");
47 }
48
49 cmFindPackageCommand::Sort(testString.begin(), testString.end(),
50 cmFindPackageCommand::Name_order,
51 cmFindPackageCommand::Dec);
52 if (!(testString[5] == "lib-0.0" && testString[4] == "lib-1.2" &&
53 testString[3] == "lib-19.0.1" && testString[2] == "lib-2.0" &&
54 testString[1] == "lib-20.01.1" && testString[0] == "lib-20.2.2a")) {
55 cmFailed("cmSystemTools::Sort fail with Name DEC");
56 }
57
58 cmFindPackageCommand::Sort(testString.begin(), testString.end(),
59 cmFindPackageCommand::Name_order,
60 cmFindPackageCommand::Asc);
61 if (!(testString[0] == "lib-0.0" && testString[1] == "lib-1.2" &&
62 testString[2] == "lib-19.0.1" && testString[3] == "lib-2.0" &&
63 testString[4] == "lib-20.01.1" && testString[5] == "lib-20.2.2a")) {
64 cmFailed("cmSystemTools::Sort fail with Natural ASC");
65 }
66
67 if (!failed) {
68 cmPassed("cmSystemTools::Sort working");
69 }
70 return failed;
71}

Callers

nothing calls this directly

Calls 5

push_backMethod · 0.80
cmFailedFunction · 0.50
cmPassedFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…