/[eiffelstudio]/trunk/eweasel/tests/unicode006/test_without_bom.e
ViewVC logotype

Contents of /trunk/eweasel/tests/unicode006/test_without_bom.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88916 - (show annotations)
Mon Jun 18 05:36:36 2012 UTC (7 years, 7 months ago) by tedf
File size: 5353 byte(s)
Added more cases for Unicode characters like '%/35797/'.
1 note
2 test: "测试"
3 test: "Test 测试 Test"
4
5 class
6 TEST
7
8 create
9 make
10
11 feature -- Make
12
13 make
14 do
15 test_char
16 test_string_32
17 test_string_8
18 end
19
20 feature -- Run time
21
22 test_char
23 do
24 -- Manifest
25 print ("CHARACTER_32 vs ASCII: " + (({CHARACTER_32}'a').code = 97).out + "%N")
26 print ("CHARACTER_8 vs ASCII: " + (({CHARACTER_8}'a').code = 97).out + "%N")
27 print ("CHARACTER_32 vs Extended ASCII: " + (({CHARACTER_32}'').code = 233).out + "%N")
28 print ("CHARACTER_8 vs Extended ASCII: " + (({CHARACTER_8}'').code = 233).out + "%N")
29 print ("CHARACTER_8 constant type: " + (char_8.generating_type).out + "%N")
30 print ("Manifest ASCII char type: " + ('a').generating_type.out + "%N")
31 print ("CHARACTER_32 ASCII character type: " + ({CHARACTER_32}'a').generating_type.out + "%N")
32 print ("CHARACTER_8 ASCII character type: " + ({CHARACTER_8}'a').generating_type.out + "%N")
33 print ("CHARACTER_32 extended ASCII character type: " + ({CHARACTER_32}'').generating_type.out + "%N")
34 print ("CHARACTER_8 extended ASCII character type: " + ({CHARACTER_8}'').generating_type.out + "%N")
35 print ("CHARACTER_32 manifest: " + ('%/35797/').generating_type.out + " " + (('%/35797/').code = 35797).out + "%N")
36
37 -- Constants
38 print ("CHARACTER_8 constant: " + char_8.generating_type.out + " " + (char_8.code = 97).out + "%N")
39 print ("CHARACTER_8 constant: " + char1_8.generating_type.out + " " + (char1_8.code = 233).out + "%N")
40 print ("CHARACTER_32 constant: " + char2_32.generating_type.out + " " + (char2_32.code = 233).out + "%N")
41 print ("CHARACTER_32 constant: " + char3_32.generating_type.out + " " + (char3_32.code = 35797).out + "%N")
42 end
43
44 test_string_32
45 local
46 l_pass: BOOLEAN
47 l_str: STRING_32
48 do
49 l_pass :=
50 str32_1.item (1).code = 0xE6 and then
51 str32_1.item (2).code = 0xB5 and then
52 str32_1.item (3).code = 0x8B and then
53 str32_1.item (4).code = 0xE8 and then
54 str32_1.item (5).code = 0xAF and then
55 str32_1.item (6).code = 0x95 and then
56 str32_1.count = 6
57 print ("STRING_32 constants test 1: " + l_pass.out + "%N")
58
59 l_pass :=
60 str32_2.item (1).code = 27979 and then
61 str32_2.item (2).code = 35797 and then
62 str32_2.count = 2
63 print ("STRING_32 constants test 2: " + l_pass.out + "%N")
64
65 l_pass :=
66 str32_3.item (1).code = 0xE6 and then
67 str32_3.item (2).code = 0xB5 and then
68 str32_3.item (3).code = 0x8B and then
69 str32_3.item (4).code = 0xE8 and then
70 str32_3.item (5).code = 0xAF and then
71 str32_3.item (6).code = 0x95 and then
72 str32_3.count = 6
73 print ("STRING_32 constants test 3: " + l_pass.out + "%N")
74
75 l_str := once_str_in_feature
76 l_pass :=
77 l_str.item (1).code = 0xE6 and then
78 l_str.item (2).code = 0xB5 and then
79 l_str.item (3).code = 0x8B and then
80 l_str.item (4).code = 0xE8 and then
81 l_str.item (5).code = 0xAF and then
82 l_str.item (6).code = 0x95 and then
83 l_str.count = 6
84 print ("STRING_32 constants test 4: " + l_pass.out + "%N")
85
86 l_str := str_in_feature
87 l_pass :=
88 l_str.item (1).code = 0xE6 and then
89 l_str.item (2).code = 0xB5 and then
90 l_str.item (3).code = 0x8B and then
91 l_str.item (4).code = 0xE8 and then
92 l_str.item (5).code = 0xAF and then
93 l_str.item (6).code = 0x95 and then
94 l_str.count = 6
95 print ("STRING_32 constants test 5: " + l_pass.out + "%N")
96
97 l_str := str_code_in_feature
98 l_pass :=
99 str32_2.item (1).code = 27979 and then
100 str32_2.item (2).code = 35797 and then
101 str32_2.count = 2
102 print ("STRING_32 constants test 6: " + l_pass.out + "%N")
103 end
104
105 test_string_8
106 local
107 l_pass: BOOLEAN
108 do
109 -- STRING_8
110 l_pass :=
111 str8_1.item (1).code = 0xE6 and then
112 str8_1.item (2).code = 0xB5 and then
113 str8_1.item (3).code = 0x8B and then
114 str8_1.item (4).code = 0xE8 and then
115 str8_1.item (5).code = 0xAF and then
116 str8_1.item (6).code = 0x95 and then
117 str8_1.count = 6
118 print ("STRING_8 constants test 1: " + l_pass.out + "%N")
119
120 l_pass :=
121 str8_3.item (1).code = 0xE6 and then
122 str8_3.item (2).code = 0xB5 and then
123 str8_3.item (3).code = 0x8B and then
124 str8_3.item (4).code = 0xE8 and then
125 str8_3.item (5).code = 0xAF and then
126 str8_3.item (6).code = 0x95 and then
127 str8_3.count = 6
128 print ("STRING_8 constants test 3: " + l_pass.out + "%N")
129 end
130
131 feature -- Comment 测试
132
133 -- 测试
134 -- Comment Test 测试 Comment Test
135
136 feature -- Characters
137
138 char_8: CHARACTER = 'a'
139 char1_8: CHARACTER = ''
140 char2_32: CHARACTER_32 = ''
141 char3_32: CHARACTER_32 = '%/35797/'
142
143 feature -- Strings
144
145 str32_1: STRING_32 = "测试"
146 str32_2: STRING_32 = "%/27979/%/35797/"
147 str32_3: STRING_32 =
148 "[
149 测试
150 ]"
151
152 str8_1: STRING = "测试"
153 str8_3: STRING =
154 "[
155 测试
156 ]"
157
158 -- Conversion
159 str8_4: STRING = "测试"
160 str8_6: STRING =
161 "[
162 测试
163 ]"
164
165 str1: STRING =
166 "[
167 Test 测试 Test.
168 测试
169 ]"
170
171 once_str_in_feature: STRING_32
172 local
173 l_str: STRING_32
174 do
175 l_str := (once {STRING_32} "测试")
176 Result := l_str
177 end
178
179 str_in_feature: STRING_32
180 local
181 l_str: STRING_32
182 do
183 l_str := ({STRING_32} "测试")
184 Result := l_str
185 end
186
187 str_code_in_feature: STRING_32
188 local
189 l_str: STRING_32
190 do
191 l_str := ({STRING_32} "%/27979/%/35797/")
192 Result := l_str
193 end
194
195 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23