13 lines
437 B
TypeScript
13 lines
437 B
TypeScript
|
import { expect, test } from 'bun:test';
|
||
|
import { TestPrograms } from './programs';
|
||
|
import { peggyParse } from '@/parser';
|
||
|
import { evaluate } from '@/interpreter';
|
||
|
import { testingLogger } from './logger';
|
||
|
|
||
|
test('Add (1 real) and (3 int) => (4 real)', async () => {
|
||
|
const ast = peggyParse(await TestPrograms.AddOneThree);
|
||
|
|
||
|
const result = await evaluate(ast, testingLogger);
|
||
|
expect(result).toEqual({ type: 'real', value: 4 });
|
||
|
});
|