diff --git a/Documentation/Test/StringEncode - Test.html b/Documentation/Test/StringEncode - Test.html new file mode 100644 index 0000000..f28dfca --- /dev/null +++ b/Documentation/Test/StringEncode - Test.html @@ -0,0 +1,16 @@ + + + + + + + \ No newline at end of file diff --git a/Documentation/Test/assert.js b/Documentation/Test/assert.js new file mode 100644 index 0000000..33d3e50 --- /dev/null +++ b/Documentation/Test/assert.js @@ -0,0 +1,13 @@ +function assertEqual(actual, expected, message){ + if(actual !== expected){ + message = ((typeof message != "undefined")? message+" ":"") + "Assertion failed. Expected "+((typeof expected == "string")?"\"":"")+ expected +((typeof expected == "string")?"\"":"")+ " instead got "+((typeof actual == "string")?"\"":"")+ actual +((typeof actual == "string")?"\"":""); + console.error(message); + }else console.log("%cTest passed. "+((typeof actual == "string")?"\"":"")+ actual +((typeof actual == "string")?"\"":"")+ " === " +((typeof expected == "string")?"\"":"")+ expected +((typeof expected == "string")?"\"":""), "color: green;"); +} + +function assertDeepEqual(actual, expected, message){ + if(JSON.stringify(actual) !== JSON.stringify(expected)){ + message = ((typeof message != "undefined")? message+" ":"") + "Assertion failed. Expected " + ((typeof expected == "string")?"\"":"") + JSON.stringify(expected) + ((typeof expected == "string")?"\"":"") + " instead got " + ((typeof actual == "string")?"\"":"") + JSON.stringify(actual) +((typeof actual == "string")?"\"":""); + console.error(message); + }else console.log("%cTest passed. "+((typeof actual == "string")?"\"":"")+ JSON.stringify(actual) +((typeof actual == "string")?"\"":"")+ " === " +((typeof expected == "string")?"\"":"")+ JSON.stringify(expected) +((typeof expected == "string")?"\"":""), "color: green;"); +} diff --git a/README.md b/README.md index 04aebbd..ccc1761 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# StringEncode.js # +# StringEncode.js Encode and Decode string to various bases in JavaScript. -### INTRODUCTION ### +### INTRODUCTION This library build on String.prototype to encode/decode strings to/from various bases.
@@ -15,7 +15,8 @@ The currently supported bases are Example of how to use the library - +