Skip to content

Commit 64a9d52

Browse files
authored
Merge pull request #1 from codewars/main
resync
2 parents 82bb935 + d666782 commit 64a9d52

File tree

6 files changed

+25
-31
lines changed

6 files changed

+25
-31
lines changed

example/test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
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, getSolution } from "./lc-test.js";
62

73
LC.configure({ purity: "Let", numEncoding: "Church" });
8-
const { counter } = LC.compile(solution());
4+
const { counter } = LC.compile(getSolution());
95

106
const T = t => _ => t;
117
const F = _ => f => f;

workspace/lc-test.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
// lc-test.js
1+
import { readFileSync } from "fs";
2+
3+
export { assert, config } from "chai";
4+
export * as LC from "@codewars/lambda-calculus";
25

3-
import {readFileSync} from "fs";
46
const read = (path) => readFileSync(new URL(path, import.meta.url), {encoding: "utf8"});
57

8+
/** Return the contents of the solution file */
69
export const getSolution = () => read("./solution.lc");
7-
export const getPreloaded = () => read("./preloaded.lc");
8-
export const getPreloadedAndSolution = () => getPreloaded() + '\n' + getSolution() ; // this might as well check solution doesn't start with a continued line
910

10-
export {assert,config} from "chai";
11+
/** Return the contents of the optional preloaded file */
12+
export const getPreloaded = () => read("./preloaded.lc");
1113

12-
export * as LC from "@codewars/lambda-calculus";
14+
/** Return the contents of the preloaded file and the solution file combined */
15+
export const getSolutionWithPreloaded = () => getPreloaded() + "\n" + getSolution();

workspace/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

workspace/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"timeout": 0
1212
},
1313
"dependencies": {
14-
"@codewars/lambda-calculus": "^1.0.0-rc.3"
14+
"@codewars/lambda-calculus": "^1.0.0-rc.4"
1515
},
1616
"devDependencies": {
1717
"@codewars/mocha-reporter": "^1.0.0",

workspace/solution.lc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
true = \ a b . a
44
false = \ a b . b
5-
%invalid = \a b . b
65

76
zero = false
87
succ = \ n f x . f (n f x)

workspace/test.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
// test.js
1+
import { assert, LC, getSolution } from "./lc-test.js";
22

3-
import * as LC from "./lc-test.js";
4-
LC.config.truncateThreshold = 0;
5-
LC.configure({ purity: "Let", numEncoding: "Church" });
6-
7-
const {counter} = LC.compile(getSolution());
8-
const {toInt} = LC;
3+
LC.configure({purity: "Let", numEncoding: "Church"});
4+
const { counter } = LC.compile(getSolution());
95

106
const T = t => _ => t;
117
const F = _ => f => f;
128

139
describe("counter", () => {
1410
it("fixed tests", () => {
15-
assert.strictEqual(toInt(counter(T)(T)(T)(F)), 3);
16-
assert.strictEqual(toInt(counter(T)(F)), 1);
17-
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);
1814
});
1915
});

0 commit comments

Comments
 (0)