| // $G $F.go && $L $F.$A && ./$A.out |
| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| for w, i, j := 0,0,0; i < l; i += w { |
| r, w = utf8.DecodeRuneInString(s[i:len(s)]) |
| if w == 0 { panic("zero width in string") } |
| if r != chars[j] { panic("wrong value from string") } |
| // encoded as bytes: 'a' 'b' 'c' e6 97 a5 e6 9c ac e8 aa 9e |
| if L != l { panic("wrong length constructing array") } |
| for w, i, j := 0,0,0; i < L; i += w { |
| r, w = utf8.DecodeRune(a[i:L]) |
| if w == 0 { panic("zero width in bytes") } |
| if r != chars[j] { panic("wrong value from bytes") } |