← back to Boomer Calculator
Compile current calculator source before math tests
90c4eaa875001bde3958f3f90cafac56d61390e2 · 2026-09-11 09:55:58 -0700 · Steve Abrams
Files touched
M package.jsonM tests/calculations.cjs
Diff
commit 90c4eaa875001bde3958f3f90cafac56d61390e2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Fri Sep 11 09:55:58 2026 -0700
Compile current calculator source before math tests
---
package.json | 3 ++-
tests/calculations.cjs | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 4469172..afc7255 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
- "lint": "next lint"
+ "lint": "next lint",
+ "test:math": "tsc lib/calculations.ts --outDir tmp/math-tests --module commonjs --target es2020 --skipLibCheck && node --test tests/calculations.cjs"
},
"dependencies": {
"@capacitor-community/admob": "^7.2.0",
diff --git a/tests/calculations.cjs b/tests/calculations.cjs
index 8826136..2f1ea95 100644
--- a/tests/calculations.cjs
+++ b/tests/calculations.cjs
@@ -1,6 +1,6 @@
const { test } = require('node:test')
const assert = require('node:assert/strict')
-const { evaluateExpression: calc, monthlyPayment, bodyMassIndex, tipAmounts, readNumber } = require(process.env.CALCULATIONS_MODULE || '/tmp/tk11230-math/calculations.js')
+const { evaluateExpression: calc, monthlyPayment, bodyMassIndex, tipAmounts, readNumber } = require('../tmp/math-tests/calculations.js')
const close = (actual, expected, epsilon = 1e-8) => assert.ok(Math.abs(actual - expected) < epsilon, `${actual} != ${expected}`)
test('arithmetic precedence, parentheses, unary signs, decimals and continued scientific notation', () => {
for (const [input, expected] of [['2+3*4',14],['(2+3)*4',20],['-2*-3',6],['.5+.25',.75],['1e+12+1',1000000000001],['8/4/2',1]]) assert.equal(calc(input), expected)
← 91a9312 Replace hardcoded calculator answers with real validated cal
·
back to Boomer Calculator
·
Verify live calculator and retain local iOS build 8 signing 2395cbf →