File tree Expand file tree Collapse file tree 5 files changed +12
-18
lines changed
Expand file tree Collapse file tree 5 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ RUN set -ex; \
77
88COPY --chown=codewarrior:codewarrior workspace/package.json /workspace/package.json
99COPY --chown=codewarrior:codewarrior workspace/package-lock.json /workspace/package-lock.json
10- COPY --chown=codewarrior:codewarrior workspace/files .js /workspace/files .js
10+ COPY --chown=codewarrior:codewarrior workspace/lc-test .js /workspace/lc-test .js
1111
1212USER codewarrior
1313WORKDIR /workspace
Original file line number Diff line number Diff line change 1- import { assert , config as chaiConfig } from "chai" ;
2- chaiConfig . truncateThreshold = 0 ;
3-
4- import * as LC from "@codewars/lambda-calculus" ;
5- import { solution } from "./files.js" ; // /workspace/files.js
1+ import { assert , LC , solution } from "./lc-test.js" ;
62
73LC . configure ( { purity : "Let" , numEncoding : "Church" } ) ;
84const { counter } = LC . compile ( solution ( ) ) ;
Original file line number Diff line number Diff line change 11import { readFileSync } from "fs" ;
22
3+ import { assert , config as chaiConfig } from "chai" ;
4+ chaiConfig . truncateThreshold = 0 ;
5+ export { assert } ;
6+ export * as LC from "@codewars/lambda-calculus" ;
7+
38const read = ( path ) => readFileSync ( new URL ( path , import . meta. url ) , { encoding : "utf8" } ) ;
49
510/** Return the contents of the solution file */
Original file line number Diff line number Diff line change 22
33true = \ a b . a
44false = \ a b . b
5- %invalid = \a b . b
65
76zero = false
87succ = \ n f x . f (n f x)
Original file line number Diff line number Diff line change 1- import { assert , config as chaiConfig } from "chai" ;
2- chaiConfig . truncateThreshold = 0 ;
1+ import { assert , LC , solution } from "./lc-test.js" ;
32
4- import * as LC from "@codewars/lambda-calculus" ;
5- import { solution } from "./files.js" ; // /workspace/files.js
6-
7- LC . config . purity = "Let" ;
8- LC . config . numEncoding = "Church" ;
9- const toInt = LC . toIntWith ( LC . config ) ;
3+ LC . configure ( { purity : "Let" , numEncoding : "Church" } ) ;
104const { counter } = LC . compile ( solution ( ) ) ;
115
126const T = t => _ => t ;
137const F = _ => f => f ;
148
159describe ( "counter" , ( ) => {
1610 it ( "fixed tests" , ( ) => {
17- assert . strictEqual ( toInt ( counter ( T ) ( T ) ( T ) ( F ) ) , 3 ) ;
18- assert . strictEqual ( toInt ( counter ( T ) ( F ) ) , 1 ) ;
19- assert . strictEqual ( toInt ( counter ( T ) ( T ) ( T ) ( T ) ( T ) ( T ) ( T ) ( F ) ) , 7 ) ;
11+ assert . equal ( counter ( T ) ( T ) ( T ) ( F ) , 3 ) ;
12+ assert . equal ( counter ( T ) ( F ) , 1 ) ;
13+ assert . equal ( counter ( T ) ( T ) ( T ) ( T ) ( T ) ( T ) ( T ) ( F ) , 7 ) ;
2014 } ) ;
2115} ) ;
You can’t perform that action at this time.
0 commit comments