-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcap_test.go
44 lines (39 loc) · 886 Bytes
/
cap_test.go
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
package drm_test
import (
"testing"
"github.com/NeowayLabs/drm"
)
func TestHasDumbBuffer(t *testing.T) {
file, err := drm.OpenCard(0)
if err != nil {
t.Fatal(err)
}
defer file.Close()
version, err := drm.GetVersion(file)
if err != nil {
t.Error(err)
return
}
if hasDumb := drm.HasDumbBuffer(file); hasDumb != (cardInfo.capabilities[drm.CapDumbBuffer] != 0) {
t.Errorf("Card '%s' should support dumb buffers...Got %v but %d", version.Name, hasDumb, cardInfo.capabilities[drm.CapDumbBuffer])
return
}
}
func TestGetCap(t *testing.T) {
file, err := drm.OpenCard(0)
if err != nil {
t.Fatal(err)
}
defer file.Close()
for cap, capval := range cardInfo.capabilities {
ccap, err := drm.GetCap(file, cap)
if err != nil {
t.Error(err)
return
}
if ccap != capval {
t.Errorf("Capability %d differs: %d != %d", cap, ccap, capval)
return
}
}
}