diff options
author | Andrew Low <Andrew_Low@ca.ibm.com> | 2014-04-01 10:18:09 -0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-04-01 23:17:43 +0400 |
commit | f984555d47298cfb01b3e55c2861066379306fc3 (patch) | |
tree | be3771704e6504a8f937bdc35fac54da37f620fd /test | |
parent | 8d6fa72d9720963387b73e0770eeec4dd0ba6dce (diff) | |
download | android-node-v8-f984555d47298cfb01b3e55c2861066379306fc3.tar.gz android-node-v8-f984555d47298cfb01b3e55c2861066379306fc3.tar.bz2 android-node-v8-f984555d47298cfb01b3e55c2861066379306fc3.zip |
test: make test-smalloc endian aware
The test/simple/test-smalloc.js has an implicit assumption
of the byte order of the data stored for Double and Uint32
values. On a big endian platform this test fails without
these patches.
Use os.endianness() to detect the endian of the platform
and use it to gate the static value used for comparison.
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-smalloc.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/simple/test-smalloc.js b/test/simple/test-smalloc.js index 3483638c12..be7e7ac326 100644 --- a/test/simple/test-smalloc.js +++ b/test/simple/test-smalloc.js @@ -21,6 +21,7 @@ var common = require('../common'); var assert = require('assert'); +var os = require('os'); // first grab js api's var smalloc = require('smalloc'); @@ -150,8 +151,13 @@ for (var i = 0; i < 6; i++) { var b = alloc(1, Types.Double); var c = alloc(2, Types.Uint32); -c[0] = 2576980378; -c[1] = 1069128089; +if (os.endianness() === 'LE') { + c[0] = 2576980378; + c[1] = 1069128089; +} else { + c[0] = 1069128089; + c[1] = 2576980378; +} copyOnto(c, 0, b, 0, 2); assert.equal(b[0], 0.1); |