diff options
| author | martin-s <webmaster@macside.net> | 2017-11-05 19:13:16 +0100 |
|---|---|---|
| committer | martin-s <webmaster@macside.net> | 2017-11-05 19:13:16 +0100 |
| commit | d5a7da6bcb92b551d6f8a9a321deb063f6632dbc (patch) | |
| tree | 9dfef57f1fb3611bde577cab7b9dee9411ffb041 /toolsrc/src/tests.statusparagraphs.cpp | |
| parent | c6d69fac625706c52fc8e48615bc0c6d7b8dad25 (diff) | |
| parent | 330b8d8bab6a3d07165bf7c05fea09a8e0d56348 (diff) | |
| download | vcpkg-d5a7da6bcb92b551d6f8a9a321deb063f6632dbc.tar.gz vcpkg-d5a7da6bcb92b551d6f8a9a321deb063f6632dbc.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg into patch-vs2013
# Conflicts:
# scripts/cmake/vcpkg_configure_cmake.cmake
# toolsrc/src/vcpkg/vcpkgpaths.cpp
Diffstat (limited to 'toolsrc/src/tests.statusparagraphs.cpp')
| -rw-r--r-- | toolsrc/src/tests.statusparagraphs.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/toolsrc/src/tests.statusparagraphs.cpp b/toolsrc/src/tests.statusparagraphs.cpp new file mode 100644 index 000000000..4cc1130b1 --- /dev/null +++ b/toolsrc/src/tests.statusparagraphs.cpp @@ -0,0 +1,85 @@ +#include <CppUnitTest.h> + +#include <vcpkg/base/util.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/statusparagraph.h> +#include <vcpkg/statusparagraphs.h> + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +using namespace vcpkg; +using namespace vcpkg::Paragraphs; + +namespace UnitTest1 +{ + class StatusParagraphsTests : public TestClass<StatusParagraphsTests> + { + TEST_METHOD(find_installed) + { + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: install ok installed +)"); + Assert::IsTrue(!!pghs); + if (!pghs) return; + + StatusParagraphs status_db(Util::fmap( + *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + auto it = status_db.find_installed("ffmpeg", Triplet::X64_WINDOWS); + Assert::IsTrue(it != status_db.end()); + } + + TEST_METHOD(find_not_installed) + { + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: purge ok not-installed +)"); + Assert::IsTrue(!!pghs); + if (!pghs) return; + + StatusParagraphs status_db(Util::fmap( + *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + auto it = status_db.find_installed("ffmpeg", Triplet::X64_WINDOWS); + Assert::IsTrue(it == status_db.end()); + } + + TEST_METHOD(find_with_feature_packages) + { + auto pghs = parse_paragraphs(R"( +Package: ffmpeg +Version: 3.3.3 +Architecture: x64-windows +Multi-Arch: same +Description: +Status: install ok installed + +Package: ffmpeg +Feature: openssl +Depends: openssl +Architecture: x64-windows +Multi-Arch: same +Description: +Status: purge ok not-installed +)"); + Assert::IsTrue(!!pghs); + if (!pghs) return; + + StatusParagraphs status_db(Util::fmap( + *pghs.get(), [](RawParagraph& rpgh) { return std::make_unique<StatusParagraph>(std::move(rpgh)); })); + + auto it = status_db.find_installed("ffmpeg", Triplet::X64_WINDOWS); + Assert::IsTrue(it != status_db.end()); + } + }; +}
\ No newline at end of file |
