/[eiffelstudio]/trunk/eweasel/tests/unicode001/test.e
ViewVC logotype

Contents of /trunk/eweasel/tests/unicode001/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88865 - (show annotations)
Wed Jun 13 05:00:29 2012 UTC (7 years, 7 months ago) by tedf
File size: 2937 byte(s)
Removed code compiler rejects.
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_system_string
18 end
19
20 feature -- Run time
21
22 test_char
23 do
24 print ("Manifest CHARACTER_32: " + (char1.code = 27979).out + "%N")
25 print ("CHARACTER_32 vs ASCII: " + (({CHARACTER_32}'a').code = 97).out + "%N")
26 print ("CHARACTER_32 vs Unicode: " + (({CHARACTER_32}'测').code = 27979).out + "%N")
27 print ("CHARACTER_8 vs ASCII: " + (({CHARACTER_8}'a').code = 97).out + "%N")
28 print ("CHARACTER_32 constant type: " + (char1.generating_type).out + "%N")
29 print ("CHARACTER_8 constant type: " + (char_8.generating_type).out + "%N")
30 print ("Manifest Unicode char type: " + ('测').generating_type.out + "%N")
31 print ("Manifest ASCII char type: " + ('a').generating_type.out + "%N")
32 print ("CHARACTER_32 ASCII character type: " + ({CHARACTER_32}'a').generating_type.out + "%N")
33 print ("CHARACTER_32 typed Unicode character type: " + ({CHARACTER_32}'测').generating_type.out + "%N")
34 print ("CHARACTER_8 typed ASCII character type: " + ({CHARACTER_8}'a').generating_type.out + "%N")
35 end
36
37 test_string_32
38 local
39 l_pass: BOOLEAN
40 l_str: STRING_32
41 do
42 l_pass :=
43 str32_1.item (1).code = 27979 and then
44 str32_1.item (2).code = 35797 and then
45 str32_1.count = 2
46 print ("STRING_32 constants test 1: " + l_pass.out + "%N")
47
48 l_pass :=
49 str32_2.item (1).code = 27979 and then
50 str32_2.item (2).code = 35797 and then
51 str32_2.count = 2
52 print ("STRING_32 constants test 2: " + l_pass.out + "%N")
53
54 l_pass :=
55 str32_3.item (1).code = 27979 and then
56 str32_3.item (2).code = 35797 and then
57 str32_3.count = 2
58 print ("STRING_32 constants test 3: " + l_pass.out + "%N")
59
60 l_str := once_str_in_feature
61 l_pass :=
62 l_str.item (1).code = 27979 and then
63 l_str.item (2).code = 35797 and then
64 l_str.count = 2
65 print ("STRING_32 constants test 4: " + l_pass.out + "%N")
66
67 l_str := str_in_feature
68 l_pass :=
69 l_str.item (1).code = 27979 and then
70 l_str.item (2).code = 35797 and then
71 l_str.count = 2
72 print ("STRING_32 constants test 5: " + l_pass.out + "%N")
73 end
74
75 test_system_string
76 local
77 l_s: SYSTEM_STRING
78 do
79 if {PLATFORM}.is_dotnet then
80 l_s := str32_1
81 l_s := {STRING_32}"测试"
82 l_s := "a"
83 end
84 end
85
86 feature -- Comment 注释测试
87
88 -- 注释测试
89 -- Comment Test 注释测试 Comment Test
90
91 feature -- Characters
92
93 char1: CHARACTER_32 = '测'
94 char_8: CHARACTER = 's'
95
96 feature -- Strings
97
98 str32_1: STRING_32 = "测试"
99 str32_2: STRING_32 = "%/27979/%/35797/"
100 str32_3: STRING_32 =
101 "[
102 测试
103 ]"
104
105 once_str_in_feature: STRING_32
106 local
107 l_str: STRING_32
108 do
109 l_str := (once {STRING_32} "测试")
110 Result := l_str
111 end
112
113 str_in_feature: STRING_32
114 local
115 l_str: STRING_32
116 do
117 l_str := ({STRING_32} "测试")
118 Result := l_str
119 end
120
121 end

Properties

Name Value
svn:eol-style native
svn:keywords author date id revision

  ViewVC Help
Powered by ViewVC 1.1.23