Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: merge typed arrays tests
Browse files Browse the repository at this point in the history
Merge simple/test-typed-arrays-typenames into simple/test-typed-arrays.
  • Loading branch information
evlun authored and bnoordhuis committed Mar 21, 2012
1 parent f2ebf24 commit 4b1d492
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 53 deletions.
48 changes: 0 additions & 48 deletions test/simple/test-typed-arrays-typenames.js

This file was deleted.

28 changes: 23 additions & 5 deletions test/simple/test-typed-arrays.js
Expand Up @@ -27,11 +27,29 @@

var common = require('../common');
var assert = require('assert');
var SlowBuffer = process.binding('buffer').SlowBuffer;
var ArrayBuffer = process.binding('typed_array').ArrayBuffer;
var Int32Array = process.binding('typed_array').Int32Array;
var Int16Array = process.binding('typed_array').Int16Array;
var Uint8Array = process.binding('typed_array').Uint8Array;

[
'ArrayBuffer',
'Int8Array',
'Uint8Array',
'Int16Array',
'Uint16Array',
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
].forEach(function(name) {
var expected = '[object ' + name + ']';
var clazz = global[name];
var obj = new clazz(1);

assert.equal(obj.toString(), expected);
assert.equal(Object.prototype.toString.call(obj), expected);

obj = new DataView(obj);
assert.equal(obj.toString(), '[object DataView]');
assert.equal(Object.prototype.toString.call(obj), '[object DataView]');
});

// initialize a zero-filled buffer
var buffer = new Buffer(8);
Expand Down

0 comments on commit 4b1d492

Please sign in to comment.