File: unicode_test.go

package info (click to toggle)
golang-barcode 0.0~git20140830-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 280 kB
  • ctags: 270
  • sloc: makefile: 4
file content (18 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package qr

import (
	"bytes"
	"testing"
)

func Test_UnicodeEncoding(t *testing.T) {
	encode := Unicode.getEncoder()
	x, vi, err := encode("A", H) // 65
	if x == nil || vi == nil || vi.Version != 1 || bytes.Compare(x.GetBytes(), []byte{64, 20, 16, 236, 17, 236, 17, 236, 17}) != 0 {
		t.Errorf("\"A\" failed to encode: %s", err)
	}
	_, _, err = encode(makeString(3000, "A"), H)
	if err == nil {
		t.Error("Unicode encoding should not be able to encode a 3kb string")
	}
}