2017-11-11 19:47:56 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <CppUnitTest.h>
|
|
|
|
|
|
|
|
#include <vcpkg/dependencies.h>
|
|
|
|
#include <vcpkg/packagespec.h>
|
|
|
|
#include <vcpkg/packagespecparseresult.h>
|
|
|
|
#include <vcpkg/statusparagraph.h>
|
2018-01-23 02:36:39 -08:00
|
|
|
#include <vcpkg/triplet.h>
|
2017-11-11 19:47:56 -08:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace Microsoft::VisualStudio::CppUnitTestFramework
|
|
|
|
{
|
2018-04-25 18:14:24 -07:00
|
|
|
template<>
|
2019-06-19 11:49:57 -07:00
|
|
|
inline std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t)
|
2018-04-25 18:14:24 -07:00
|
|
|
{
|
|
|
|
switch (t)
|
|
|
|
{
|
|
|
|
case vcpkg::Dependencies::InstallPlanType::ALREADY_INSTALLED: return L"ALREADY_INSTALLED";
|
|
|
|
case vcpkg::Dependencies::InstallPlanType::BUILD_AND_INSTALL: return L"BUILD_AND_INSTALL";
|
|
|
|
case vcpkg::Dependencies::InstallPlanType::EXCLUDED: return L"EXCLUDED";
|
|
|
|
case vcpkg::Dependencies::InstallPlanType::UNKNOWN: return L"UNKNOWN";
|
|
|
|
default: return ToString(static_cast<int>(t));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<>
|
2019-06-19 11:49:57 -07:00
|
|
|
inline std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t)
|
2018-04-25 18:14:24 -07:00
|
|
|
{
|
|
|
|
switch (t)
|
|
|
|
{
|
|
|
|
case vcpkg::Dependencies::RequestType::AUTO_SELECTED: return L"AUTO_SELECTED";
|
|
|
|
case vcpkg::Dependencies::RequestType::USER_REQUESTED: return L"USER_REQUESTED";
|
|
|
|
case vcpkg::Dependencies::RequestType::UNKNOWN: return L"UNKNOWN";
|
|
|
|
default: return ToString(static_cast<int>(t));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<>
|
2019-06-19 11:49:57 -07:00
|
|
|
inline std::wstring ToString<vcpkg::PackageSpecParseResult>(const vcpkg::PackageSpecParseResult& t)
|
2018-04-25 18:14:24 -07:00
|
|
|
{
|
|
|
|
return ToString(static_cast<uint32_t>(t));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<>
|
2019-06-19 11:49:57 -07:00
|
|
|
inline std::wstring ToString<vcpkg::PackageSpec>(const vcpkg::PackageSpec& t)
|
2018-04-25 18:14:24 -07:00
|
|
|
{
|
|
|
|
return ToString(t.to_string());
|
|
|
|
}
|
2017-11-11 19:47:56 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<vcpkg::StatusParagraph> make_status_pgh(const char* name,
|
|
|
|
const char* depends = "",
|
2018-02-15 01:18:25 +01:00
|
|
|
const char* default_features = "",
|
2017-11-11 19:47:56 -08:00
|
|
|
const char* triplet = "x86-windows");
|
|
|
|
std::unique_ptr<vcpkg::StatusParagraph> make_status_feature_pgh(const char* name,
|
|
|
|
const char* feature,
|
|
|
|
const char* depends = "",
|
2017-12-13 05:43:00 -08:00
|
|
|
const char* triplet = "x86-windows");
|
|
|
|
|
|
|
|
template<class T, class S>
|
|
|
|
T&& unwrap(vcpkg::ExpectedT<T, S>&& p)
|
|
|
|
{
|
|
|
|
Assert::IsTrue(p.has_value());
|
|
|
|
return std::move(*p.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
T&& unwrap(vcpkg::Optional<T>&& opt)
|
|
|
|
{
|
|
|
|
Assert::IsTrue(opt.has_value());
|
|
|
|
return std::move(*opt.get());
|
|
|
|
}
|
2018-01-23 02:36:39 -08:00
|
|
|
|
|
|
|
vcpkg::PackageSpec unsafe_pspec(std::string name, vcpkg::Triplet t = vcpkg::Triplet::X86_WINDOWS);
|