File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 11import { readFileSync } from "fs" ;
22
3- export { assert , config } from "chai" ;
4- export * as LC from "@codewars/lambda-calculus" ;
3+ import { assert , config } from "chai" ;
4+ import * as LC from "../src/lambda-calculus.js" ;
5+
6+ export { assert , config , LC } ;
57
68const read = ( path ) => readFileSync ( new URL ( path , import . meta. url ) , { encoding : "utf8" } ) ;
79
@@ -13,3 +15,16 @@ export const getPreloaded = () => read("./preloaded.lc");
1315
1416/** Return the contents of the preloaded file and the solution file combined */
1517export const getSolutionWithPreloaded = ( ) => getPreloaded ( ) + "\n" + getSolution ( ) ;
18+
19+
20+ /** Custom assertions */
21+
22+ function numEql ( got , exp , msg ) {
23+ if ( got ?. term && got ?. env ) got = LC . toInt ( got ) ;
24+ if ( exp ?. term && exp ?. env ) exp = LC . toInt ( exp ) ;
25+ return this . equal ( got , exp , msg ) ;
26+ }
27+
28+ Object . assign ( assert , {
29+ numEql
30+ } ) ;
You can’t perform that action at this time.
0 commit comments