-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.go
More file actions
49 lines (38 loc) · 720 Bytes
/
util_test.go
File metadata and controls
49 lines (38 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package go_qoi
import (
"bufio"
"bytes"
"image/color"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReadUint32(t *testing.T) {
bs := []byte{23, 100, 255, 0}
r := bytes.NewReader(bs)
reader := bufio.NewReader(r)
value, err := readUint32(reader)
if err != nil {
t.Error(err)
}
var expected uint32 = 392494848
assert.Equal(t, value, expected)
}
func TestWriteUint32(t *testing.T) {
r := new(bytes.Buffer)
err := writeUint32(r, 392494848)
assert.Nil(t, err)
expected := []byte{23, 100, 255, 0}
assert.Equal(t, expected, r.Bytes())
}
func TestColorEquals(t *testing.T) {
assert.Equal(
t,
color.Black,
color.Black,
)
assert.NotEqual(
t,
color.Black,
color.White,
)
}