diff --git a/package-lock.json b/package-lock.json index f96fa96da..6d72297c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "./packages/*" ], "dependencies": { - "math-expressions": "^2.0.0-alpha68", + "math-expressions": "^2.0.0-alpha70", "react-router-dom": "^6.26.2" }, "devDependencies": { @@ -13748,14 +13748,14 @@ } }, "node_modules/math-expressions": { - "version": "2.0.0-alpha68", - "resolved": "https://registry.npmjs.org/math-expressions/-/math-expressions-2.0.0-alpha68.tgz", - "integrity": "sha512-PfOzxkfxj7U2F0UiBFFSzXVaWoroRG9DIZTUljqmlD/HM/jGxn2ofPLe4Y5dZhk8eSQXXa2dfsAozBrnC/ky8Q==", + "version": "2.0.0-alpha70", + "resolved": "https://registry.npmjs.org/math-expressions/-/math-expressions-2.0.0-alpha70.tgz", + "integrity": "sha512-hKdOeRjcO2EkTpVw5j3gt6g89QW0j9v+ke0griDaZPYN3l2HMJowk4U5dARVJoEpX4nfN9jIpSnbUA/b9UQ5QA==", "license": "(GPL-3.0 OR Apache-2.0)", "dependencies": { - "@babel/cli": "^7.25.6", + "@babel/cli": "^7.25.7", "babel-upgrade": "^1.0.1", - "mathjs": "^13.1.1", + "mathjs": "^13.2.0", "number-theory": "1.1.0", "numeric": "1.2.6", "seedrandom": "^3.0.5", @@ -22819,7 +22819,7 @@ }, "packages/doenetml": { "name": "@doenet/doenetml", - "version": "0.7.0-alpha18", + "version": "0.7.0-alpha19", "license": "AGPL-3.0-or-later", "dependencies": { "@chakra-ui/icons": "^2.0.19", @@ -22861,7 +22861,7 @@ }, "packages/doenetml-iframe": { "name": "@doenet/doenetml-iframe", - "version": "0.7.0-alpha18", + "version": "0.7.0-alpha19", "license": "AGPL-3.0-or-later", "devDependencies": {}, "peerDependencies": { @@ -22939,7 +22939,7 @@ }, "packages/standalone": { "name": "@doenet/standalone", - "version": "0.7.0-alpha18", + "version": "0.7.0-alpha19", "license": "AGPL-3.0-or-later", "devDependencies": {} }, diff --git a/package.json b/package.json index cec2e923c..be497ce7d 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "tabWidth": 4 }, "dependencies": { - "math-expressions": "^2.0.0-alpha68", + "math-expressions": "^2.0.0-alpha70", "react-router-dom": "^6.26.2" } } diff --git a/packages/doenetml-iframe/package.json b/packages/doenetml-iframe/package.json index 97f073bd4..ba01a4216 100644 --- a/packages/doenetml-iframe/package.json +++ b/packages/doenetml-iframe/package.json @@ -2,7 +2,7 @@ "name": "@doenet/doenetml-iframe", "type": "module", "description": "A renderer for DoenetML contained in an iframe", - "version": "0.7.0-alpha18", + "version": "0.7.0-alpha19", "license": "AGPL-3.0-or-later", "homepage": "https://github.com/Doenet/DoenetML#readme", "private": true, diff --git a/packages/doenetml-worker/src/test/tagSpecific/boolean.test.ts b/packages/doenetml-worker/src/test/tagSpecific/boolean.test.ts index 741748166..a13789eaf 100644 --- a/packages/doenetml-worker/src/test/tagSpecific/boolean.test.ts +++ b/packages/doenetml-worker/src/test/tagSpecific/boolean.test.ts @@ -96,17 +96,23 @@ describe("Boolean tag tests", async () => { let stateVariables = await returnAllStateVariables(core); for (let i = 1; i <= nTrues; i++) { - expect(stateVariables[`/t${i}`].stateValues.value).to.be.true; + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; } for (let i = 1; i <= nFalses; i++) { - expect(stateVariables[`/f${i}`].stateValues.value).to.be.false; + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; } }); it("boolean based on math", async () => { let core = await createTestCore({ doenetML: ` - + $mi Hello there! @@ -166,10 +172,16 @@ describe("Boolean tag tests", async () => { let stateVariables = await returnAllStateVariables(core); for (let i = 1; i <= nTrues; i++) { - expect(stateVariables[`/t${i}`].stateValues.value).to.be.true; + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; } for (let i = 1; i <= nFalses; i++) { - expect(stateVariables[`/f${i}`].stateValues.value).to.be.false; + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; } }); @@ -267,10 +279,16 @@ describe("Boolean tag tests", async () => { let stateVariables = await returnAllStateVariables(core); for (let i = 1; i <= nTrues; i++) { - expect(stateVariables[`/t${i}`].stateValues.value).to.be.true; + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; } for (let i = 1; i <= nFalses; i++) { - expect(stateVariables[`/f${i}`].stateValues.value).to.be.false; + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; } }); @@ -1024,10 +1042,16 @@ describe("Boolean tag tests", async () => { let stateVariables = await returnAllStateVariables(core); for (let i = 1; i <= nTrues; i++) { - expect(stateVariables[`/t${i}`].stateValues.value).to.be.true; + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; } for (let i = 1; i <= nFalses; i++) { - expect(stateVariables[`/f${i}`].stateValues.value).to.be.false; + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; } }); @@ -1052,10 +1076,16 @@ describe("Boolean tag tests", async () => { let stateVariables = await returnAllStateVariables(core); for (let i = 1; i <= nTrues; i++) { - expect(stateVariables[`/t${i}`].stateValues.value).to.be.true; + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; } for (let i = 1; i <= nFalses; i++) { - expect(stateVariables[`/f${i}`].stateValues.value).to.be.false; + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; } }); @@ -1401,10 +1431,88 @@ describe("Boolean tag tests", async () => { let stateVariables = await returnAllStateVariables(core); for (let i = 1; i <= nTrues; i++) { - expect(stateVariables[`/t${i}`].stateValues.value).to.be.true; + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; + } + for (let i = 1; i <= nFalses; i++) { + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; + } + }); + + it("symbolicEquality correctly matches negative numbers", async () => { + let core = await createTestCore({ + doenetML: ` + 5 + 5x + -5 + -$p5 + -$n5 + -$n5b + -5x + -$p5x + $n5 x + $n5b x + -$n5x + -$n5xb + -$n5xc + -$n5xd + + $n5 = -5 + $n5b = -5 + $n5 = $n5b + $nn5 = $nn5b + $n5x = -5x + $n5xb = -5x + $n5xc = -5x + $n5xd = -5x + $n5xb = $n5x + $n5xc = $n5x + $n5xd = $n5x + $n5xc = $n5xb + $n5xd = $n5xb + $n5xd = $n5xc + 7-$p5-$p5x = 7-5-5x + 7+$n5+$n5x = 7-5-5x + + $nn5 = $p5 + $nn5b = $p5 + $nn5 = 5 + $nn5b = 5 + $nn5x = $p5x + $nn5xb = $p5x + $nn5xc = $p5x + $nn5xd = $p5x + $nn5x = 5x + $nn5xb = 5x + $nn5xc = 5x + $nn5xd = 5x + 7-$n5-$n5x = 7+5+5x + 7-$p5x-$p5 = 7-5-5x + 7+$n5x+$n5 = 7-5-5x + + `, + }); + + let nTrues = 16, + nFalses = 15; + + let stateVariables = await returnAllStateVariables(core); + for (let i = 1; i <= nTrues; i++) { + expect( + stateVariables[`/t${i}`].stateValues.value, + `expected t${i} to be true`, + ).to.be.true; } for (let i = 1; i <= nFalses; i++) { - expect(stateVariables[`/f${i}`].stateValues.value).to.be.false; + expect( + stateVariables[`/f${i}`].stateValues.value, + `expected f${i} to be false`, + ).to.be.false; } }); }); diff --git a/packages/doenetml/package.json b/packages/doenetml/package.json index 2ce7c922b..25c61d5d9 100644 --- a/packages/doenetml/package.json +++ b/packages/doenetml/package.json @@ -2,7 +2,7 @@ "name": "@doenet/doenetml", "type": "module", "description": "Semantic markup for building interactive web activities", - "version": "0.7.0-alpha18", + "version": "0.7.0-alpha19", "license": "AGPL-3.0-or-later", "homepage": "https://github.com/Doenet/DoenetML#readme", "private": true, diff --git a/packages/standalone/package.json b/packages/standalone/package.json index 6ab2266ff..5a6f95dcd 100644 --- a/packages/standalone/package.json +++ b/packages/standalone/package.json @@ -2,7 +2,7 @@ "name": "@doenet/standalone", "type": "module", "description": "Standalone renderer for DoenetML suitable for being included in a web page", - "version": "0.7.0-alpha18", + "version": "0.7.0-alpha19", "license": "AGPL-3.0-or-later", "homepage": "https://github.com/Doenet/DoenetML#readme", "private": true,