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

Method test_binary_encode

test/test_other.py:15535–15546  ·  view source on GitHub ↗
(self, extra)

Source from the content-addressed store, hash-verified

15533 'strict': ('"use strict";',),
15534 })
15535 def test_binary_encode(self, extra):
15536 # Encode values 0 .. 65535 into test data
15537 test_data = bytearray(struct.pack('<' + 'H' * 65536, *range(65536)))
15538 write_binary('data.tmp', test_data)
15539 binary_encoded = binary_encode('data.tmp')
15540 test_js = extra + ''&#x27;
15541var u16 = new Uint16Array(binaryDecode(src).buffer);
15542for(var i = 0; i < 65536; ++i)
15543 if (u16[i] != i) throw i;
15544console.log('OK');''&#x27;
15545 write_file('test.js', read_file(path_from_root('src/binaryDecode.js')) + '\nvar src = ' + binary_encoded + ';\n' + test_js)
15546 self.assertContained('OK', self.run_js('test.js'))
15547
15548 @crossplatform
15549 def test_executable_output_default(self):

Callers

nothing calls this directly

Calls 8

write_binaryFunction · 0.90
binary_encodeFunction · 0.90
write_fileFunction · 0.90
read_fileFunction · 0.90
path_from_rootFunction · 0.85
assertContainedMethod · 0.80
run_jsMethod · 0.80
rangeFunction · 0.50

Tested by

no test coverage detected