Restrict A1Z26 Magic checks to valid ranges (#2644)
This commit is contained in:
parent
8e19b7e402
commit
be42a3b9c8
@ -35,32 +35,32 @@ class A1Z26CipherDecode extends Operation {
|
||||
];
|
||||
this.checks = [
|
||||
{
|
||||
pattern: "^\\s*([12]?[0-9] )+[12]?[0-9]\\s*$",
|
||||
pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]) )+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$",
|
||||
flags: "",
|
||||
args: ["Space"]
|
||||
},
|
||||
{
|
||||
pattern: "^\\s*([12]?[0-9],)+[12]?[0-9]\\s*$",
|
||||
pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]),)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$",
|
||||
flags: "",
|
||||
args: ["Comma"]
|
||||
},
|
||||
{
|
||||
pattern: "^\\s*([12]?[0-9];)+[12]?[0-9]\\s*$",
|
||||
pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]);)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$",
|
||||
flags: "",
|
||||
args: ["Semi-colon"]
|
||||
},
|
||||
{
|
||||
pattern: "^\\s*([12]?[0-9]:)+[12]?[0-9]\\s*$",
|
||||
pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]):)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$",
|
||||
flags: "",
|
||||
args: ["Colon"]
|
||||
},
|
||||
{
|
||||
pattern: "^\\s*([12]?[0-9]\\n)+[12]?[0-9]\\s*$",
|
||||
pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6])\\n)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$",
|
||||
flags: "",
|
||||
args: ["Line feed"]
|
||||
},
|
||||
{
|
||||
pattern: "^\\s*([12]?[0-9]\\r\\n)+[12]?[0-9]\\s*$",
|
||||
pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6])\\r\\n)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$",
|
||||
flags: "",
|
||||
args: ["CRLF"]
|
||||
}
|
||||
|
||||
@ -152,5 +152,49 @@ TestRegister.addTests([
|
||||
args: [1, false, false]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Magic: invalid zero A1Z26 values do not match",
|
||||
input: "0,0",
|
||||
unexpectedMatch: /A1Z26 Cipher Decode/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [0, false, false]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Magic: invalid high A1Z26 values do not match",
|
||||
input: "27,1",
|
||||
unexpectedMatch: /A1Z26 Cipher Decode/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [0, false, false]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Magic: valid leading-zero A1Z26 values match",
|
||||
input: "26,01",
|
||||
expectedMatch: /A1Z26 Cipher Decode/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [0, false, false]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Magic: valid leading-zero A1Z26 values match with two digits",
|
||||
input: "09,10",
|
||||
expectedMatch: /A1Z26 Cipher Decode/,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Magic",
|
||||
args: [0, false, false]
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user