Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Debug/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,15 @@ void Debugger::printValue(const StackValue *v, const uint32_t idx,
v->value.uint64);
break;
case F32:
snprintf(buff, 255, R"("type":"F32","value":")" FMT(PRIx32) "\"",
snprintf(buff, 255, R"("type":"F32","value":")" FMT(PRIi32) "\"",
v->value.uint32);
break;
case F64:
snprintf(buff, 255, R"("type":"F64","value":")" FMT(PRIx64) "\"",
snprintf(buff, 255, R"("type":"F64","value":")" FMT(PRIi64) "\"",
v->value.uint64);
break;
default:
snprintf(buff, 255, R"("type":"%02x","value":")" FMT(PRIx64) "\"",
snprintf(buff, 255, R"("type":"%02x","value":")" FMT(PRIi64) "\"",
v->value_type, v->value.uint64);
}
this->channel->write(R"({"idx":%d,%s}%s)", idx, buff, end ? "" : ",");
Expand Down
Binary file added tests/latch/latch-0.5.0.tgz
Binary file not shown.
155 changes: 116 additions & 39 deletions tests/latch/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/latch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"comptest": "npx ts-node ./src/comp.test.ts"
},
"devDependencies": {
"latch": "file:./latch-0.4.3.tgz",
"latch": "file:./latch-0.5.0.tgz",
"mqtt": "^4.3.7",
"serialport": "^10.4.0",
"typescript": "^4.5.5"
Expand Down
2 changes: 1 addition & 1 deletion tests/latch/src/comp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "latch";

const framework = Framework.getImplementation();
framework.style(StyleType.github);
framework.reporter.style(StyleType.github)

const suite = framework.suite('Specification test suite for WebAssembly');
suite.testee('emulator [:8500]', new EmulatorSpecification(8500));
Expand Down
2 changes: 1 addition & 1 deletion tests/latch/src/debugger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const EXAMPLES: string = `${__dirname}/../examples/`;
*/

const framework = Framework.getImplementation();
framework.style(StyleType.github);
framework.reporter.style(StyleType.github)

const integration: Suite = framework.suite('Integration tests: Debugger'); // must be called first

Expand Down
2 changes: 1 addition & 1 deletion tests/latch/src/primitives.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Type = WASM.Type;
import {Breakpoint} from "latch/dist/types/debug/Breakpoint";

const framework = Framework.getImplementation();
framework.style(StyleType.github);
framework.reporter.style(StyleType.github)

// TODO disclaimer: file is currently disabled until latch supports AS compilation

Expand Down
6 changes: 3 additions & 3 deletions tests/latch/src/spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if (TESTFILE.length > 0) {
// run tests

const framework = Framework.getImplementation();
framework.style(StyleType.github);
framework.reporter.style(StyleType.github)

const spec = framework.suite('Specification test suite for WebAssembly');
spec.testee('emulator [:8500]', new EmulatorSpecification(8500));
Expand All @@ -75,8 +75,8 @@ function createTest(module: string, asserts: string[]): TestScenario {
for (const assert of asserts) {
const cursor = {value: 0};
const func: string = find(/invoke "([^"]+)"/, assert);
const args: WASM.Value[] = parseArguments(assert.replace(`(invoke "${func} "`, ''), cursor);
const result: WASM.Value | undefined = parseResult(assert.slice(cursor.value));
const args: WASM.Value<WASM.Type>[] = parseArguments(assert.replace(`(invoke "${func} "`, ''), cursor);
const result: WASM.Value<WASM.Type> | undefined = parseResult(assert.slice(cursor.value));

steps.push({
title: assert,
Expand Down
14 changes: 7 additions & 7 deletions tests/latch/src/util/spec.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Cursor {
value: number;
}

export function parseResult(input: string): WASM.Value | undefined {
export function parseResult(input: string): WASM.Value<WASM.Type> | undefined {
let cursor = 0;
let delta: number = consume(input, cursor, /\(/d);
if (delta === 0) {
Expand All @@ -14,13 +14,13 @@ export function parseResult(input: string): WASM.Value | undefined {
cursor += delta;

delta = consume(input, cursor, /^[^.)]*/d);
const type: WASM.Type = WASM.typing.get(input.slice(cursor, cursor + delta)) ?? WASM.Type.i64;
const type: WASM.Type = WASM.typing.get(input.slice(cursor, cursor + delta)) ?? WASM.Integer.i64;

cursor += delta + consume(input, cursor + delta);

let value;
delta = consume(input, cursor, /^[^)]*/d);
if (type === WASM.Type.f32 || type === WASM.Type.f64) {
if (type === WASM.Float.f32 || type === WASM.Float.f64) {
value = parseHexFloat(input.slice(cursor, cursor + delta));
} else {
value = parseInteger(input.slice(cursor, cursor + delta));
Expand All @@ -33,8 +33,8 @@ export function parseResult(input: string): WASM.Value | undefined {
return {type, value};
}

export function parseArguments(input: string, index: Cursor): WASM.Value[] {
const args: WASM.Value[] = [];
export function parseArguments(input: string, index: Cursor): WASM.Value<WASM.Type>[] {
const args: WASM.Value<WASM.Type>[] = [];

let cursor: number = consume(input, 0, /invoke "[^"]+"/d);
while (cursor < input.length) {
Expand All @@ -45,12 +45,12 @@ export function parseArguments(input: string, index: Cursor): WASM.Value[] {
cursor += delta;

delta = consume(input, cursor, /^[^.)]*/d);
const type: WASM.Type = WASM.typing.get(input.slice(cursor + delta - 3, cursor + delta)) ?? WASM.Type.i64;
const type: WASM.Type = WASM.typing.get(input.slice(cursor + delta - 3, cursor + delta)) ?? WASM.Integer.i64;

cursor += delta + consume(input, cursor + delta, /^[^)]*const /d);
delta = consume(input, cursor, /^[^)]*/d);
let maybe: number | undefined;
if (type === WASM.Type.f32 || type === WASM.Type.f64) {
if (type === WASM.Float.f32 || type === WASM.Float.f64) {
maybe = parseHexFloat(input.slice(cursor, cursor + delta));
} else {
maybe = parseInteger(input.slice(cursor, cursor + delta));
Expand Down
Loading