Sha256: 31b55f5bd5f03a6b9801907f2856fc9e71fa0e883a7952f2b18321ca6632e106

Contents?: true

Size: 947 Bytes

Versions: 3

Compression:

Stored size: 947 Bytes

Contents

require 'ting'
require 'test/unit'

class TestOddSyllables < Test::Unit::TestCase
  def test_zhuyin_conversion
    pinyin_to_zhuyin = Ting::Converter.new(:hanyu, :numbers, :zhuyin, :marks)
    zhuyin_to_pinyin = Ting::Converter.new(:zhuyin, :marks, :hanyu, :numbers)
    
    # These syllable could not be converted to Zhuyin in Ting 0.9.
    %w(yo1 yai2).each do |pinyin|
      zhuyin = pinyin_to_zhuyin.convert(pinyin)
      pinyin2 = zhuyin_to_pinyin.convert(zhuyin)
      assert_equal pinyin, pinyin2
    end
  end

  def test_wg_conversion
    pinyin_to_wg = Ting::Converter.new(:hanyu, :numbers, :wadegiles, :numbers)
    wg_to_pinyin = Ting::Converter.new(:wadegiles, :numbers, :hanyu, :numbers)
    
    # These syllable could not be converted to Wade-Giles in Ting 0.9.
    %w(yo1 yai2).each do |pinyin|
      wg = pinyin_to_wg.convert(pinyin)
      pinyin2 = wg_to_pinyin.convert(wg)
      assert_equal pinyin, pinyin2
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ting-0.12.0 test/test_odd_syllables.rb
ting-0.11.0 test/test_odd_syllables.rb
ting-0.10.0 test/test_odd_syllables.rb