Sha256: 6c83dc7698971ddcdae09f41560ec34907343052bace46ed85da8aececde5086

Contents?: true

Size: 1.2 KB

Versions: 20

Compression:

Stored size: 1.2 KB

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'spec_helper'

include TwitterCldr::Normalization

describe Hangul do

  describe ".compose" do
    it 'composes decomposed Hangul syllable without a trailing consonant' do
      Hangul.compose([0x1101, 0x1167]).should == 0xAEF4
    end

    it 'composes decomposed Hangul syllable with a trailing consonant' do
      Hangul.compose([0x1111, 0x1171, 0x11B6]).should == 0xD4DB
    end
  end

  describe ".decompose" do
    it 'decomposes precomposed Hangul syllable without a trailing consonant' do
      Hangul.decompose(0xAEF4).should == [0x1101, 0x1167]
    end

    it 'decomposes precomposed Hangul syllable with a trailing consonant' do
      Hangul.decompose(0xD4DB).should == [0x1111, 0x1171, 0x11B6]
    end
  end

  describe '.hangul_syllable?' do
    it 'returns true for code points from Hangul syllables range' do
      [0xAC00, 0xAC01, 0xBC9F, 0xD7A1, 0xD7A3].map { |code_point| Hangul.hangul_syllable?(code_point).should be_true }
    end

    it 'returns false for other code points' do
      [0xAB, 0xABFF, 0xD7A4, 0xFFCF].map { |code_point| Hangul.hangul_syllable?(code_point).should be_false }
    end
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
twitter_cldr-2.4.3 spec/normalization/hangul_spec.rb
twitter_cldr-3.0.0.beta1 spec/normalization/hangul_spec.rb
twitter_cldr-2.4.2 spec/normalization/hangul_spec.rb
twitter_cldr-2.4.1 spec/normalization/hangul_spec.rb
twitter_cldr-2.4.0 spec/normalization/hangul_spec.rb
twitter_cldr-2.2.0 spec/normalization/hangul_spec.rb
twitter_cldr-2.1.1 spec/normalization/hangul_spec.rb
twitter_cldr-2.1.0 spec/normalization/hangul_spec.rb
twitter_cldr-2.0.2 spec/normalization/hangul_spec.rb
twitter_cldr-2.0.1 spec/normalization/hangul_spec.rb
twitter_cldr-2.0.0 spec/normalization/hangul_spec.rb
twitter_cldr-1.9.1 spec/normalization/hangul_spec.rb
twitter_cldr-1.9.0 spec/normalization/hangul_spec.rb
twitter_cldr-1.8.1 spec/normalization/hangul_spec.rb
twitter_cldr-1.8.0 spec/normalization/hangul_spec.rb
twitter_cldr-1.7.0 spec/normalization/hangul_spec.rb
twitter_cldr-1.6.2 spec/normalization/hangul_spec.rb
twitter_cldr-1.6.1 spec/normalization/hangul_spec.rb
twitter_cldr-1.6.0 spec/normalization/hangul_spec.rb
twitter_cldr-1.5.0 spec/normalization/hangul_spec.rb