Add octal support to Change IP Format.

Also add test cases covering interchanging between all four
formats.
This commit is contained in:
Chris Smith 2019-08-24 01:14:44 +01:00
parent d3e3e6e6fc
commit 6c9ce15b26
No known key found for this signature in database
GPG key ID: 3A2D4BBDC4A3C9A9
3 changed files with 79 additions and 8 deletions

View file

@ -0,0 +1,52 @@
/**
* Change IP format tests.
*
* @author Chris Smith
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Change IP format: Dotted Decimal to Hex",
input: "192.168.1.1",
expectedOutput: "c0a80101",
recipeConfig: [
{
op: "Change IP format",
args: ["Dotted Decimal", "Hex"],
},
],
}, {
name: "Change IP format: Decimal to Dotted Decimal",
input: "3232235777",
expectedOutput: "192.168.1.1",
recipeConfig: [
{
op: "Change IP format",
args: ["Decimal", "Dotted Decimal"],
},
],
}, {
name: "Change IP format: Hex to Octal",
input: "c0a80101",
expectedOutput: "030052000401",
recipeConfig: [
{
op: "Change IP format",
args: ["Hex", "Octal"],
},
],
}, {
name: "Change IP format: Octal to Decimal",
input: "030052000401",
expectedOutput: "3232235777",
recipeConfig: [
{
op: "Change IP format",
args: ["Octal", "Decimal"],
},
],
},
]);