forked from richardlehane/mscfb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_test.go
32 lines (29 loc) · 911 Bytes
/
file_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package mscfb
import (
"testing"
)
func equal(a [][2]int64, b [][2]int64) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v[0] != b[i][0] || v[1] != b[i][1] {
return false
}
}
return true
}
func TestCompress(t *testing.T) {
a := [][2]int64{[2]int64{4608, 1024}, [2]int64{5632, 1024}, [2]int64{6656, 1024}, [2]int64{7680, 1024}, [2]int64{8704, 1024}, [2]int64{9728, 1024}, [2]int64{10752, 512}}
ar := [][2]int64{[2]int64{4608, 6656}}
a = compressChain(a)
if !equal(a, ar) {
t.Errorf("Streams compress fail; Expecting: %v, Got: %v", ar, a)
}
b := [][2]int64{[2]int64{4608, 1024}, [2]int64{6656, 1024}, [2]int64{7680, 1024}, [2]int64{8704, 1024}, [2]int64{10752, 512}}
br := [][2]int64{[2]int64{4608, 1024}, [2]int64{6656, 3072}, [2]int64{10752, 512}}
b = compressChain(b)
if !equal(b, br) {
t.Errorf("Streams compress fail; Expecting: %v, Got: %v", br, b)
}
}