more tests renamed utf8.go

This commit is contained in:
Florian Sundermann 2013-12-12 14:04:10 +01:00
parent 4c758a440a
commit 3ddff87dab
2 changed files with 18 additions and 0 deletions

18
qr/unicode_test.go Normal file
View File

@ -0,0 +1,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), H)
if err == nil {
t.Error("Unicode encoding should not be able to encode a 3kb string")
}
}