This commit is contained in:
ed 2021-12-22 10:26:45 +01:00
parent 0407685ecf
commit 4ccdb9a673
4 changed files with 104 additions and 36 deletions

View file

@ -17,7 +17,7 @@ import {
} from "../lib/utils.mjs";
import TestRegister from "../lib/TestRegister.mjs";
/*import "./tests/BCD.mjs";
import "./tests/BCD.mjs";
import "./tests/BSON.mjs";
import "./tests/BaconCipher.mjs";
import "./tests/Base58.mjs";
@ -40,9 +40,9 @@ import "./tests/CSV.mjs";
import "./tests/DateTime.mjs";
import "./tests/ExtractEmailAddresses.mjs";
import "./tests/Fork.mjs";
import "./tests/FromDecimal.mjs";*/
import "./tests/FromDecimal.mjs";
import "./tests/Gsm7.mjs";
/*import "./tests/Gzip.mjs";
import "./tests/Gzip.mjs";
import "./tests/Gunzip.mjs";
import "./tests/Hash.mjs";
import "./tests/HaversineDistance.mjs";
@ -107,7 +107,7 @@ import "./tests/CBOREncode.mjs";
import "./tests/CBORDecode.mjs";
import "./tests/JA3Fingerprint.mjs";
import "./tests/JA3SFingerprint.mjs";
import "./tests/HASSH.mjs";*/
import "./tests/HASSH.mjs";
// Cannot test operations that use the File type yet

View file

@ -39,32 +39,13 @@ TestRegister.addTests([
],
},
{
name: "To GSM-7: not padding a 7 chars SMS",
input: "7Chars.",
expectedOutput: "b7 21 3a 2c 9f bb 00",
name: "To GSM-7: smiley",
input: "😀",
expectedOutput: "character '😀' is not present in current charset+extension.<br>A real device would encode this SMS using UCS-2 (UTF-16)",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", false],
},
{
op: "To Hex",
args: ["Space", 0],
}
],
},
{
name: "To GSM-7: padding a 7 chars SMS",
input: "7Chars.",
expectedOutput: "b7 21 3a 2c 9f bb 1a",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", true],
},
{
op: "To Hex",
args: ["Space", 0],
}
],
},
@ -97,5 +78,95 @@ TestRegister.addTests([
args: ["Default", "Default", true],
}
],
},
{
name: "GSM-7: padding/not unpadding a %7 chars SMS",
input: "7Chars.",
expectedOutput: "7Chars.\r",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", true],
},
{
op: "From GSM-7",
args: ["Default", "Default", false],
}
],
},
{
name: "GSM-7: padding/unpadding a %7 chars SMS",
input: "twenty three characters",
expectedOutput: "twenty three characters",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", true],
},
{
op: "From GSM-7",
args: ["Default", "Default", true],
}
],
},
{
name: "GSM-7: not padding/not unpadding a %7 chars SMS",
input: "<15 characters>",
expectedOutput: "<15 characters>@",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", false],
},
{
op: "From GSM-7",
args: ["Default", "Default", false],
}
],
},
{
name: "GSM-7: padding/not unpadding a 8 chars SMS",
input: "8 chars.",
expectedOutput: "8 chars.",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", true],
},
{
op: "From GSM-7",
args: ["Default", "Default", false],
}
],
},
{
name: "GSM-7: padding/not unpadding a 8 chars SMS with final CR",
input: "8 chars\r",
expectedOutput: "8 chars\r\r",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", true],
},
{
op: "From GSM-7",
args: ["Default", "Default", false],
}
],
},
{
name: "GSM-7: padding/unpadding a 8 chars SMS with final CR",
input: "8 chars\r",
expectedOutput: "8 chars\r\r",
recipeConfig: [
{
op: "To GSM-7",
args: ["Default", "Default", true],
},
{
op: "From GSM-7",
args: ["Default", "Default", true],
}
],
}
]);