Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
V-for-Vasili committed Mar 1, 2021
1 parent a099773 commit 841e180
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
18 changes: 18 additions & 0 deletions tests/optimizer/test-LittleEndianHeap-output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
a = HEAP8[x];
HEAP8[x] = a;
a = HEAPU8[x];
HEAPU8[x] = a;
a = LE_HEAP_LOAD_I16(x * 2);
LE_HEAP_STORE_I16(x * 2, a);
a = LE_HEAP_LOAD_U16(x * 2);
LE_HEAP_STORE_U16(x * 2, a);
a = LE_HEAP_LOAD_I32(x * 4);
LE_HEAP_STORE_I32(x * 4, a);
a = LE_HEAP_LOAD_U32(x * 4);
LE_HEAP_STORE_U32(x * 4, a);
a = LE_HEAP_LOAD_F32(x * 4);
LE_HEAP_STORE_F32(x * 4, a);
a = LE_HEAP_LOAD_F64(x * 8);
LE_HEAP_STORE_F64(x * 8, a);
HEAP[x];
HeAp[x];
18 changes: 18 additions & 0 deletions tests/optimizer/test-LittleEndianHeap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
a = HEAP8[x]; // HEAP8
HEAP8[x] = a;
a = HEAPU8[x]; // HEAPU8
HEAPU8[x] = a;
a = HEAP16[x]; // HEAP16
HEAP16[x] = a;
a = HEAPU16[x]; // HEAPU16
HEAPU16[x] = a;
a = HEAP32[x]; // HEAPI32
HEAP32[x] = a;
a = HEAPU32[x]; // HEAPU32
HEAPU32[x] = a;
a = HEAPF32[x]; // HEAPF32
HEAPF32[x] = a;
a = HEAPF64[x]; // HEAPF64
HEAPF64[x] = a;
HEAP[x]; // should not be changed
HeAp[x];
5 changes: 4 additions & 1 deletion tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,8 @@ def test_js_optimizer(self):
'growableHeap',
'unsignPointers',
'asanify',
'safeHeap'
'safeHeap',
'littleEndianHeap'
]
for input, expected, passes in [
(path_from_root('tests', 'optimizer', 'test-js-optimizer-minifyLocals.js'), open(path_from_root('tests', 'optimizer', 'test-js-optimizer-minifyLocals-output.js')).read(),
Expand Down Expand Up @@ -1861,6 +1862,8 @@ def test_js_optimizer(self):
['asanify']),
(path_from_root('tests', 'optimizer', 'test-safeHeap.js'), open(path_from_root('tests', 'optimizer', 'test-safeHeap-output.js')).read(),
['safeHeap']),
(path_from_root('tests', 'optimizer', 'test-LittleEndianHeap.js'), open(path_from_root('tests', 'optimizer', 'test-LittleEndianHeap-output.js')).read(),
['littleEndianHeap']),
]:
print(input, passes)

Expand Down

0 comments on commit 841e180

Please sign in to comment.