var Iconv = require('iconv').Iconv,
   assert = require('assert');

var iconv = new Iconv('UTF-8', 'UTF-16');

var utf8 = new Buffer(20000000);
for (var i = 0; i < utf8.length; i++) {
  utf8[i] = 97 + i % 26; // cycle from 'a' to 'z'.
}
var utf16 = iconv.convert(utf8);

// 2 bytes per character + 2 bytes for BOM
assert.equal(utf16.length, utf8.length * 2 + 2);

// test for BOM
assert.equal(utf16[0], 0xff);
assert.equal(utf16[1], 0xfe);

for (i = 0; i < utf8.length; ++i) {
  assert.equal(utf16[2 + i * 2], utf8[i]);
  assert.equal(utf16[2 + i * 2 + 1], 0);
}


@@ -99,16 +99,18 @@
  'UTF-16
+LE
 ');%0A%0Avar
@@ -270,174 +270,50 @@
 );%0A%0A
-// 2 bytes per character + 2 bytes for BOM%0Aassert.equal(utf16.length, utf8.length * 2 + 2);%0A%0A// test for BOM%0Aassert.equal(utf16%5B0%5D, 0xff);%0Aassert.equal(utf16%5B1%5D, 0xfe
+assert.equal(utf16.length, utf8.length * 2
 );%0A%0A
@@ -365,28 +365,24 @@
 equal(utf16%5B
-2 + 
 i * 2%5D, utf8
@@ -408,20 +408,16 @@
 l(utf16%5B
-2 + 
 i * 2 + 

Fix for test failure: encoding to UTF-16 is implementation dependent, output may be either big or little endian. Therefore, encode explicitly to UTF-16LE.