MCPcopy Create free account
hub / github.com/egonelbre/exp / TestPacking

Function TestPacking

coder/arith/encoding_test.go:36–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestPacking(t *testing.T) {
37 const N = 1 << 16
38 enc := NewEncoder()
39 p := Prob(0.1)
40 for i := 0; i < N; i++ {
41 if rand.Intn(100) < 10 {
42 enc.Encode(1, p)
43 } else {
44 enc.Encode(0, p)
45 }
46 }
47 enc.Close()
48
49 if len(enc.Bytes()) > N/8 {
50 t.Fatalf("No packing: %v vs %v", len(enc.Bytes()), N/8)
51 }
52 enc.Bytes()
53}

Callers

nothing calls this directly

Calls 5

EncodeMethod · 0.95
CloseMethod · 0.95
BytesMethod · 0.95
NewEncoderFunction · 0.85
ProbFunction · 0.85

Tested by

no test coverage detected