aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/manifest.cxx6
-rw-r--r--tests/package-version/driver.cxx21
2 files changed, 14 insertions, 13 deletions
diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx
index 2236d3a..0557259 100644
--- a/bpkg/manifest.cxx
+++ b/bpkg/manifest.cxx
@@ -218,10 +218,10 @@ namespace bpkg
bool zo (false); // Digit-only zero component.
if (numeric)
{
- if (end - begin > 8)
- throw invalid_argument ("8 digits maximum allowed in a component");
+ if (end - begin > 16)
+ throw invalid_argument ("16 digits maximum allowed in a component");
- append (8 - (end - begin), '0'); // Add padding zeros.
+ append (16 - (end - begin), '0'); // Add padding zeros.
string c (begin, end);
append (c);
diff --git a/tests/package-version/driver.cxx b/tests/package-version/driver.cxx
index 9753f76..60460ab 100644
--- a/tests/package-version/driver.cxx
+++ b/tests/package-version/driver.cxx
@@ -82,9 +82,9 @@ main (int argc, char* argv[])
assert (bad_version ("3.5+1+4")); // Extra revision.
assert (bad_version ("1~~2+3")); // Duplicated epoch separator.
assert (bad_version ("1~2++3")); // Duplicated revision separator.
- assert (bad_version ("a.394857391.3")); // Too long numeric component.
- assert (bad_version ("a.000000000.3")); // Too long numeric zero component.
- assert (bad_version ("1-a.000000000")); // Same.
+ assert (bad_version ("a.39485739122323231.3")); // Too long component.
+ assert (bad_version ("a.00000000000000000.3")); // Too long zero component.
+ assert (bad_version ("1-a.00000000000000000")); // Same.
assert (bad_version ("65536~q.3")); // Too big epoch.
assert (bad_version ("1+q+65536")); // Too big revision.
assert (bad_version ("3.5~1.4")); // Components in epoch.
@@ -157,7 +157,7 @@ main (int argc, char* argv[])
{
version v ("1");
assert (v.string () == "1");
- assert (v.canonical_upstream == "00000001");
+ assert (v.canonical_upstream == "0000000000000001");
assert (test_constructor (v));
}
@@ -178,28 +178,28 @@ main (int argc, char* argv[])
{
version v ("1.0.0");
assert (v.string () == "1.0.0");
- assert (v.canonical_upstream == "00000001");
+ assert (v.canonical_upstream == "0000000000000001");
assert (test_constructor (v));
}
{
version v ("0.1.00");
assert (v.string () == "0.1.00");
- assert (v.canonical_upstream == "00000000.00000001");
+ assert (v.canonical_upstream == "0000000000000000.0000000000000001");
assert (test_constructor (v));
}
{
version v ("0.0a.00");
assert (v.string () == "0.0a.00");
- assert (v.canonical_upstream == "00000000.0a");
+ assert (v.canonical_upstream == "0000000000000000.0a");
assert (test_constructor (v));
}
{
version v ("0.a00.00");
assert (v.string () == "0.a00.00");
- assert (v.canonical_upstream == "00000000.a00");
+ assert (v.canonical_upstream == "0000000000000000.a00");
assert (test_constructor (v));
}
@@ -227,7 +227,8 @@ main (int argc, char* argv[])
{
version v ("3~1A.31.0.4.0+7");
assert (v.string () == "3~1A.31.0.4.0+7");
- assert (v.canonical_upstream == "1a.00000031.00000000.00000004");
+ assert (v.canonical_upstream ==
+ "1a.0000000000000031.0000000000000000.0000000000000004");
assert (test_constructor (v));
}
@@ -259,7 +260,7 @@ main (int argc, char* argv[])
version v ("1~A-1.2.3B.00+0");
assert (v.string () == "1~A-1.2.3B.00");
assert (v.release && *v.release == "1.2.3B.00");
- assert (v.canonical_release == "00000001.00000002.3b");
+ assert (v.canonical_release == "0000000000000001.0000000000000002.3b");
assert (test_constructor (v));
}