Fix From BCD scheme validation

This commit is contained in:
marko1olo 2026-06-06 03:53:51 +04:00
parent d735496641
commit 11cdb2c25c
2 changed files with 15 additions and 0 deletions

View File

@ -70,6 +70,10 @@ class FromBCD extends Operation {
inputFormat = args[3],
nibbles = [];
if (!encoding) {
throw new OperationError("Invalid BCD encoding scheme");
}
let output = "",
byteArray;

View File

@ -85,6 +85,17 @@ TestRegister.addTests([
}
]
},
{
name: "From BCD: invalid encoding scheme",
input: "1000",
expectedOutput: "Invalid BCD encoding scheme",
recipeConfig: [
{
"op": "From BCD",
"args": ["", true, false, "Nibbles"]
}
]
},
{
name: "BCD: raw 4 2 2 1, packed, signed",
input: "1234567890",