source: EcnlProtoTool/trunk/mruby-1.2.0/test/t/unicode.rb@ 270

Last change on this file since 270 was 270, checked in by coas-nagasima, 7 years ago

mruby版ECNLプロトタイピング・ツールを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby
File size: 1.0 KB
Line 
1# Test of the \u notation
2
3assert('bare \u notation test') do
4 # Mininum and maximum one byte characters
5 assert_equal("\u0000", "\x00")
6 assert_equal("\u007F", "\x7F")
7
8 # Mininum and maximum two byte characters
9 assert_equal("\u0080", "\xC2\x80")
10 assert_equal("\u07FF", "\xDF\xBF")
11
12 # Mininum and maximum three byte characters
13 assert_equal("\u0800", "\xE0\xA0\x80")
14 assert_equal("\uFFFF", "\xEF\xBF\xBF")
15
16 # Four byte characters require the \U notation
17end
18
19assert('braced \u notation test') do
20 # Mininum and maximum one byte characters
21 assert_equal("\u{0000}", "\x00")
22 assert_equal("\u{007F}", "\x7F")
23
24 # Mininum and maximum two byte characters
25 assert_equal("\u{0080}", "\xC2\x80")
26 assert_equal("\u{07FF}", "\xDF\xBF")
27
28 # Mininum and maximum three byte characters
29 assert_equal("\u{0800}", "\xE0\xA0\x80")
30 assert_equal("\u{FFFF}", "\xEF\xBF\xBF")
31
32 # Mininum and maximum four byte characters
33 assert_equal("\u{10000}", "\xF0\x90\x80\x80")
34 assert_equal("\u{10FFFF}", "\xF4\x8F\xBF\xBF")
35end
Note: See TracBrowser for help on using the repository browser.