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

Function TestByteModeLengthCalculations

encoder_test.go:64–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestByteModeLengthCalculations(t *testing.T) {
65 tests := []struct {
66 dataEncoderType dataEncoderType
67 dataMode dataMode
68 numSymbols int
69 expectedLength int
70 }{}
71
72 for i, test := range tests {
73 encoder := newDataEncoder(test.dataEncoderType)
74 var resultLength int
75
76 resultLength, err := encoder.encodedLength(test.dataMode, test.numSymbols)
77
78 if test.expectedLength == -1 {
79 if err == nil {
80 t.Errorf("Test %d: got length %d, expected error", i, resultLength)
81 }
82 } else if resultLength != test.expectedLength {
83 t.Errorf("Test %d: got length %d, expected length %d", i, resultLength,
84 test.expectedLength)
85 }
86 }
87}
88
89func TestSingleModeEncodings(t *testing.T) {
90 tests := []struct {

Callers

nothing calls this directly

Calls 2

newDataEncoderFunction · 0.85
encodedLengthMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…