change test to use exported UnmarshalStandardRoaring()

This commit is contained in:
Travis Turner 2018-09-04 10:35:47 -05:00
parent de478870fb
commit 8a1f8659fa
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9
2 changed files with 7 additions and 6 deletions

1
api.go
View file

@ -1,3 +1,4 @@
// Copyright 2017 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.

View file

@ -3231,27 +3231,27 @@ func runContainerFunc(f interface{}, c ...*Container) *Container {
func TestUnmarshalStdRoaring(t *testing.T) {
//generated serialize image from java(clojure) with arrays
_2arrayContainer, _ := hex.DecodeString("3A300000020000000000020001000000180000001E0000000100020003000100")
bm, er := unmarshalStandardRoaring(_2arrayContainer)
bm, er := UnmarshalStandardRoaring(_2arrayContainer)
if er != nil {
t.Fatalf("unmarshalStandardRoaring %s", er)
t.Fatalf("UnmarshalStandardRoaring %s", er)
}
if bm.Count() != 4 {
t.Fatalf("unexpected bitmap %v expected bits [1 2 3 65537]", bm.Slice())
}
//generated serialize image from java(clojure) with a run and array
_rle_array_container, _ := hex.DecodeString("3B3001000100000900010000000100010009000100")
bm, er = unmarshalStandardRoaring(_rle_array_container)
bm, er = UnmarshalStandardRoaring(_rle_array_container)
if er != nil {
t.Fatalf("unmarshalStandardRoaring %s", er)
t.Fatalf("UnmarshalStandardRoaring %s", er)
}
if bm.Count() != 11 {
t.Fatalf("unexpected bitmap %v expected bits [1 2 3 4 5 6 7 8 9 10 65537]", bm.Slice())
}
//had to use an external file because emacs was barfing on the long line :()
_bitmap_array_container, _ := ioutil.ReadFile("./bitmapcontainer.roaringbitmap")
bm, er = unmarshalStandardRoaring(_bitmap_array_container)
bm, er = UnmarshalStandardRoaring(_bitmap_array_container)
if er != nil {
t.Fatalf("unmarshalStandardRoaring %s", er)
t.Fatalf("UnmarshalStandardRoaring %s", er)
}
if bm.Count() != 10000 {
t.Fatalf("expecting X got %d", bm.Count())