예제 #1
0
func checkCodeBook(t *testing.T, protocolVersion byte, maxCodePage byte, expectedCodePageCounts map[byte]int) {
	var (
		cb *wbxml.CodeBook = MakeCodeBook(protocolVersion)
		i  byte
	)

	if !cb.IsReady() {
		t.Error("CodeBook should be ready")
	}

	for i = 0; i < 25; i++ {
		if i != 3 && i < maxCodePage {
			checkCodePage(t, cb, i, expectedCodePageCounts)
		} else {
			checkHasNotCodePage(t, cb, i)
		}
	}
}
예제 #2
0
func checkHasNotCodePage(t *testing.T, cb *wbxml.CodeBook, code byte) {
	if cb.HasTagCode(code) {
		t.Errorf("codebook should NOT have tag code page %d!", code)
	}
}
예제 #3
0
func checkCodePage(t *testing.T, cb *wbxml.CodeBook, code byte, expectedCount map[byte]int) {
	if !cb.HasTagCode(code) {
		t.Errorf("codebook should have tag code page %d!", code)
	}
	checkCodePageCount(t, cb.TagCodePages[code], expectedCount)
}