UNPKG

@alu0101051420/constant-folding

Version:
27 lines (20 loc) 795 B
const eggConstantFolding = require('../src/egg-constant-folding'); const should = require('chai').should(); const fs = require('fs'); const exampleNames = [ 'binary' ] const binaryExamples = [] describe('constantFolding binary operation tests on egg language', () => { exampleNames.forEach((name) => { const source = fs.readFileSync('test/examples/egg/' + name + '.json', 'utf8'); const expected = fs.readFileSync('test/examples/egg/' + name + '.json.expected', 'utf8'); binaryExamples.push({ name: name, input: JSON.parse(source), result: JSON.parse(expected) }); }) binaryExamples.forEach((example) => { it(example.name, () => { debugger; JSON.stringify(eggConstantFolding(example.input)).should.equal(JSON.stringify(example.result)); }) }) });