MCPcopy Create free account
hub / github.com/skip2/go-qrcode / TestDecodeBasic

Function TestDecodeBasic

qrcode_decode_test.go:32–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30 "Enable decode fuzz tests. Requires zbarimg installed.")
31
32func TestDecodeBasic(t *testing.T) {
33 if !*testDecode {
34 t.Skip("Decode tests not enabled")
35 }
36
37 tests := []struct {
38 content string
39 numRepetitions int
40 level RecoveryLevel
41 }{
42 {
43 "A",
44 1,
45 Low,
46 },
47 {
48 "A",
49 1,
50 Medium,
51 },
52 {
53 "A",
54 1,
55 High,
56 },
57 {
58 "A",
59 1,
60 Highest,
61 },
62 {
63 "01234567",
64 1,
65 Medium,
66 },
67 }
68
69 for _, test := range tests {
70 content := strings.Repeat(test.content, test.numRepetitions)
71
72 q, err := New(content, test.level)
73 if err != nil {
74 t.Error(err.Error())
75 }
76
77 err = zbarimgCheck(q)
78
79 if err != nil {
80 t.Error(err.Error())
81 }
82 }
83}
84
85func TestDecodeAllVersionLevels(t *testing.T) {
86 if !*testDecode {

Callers

nothing calls this directly

Calls 2

zbarimgCheckFunction · 0.85
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…