shawnps il y a 10 ans
Parent
commit
d6fbce3eb2
5 fichiers modifiés avec 13 ajouts et 14 suppressions
  1. 6 6
      bitset/bitset_test.go
  2. 1 1
      qrcode.go
  3. 1 2
      qrcode_decode_test.go
  4. 2 2
      qrcode_test.go
  5. 3 3
      symbol.go

+ 6 - 6
bitset/bitset_test.go

@@ -10,12 +10,12 @@ import (
 
 func TestNewBitset(t *testing.T) {
 	tests := [][]bool{
-		[]bool{},
-		[]bool{b1},
-		[]bool{b0},
-		[]bool{b1, b0},
-		[]bool{b1, b0, b1},
-		[]bool{b0, b0, b1},
+		{},
+		{b1},
+		{b0},
+		{b1, b0},
+		{b1, b0, b1},
+		{b0, b0, b1},
 	}
 
 	for _, v := range tests {

+ 1 - 1
qrcode.go

@@ -101,7 +101,7 @@ type QRCode struct {
 
 	data   *bitset.Bitset
 	symbol *symbol
-	mask int
+	mask   int
 }
 
 // New constructs a QRCode.

+ 1 - 2
qrcode_decode_test.go

@@ -154,7 +154,7 @@ func TestDecodeFuzz(t *testing.T) {
 		for j := 0; j < len; j++ {
 			// zbarimg seems to have trouble with special characters, test printable
 			// characters only for now.
-			content += string(32+r.Intn(94))
+			content += string(32 + r.Intn(94))
 		}
 
 		for _, level := range []RecoveryLevel{Low, Medium, High, Highest} {
@@ -230,4 +230,3 @@ func BenchmarkDecodeTest(b *testing.B) {
 		}
 	}
 }
-

+ 2 - 2
qrcode_test.go

@@ -14,7 +14,7 @@ func TestQRCodeMaxCapacity(t *testing.T) {
 	}
 
 	tests := []struct {
-		string string
+		string         string
 		numRepetitions int
 	}{
 		{
@@ -155,7 +155,7 @@ func TestQRCodeISOAnnexIExample(t *testing.T) {
 
 	if q.mask != 2 {
 		t.Errorf("ISO Annex I example mask got %d, expected %d\n", q.mask,
-		expectedMask)
+			expectedMask)
 	}
 }
 

+ 3 - 3
symbol.go

@@ -81,7 +81,7 @@ func (m *symbol) numEmptyModules() int {
 	var count int
 	for y := 0; y < m.symbolSize; y++ {
 		for x := 0; x < m.symbolSize; x++ {
-			if !m.isUsed[y + m.quietZoneSize][x + m.quietZoneSize] {
+			if !m.isUsed[y+m.quietZoneSize][x+m.quietZoneSize] {
 				count++
 			}
 		}
@@ -252,7 +252,7 @@ func (m *symbol) penalty3() int {
 				penalty += penaltyWeight3
 				bitBuffer = 0xFF
 			default:
-				if x == m.symbolSize - 1 && (bitBuffer & 0x7f) == 0x5d {
+				if x == m.symbolSize-1 && (bitBuffer&0x7f) == 0x5d {
 					penalty += penaltyWeight3
 					bitBuffer = 0xFF
 				}
@@ -276,7 +276,7 @@ func (m *symbol) penalty3() int {
 				penalty += penaltyWeight3
 				bitBuffer = 0xFF
 			default:
-				if y == m.symbolSize - 1 && (bitBuffer & 0x7f) == 0x5d {
+				if y == m.symbolSize-1 && (bitBuffer&0x7f) == 0x5d {
 					penalty += penaltyWeight3
 					bitBuffer = 0xFF
 				}