-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag_test.go
37 lines (34 loc) · 855 Bytes
/
tag_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
33
34
35
36
37
package gopar3
import (
"bytes"
"math"
"reflect"
"testing"
)
func TestTagLimits(t *testing.T) {
if TagSize != 16 {
t.Fatal("tag size bent out of standard", TagSize)
}
if DifferentiatorSize != 13 {
t.Fatal("differentiator size bent out of standard", DifferentiatorSize)
}
if ShardLimit != math.MaxUint8 {
t.Fatal("unexpected shard limit", ShardLimit, math.MaxUint8)
}
if ShardBatchLimit != math.MaxUint16 {
t.Fatal("unexpected shard limit", ShardBatchLimit, math.MaxUint16)
}
if SourceSizeLimit != math.MaxUint64 {
t.Fatal("unexpected shard limit")
}
a := []byte("1234567890123456")
b := NewTagFromBytes(a).Bytes()
if !bytes.Equal(a, b) {
t.Logf("a: %q", a)
t.Logf("b: %q", b)
t.Fatal("values do not match")
}
if !reflect.DeepEqual(NewTagFromBytes(a), NewTagFromBytes(b)) {
t.Fatal("decoded tags do not match")
}
}