1- // import { describe, it } from "node:test";
2- // import assert from "node:assert/strict";
3- // import optimize from "../src/optimizer.js";
4- // import * as core from "../src/core.js";
1+ import { describe , it } from "node:test" ;
2+ import assert from "node:assert/strict" ;
3+ import optimize from "../src/optimizer.js" ;
4+ import * as core from "../src/core.js" ;
55
6- // const num = (value) => core.num(value);
7- // const add = (left, op, right) => core.addExpr(left, op, right);
8- // const mul = (left, op, right) => core.mulExpr(left, op, right);
9- // const condExpr = (left, op, right, then, elseB) => core.condExpr(left, op, right, then, elseB);
10- // const id = (name) => core.id(name);
6+ const num = ( value ) => core . num ( value ) ;
7+ const add = ( left , op , right ) => core . addExpr ( left , op , right ) ;
8+ const mul = ( left , op , right ) => core . mulExpr ( left , op , right ) ;
9+ const condExpr = ( left , op , right , then , elseB ) => core . condExpr ( left , op , right , then , elseB ) ;
10+ const id = ( name ) => core . id ( name ) ;
1111
1212const tests = [
1313 [
@@ -311,11 +311,11 @@ const tests = [
311311 ] ,
312312] ;
313313
314- // describe("The optimizer", () => {
315- // for (const [scenario, before, after] of tests) {
316- // it(scenario, () => {
317- // const result = optimize(before);
318- // assert.deepEqual(result, after);
319- // });
320- // }
321- // });
314+ describe ( "The optimizer" , ( ) => {
315+ for ( const [ scenario , before , after ] of tests ) {
316+ it ( scenario , ( ) => {
317+ const result = optimize ( before ) ;
318+ assert . deepEqual ( result , after ) ;
319+ } ) ;
320+ }
321+ } ) ;
0 commit comments