diff --git a/assets/js/footer-functions.js b/assets/js/footer-functions.js index 3587073..f71beb1 100644 --- a/assets/js/footer-functions.js +++ b/assets/js/footer-functions.js @@ -9,9 +9,6 @@ subtractionAndMultiplicationTest(); subtractionAndDivisonTest(); allOperatorTest(); - - - function additionTest() { testCompute(2, "1+1"); testCompute(3, "1+1+1"); @@ -56,10 +53,6 @@ function subtractionAndMultiplicationTest() { testCompute(-14, "10-2*12"); } - - - - function additionAndDivisonTest() { testCompute(1.5, "1+1/2"); testCompute(16, "10+6/1"); @@ -74,7 +67,7 @@ function subtractionAndDivisonTest() { function allOperatorTest() { - testCompute(-12, "1+2-3*10/2"); - testCompute(-11, "1+3-3*10/2"); - testCompute(-4, "3-2-3*10/2+10"); + testCompute(-12, "1+2-3*10/2"); + testCompute(-11, "1+3-3*10/2"); + testCompute(-4, "3-2-3*10/2+10"); } \ No newline at end of file diff --git a/assets/js/header-functions.js b/assets/js/header-functions.js index aca3392..1b8df3f 100644 --- a/assets/js/header-functions.js +++ b/assets/js/header-functions.js @@ -1,11 +1,17 @@ function testCompute(expectedOutput, numberOfStars) { - test(expectedOutput, compute, numberOfStars); + console.log("\n"); + console.log("Test Compute Expression "+ numberOfStars); + console.log("ExpectedOutput "+ expectedOutput); + var v=compute(numberOfStars); + console.log("Actual output "+v); + + if(v==expectedOutput){ + console.log("Test Pass"); + }else { + console.log("Test Fail"); + } } - - - - diff --git a/assets/js/numbers.js b/assets/js/numbers.js index 5a925a6..8cb5ea2 100644 --- a/assets/js/numbers.js +++ b/assets/js/numbers.js @@ -1,3 +1,5 @@ function compute(expression) { // TODO - write method definition here + return eval(expression); + } \ No newline at end of file