[vcpkg] Reformat tests.plan.cpp and add :x64 version of test
MODIFY
src/tests.plan.cpp
src/tests.plan.cpp
@@ -39,9 +39,7 @@ namespace Microsoft::VisualStudio::CppUnitTestFramework
namespace UnitTest1
{
static std::unique_ptr<SourceControlFile> make_control_file(
- const char* name,
- const char* depends,
- const std::vector<std::pair<const char*, const char*>>& features = {})
+ const char* name, const char* depends, const std::vector<std::pair<const char*, const char*>>& features = {})
{
using Pgh = std::unordered_map<std::string, std::string>;
std::vector<Pgh> scf_pghs;
@@ -98,25 +96,28 @@ namespace UnitTest1
Assert::AreEqual(pkg_name.c_str(), plan.spec.name().c_str());
}
- static std::unique_ptr<StatusParagraph> make_status_pgh(const char* name, const char* depends = "")
+ static std::unique_ptr<StatusParagraph> make_status_pgh(const char* name,
+ const char* depends = "",
+ const char* triplet = "x86-windows")
{
using Pgh = std::unordered_map<std::string, std::string>;
return std::make_unique<StatusParagraph>(Pgh{{"Package", name},
{"Version", "1"},
- { "Architecture", "x86-windows" },
+ {"Architecture", triplet},
{"Multi-Arch", "same"},
{"Depends", depends},
{"Status", "install ok installed"}});
}
static std::unique_ptr<StatusParagraph> make_status_feature_pgh(const char* name,
const char* feature,
- const char* depends = "")
+ const char* depends = "",
+ const char* triplet = "x86-windows")
{
using Pgh = std::unordered_map<std::string, std::string>;
return std::make_unique<StatusParagraph>(Pgh{{"Package", name},
{"Version", "1"},
{"Feature", feature},
- { "Architecture", "x86-windows" },
+ {"Architecture", triplet},
{"Multi-Arch", "same"},
{"Depends", depends},
{"Status", "install ok installed"}});
@@ -557,5 +558,23 @@ namespace UnitTest1
Assert::AreEqual("vtk", remove_plan[1].spec.name().c_str());
Assert::AreEqual("expat", remove_plan[2].spec.name().c_str());
}
+
+ TEST_METHOD(features_depend_remove_scheme_once_removed_x64)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> pghs;
+ pghs.push_back(make_status_pgh("expat", "", "x64"));
+ pghs.push_back(make_status_pgh("vtk", "expat", "x64"));
+ pghs.push_back(make_status_pgh("opencv", "", "x64"));
+ pghs.push_back(make_status_feature_pgh("opencv", "vtk", "vtk", "x64"));
+ StatusParagraphs status_db(std::move(pghs));
+
+ auto remove_plan = Dependencies::create_remove_plan(
+ {unsafe_pspec("expat", Triplet::from_canonical_name("x64"))}, status_db);
+
+ Assert::AreEqual(size_t(3), remove_plan.size());
+ Assert::AreEqual("opencv", remove_plan[0].spec.name().c_str());
+ Assert::AreEqual("vtk", remove_plan[1].spec.name().c_str());
+ Assert::AreEqual("expat", remove_plan[2].spec.name().c_str());
+ }
};
}

[vcpkg] Reformat tests.plan.cpp and add :x64 version of test