MCPcopy
hub / github.com/skip2/go-qrcode / TestSymbolBasic

Function TestSymbolBasic

symbol_test.go:8–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6import "testing"
7
8func TestSymbolBasic(t *testing.T) {
9 size := 10
10 quietZoneSize := 4
11
12 m := newSymbol(size, quietZoneSize)
13
14 if m.size != size+quietZoneSize*2 {
15 t.Errorf("Symbol size is %d, expected %d", m.size, size+quietZoneSize*2)
16 }
17
18 for i := 0; i < size; i++ {
19 for j := 0; j < size; j++ {
20
21 v := m.get(i, j)
22
23 if v != false {
24 t.Errorf("New symbol not empty")
25 }
26
27 if !m.empty(i, j) {
28 t.Errorf("New symbol is not empty")
29 }
30
31 value := i*j%2 == 0
32 m.set(i, j, value)
33
34 v = m.get(i, j)
35
36 if v != value {
37 t.Errorf("Symbol ignores set bits")
38 }
39
40 if m.empty(i, j) {
41 t.Errorf("Symbol ignores set bits")
42 }
43 }
44 }
45}
46
47func TestSymbolPenalties(t *testing.T) {
48 tests := []struct {

Callers

nothing calls this directly

Calls 4

newSymbolFunction · 0.85
getMethod · 0.80
emptyMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…