From a3efb871e433b37db15adc3e24e1d0bff9059d1d Mon Sep 17 00:00:00 2001
From: dokkie8844
Date: Fri, 24 May 2024 17:37:14 +0200
Subject: [PATCH] Add fpc test for encoding/decoding $FFFFFFFFFFFFFFFF
---
tests/fpc/encoding.pas | 15 +++++++++++++++
tests/fpc/testsqids.lpi | 5 ++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/tests/fpc/encoding.pas b/tests/fpc/encoding.pas
index dd79589..0f6c57d 100644
--- a/tests/fpc/encoding.pas
+++ b/tests/fpc/encoding.pas
@@ -24,6 +24,7 @@ TTestEncoding = class(TTestCase)
procedure IdWithInvalidCharacter;
// out-of-range test not implemented:
// compiler enforces that all numbers are within the range of a TNumber
+ procedure ExtremeValue;
end;
implementation
@@ -189,6 +190,20 @@ procedure TTestEncoding.IdWithInvalidCharacter;
end;
end;
+procedure TTestEncoding.ExtremeValue;
+const
+ Number: TNumber = $FFFFFFFFFFFFFFFF;
+ Id = 'eIkvoXH40Lmd'; // from a previous EncodeSingle
+begin
+ with TSqids.Create do
+ try
+ AssertEquals(EncodeSingle(Number), Id);
+ AssertTrue(DecodeSingle(Id) = Number);
+ finally
+ Free;
+ end;
+end;
+
initialization
RegisterTest(TTestEncoding);
diff --git a/tests/fpc/testsqids.lpi b/tests/fpc/testsqids.lpi
index 43f1174..3f0347a 100644
--- a/tests/fpc/testsqids.lpi
+++ b/tests/fpc/testsqids.lpi
@@ -1,16 +1,16 @@
-
+
+
-
@@ -24,7 +24,6 @@
-