LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package build | 5 package build |
6 | 6 |
7 import "testing" | 7 import "testing" |
8 | 8 |
9 // cjk returns an implicit collation element for a CJK rune. | 9 // cjk returns an implicit collation element for a CJK rune. |
10 func cjk(r rune) [][]int { | 10 func cjk(r rune) [][]int { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return b | 56 return b |
57 } | 57 } |
58 | 58 |
59 type convertTest struct { | 59 type convertTest struct { |
60 in, out [][]int | 60 in, out [][]int |
61 err bool | 61 err bool |
62 } | 62 } |
63 | 63 |
64 var convLargeTests = []convertTest{ | 64 var convLargeTests = []convertTest{ |
65 {pCE(0xFB39), pCE(0xFB39), false}, | 65 {pCE(0xFB39), pCE(0xFB39), false}, |
66 » {cjk(0x2F9B2), pqCE(0x7F4F2, 0x2F9B2), false}, | 66 » {cjk(0x2F9B2), pqCE(0x4F4F2, 0x2F9B2), false}, |
67 {pCE(0xFB40), pCE(0), true}, | 67 {pCE(0xFB40), pCE(0), true}, |
68 {append(pCE(0xFB40), pCE(0)[0]), pCE(0), true}, | 68 {append(pCE(0xFB40), pCE(0)[0]), pCE(0), true}, |
69 {pCE(0xFFFE), pCE(illegalOffset), false}, | 69 {pCE(0xFFFE), pCE(illegalOffset), false}, |
70 {pCE(0xFFFF), pCE(illegalOffset + 1), false}, | 70 {pCE(0xFFFF), pCE(illegalOffset + 1), false}, |
71 } | 71 } |
72 | 72 |
73 func TestConvertLarge(t *testing.T) { | 73 func TestConvertLarge(t *testing.T) { |
74 for i, tt := range convLargeTests { | 74 for i, tt := range convLargeTests { |
75 e := &entry{elems: tt.in} | 75 e := &entry{elems: tt.in} |
76 elems, err := convertLargeWeights(e.elems) | 76 elems, err := convertLargeWeights(e.elems) |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 256 } |
257 ce := b.t.contractElem[offset+e.contractionIndex] | 257 ce := b.t.contractElem[offset+e.contractionIndex] |
258 if want, _ := makeCE(tt.ces[0]); want != ce { | 258 if want, _ := makeCE(tt.ces[0]); want != ce { |
259 t.Errorf("%s: element %X; want %X", tt.str, ce, want) | 259 t.Errorf("%s: element %X; want %X", tt.str, ce, want) |
260 } | 260 } |
261 } | 261 } |
262 if len(b.t.contractElem) != totalElements { | 262 if len(b.t.contractElem) != totalElements { |
263 t.Errorf("len(expandElem)==%d; want %d", len(b.t.contractElem),
totalElements) | 263 t.Errorf("len(expandElem)==%d; want %d", len(b.t.contractElem),
totalElements) |
264 } | 264 } |
265 } | 265 } |
LEFT | RIGHT |