aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg-test/supports.cpp
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2019-07-24 11:02:24 -0700
committerGitHub <noreply@github.com>2019-07-24 11:02:24 -0700
commit36dea3d7a6aca229a5dde0903b9cede506d41b90 (patch)
treea211bc6fd36e9f60d4e3383309a82f1ea7ce1baf /toolsrc/src/vcpkg-test/supports.cpp
parent265921b4a307d71bfc408b8ab927501d79d77973 (diff)
parent2c20a9d98186e029ff443932295d7cdcad96980e (diff)
downloadvcpkg-36dea3d7a6aca229a5dde0903b9cede506d41b90.tar.gz
vcpkg-36dea3d7a6aca229a5dde0903b9cede506d41b90.zip
Merge pull request #7228 from ubsan/parallel-file-ops
Parallel file operations
Diffstat (limited to 'toolsrc/src/vcpkg-test/supports.cpp')
-rw-r--r--toolsrc/src/vcpkg-test/supports.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/toolsrc/src/vcpkg-test/supports.cpp b/toolsrc/src/vcpkg-test/supports.cpp
new file mode 100644
index 000000000..8bd386da0
--- /dev/null
+++ b/toolsrc/src/vcpkg-test/supports.cpp
@@ -0,0 +1,79 @@
+#include <vcpkg-test/catch.h>
+
+#include <vcpkg/sourceparagraph.h>
+
+using namespace vcpkg;
+using Parse::parse_comma_list;
+
+TEST_CASE ("parse supports all", "[supports]")
+{
+ auto v = Supports::parse({
+ "x64",
+ "x86",
+ "arm",
+ "windows",
+ "uwp",
+ "v140",
+ "v141",
+ "crt-static",
+ "crt-dynamic",
+ });
+
+ REQUIRE(v.has_value());
+
+ REQUIRE(v.get()->is_supported(System::CPUArchitecture::X64,
+ Supports::Platform::UWP,
+ Supports::Linkage::DYNAMIC,
+ Supports::ToolsetVersion::V140));
+ REQUIRE(v.get()->is_supported(System::CPUArchitecture::ARM,
+ Supports::Platform::WINDOWS,
+ Supports::Linkage::STATIC,
+ Supports::ToolsetVersion::V141));
+}
+
+TEST_CASE ("parse supports invalid", "[supports]")
+{
+ auto v = Supports::parse({"arm64"});
+
+ REQUIRE_FALSE(v.has_value());
+
+ REQUIRE(v.error().size() == 1);
+ REQUIRE(v.error().at(0) == "arm64");
+}
+
+TEST_CASE ("parse supports case sensitive", "[supports]")
+{
+ auto v = Supports::parse({"Windows"});
+
+ REQUIRE_FALSE(v.has_value());
+ REQUIRE(v.error().size() == 1);
+ REQUIRE(v.error().at(0) == "Windows");
+}
+
+TEST_CASE ("parse supports some", "[supports]")
+{
+ auto v = Supports::parse({
+ "x64",
+ "x86",
+ "windows",
+ });
+
+ REQUIRE(v.has_value());
+
+ REQUIRE(v.get()->is_supported(System::CPUArchitecture::X64,
+ Supports::Platform::WINDOWS,
+ Supports::Linkage::DYNAMIC,
+ Supports::ToolsetVersion::V140));
+ REQUIRE_FALSE(v.get()->is_supported(System::CPUArchitecture::ARM,
+ Supports::Platform::WINDOWS,
+ Supports::Linkage::DYNAMIC,
+ Supports::ToolsetVersion::V140));
+ REQUIRE_FALSE(v.get()->is_supported(System::CPUArchitecture::X64,
+ Supports::Platform::UWP,
+ Supports::Linkage::DYNAMIC,
+ Supports::ToolsetVersion::V140));
+ REQUIRE(v.get()->is_supported(System::CPUArchitecture::X64,
+ Supports::Platform::WINDOWS,
+ Supports::Linkage::STATIC,
+ Supports::ToolsetVersion::V141));
+}