
//these examples from from parquet-mr/parquet-encoding
var fixtures = require('./fixture.json')
var tape = require('tape')
var u = require('../util')
var packer = require('../')

tape('fixtures', function (t) {
  fixtures.forEach(function (e, i) {
    t.test('test:'+i, function (t) {
//      console.log(e)
      var bytes = Math.ceil(Math.ceil((e.ary.length*e.width) / 32)*4)
      var buffer = packer(new Buffer(bytes), e.ary, e.width)
      console.log('output', buffer.length, u.bufferToBits(buffer))
      t.equal(u.bufferToBits(buffer
//        .slice(0, Math.ceil((e.ary.length*e.width)/8))
        ), e.bits)
      t.end()
    })
  })
  t.end()
})




@@ -173,16 +173,80 @@
 '../')%0A%0A
+function Z(n) %7B%0A  var b = new Buffer(n); b.fill(0); return b%0A%7D%0A%0A
 tape('fi
@@ -347,30 +347,8 @@
 ) %7B%0A
-//      console.log(e)
 %0A   
@@ -440,26 +440,17 @@
  packer(
-new Buffer
+Z
 (bytes),
@@ -466,16 +466,57 @@
 .width)%0A
+      var bits = e.ary.length * e.width%0A%0A
       co
@@ -574,16 +574,44 @@
 uffer))%0A
+      console.log(bits, e)%0A%0A
       t.
@@ -635,25 +635,19 @@
 its(
-buffer%0A//
+%0A  
         
 .sli
@@ -642,16 +642,22 @@
         
+buffer
 .slice(0
@@ -668,38 +668,20 @@
 th.ceil(
-(e.ary.length*e.width)
+bits
 /8))%0A   
@@ -736,10 +736,8 @@
 d()%0A%7D)%0A%0A
-%0A%0A

test passing in buffer