-
Notifications
You must be signed in to change notification settings - Fork 2
/
ir_writer_test.ts
34 lines (22 loc) · 1.18 KB
/
ir_writer_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as reader from "../ir/reader";
import * as writer from "../ir/writer";
function do_test(sexp_text: string){
const ir_sexp = reader.read_ir(sexp_text);
const sexp_text_normalized = writer.write_ir(ir_sexp);
const ir_sexp_2 = reader.read_ir(sexp_text);
const sexp_text_normalized_2 = writer.write_ir(ir_sexp_2);
expect(sexp_text_normalized).toEqual(sexp_text_normalized_2);
}
describe("test_writer_1", () => {
test("100", () => do_test("100"));
test("0x0100", () => do_test("0x0100"));
test("0x100", () => do_test("0x100"));
test('"100"', () => do_test('"100"'));
test('"the quick brown fox jumps over the lazy dogs"', () => do_test('"the quick brown fox jumps over the lazy dogs"'));
test("(the quick brown fox jumps over the lazy dogs)", () => do_test("(the quick brown fox jumps over the lazy dogs)"));
test("foo", () => do_test("foo"));
test("(100 0x0100)", () => do_test("(100 0x0100)"));
test('(c (quote 100) (c (quote "foo") (quote ())))', () => do_test('(c (quote 100) (c (quote "foo") (quote ())))'));
test("(c . foo)", () => do_test("(c . foo)"));
test("(a b c de f g h i . j)", () => do_test("(a b c de f g h i . j)"));
});