From 5dfa0c0e1e8323a86cd6585695b24bc319f6db36 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 5 Dec 2023 06:55:35 -0800 Subject: [PATCH] Rough assertion code --- test.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test.js b/test.js index a618a51..a773dbc 100644 --- a/test.js +++ b/test.js @@ -31,15 +31,15 @@ function newResult(shouldApplyCap, reasonNum, trueCap, capSource, myBidNum) { result.trueCap = trueCap; result.capSource = capSource; result.myBid = myBidNum; - return results; + return result; } function getBidCapReason(generalCapIsEnabled, generalCap, capPresidence, applyPresidenceTo, oversightAction, rowCapIsEnabled, rowCap, tieBid, myBid) { - let tieBidNum = number(tieBid); - let winBidNum = number(tieBid) + 25; - let generalCapNum = number(generalCap); - let rowCapNum = number(rowCap); - let myBidNum = number(myBid); + let tieBidNum = Number(tieBid); + let winBidNum = Number(tieBid) + 25; + let generalCapNum = Number(generalCap); + let rowCapNum = Number(rowCap); + let myBidNum = Number(myBid); //Build our response object let results = newResult(false, 0, null, null, myBidNum); @@ -142,6 +142,11 @@ function getBidCapReason(generalCapIsEnabled, generalCap, capPresidence, applyPr return results; } +function Assert(testName, assertion) { + const output = (assertion == true) ? "Pass" : "Fail"; + console.log("Test "+ testName + "\t"+ output); + return output; +} const expected1 = {}; const ShouldApplyCap = true; @@ -154,4 +159,5 @@ const results1 = getBidCapReason( GeneralCapIsEnabled , 300 , Presidence. const results2 = getBidCapReason( GeneralCapIsEnabled , 300 , Presidence.General , AppliesTo.All , Oversight.Win , RowCapIsEnabled , 450 , 500 , 300 ); const results3 = getBidCapReason( GeneralCapIsEnabled , 300 , Presidence.General , AppliesTo.All , Oversight.Tie , !RowCapIsEnabled , null , 500 , 300 ); -console.log(results1.shouldApplyCap = true && results1.reason == 1 && results1.trueCap == 200 && results1.capSource == Capsource.General && mybid == 300); +console.log(JSON.stringify(results1)); +Assert(1,(results1.shouldApplyCap == true && results1.reason == 1 && results1.trueCap == 200 && results1.capSource == Capsource.General && mybid == 300));