Skip to content

Commit

Permalink
internal/bits: minor updates of TestUnary for consistency
Browse files Browse the repository at this point in the history
Run `goimports -w` to sort imports and change order of
"expected xx, got xx" to match other test cases
(e.g. TestZigZag).
  • Loading branch information
mewmew committed Oct 31, 2023
1 parent 2223fc0 commit fc0e2e6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/bits/unary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package bits_test

import (
"bytes"
"testing"

"github.com/icza/bitio"
"github.com/mewkiz/flac/internal/bits"
"testing"
)

func TestUnary(t *testing.T) {
w := new(bytes.Buffer)
bw := bitio.NewWriter(w)
buf := &bytes.Buffer{}
bw := bitio.NewWriter(buf)

var want uint64
for ; want < 1000; want++ {
for want := uint64(0); want < 1000; want++ {
// Write unary
if err := bits.WriteUnary(bw, want); err != nil {
t.Fatalf("unable to write unary; %v", err)
Expand All @@ -23,14 +23,14 @@ func TestUnary(t *testing.T) {
}

// Read written unary
r := bits.NewReader(w)
r := bits.NewReader(buf)
got, err := r.ReadUnary()
if err != nil {
t.Fatalf("unable to read unary; %v", err)
}

if got != want {
t.Fatalf("the written and read unary doesn't match the original value, got: %v, expected: %v", got, want)
if want != got {
t.Fatalf("mismatch between written and read unary value; expected: %d, got: %d", want, got)
}
}
}

0 comments on commit fc0e2e6

Please sign in to comment.