diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/DUtilUnitTest/VerUtilTests.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/test/DUtilUnitTest/VerUtilTests.cpp b/src/test/DUtilUnitTest/VerUtilTests.cpp index 58b561e9..8f24ad1a 100644 --- a/src/test/DUtilUnitTest/VerUtilTests.cpp +++ b/src/test/DUtilUnitTest/VerUtilTests.cpp | |||
@@ -237,7 +237,7 @@ namespace DutilTests | |||
237 | 237 | ||
238 | TestVerutilCompareParsedVersions(pVersion1, pVersion2, 1); | 238 | TestVerutilCompareParsedVersions(pVersion1, pVersion2, 1); |
239 | TestVerutilCompareParsedVersions(pVersion3, pVersion4, 1); | 239 | TestVerutilCompareParsedVersions(pVersion3, pVersion4, 1); |
240 | TestVerutilCompareParsedVersions(pVersion5, pVersion6, 1); | 240 | TestVerutilCompareParsedVersions(pVersion5, pVersion6, -1); |
241 | } | 241 | } |
242 | finally | 242 | finally |
243 | { | 243 | { |
@@ -663,6 +663,48 @@ namespace DutilTests | |||
663 | void VerCopyVersionCopiesVersion() | 663 | void VerCopyVersionCopiesVersion() |
664 | { | 664 | { |
665 | HRESULT hr = S_OK; | 665 | HRESULT hr = S_OK; |
666 | LPCWSTR wzVersion = L"1.2.3.4+abc123"; | ||
667 | VERUTIL_VERSION* pSource = NULL; | ||
668 | VERUTIL_VERSION* pCopy = NULL; | ||
669 | int nResult = 0; | ||
670 | |||
671 | try | ||
672 | { | ||
673 | hr = VerParseVersion(wzVersion, 0, FALSE, &pSource); | ||
674 | NativeAssert::Succeeded(hr, "VerParseVersion failed"); | ||
675 | |||
676 | NativeAssert::StringEqual(wzVersion, pSource->sczVersion); | ||
677 | Assert::Equal<DWORD>(1, pSource->dwMajor); | ||
678 | Assert::Equal<DWORD>(2, pSource->dwMinor); | ||
679 | Assert::Equal<DWORD>(3, pSource->dwPatch); | ||
680 | Assert::Equal<DWORD>(4, pSource->dwRevision); | ||
681 | Assert::Equal<DWORD>(0, pSource->cReleaseLabels); | ||
682 | |||
683 | Assert::Equal<DWORD>(8, pSource->cchMetadataOffset); | ||
684 | Assert::Equal<BOOL>(FALSE, pSource->fInvalid); | ||
685 | |||
686 | hr = VerCopyVersion(pSource, &pCopy); | ||
687 | NativeAssert::Succeeded(hr, "VerCopyVersion failed"); | ||
688 | |||
689 | Assert::False(pSource == pCopy); | ||
690 | Assert::False(pSource->sczVersion == pCopy->sczVersion); | ||
691 | |||
692 | hr = VerCompareParsedVersions(pSource, pCopy, &nResult); | ||
693 | NativeAssert::Succeeded(hr, "VerCompareParsedVersions failed"); | ||
694 | |||
695 | Assert::Equal<int>(nResult, 0); | ||
696 | } | ||
697 | finally | ||
698 | { | ||
699 | ReleaseVerutilVersion(pCopy); | ||
700 | ReleaseVerutilVersion(pSource); | ||
701 | } | ||
702 | } | ||
703 | |||
704 | [Fact] | ||
705 | void VerCopyVersionCopiesPrereleaseVersion() | ||
706 | { | ||
707 | HRESULT hr = S_OK; | ||
666 | LPCWSTR wzVersion = L"1.2.3.4-a.b.c.d.5.+abc123"; | 708 | LPCWSTR wzVersion = L"1.2.3.4-a.b.c.d.5.+abc123"; |
667 | VERUTIL_VERSION* pSource = NULL; | 709 | VERUTIL_VERSION* pSource = NULL; |
668 | VERUTIL_VERSION* pCopy = NULL; | 710 | VERUTIL_VERSION* pCopy = NULL; |