Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake committed Sep 25, 2022
1 parent c364fbd commit 23c2c15
Show file tree
Hide file tree
Showing 6 changed files with 3,381 additions and 2,766 deletions.
2 changes: 1 addition & 1 deletion __tests__/Data/Parser/Literals_Pass.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion __tests__/Data/Parser/Parser_Pass.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions __tests__/Tests/WasmBuilder/Expression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { expect, test } from '@jest/globals';
// Test Components
import * as Expressions from '../../../src/wasmBuilder/Build/Expression';
import { ieee754, signedLEB128, unsignedLEB128 } from '../../../src/wasmBuilder/Build/Utils';
import { typeRefIdentifier, funcRefIdentifier, globalRefIdentifier } from '../../../src/wasmBuilder/Types/Nodes'
// WasmBuilder Expressions Tests
test('WasmBuilder-Expressions: unreachableExpression', () => {
expect(Expressions.unreachableExpression()).toEqual([0x00]);
Expand Down Expand Up @@ -72,6 +73,7 @@ test('WasmBuilder-Expressions: callExpression', () => {
...Expressions.nopExpression(),
...Expressions.nopExpression(),
0x10,
funcRefIdentifier,
...unsignedLEB128(0),
]);
});
Expand All @@ -88,6 +90,7 @@ test('WasmBuilder-Expressions: call_indirect', () => {
...Expressions.nopExpression(),
...Expressions.i32_ConstExpression(0),
0x11,
typeRefIdentifier,
...unsignedLEB128(0),
0x00,
]);
Expand Down Expand Up @@ -117,12 +120,13 @@ test('WasmBuilder-Expressions: local_TeeExpression', () => {
]);
});
test('WasmBuilder-Expressions: global_GetExpression', () => {
expect(Expressions.global_GetExpression('test')).toEqual([0x23, 'test']);
expect(Expressions.global_GetExpression('test')).toEqual([0x23, globalRefIdentifier, 'test']);
});
test('WasmBuilder-Expressions: global_SetExpression', () => {
expect(Expressions.global_SetExpression('test', Expressions.nopExpression())).toEqual([
...Expressions.nopExpression(),
0x24,
globalRefIdentifier,
'test',
]);
});
Expand Down Expand Up @@ -572,7 +576,7 @@ test('WasmBuilder-Expressions: br_IfExpression-label', () => {
test('WasmBuilder-Expressions: callExpression-label', () => {
expect(
Expressions.callExpression('test', [Expressions.nopExpression(), Expressions.nopExpression()])
).toEqual([...Expressions.nopExpression(), ...Expressions.nopExpression(), 0x10, 'test']);
).toEqual([...Expressions.nopExpression(), ...Expressions.nopExpression(), 0x10, funcRefIdentifier, 'test']);
});
test('WasmBuilder-Expressions: local_GetExpression-label', () => {
expect(Expressions.local_GetExpression('test')).toEqual([0x20, 'test']);
Expand All @@ -592,12 +596,13 @@ test('WasmBuilder-Expressions: local_TeeExpression-label', () => {
]);
});
test('WasmBuilder-Expressions: global_GetExpression-label', () => {
expect(Expressions.global_GetExpression('test')).toEqual([0x23, 'test']);
expect(Expressions.global_GetExpression('test')).toEqual([0x23, globalRefIdentifier, 'test']);
});
test('WasmBuilder-Expressions: global_SetExpression-label', () => {
expect(Expressions.global_SetExpression('test', Expressions.nopExpression())).toEqual([
...Expressions.nopExpression(),
0x24,
globalRefIdentifier,
'test',
]);
});
Expand Down
4 changes: 4 additions & 0 deletions __tests__/Tests/WasmBuilder/WasmModule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test('WasmBuilder-WasmTypes: createEmptyModule', () => {
functionMap: new Map(),
globalMap: new Map(),
localData: new Map(),
codeReferences: [],
// Sections
customSections: [],
typeSection: [],
Expand All @@ -65,6 +66,7 @@ test('WasmBuilder-WasmTypes: addMemory', () => {
functionMap: new Map(),
globalMap: new Map(),
localData: new Map(),
codeReferences: [],
// Sections
customSections: [],
typeSection: [],
Expand Down Expand Up @@ -95,6 +97,7 @@ test('WasmBuilder-WasmTypes: addGlobal', () => {
functionMap: new Map(),
globalMap: new Map([['test', 0]]),
localData: new Map(),
codeReferences: [],
// Sections
customSections: [],
typeSection: [],
Expand Down Expand Up @@ -127,6 +130,7 @@ test('WasmBuilder-WasmTypes: addData', () => {
functionMap: new Map(),
globalMap: new Map(),
localData: new Map(),
codeReferences: [],
// Sections
customSections: [],
typeSection: [],
Expand Down
Loading

0 comments on commit 23c2c15

Please sign in to comment.