19 lines
542 B
TypeScript
19 lines
542 B
TypeScript
import fc from "fast-check";
|
|
import { describe, expect, test } from "bun:test";
|
|
import { churchEncode, inferType, prettyTerm, prettyType } from ".";
|
|
|
|
// Code under test
|
|
const contains = (text, pattern) => text.indexOf(pattern) >= 0;
|
|
|
|
// Properties
|
|
describe("church encoding", () => {
|
|
test("well typed", () => {
|
|
fc.assert(
|
|
fc.property(fc.integer(), (num) => {
|
|
const churchNum = churchEncode(num);
|
|
console.log(prettyTerm(churchNum));
|
|
console.log(prettyType(inferType(churchNum)));
|
|
}),
|
|
);
|
|
});
|
|
});
|