2020-01-18 00:21:15 +00:00
import TestRegister from "../../lib/TestRegister.mjs" ;
TestRegister . addTests ( [
{
name : "ASCII to Hex stream" ,
input : "aberystwyth" ,
expectedOutput : "6162657279737477797468" ,
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "To Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "None" , 0 ]
}
2024-02-25 16:23:48 -05:00
]
2020-01-18 00:21:15 +00:00
} ,
{
name : "ASCII to Hex with colon deliminator " ,
input : "aberystwyth" ,
expectedOutput : "61:62:65:72:79:73:74:77:79:74:68" ,
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "To Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "Colon" , 0 ]
2024-02-25 16:23:48 -05:00
}
]
2020-01-18 00:21:15 +00:00
} ,
{
name : "ASCII to 0x Hex with comma" ,
input : "aberystwyth" ,
2024-02-25 16:23:48 -05:00
expectedOutput : "0x61,0x62,0x65,0x72,0x79,0x73,0x74,0x77,0x79,0x74,0x68" ,
2020-01-18 00:21:15 +00:00
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "To Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "0x with comma" , 0 ]
2024-02-25 16:23:48 -05:00
}
]
2020-01-18 00:21:15 +00:00
} ,
{
name : "ASCII to 0x Hex with comma and line breaks" ,
input : "aberystwyth" ,
2024-02-25 16:23:48 -05:00
expectedOutput : "0x61,0x62,0x65,0x72,\n0x79,0x73,0x74,0x77,\n0x79,0x74,0x68" ,
2020-01-18 00:21:15 +00:00
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "To Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "0x with comma" , 4 ]
2024-02-25 16:23:48 -05:00
}
]
2020-01-18 00:21:15 +00:00
} ,
{
name : "Hex stream to UTF-8" ,
input : "e69591e69591e5ada9e5ad90" ,
expectedOutput : "救救孩子" ,
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "From Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "Auto" ]
2024-02-25 16:23:48 -05:00
}
]
2020-01-18 00:21:15 +00:00
} ,
{
name : "Multiline 0x hex to ASCII" ,
input : " 0x49 , 0x20 , 0x73 , 0x61 , 0x77 , 0x20 , 0x6d , 0x79 , 0x73 , 0x65 , 0x6c , 0x66 , 0x20 , 0x73 , 0x69 , \
0x74 , 0x74 , 0x69 , 0x6e , 0x67 , 0x20 , 0x69 , 0x6e , 0x20 , 0x74 , 0x68 , 0x65 , 0x20 , 0x63 , 0x72 , \
0x6f , 0x74 , 0x63 , 0x68 , 0x20 , 0x6f , 0x66 , 0x20 , 0x74 , 0x68 , 0x65 , 0x20 , 0x74 , 0x68 , 0x69 , \
0x73 , 0x20 , 0x66 , 0x69 , 0x67 , 0x20 , 0x74 , 0x72 , 0x65 , 0x65 , 0x2c , 0x20 , 0x73 , 0x74 , 0x61 , \
0x72 , 0x76 , 0x69 , 0x6e , 0x67 , 0x20 , 0x74 , 0x6f , 0x20 , 0x64 , 0x65 , 0x61 , 0x74 , 0x68 , 0x2c , \
0x20 , 0x6a , 0x75 , 0x73 , 0x74 , 0x20 , 0x62 , 0x65 , 0x63 , 0x61 , 0x75 , 0x73 , 0x65 , 0x20 , 0x49 , \
0x20 , 0x63 , 0x6f , 0x75 , 0x6c , 0x64 , 0x6e , 0x27 , 0x74 , 0x20 , 0x6d , 0x61 , 0x6b , 0x65 , 0x20 , \
0x75 , 0x70 , 0x20 , 0x6d , 0x79 , 0x20 , 0x6d , 0x69 , 0x6e , 0x64 , 0x20 , 0x77 , 0x68 , 0x69 , 0x63 , \
0x68 , 0x20 , 0x6f , 0x66 , 0x20 , 0x74 , 0x68 , 0x65 , 0x20 , 0x66 , 0x69 , 0x67 , 0x73 , 0x20 , 0x49 , \
0x20 , 0x77 , 0x6f , 0x75 , 0x6c , 0x64 , 0x20 , 0x63 , 0x68 , 0x6f , 0x6f , 0x73 , 0x65 , 0x2e " ,
2024-02-25 16:31:23 -05:00
expectedOutput :
"I saw myself sitting in the crotch of the this fig tree, starving to death, just because I couldn't make up my mind which of the figs I would choose." ,
2020-01-18 00:21:15 +00:00
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "From Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "Auto" ]
2024-02-25 16:23:48 -05:00
}
]
2020-03-10 11:23:14 +00:00
} ,
{
name : "0x with Comma to Ascii" ,
input : "0x74,0x65,0x73,0x74,0x20,0x73,0x74,0x72,0x69,0x6e,0x67" ,
expectedOutput : "test string" ,
recipeConfig : [
{
2024-02-25 16:23:48 -05:00
"op" : "From Hex" ,
2024-02-25 16:31:23 -05:00
"args" : [ "0x with comma" ]
2024-02-25 16:23:48 -05:00
}
]
2024-02-25 16:31:23 -05:00
}
2020-01-18 00:21:15 +00:00
] ) ;