MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / test_binary_encode

Method test_binary_encode

test/test_browser.py:5660–5677  ·  view source on GitHub ↗
(self, extra)

Source from the content-addressed store, hash-verified

5658 'strict': ('"use strict";',),
5659 })
5660 def test_binary_encode(self, extra):
5661 # Encode values 0 .. 65535 into test data
5662 test_data = bytearray(struct.pack('<' + 'H' * 65536, *range(65536)))
5663 write_binary('data.tmp', test_data)
5664 binary_encoded = binary_encode('data.tmp')
5665
5666 write_file('test.html', ''&#x27;<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><script>
5667''' + extra + '\n' + read_file(path_from_root('src/binaryDecode.js')) + '''
5668var src = ''' + binary_encoded + ''';
5669var u16 = new Uint16Array(binaryDecode(src).buffer);
5670for(var i = 0; i < 65536; ++i)
5671 if (u16[i] != i) throw i;
5672console.log('OK');
5673fetch('report_result?0');
5674</script></body></html>
5675''&#x27;)
5676
5677 self.run_browser('test.html', '/report_result?0')
5678
5679 @parameterized({
5680 '': ([],),

Callers

nothing calls this directly

Calls 7

write_binaryFunction · 0.90
binary_encodeFunction · 0.90
write_fileFunction · 0.90
path_from_rootFunction · 0.85
run_browserMethod · 0.80
rangeFunction · 0.50
read_fileFunction · 0.50

Tested by

no test coverage detected