author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 30 Aug 2013 12:19:02 +0100 | |
branch | development |
changeset 2697 | d5110c6822c6 |
parent 2578 | fc6186a4961f |
child 2711 | a00302fe5083 |
permissions | -rw-r--r-- |
749 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
5 |
|
749 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
TestCase subclass:#JavaUTF8Tests |
|
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests' |
|
28 |
! |
|
29 |
||
30 |
!JavaUTF8Tests class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
36 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
37 |
|
749 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
48 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
49 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
50 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!JavaUTF8Tests methodsFor:'loadingTests'! |
|
57 |
||
58 |
testSingleByteCharacters |
|
59 |
|bytes| |
|
60 |
||
61 |
bytes := ByteArray new:1. |
|
62 |
bytes at:1 put:65. |
|
63 |
self assert:((CharacterArray decodeFromJavaUTF8:bytes) = 'A'). |
|
64 |
||
65 |
"Created: / 04-02-2011 / 14:18:10 / Marcel Hlopko <hlopik@gmail.com>" |
|
66 |
! |
|
67 |
||
68 |
testSixByteCharacters |
|
69 |
| bytes convertedString expectedString | |
|
70 |
||
71 |
bytes := ByteArray new: 6. |
|
72 |
bytes at: 1 put: 2r11101101. |
|
73 |
bytes at: 2 put: 2r10101111. |
|
74 |
bytes at: 3 put: 2r10111111. |
|
75 |
bytes at: 4 put: 2r11101101. |
|
76 |
bytes at: 5 put: 2r10111111. |
|
77 |
bytes at: 6 put: 2r10101111. |
|
78 |
expectedString := Unicode32String new: 1. |
|
79 |
expectedString at: 1 |
|
80 |
put: (Character codePoint: (((((2r11111111111111111111)))))). |
|
81 |
convertedString := CharacterArray decodeFromJavaUTF8: bytes. |
|
82 |
self assert: convertedString = expectedString. |
|
83 |
||
84 |
"Created: / 04-02-2011 / 15:25:27 / Marcel Hlopko <hlopik@gmail.com>" |
|
85 |
"Modified: / 13-03-2011 / 15:44:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
86 |
! |
|
87 |
||
88 |
testSixByteCharactersTrap |
|
89 |
|bytes convertedString expectedString| |
|
90 |
||
91 |
bytes := ByteArray new:6. |
|
92 |
bytes at:1 put:2r11101101. |
|
93 |
bytes at:2 put:2r10101111. |
|
94 |
bytes at:3 put:2r10111111. |
|
95 |
bytes at:4 put:2r11101101. |
|
96 |
bytes at:5 put:2r10101111. |
|
97 |
bytes at:6 put:2r10111111. |
|
98 |
expectedString := Unicode32String new:2. |
|
99 |
expectedString at:1 |
|
100 |
put:(Character codePoint:2r1101101111111111). |
|
101 |
expectedString at:2 |
|
102 |
put:(Character codePoint:2r1101101111111111). |
|
103 |
convertedString := CharacterArray decodeFromJavaUTF8:bytes. |
|
104 |
self assert:convertedString = expectedString. |
|
105 |
||
106 |
"Created: / 04-02-2011 / 16:01:32 / Marcel Hlopko <hlopik@gmail.com>" |
|
107 |
! |
|
108 |
||
109 |
testThreeByteCharacters |
|
110 |
|bytes convertedString expectedString| |
|
111 |
||
112 |
bytes := ByteArray new:3. |
|
113 |
bytes at:1 put:2r11101111. |
|
114 |
bytes at:2 put:2r10001111. |
|
115 |
bytes at:3 put:2r10101111. |
|
116 |
expectedString := Unicode16String new:1. |
|
117 |
expectedString at:1 put:(Character codePoint:2r1111001111101111). |
|
118 |
convertedString := CharacterArray decodeFromJavaUTF8:bytes. |
|
119 |
self assert:convertedString = expectedString. |
|
120 |
||
121 |
"Created: / 04-02-2011 / 15:06:03 / Marcel Hlopko <hlopik@gmail.com>" |
|
122 |
! |
|
123 |
||
124 |
testTwoByteCharacters |
|
125 |
|bytes convertedString expectedString| |
|
126 |
||
127 |
bytes := ByteArray new:2. |
|
128 |
bytes at:1 put:2r11011111. |
|
129 |
bytes at:2 put:2r10001111. |
|
130 |
expectedString := Unicode16String new:1. |
|
131 |
expectedString at:1 put:(Character codePoint:2r11111001111). |
|
132 |
convertedString := CharacterArray decodeFromJavaUTF8:bytes. |
|
133 |
self assert:convertedString = expectedString. |
|
134 |
||
135 |
"Created: / 04-02-2011 / 14:31:26 / Marcel Hlopko <hlopik@gmail.com>" |
|
136 |
"Modified: / 04-02-2011 / 16:02:16 / Marcel Hlopko <hlopik@gmail.com>" |
|
137 |
! ! |
|
138 |
||
139 |
!JavaUTF8Tests class methodsFor:'documentation'! |
|
140 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
141 |
version_CVS |
2578
fc6186a4961f
Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
142 |
^ '$Header: /cvs/stx/stx/libjava/JavaUTF8Tests.st,v 1.3 2013/02/25 11:15:31 vrany Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
143 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
144 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
145 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
146 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
147 |
^ '$Changeset: <not expanded> $' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
148 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
149 |
|
749 | 150 |
version_SVN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
151 |
^ '§Id§' |
2152 | 152 |
! ! |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
153 |