|
@@ -15,12 +15,15 @@
|
|
|
**********************************************************************}
|
|
|
program testbasenenc;
|
|
|
|
|
|
+{$mode objfpc}
|
|
|
+{$h+}
|
|
|
+
|
|
|
uses sysutils, basenenc;
|
|
|
|
|
|
|
|
|
-Procedure AssertEquals(Const aActual,aExpected : TBytes; aMsg : );
|
|
|
+Procedure AssertEquals(Const aActual,aExpected : TBytes; aMsg : String);
|
|
|
|
|
|
- function ToStr(aBytes : TBytes) : ;
|
|
|
+ function ToStr(aBytes : TBytes) : String;
|
|
|
|
|
|
Var
|
|
|
I : Integer;
|
|
@@ -45,7 +48,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-Procedure AssertEquals(Const aActual,aExpected,aMsg : );
|
|
|
+Procedure AssertEquals(Const aActual,aExpected,aMsg : String);
|
|
|
|
|
|
begin
|
|
|
if aActual<>aExpected then
|
|
@@ -55,7 +58,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-Procedure DoTest(B : Tbytes; aExpected : ; aURL : Boolean = False);
|
|
|
+Procedure DoTest(B : Tbytes; aExpected : String; aURL : Boolean = False);
|
|
|
|
|
|
Var
|
|
|
B2 : TBytes;
|
|
@@ -74,13 +77,13 @@ begin
|
|
|
AssertEquals(B2,B,'DoTest Wrong decode');
|
|
|
end;
|
|
|
|
|
|
-Procedure DoTest64(aValue, aExpected : );
|
|
|
+Procedure DoTest64(aValue, aExpected : String);
|
|
|
|
|
|
begin
|
|
|
DoTest(TEncoding.UTF8.GetAnsiBytes(aValue),aExpected);
|
|
|
end;
|
|
|
|
|
|
-Procedure DoTest32(aValue, aExpected : );
|
|
|
+Procedure DoTest32(aValue, aExpected : String);
|
|
|
|
|
|
Var
|
|
|
B2 : TBytes;
|
|
@@ -93,7 +96,7 @@ begin
|
|
|
AssertEquals(b2,TEncoding.UTF8.GetAnsiBytes(aValue),'Base32 Wrong encode for '+aValue);
|
|
|
end;
|
|
|
|
|
|
-Procedure DoTest32Hex(aValue, aExpected : );
|
|
|
+Procedure DoTest32Hex(aValue, aExpected : String);
|
|
|
|
|
|
Var
|
|
|
B2 : TBytes;
|
|
@@ -106,7 +109,7 @@ begin
|
|
|
AssertEquals(B2,TEncoding.UTF8.GetAnsiBytes(aValue),'Base32Hex Wrong encode for '+aValue);
|
|
|
end;
|
|
|
|
|
|
-Procedure DoTest16(aValue, aExpected : );
|
|
|
+Procedure DoTest16(aValue, aExpected : String);
|
|
|
|
|
|
Var
|
|
|
B2 : TBytes;
|
|
@@ -161,5 +164,6 @@ begin
|
|
|
DoTest16('foob','666F6F62');
|
|
|
DoTest16('fooba','666F6F6261');
|
|
|
DoTest16('foobar','666F6F626172');
|
|
|
+ Writeln('All OK');
|
|
|
end.
|
|
|
|