unf 0.2.0.beta1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_unf.rb DELETED
@@ -1,41 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'helper'
3
- require 'pathname'
4
-
5
- class TestUNF < Test::Unit::TestCase
6
- test "raise ArgumentError if an unknown normalization form is given" do
7
- normalizer = UNF::Normalizer.instance
8
- assert_raises(ArgumentError) { normalizer.normalize("が", :nfck) }
9
- end
10
-
11
- test "pass all tests bundled with the original unf" do
12
- normalizer = UNF::Normalizer.instance
13
- open(Pathname(__FILE__).dirname + 'normalization-test.txt', 'r:utf-8').each_slice(6) { |lines|
14
- flunk "broken test file" if lines.size != 6 || lines.pop !~ /^$/
15
- str, nfd, nfc, nfkd, nfkc = lines
16
- assert nfd, normalizer.normalize(str, :nfd)
17
- assert nfd, normalizer.normalize(nfd, :nfd)
18
- assert nfd, normalizer.normalize(nfc, :nfd)
19
- assert nfkd, normalizer.normalize(nfkc, :nfd)
20
- assert nfkd, normalizer.normalize(nfkc, :nfd)
21
-
22
- assert nfc, normalizer.normalize(str, :nfd)
23
- assert nfc, normalizer.normalize(nfd, :nfc)
24
- assert nfc, normalizer.normalize(nfc, :nfc)
25
- assert nfkc, normalizer.normalize(nfkc, :nfc)
26
- assert nfkc, normalizer.normalize(nfkd, :nfc)
27
-
28
- assert nfkd, normalizer.normalize(str, :nfkd)
29
- assert nfkd, normalizer.normalize(nfd, :nfkd)
30
- assert nfkd, normalizer.normalize(nfc, :nfkd)
31
- assert nfkd, normalizer.normalize(nfkc, :nfkd)
32
- assert nfkd, normalizer.normalize(nfkd, :nfkd)
33
-
34
- assert nfkc, normalizer.normalize(str, :nfkc)
35
- assert nfkc, normalizer.normalize(nfd, :nfkc)
36
- assert nfkc, normalizer.normalize(nfc, :nfkc)
37
- assert nfkc, normalizer.normalize(nfkc, :nfkc)
38
- assert nfkc, normalizer.normalize(nfkd, :nfkc)
39
- }
40
- end
41
- end