fix: validate To BCD scheme option
This commit is contained in:
parent
72ca1aeec7
commit
44b7d045cd
@ -67,6 +67,10 @@ class ToBCD extends Operation {
|
||||
signed = args[2],
|
||||
outputFormat = args[3];
|
||||
|
||||
if (!encoding) {
|
||||
throw new OperationError("Invalid BCD encoding scheme");
|
||||
}
|
||||
|
||||
// Split input number up into separate digits
|
||||
const digits = input.toFixed().split("");
|
||||
|
||||
|
||||
@ -52,6 +52,17 @@ TestRegister.addTests([
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "To BCD: invalid scheme",
|
||||
input: "43",
|
||||
expectedOutput: "Invalid BCD encoding scheme",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "To BCD",
|
||||
"args": ["", true, false, "Nibbles"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "From BCD: default 0",
|
||||
input: "0000",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user