Skip to content

Commit 9677416

Browse files
authored
Merge pull request #53 from pie-framework/fix/PD-1494
fix(leading-zeros): math validation problem with a leading zero, when the response and the correct answer also have matching trailing zeros
2 parents df5b493 + fdef445 commit 9677416

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/conversion/latex-to-ast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ export class LatexToAst {
11461146
if (parsedNumber !== number.toString()) {
11471147
const p = number.toString();
11481148
// @ts-ignore
1149-
const sub = result
1149+
const sub = parsedNumber
11501150
// @ts-ignore
11511151
.substring(p.length)
11521152
.split("")

src/fixtures/latex-equal/literal/literal.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export default {
2+
23
mode: "literal",
34
tests: [
45
{
@@ -13,6 +14,23 @@ export default {
1314
ne: ["12.001"],
1415
opts: { literal: { allowTrailingZeros: true } },
1516
},
17+
{
18+
target: "0.500",
19+
eq: [".500000"],
20+
opts: { literal: { allowTrailingZeros: true } },
21+
ne: [".5001"],
22+
},
23+
{
24+
target: "0.500",
25+
ne: [".500000"],
26+
opts: { literal: { allowTrailingZeros: false } },
27+
},
28+
{
29+
target: "0.500",
30+
eq: [".500"],
31+
opts: { literal: { allowTrailingZeros: true } },
32+
ne: [".5001"],
33+
},
1634
{
1735
target: "12.00",
1836
eq: ["12.00"],

src/latex-equal.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ export const latexEqual = (a: Latex, b: Latex, opts: Opts) => {
2626
}
2727

2828
const al = lta.convert(a);
29-
console.log(al, "al")
30-
3129

3230
const bl = lta.convert(b);
33-
console.log(bl, "bl")
31+
3432
if (differenceIsTooGreat(al, bl)) {
3533
return false;
3634
}

0 commit comments

Comments
 (0)