var test = require('tape')

var prettierBytes = require('../')

var testData = [
  [2335, '2.3 KB'],
  [23552, '23 KB'],
  [235520, '235 KB'],
  [2355520, '2.4 MB'],
  [23555520, '23 MB'],
  [235555520, '235 MB'],
  [2355555520, '2.4 GB'],
  [23555555520, '23 GB'],
  [235556555520, '235 GB'],
  [2355556655520, '2.4 TB'],
  [23555566655520, '23 TB'],
  [235555566665520, '235 TB']
]

test('pretty bytes', function (t) {
  testData.forEach(function (data) {
    t.equals(prettierBytes(data[0]), data[1], 'bytes: ' + data[0] + ' -> ' + data[1])
  })

  t.end()
})

test('throws on non-number', function (t) {
  t.throws(function () {
    prettierBytes('this is a string')
  })
  t.end()
})

test('throws on NaN', function (t) {
  t.throws(function () {
    prettierBytes(NaN)
  })
  t.end()
})

@@ -74,16 +74,64 @@
 ata = %5B%0A
+  %5B2, '2 B'%5D,%0A  %5B25, '25 B'%5D,%0A  %5B235, '235 B'%5D,%0A
   %5B2335,

add failing B tests