Skip to content

Commit cd34802

Browse files
committed
✅ Add first unit test for out-of-place
1 parent b027564 commit cd34802

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

tests/latch/src/debugger.test.ts

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818

1919
export const EMULATOR: string = process.env.EMULATOR ?? `${require('os').homedir()}/Arduino/libraries/WARDuino/build-emu/wdcli`;
2020

21-
2221
const EXAMPLES: string = `${__dirname}/../examples/`;
2322

2423
/**
@@ -312,7 +311,6 @@ const stepOverTest: TestScenario = {
312311

313312
integration.test(stepOverTest);
314313

315-
// EDWARD tests with mock proxy
316314

317315
const dumpEventsTest: TestScenario = {
318316
title: 'Test DUMPEvents',
@@ -332,4 +330,57 @@ const dumpEventsTest: TestScenario = {
332330

333331
integration.test(dumpEventsTest);
334332

335-
framework.run([integration]);
333+
// EDWARD tests
334+
335+
const oop = framework.suite('Test Out-of-place primitives');
336+
337+
oop.testee('supervisor[:8100] - proxy[:8150]', new OutofPlaceSpecification(8100, 8150));
338+
339+
oop.test({
340+
title: `Test store primitive`,
341+
program: 'test/dummy.wast',
342+
dependencies: [],
343+
steps: [
344+
{
345+
title: '[supervisor] CHECK: execution at start of main',
346+
instruction: {kind: Kind.Request, value: dump},
347+
expected: [{'pc': {kind: 'primitive', value: 129} as Expected<number>}]
348+
},
349+
350+
{
351+
title: '[proxy] CHECK: execution at start of main',
352+
instruction: {kind: Kind.Request, value: dump},
353+
expected: [{'pc': {kind: 'primitive', value: 129} as Expected<number>}],
354+
target: Target.proxy
355+
},
356+
357+
new Invoker('load', [WASM.i32(32)], WASM.i32(0), Target.proxy),
358+
359+
{
360+
title: '[supervisor] Send STEP command',
361+
instruction: {kind: Kind.Request, value: step}
362+
},
363+
364+
{
365+
title: '[supervisor] Send STEP command',
366+
instruction: {kind: Kind.Request, value: step}
367+
},
368+
369+
{
370+
title: '[supervisor] Send STEP command',
371+
instruction: {kind: Kind.Request, value: step}
372+
},
373+
374+
{
375+
title: '[supervisor] CHECK: execution took three steps',
376+
instruction: {kind: Kind.Request, value: dump},
377+
expected: [{'pc': {kind: 'primitive', value: 136} as Expected<number>}]
378+
},
379+
380+
new Invoker('load', [WASM.i32(32)], WASM.i32(42), Target.proxy),
381+
382+
new Invoker('load', [WASM.i32(32)], WASM.i32(42), Target.supervisor)
383+
]
384+
});
385+
386+
framework.run([integration,oop]);

tests/latch/src/primitives.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const examples = `${__dirname}/../examples`;
1919
const framework = Framework.getImplementation();
2020
framework.style(OutputStyle.github);
2121

22-
// TODO disclaimer: file is currently disabled until latch supports AS compilation
23-
2422
const dummy: Suite = framework.suite('Integration tests: dummy primitives');
2523

2624
dummy.testee('emulator [:8520]', new EmulatorSpecification(8520));
@@ -45,6 +43,8 @@ const dummyScenario: TestScenario = {
4543

4644
dummy.test(dummyScenario);
4745

46+
// TODO disclaimer: rest of the file is currently disabled until latch supports AS compilation
47+
4848
const basic: Suite = framework.suite('Integration tests: basic primitives');
4949

5050
basic.testee('emulator [:8520]', new EmulatorSpecification(8520));

0 commit comments

Comments
 (0)