From 0c2c0d7b8be1daa5c251b06e76c58fe034a10a87 Mon Sep 17 00:00:00 2001 From: bwhitn Date: Mon, 12 Jun 2017 05:28:41 -0700 Subject: [PATCH] Added DateTime test, added filetime functions to Catagories, and removed unused variables. --- src/core/config/Categories.js | 2 ++ src/core/operations/DateTime.js | 7 ------- test/index.js | 1 + test/tests/operations/DateTime.js | 34 +++++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 test/tests/operations/DateTime.js diff --git a/src/core/config/Categories.js b/src/core/config/Categories.js index 9e6f6157..169dd21c 100755 --- a/src/core/config/Categories.js +++ b/src/core/config/Categories.js @@ -192,6 +192,8 @@ const Categories = [ "Translate DateTime Format", "From UNIX Timestamp", "To UNIX Timestamp", + "From Windows Filetime To UNIX", + "To Windows Filetime From UNIX", "Extract dates", ] }, diff --git a/src/core/operations/DateTime.js b/src/core/operations/DateTime.js index 2a37ed47..bac9b861 100755 --- a/src/core/operations/DateTime.js +++ b/src/core/operations/DateTime.js @@ -80,13 +80,6 @@ const DateTime = { }, - /** - *@constant - *@default - */ - RADIX: ["Decimal", "Hex"], - - /** * Converts a Windows FILETIME to Unix Epoch time. * diff --git a/test/index.js b/test/index.js index dba360ca..dbf1393d 100644 --- a/test/index.js +++ b/test/index.js @@ -16,6 +16,7 @@ import "./tests/operations/ByteRepr.js"; import "./tests/operations/CharEnc.js"; import "./tests/operations/Code.js"; import "./tests/operations/Compress.js"; +import "./tests/operations/DateTime.js"; import "./tests/operations/FlowControl.js"; import "./tests/operations/Image.js"; import "./tests/operations/MorseCode.js"; diff --git a/test/tests/operations/DateTime.js b/test/tests/operations/DateTime.js new file mode 100644 index 00000000..7ee445ff --- /dev/null +++ b/test/tests/operations/DateTime.js @@ -0,0 +1,34 @@ +/** + * DateTime tests. + * + * @author bwhitn [brian.m.whitney@outlook.com] + * + * @copyright Crown Copyright 2017 + * @license Apache-2.0 + */ +import TestRegister from "../../TestRegister.js"; + +TestRegister.addTests([ + { + name: "Filetime to Unix", + input: "129207366395297693", + expectedOutput: "1276263039529769300", + recipeConfig: [ + { + op: "Windows Filetime to UNIX Timestamp", + args: ["Nanoseconds (ns)"], + }, + ], + }, + { + name: "Unix to Filetime", + input: "1276263039529769300", + expectedOutput: "129207366395297693", + recipeConfig: [ + { + op: "UNIX Timestamp to Windows Filetime", + args: ["Nanoseconds (ns)"], + }, + ], + }, +]);