1 | # Test of the \u notation
|
---|
2 |
|
---|
3 | assert('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
|
---|
17 | end
|
---|
18 |
|
---|
19 | assert('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")
|
---|
35 | end
|
---|