From c6a94a7f3556c8dc998630aa65b4e812c7898ad1 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 17 Oct 2020 19:36:11 -0500 Subject: Update verutil precedence rules to check for invalid after release labels. --- src/test/DUtilUnitTest/VerUtilTests.cpp | 44 ++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'src/test') 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 TestVerutilCompareParsedVersions(pVersion1, pVersion2, 1); TestVerutilCompareParsedVersions(pVersion3, pVersion4, 1); - TestVerutilCompareParsedVersions(pVersion5, pVersion6, 1); + TestVerutilCompareParsedVersions(pVersion5, pVersion6, -1); } finally { @@ -661,6 +661,48 @@ namespace DutilTests [Fact] void VerCopyVersionCopiesVersion() + { + HRESULT hr = S_OK; + LPCWSTR wzVersion = L"1.2.3.4+abc123"; + VERUTIL_VERSION* pSource = NULL; + VERUTIL_VERSION* pCopy = NULL; + int nResult = 0; + + try + { + hr = VerParseVersion(wzVersion, 0, FALSE, &pSource); + NativeAssert::Succeeded(hr, "VerParseVersion failed"); + + NativeAssert::StringEqual(wzVersion, pSource->sczVersion); + Assert::Equal(1, pSource->dwMajor); + Assert::Equal(2, pSource->dwMinor); + Assert::Equal(3, pSource->dwPatch); + Assert::Equal(4, pSource->dwRevision); + Assert::Equal(0, pSource->cReleaseLabels); + + Assert::Equal(8, pSource->cchMetadataOffset); + Assert::Equal(FALSE, pSource->fInvalid); + + hr = VerCopyVersion(pSource, &pCopy); + NativeAssert::Succeeded(hr, "VerCopyVersion failed"); + + Assert::False(pSource == pCopy); + Assert::False(pSource->sczVersion == pCopy->sczVersion); + + hr = VerCompareParsedVersions(pSource, pCopy, &nResult); + NativeAssert::Succeeded(hr, "VerCompareParsedVersions failed"); + + Assert::Equal(nResult, 0); + } + finally + { + ReleaseVerutilVersion(pCopy); + ReleaseVerutilVersion(pSource); + } + } + + [Fact] + void VerCopyVersionCopiesPrereleaseVersion() { HRESULT hr = S_OK; LPCWSTR wzVersion = L"1.2.3.4-a.b.c.d.5.+abc123"; -- cgit v1.2.3-55-g6feb