Debian Codegraph @

cram/encoding/ltf8/ltf_test.go

raw symbols SCIP
1 // Copyright ©2017 The bíogo Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package ltf8scip-go gomod github.com/biogo/hts . `github.com/biogo/hts/cram/encoding/ltf8`/
6
7 import "testingscip-go gomod github.com/golang/go/src go1.19 testing/"
8
9 func TestInt64RoundTripscip-go gomod github.com/biogo/hts . `github.com/biogo/hts/cram/encoding/ltf8`/TestInt64RoundTrip().(t *testingscip-go gomod github.com/golang/go/src go1.19 testing/.Tscip-go gomod github.com/golang/go/src go1.19 testing/T#) {
10 b := make([]byte, 10)
11 for i := uint(0); i < 64; i++ {
12 for off := -1; off <= 1; off++ {
13 in := int64(1<<i + off)
14 inn := Encodescip-go gomod github.com/biogo/hts . `github.com/biogo/hts/cram/encoding/ltf8`/Encode().(b, in)
15 wantn := Lenscip-go gomod github.com/biogo/hts . `github.com/biogo/hts/cram/encoding/ltf8`/Len().(in)
16 if wantn != inn {
17 t.Errorfscip-go gomod github.com/golang/go/src go1.19 testing/common#Errorf().("disagreement in number of encoded bytes required: want=%d need=%d", wantn, inn)
18 }
19 out, outn, ok := Decodescip-go gomod github.com/biogo/hts . `github.com/biogo/hts/cram/encoding/ltf8`/Decode().(b)
20 if !ok {
21 t.Errorfscip-go gomod github.com/golang/go/src go1.19 testing/common#Errorf().("failed to decode LTF-8 bytes: %08b", b[:inn])
22 }
23 if inn != outn {
24 t.Errorfscip-go gomod github.com/golang/go/src go1.19 testing/common#Errorf().("disagreement in number of encoded bytes: in=%d out=%d", inn, outn)
25 }
26 if in != out {
27 t.Errorfscip-go gomod github.com/golang/go/src go1.19 testing/common#Errorf().("disagreement in encoded value: in=%d (0x%[1]x) out=%d (0x%[2]x)\nencoding=%08b", in, out, b[:inn])
28 }
29 }
30 }
31 }