File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ export function toInt(term) {
147
147
} else if ( config . numEncoding === "None" )
148
148
return term ;
149
149
else
150
- return numEncoding . toInt ( term ) ; // Custom encoding
150
+ return config . numEncoding . toInt ( term ) ; // Custom encoding
151
151
} catch ( e ) {
152
152
if ( config . verbosity >= "Concise" ) console . error ( `toInt: ${ term } is not a number in numEncoding ${ numEncoding } ` ) ;
153
153
throw e ;
Original file line number Diff line number Diff line change 1
1
import { readFileSync } from "fs" ;
2
2
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 } ;
5
7
6
8
const read = ( path ) => readFileSync ( new URL ( path , import . meta. url ) , { encoding : "utf8" } ) ;
7
9
@@ -13,3 +15,16 @@ export const getPreloaded = () => read("./preloaded.lc");
13
15
14
16
/** Return the contents of the preloaded file and the solution file combined */
15
17
export const getSolutionWithPreloaded = ( ) => getPreloaded ( ) + "\n_ = ()\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