(t *testing.T)
| 30 | "Enable decode fuzz tests. Requires zbarimg installed.") |
| 31 | |
| 32 | func 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 | |
| 85 | func TestDecodeAllVersionLevels(t *testing.T) { |
| 86 | if !*testDecode { |
nothing calls this directly
no test coverage detected
searching dependent graphs…