File: testjis0208.rb

package info (click to toggle)
docdiff 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 960 kB
  • sloc: ruby: 13,872; makefile: 92; lisp: 33; sh: 26
file content (38 lines) | stat: -rw-r--r-- 1,051 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'test/unit'
require 'jis0208'
require 'nkf'
require 'iconv'

class TC_JIS0208 < Test::Unit::TestCase
  def setup()
    #
  end

=begin obsolete
  def test_string_to_array()
    jis0208 = JIS0208.new
    expected = [0xe1, 0xa1, 0xa8] # "ɽ"(4129) UTF-8 as array
    # assert_equal(expected, Iconv.iconv("UTF-8", "EUC-JP", "ɽ").to_s)
    assert_equal(expected, jis0208.string_to_array("\xe1\xa1\xa8"))
  end
  def test_array_to_string()
    jis0208 = JIS0208.new
    expected = "\xe1\xa1\xa8" # "ɽ"(4129) in UTF-8 string
    # assert_equal(expected, Iconv.iconv("UTF-8", "EUC-JP", "ɽ").to_s)
    assert_equal(expected, jis0208.array_to_string([0xe1, 0xa1, 0xa8]))
  end
=end
=begin obsolete
  def test_to_value_array()
    expected = [0xe1, 0xa1, 0xa8] # "ɽ"(4129) UTF-8 as array
    assert_equal(expected, "\xe1\xa1\xa8".to_value_array)
  end
  def test_to_binary_string()
    expected = "\xe1\xa1\xa8" # "ɽ"(4129) in UTF-8 string
    assert_equal(expected, [0xe1, 0xa1, 0xa8].to_binary_string)
  end
  def teardown()
    #
  end
=end
end