vcpkg/toolsrc/src/tests_arguments.cpp

35 lines
1.5 KiB
C++
Raw Normal View History

#include "CppUnitTest.h"
#include "VcpkgCmdArguments.h"
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
2017-04-27 10:21:40 +08:00
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace vcpkg;
namespace UnitTest1
{
struct ArgumentTests : TestClass<ArgumentTests>
2017-04-27 10:21:40 +08:00
{
TEST_METHOD(create_from_arg_sequence_options_lower)
{
std::vector<std::string> t = { "--vcpkg-root", "C:\\vcpkg", "--debug", "--sendmetrics", "--printmetrics" };
2017-04-27 10:21:40 +08:00
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
Assert::AreEqual("C:\\vcpkg", v.vcpkg_root_dir.get()->c_str());
2017-04-27 10:21:40 +08:00
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.debug);
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.sendmetrics);
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.printmetrics);
}
TEST_METHOD(create_from_arg_sequence_options_upper)
{
std::vector<std::string> t = { "--VCPKG-ROOT", "C:\\vcpkg", "--DEBUG", "--SENDMETRICS", "--PRINTMETRICS" };
2017-04-27 10:21:40 +08:00
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
Assert::AreEqual("C:\\vcpkg", v.vcpkg_root_dir.get()->c_str());
2017-04-27 10:21:40 +08:00
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.debug);
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.sendmetrics);
Assert::IsTrue(vcpkg::OptBoolC::ENABLED == v.printmetrics);
}
};
}