github.com/philpearl/plenc@v0.0.15/plenccore/wire_test.go (about)

     1  package plenccore
     2  
     3  import "testing"
     4  
     5  func TestTags(t *testing.T) {
     6  	for wt := WTVarInt; wt <= WT32; wt++ {
     7  		for index := 1; index < 1000; index++ {
     8  			l := SizeTag(wt, index)
     9  			b := make([]byte, 0, l)
    10  			data := AppendTag(b, wt, index)
    11  			awt, aindex, n := ReadTag(data)
    12  
    13  			if n != l {
    14  				t.Errorf("data size issue %d %d", l, n)
    15  			}
    16  			if awt != wt || aindex != index {
    17  				t.Errorf("exp %d %d, actual %d %d", wt, index, awt, aindex)
    18  			}
    19  		}
    20  	}
    21  }