unf_ext 0.0.8.2.beta-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.github/workflows/unf_ext.yml +43 -0
- data/.gitignore +19 -0
- data/CHANGELOG.md +62 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +37 -0
- data/ext/unf_ext/extconf.rb +50 -0
- data/ext/unf_ext/unf/normalizer.hh +139 -0
- data/ext/unf_ext/unf/table.hh +13617 -0
- data/ext/unf_ext/unf/trie/char_stream.hh +150 -0
- data/ext/unf_ext/unf/trie/node.hh +25 -0
- data/ext/unf_ext/unf/trie/searcher.hh +194 -0
- data/ext/unf_ext/unf/util.hh +24 -0
- data/ext/unf_ext/unf.cc +75 -0
- data/lib/3.1/unf_ext.so +0 -0
- data/lib/unf_ext/version.rb +5 -0
- data/lib/unf_ext.rb +5 -0
- data/test/helper.rb +18 -0
- data/test/normalization-test.txt +112332 -0
- data/test/test_unf_ext.rb +40 -0
- data/unf_ext.gemspec +34 -0
- metadata +157 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
class TestUnf < Test::Unit::TestCase
|
5
|
+
test "raise ArgumentError if an unknown normalization form is given" do
|
6
|
+
normalizer = UNF::Normalizer.new
|
7
|
+
assert_raises(ArgumentError) { normalizer.normalize("が", :nfck) }
|
8
|
+
end
|
9
|
+
|
10
|
+
test "pass all tests bundled with the original unf" do
|
11
|
+
normalizer = UNF::Normalizer.new
|
12
|
+
open(Pathname(__FILE__).dirname + 'normalization-test.txt', 'r:utf-8').each_slice(6) { |lines|
|
13
|
+
flunk "broken test file" if lines.size != 6 || lines.pop !~ /^$/
|
14
|
+
str, nfc, nfd, nfkc, nfkd = lines
|
15
|
+
assert_equal nfd, normalizer.normalize(str, :nfd)
|
16
|
+
assert_equal nfd, normalizer.normalize(nfd, :nfd)
|
17
|
+
assert_equal nfd, normalizer.normalize(nfc, :nfd)
|
18
|
+
assert_equal nfkd, normalizer.normalize(nfkc, :nfd)
|
19
|
+
assert_equal nfkd, normalizer.normalize(nfkc, :nfd)
|
20
|
+
|
21
|
+
assert_equal nfc, normalizer.normalize(str, :nfc)
|
22
|
+
assert_equal nfc, normalizer.normalize(nfd, :nfc)
|
23
|
+
assert_equal nfc, normalizer.normalize(nfc, :nfc)
|
24
|
+
assert_equal nfkc, normalizer.normalize(nfkc, :nfc)
|
25
|
+
assert_equal nfkc, normalizer.normalize(nfkd, :nfc)
|
26
|
+
|
27
|
+
assert_equal nfkd, normalizer.normalize(str, :nfkd)
|
28
|
+
assert_equal nfkd, normalizer.normalize(nfd, :nfkd)
|
29
|
+
assert_equal nfkd, normalizer.normalize(nfc, :nfkd)
|
30
|
+
assert_equal nfkd, normalizer.normalize(nfkc, :nfkd)
|
31
|
+
assert_equal nfkd, normalizer.normalize(nfkd, :nfkd)
|
32
|
+
|
33
|
+
assert_equal nfkc, normalizer.normalize(str, :nfkc)
|
34
|
+
assert_equal nfkc, normalizer.normalize(nfd, :nfkc)
|
35
|
+
assert_equal nfkc, normalizer.normalize(nfc, :nfkc)
|
36
|
+
assert_equal nfkc, normalizer.normalize(nfkc, :nfkc)
|
37
|
+
assert_equal nfkc, normalizer.normalize(nfkd, :nfkc)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
data/unf_ext.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'unf_ext/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "unf_ext"
|
7
|
+
gem.version = UNF::Normalizer::VERSION
|
8
|
+
gem.authors = ["Takeru Ohta", "Akinori MUSHA"]
|
9
|
+
gem.email = ["knu@idaemons.org"]
|
10
|
+
gem.description = %q{Unicode Normalization Form support library for CRuby}
|
11
|
+
gem.summary = %q{Unicode Normalization Form support library for CRuby}
|
12
|
+
gem.homepage = "https://github.com/knu/ruby-unf_ext"
|
13
|
+
gem.licenses = ["MIT"]
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/}).grep(%r{/test_[^/]+\.rb$})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.extensions = ["ext/unf_ext/extconf.rb"]
|
20
|
+
|
21
|
+
gem.extra_rdoc_files = [
|
22
|
+
"LICENSE.txt",
|
23
|
+
"README.md"
|
24
|
+
]
|
25
|
+
|
26
|
+
gem.required_ruby_version = '>= 2.2'
|
27
|
+
|
28
|
+
gem.add_development_dependency("rake", [">= 0.9.2.2"])
|
29
|
+
gem.add_development_dependency("test-unit")
|
30
|
+
gem.add_development_dependency("rdoc", ["> 2.4.2"])
|
31
|
+
gem.add_development_dependency("bundler", [">= 1.2"])
|
32
|
+
gem.add_development_dependency("rake-compiler", [">= 1.1.1"])
|
33
|
+
gem.add_development_dependency("rake-compiler-dock", [">= 1.2.1"])
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unf_ext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8.2.beta
|
5
|
+
platform: x64-mingw-ucrt
|
6
|
+
authors:
|
7
|
+
- Takeru Ohta
|
8
|
+
- Akinori MUSHA
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.9.2.2
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.9.2.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: test-unit
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rdoc
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 2.4.2
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.4.2
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: bundler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.2'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.2'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake-compiler
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.1.1
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 1.1.1
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake-compiler-dock
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.2.1
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.2.1
|
98
|
+
description: Unicode Normalization Form support library for CRuby
|
99
|
+
email:
|
100
|
+
- knu@idaemons.org
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files:
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.md
|
106
|
+
files:
|
107
|
+
- ".document"
|
108
|
+
- ".github/workflows/unf_ext.yml"
|
109
|
+
- ".gitignore"
|
110
|
+
- CHANGELOG.md
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- ext/unf_ext/extconf.rb
|
116
|
+
- ext/unf_ext/unf.cc
|
117
|
+
- ext/unf_ext/unf/normalizer.hh
|
118
|
+
- ext/unf_ext/unf/table.hh
|
119
|
+
- ext/unf_ext/unf/trie/char_stream.hh
|
120
|
+
- ext/unf_ext/unf/trie/node.hh
|
121
|
+
- ext/unf_ext/unf/trie/searcher.hh
|
122
|
+
- ext/unf_ext/unf/util.hh
|
123
|
+
- lib/3.1/unf_ext.so
|
124
|
+
- lib/unf_ext.rb
|
125
|
+
- lib/unf_ext/version.rb
|
126
|
+
- test/helper.rb
|
127
|
+
- test/normalization-test.txt
|
128
|
+
- test/test_unf_ext.rb
|
129
|
+
- unf_ext.gemspec
|
130
|
+
homepage: https://github.com/knu/ruby-unf_ext
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '3.1'
|
143
|
+
- - "<"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 3.2.dev
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 1.3.1
|
151
|
+
requirements: []
|
152
|
+
rubygems_version: 3.3.4
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: Unicode Normalization Form support library for CRuby
|
156
|
+
test_files:
|
157
|
+
- test/test_unf_ext.rb
|