sekka 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +22 -0
- data/bin/.gitignore +1 -0
- data/bin/sekka-jisyo +98 -0
- data/bin/sekka-server +83 -0
- data/emacs/http-cookies.el +416 -0
- data/emacs/http-get.el +448 -0
- data/emacs/sekka.el +1069 -0
- data/lib/sekka/alphabet-lib.nnd +59 -0
- data/lib/sekka/approximatesearch.rb +72 -0
- data/lib/sekka/convert-jisyo.nnd +129 -0
- data/lib/sekka/henkan.nnd +464 -0
- data/lib/sekka/jisyo-db.nnd +184 -0
- data/lib/sekka/kvs.rb +135 -0
- data/lib/sekka/roman-lib.nnd +660 -0
- data/lib/sekka/sekkaversion.rb +6 -0
- data/lib/sekka/util.nnd +64 -0
- data/lib/sekka.ru +36 -0
- data/lib/sekkaconfig.rb +62 -0
- data/lib/sekkaserver.rb +127 -0
- data/test/alphabet-lib.nnd +188 -0
- data/test/approximate-bench.nnd +83 -0
- data/test/common.nnd +51 -0
- data/test/henkan-main.nnd +942 -0
- data/test/jisyo.nnd +94 -0
- data/test/roman-lib.nnd +422 -0
- data/test/util.nnd +100 -0
- metadata +223 -0
data/lib/sekka/util.nnd
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
:; #-*- mode: nendo; syntax: scheme -*-;;
|
2
|
+
;;;
|
3
|
+
;;; util.nnd - Sekkaの汎用文字列処理ライブラリ
|
4
|
+
;;;
|
5
|
+
;;; Copyright (c) 2010 Kiyoka Nishiyama <kiyoka@sumibi.org>
|
6
|
+
;;;
|
7
|
+
;;; Redistribution and use in source and binary forms, with or without
|
8
|
+
;;; modification, are permitted provided that the following conditions
|
9
|
+
;;; are met:
|
10
|
+
;;;
|
11
|
+
;;; 1. Redistributions of source code must retain the above copyright
|
12
|
+
;;; notice, this list of conditions and the following disclaimer.
|
13
|
+
;;;
|
14
|
+
;;; 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
;;; notice, this list of conditions and the following disclaimer in the
|
16
|
+
;;; documentation and/or other materials provided with the distribution.
|
17
|
+
;;;
|
18
|
+
;;; 3. Neither the name of the authors nor the names of its contributors
|
19
|
+
;;; may be used to endorse or promote products derived from this
|
20
|
+
;;; software without specific prior written permission.
|
21
|
+
;;;
|
22
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
23
|
+
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
24
|
+
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
25
|
+
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
26
|
+
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
27
|
+
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
28
|
+
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
29
|
+
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
30
|
+
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
31
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
32
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
;;;
|
34
|
+
;;; $Id:
|
35
|
+
;;;
|
36
|
+
(define (string-drop str n)
|
37
|
+
(or (str.slice n (str.size))
|
38
|
+
""))
|
39
|
+
|
40
|
+
;; "string" => (cons "s" "tring")
|
41
|
+
(define (string-split-first-and-rest str)
|
42
|
+
(if (= 0 str.size)
|
43
|
+
(cons "" "")
|
44
|
+
(cons (str.slice 0 1)
|
45
|
+
(str.slice 1 str.size))))
|
46
|
+
|
47
|
+
(define (string-downcase-first str)
|
48
|
+
(let1 _pair (string-split-first-and-rest str)
|
49
|
+
(+ (. (car _pair) downcase)
|
50
|
+
(cdr _pair))))
|
51
|
+
|
52
|
+
(define (split-dict-line line)
|
53
|
+
(if-let1 index (line.index #/[ ]+/)
|
54
|
+
(list (car (to-list (line.split #/[ ]+/)))
|
55
|
+
(. (line.slice index (line.size)) strip))
|
56
|
+
#f))
|
57
|
+
|
58
|
+
(define (take* lst limit)
|
59
|
+
(let1 len (length lst)
|
60
|
+
(if (< len limit)
|
61
|
+
lst
|
62
|
+
(take lst limit))))
|
63
|
+
|
64
|
+
|
data/lib/sekka.ru
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
# sekka.ru - "config file for rack"
|
3
|
+
#
|
4
|
+
# Copyright (c) 2010 Kiyoka Nishiyama <kiyoka@sumibi.org>
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions
|
8
|
+
# are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
#
|
13
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
# notice, this list of conditions and the following disclaimer in the
|
15
|
+
# documentation and/or other materials provided with the distribution.
|
16
|
+
#
|
17
|
+
# 3. Neither the name of the authors nor the names of its contributors
|
18
|
+
# may be used to endorse or promote products derived from this
|
19
|
+
# software without specific prior written permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
27
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
28
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
29
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
30
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
31
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
#
|
33
|
+
# $Id:
|
34
|
+
#
|
35
|
+
require './lib/sekkaserver'
|
36
|
+
run SekkaServer::Server.new
|
data/lib/sekkaconfig.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# sekkaconfig.rb - "a config info class"
|
5
|
+
#
|
6
|
+
# Copyright (c) 2010 Kiyoka Nishiyama <kiyoka@sumibi.org>
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# 1. Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
#
|
15
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
16
|
+
# notice, this list of conditions and the following disclaimer in the
|
17
|
+
# documentation and/or other materials provided with the distribution.
|
18
|
+
#
|
19
|
+
# 3. Neither the name of the authors nor the names of its contributors
|
20
|
+
# may be used to endorse or promote products derived from this
|
21
|
+
# software without specific prior written permission.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
24
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
25
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
26
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
27
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
28
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
29
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
33
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
#
|
35
|
+
# $Id:
|
36
|
+
#
|
37
|
+
require 'singleton'
|
38
|
+
|
39
|
+
module SekkaServer
|
40
|
+
class Config
|
41
|
+
include Singleton
|
42
|
+
|
43
|
+
def self.setup( dictSource, cacheSource = false, listenPort )
|
44
|
+
@@dictSource = dictSource
|
45
|
+
@@cacheSource = cacheSource
|
46
|
+
@@listenPort = listenPort
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.dictSource
|
50
|
+
@@dictSource
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.cacheSource
|
54
|
+
@@cacheSource
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.listenPort
|
58
|
+
@@listenPort
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
data/lib/sekkaserver.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# sekkaserver.rb - "a sekka server"
|
5
|
+
#
|
6
|
+
# Copyright (c) 2010 Kiyoka Nishiyama <kiyoka@sumibi.org>
|
7
|
+
#
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
9
|
+
# modification, are permitted provided that the following conditions
|
10
|
+
# are met:
|
11
|
+
#
|
12
|
+
# 1. Redistributions of source code must retain the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer.
|
14
|
+
#
|
15
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
16
|
+
# notice, this list of conditions and the following disclaimer in the
|
17
|
+
# documentation and/or other materials provided with the distribution.
|
18
|
+
#
|
19
|
+
# 3. Neither the name of the authors nor the names of its contributors
|
20
|
+
# may be used to endorse or promote products derived from this
|
21
|
+
# software without specific prior written permission.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
24
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
25
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
26
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
27
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
28
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
29
|
+
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
33
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
#
|
35
|
+
# $Id:
|
36
|
+
#
|
37
|
+
require 'rack'
|
38
|
+
require 'nendo'
|
39
|
+
require 'eventmachine'
|
40
|
+
require 'syslog'
|
41
|
+
require 'uri'
|
42
|
+
require './lib/sekkaconfig'
|
43
|
+
require './lib/sekka/sekkaversion'
|
44
|
+
|
45
|
+
module SekkaServer
|
46
|
+
class Server
|
47
|
+
def initialize
|
48
|
+
$LOAD_PATH.push( File.dirname(__FILE__) + "/../lib" )
|
49
|
+
@core = Nendo::Core.new()
|
50
|
+
@core.loadInitFile
|
51
|
+
@core.evalStr( "(use debug.syslog)" )
|
52
|
+
@core.evalStr( "(use sekka.henkan)" )
|
53
|
+
@core.evalStr( '(define (writeToString sexp) (write-to-string sexp))' )
|
54
|
+
@core.evalStr( '(export-to-ruby writeToString)' )
|
55
|
+
(@kvs,@cachesv) = @core.openSekkaJisyo( SekkaServer::Config.dictSource,
|
56
|
+
SekkaServer::Config.cacheSource )
|
57
|
+
@queue = EM::Queue.new
|
58
|
+
|
59
|
+
STDERR.puts( "----- Sekka Server Started -----" )
|
60
|
+
STDERR.printf( " version : %s\n", SekkaVersion.version )
|
61
|
+
STDERR.printf( " dict-db : %s\n", SekkaServer::Config.dictSource )
|
62
|
+
STDERR.printf( " memcached: %s\n", SekkaServer::Config.cacheSource )
|
63
|
+
STDERR.printf( " listenPort: %s\n", SekkaServer::Config.listenPort )
|
64
|
+
STDERR.puts( "--------------------------------" )
|
65
|
+
|
66
|
+
begin
|
67
|
+
@thread = Thread.new do
|
68
|
+
Thread.pass
|
69
|
+
EventMachine::run {
|
70
|
+
EventMachine::PeriodicTimer.new( 5 ) do
|
71
|
+
while not @queue.empty?
|
72
|
+
@queue.pop { |word|
|
73
|
+
arr = word.split( /[ ]+/ )
|
74
|
+
userid = arr[0]
|
75
|
+
dictline = arr[1] + " " + arr[2]
|
76
|
+
registered = @core.registerUserJisyo(userid, @kvs, dictline)
|
77
|
+
if registered
|
78
|
+
puts "Info: added to dict userid[" + userid + "] dictline[" + dictline + "]"
|
79
|
+
else
|
80
|
+
puts "Info: ignored (already added) userid[" + userid + "] dictline[" + dictline + "]"
|
81
|
+
end
|
82
|
+
}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
}
|
86
|
+
end
|
87
|
+
@thread.run
|
88
|
+
rescue
|
89
|
+
p $! # => "unhandled exception"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def call(env)
|
94
|
+
req = Rack::Request.new(env)
|
95
|
+
body = case req.request_method
|
96
|
+
when 'POST'
|
97
|
+
userid = URI.decode( req.params['userid'].force_encoding("UTF-8") )
|
98
|
+
format = URI.decode( req.params['format'].force_encoding("UTF-8") )
|
99
|
+
case req.path
|
100
|
+
when "/henkan"
|
101
|
+
_yomi = URI.decode( req.params[ 'yomi'].force_encoding("UTF-8") )
|
102
|
+
_limit = URI.decode( req.params[ 'limit'].force_encoding("UTF-8") )
|
103
|
+
_method = URI.decode( req.params['method'].force_encoding("UTF-8") )
|
104
|
+
@core.writeToString( @core.sekkaHenkan( userid, @kvs, @cachesv, _yomi, _limit.to_i, _method ))
|
105
|
+
when "/kakutei"
|
106
|
+
_key = URI.decode( req.params[ 'key'].force_encoding("UTF-8") )
|
107
|
+
_tango = URI.decode( req.params[ 'tango'].force_encoding("UTF-8") )
|
108
|
+
@core.sekkaKakutei( userid, @kvs, @cachesv, _key, _tango )
|
109
|
+
when "/register"
|
110
|
+
dict = URI.decode( req.params['dict'].force_encoding( "UTF-8" ) ).split( "\n" )
|
111
|
+
dict.each { |x| @queue.push( userid + " " + x ) }
|
112
|
+
sprintf( "register request successful (%s) words", dict.size )
|
113
|
+
else
|
114
|
+
sprintf( "unknown path name. [%s]", req.path )
|
115
|
+
end
|
116
|
+
else
|
117
|
+
"no message."
|
118
|
+
end
|
119
|
+
res = Rack::Response.new { |r|
|
120
|
+
r.status = 200
|
121
|
+
r['Content-Type'] = "text/plain"
|
122
|
+
r.write body
|
123
|
+
}
|
124
|
+
res.finish
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
;;-*- mode: nendo; syntax: scheme -*-
|
2
|
+
;;;
|
3
|
+
;;; roman-lib.nnd - アルファベットライブラリ部のテストスイート
|
4
|
+
;;;
|
5
|
+
;;; Copyright (c) 2010 Kiyoka Nishiyama <kiyoka@sumibi.org>
|
6
|
+
;;;
|
7
|
+
;;; Redistribution and use in source and binary forms, with or without
|
8
|
+
;;; modification, are permitted provided that the following conditions
|
9
|
+
;;; are met:
|
10
|
+
;;;
|
11
|
+
;;; 1. Redistributions of source code must retain the above copyright
|
12
|
+
;;; notice, this list of conditions and the following disclaimer.
|
13
|
+
;;;
|
14
|
+
;;; 2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
;;; notice, this list of conditions and the following disclaimer in the
|
16
|
+
;;; documentation and/or other materials provided with the distribution.
|
17
|
+
;;;
|
18
|
+
;;; 3. Neither the name of the authors nor the names of its contributors
|
19
|
+
;;; may be used to endorse or promote products derived from this
|
20
|
+
;;; software without specific prior written permission.
|
21
|
+
;;;
|
22
|
+
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
23
|
+
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
24
|
+
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
25
|
+
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
26
|
+
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
27
|
+
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
28
|
+
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
29
|
+
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
30
|
+
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
31
|
+
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
32
|
+
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
;;;
|
34
|
+
;;; $Id:
|
35
|
+
;;;
|
36
|
+
(use nendo.test)
|
37
|
+
(use sekka.alphabet-lib)
|
38
|
+
(test-start "alphabet-lib")
|
39
|
+
|
40
|
+
;;===================================================================
|
41
|
+
|
42
|
+
;;-------------------------------------------------------------------
|
43
|
+
(test-section "半角 checker")
|
44
|
+
(test* "半角? 1" #t
|
45
|
+
(is-alphabet-hankaku "abczabcz"))
|
46
|
+
(test* "半角? 2" #t
|
47
|
+
(is-alphabet-hankaku "!}"))
|
48
|
+
(test* "半角? 3" #f
|
49
|
+
(is-alphabet-hankaku "!abcdefg}A"))
|
50
|
+
(test* "半角? 4" #f
|
51
|
+
(is-alphabet-hankaku "abczABCZ"))
|
52
|
+
(test* "半角? 5" #f
|
53
|
+
(is-alphabet-hankaku "漢字"))
|
54
|
+
(test* "半角? 6" #f
|
55
|
+
(is-alphabet-hankaku "ひらがな"))
|
56
|
+
(test* "半角? 7" #f
|
57
|
+
(is-alphabet-hankaku "カタカナ"))
|
58
|
+
|
59
|
+
|
60
|
+
;;-------------------------------------------------------------------
|
61
|
+
(test-section "全角 checker")
|
62
|
+
(test* "全角? 1" #t
|
63
|
+
(is-alphabet-zenkaku "abczABCZ"))
|
64
|
+
(test* "全角? 2" #t
|
65
|
+
(is-alphabet-zenkaku "!}"))
|
66
|
+
(test* "全角? 3" #f
|
67
|
+
(is-alphabet-zenkaku "!A}"))
|
68
|
+
(test* "全角? 4" #f
|
69
|
+
(is-alphabet-zenkaku "AA"))
|
70
|
+
(test* "全角? 4" #f
|
71
|
+
(is-alphabet-zenkaku "!abcdefg}"))
|
72
|
+
(test* "全角? 5" #f
|
73
|
+
(is-alphabet-zenkaku "漢字"))
|
74
|
+
(test* "全角? 6" #f
|
75
|
+
(is-alphabet-zenkaku "ひらがな"))
|
76
|
+
(test* "全角? 7" #f
|
77
|
+
(is-alphabet-zenkaku "カタカナ"))
|
78
|
+
(test* "全角? 8" #f
|
79
|
+
(is-alphabet-zenkaku "漢A字"))
|
80
|
+
(test* "全角? 9" #f
|
81
|
+
(is-alphabet-zenkaku "ひAらがな"))
|
82
|
+
(test* "全角? 10" #f
|
83
|
+
(is-alphabet-zenkaku "カAタカナ"))
|
84
|
+
|
85
|
+
|
86
|
+
;;-------------------------------------------------------------------
|
87
|
+
(test-section "半角 inculde checker")
|
88
|
+
(test* "半角含む? 1" #t
|
89
|
+
(include-alphabet-hankaku "abczabcz"))
|
90
|
+
(test* "半角含む? 2" #t
|
91
|
+
(include-alphabet-hankaku "!}"))
|
92
|
+
(test* "半角含む? 3" #t
|
93
|
+
(include-alphabet-hankaku "!abcdefg}A"))
|
94
|
+
(test* "半角含む? 4" #f
|
95
|
+
(include-alphabet-hankaku "abczABCZ"))
|
96
|
+
(test* "半角含む? 5" #t
|
97
|
+
(include-alphabet-hankaku "abczAABCZ"))
|
98
|
+
(test* "半角含む? 6" #f
|
99
|
+
(include-alphabet-hankaku "漢字"))
|
100
|
+
(test* "半角含む? 7" #f
|
101
|
+
(include-alphabet-hankaku "ひらがな"))
|
102
|
+
(test* "半角含む? 8" #f
|
103
|
+
(include-alphabet-hankaku "カタカナ"))
|
104
|
+
(test* "半角含む? 9" #t
|
105
|
+
(include-alphabet-hankaku "漢A字"))
|
106
|
+
(test* "半角含む? 10" #t
|
107
|
+
(include-alphabet-hankaku "ひAらがな"))
|
108
|
+
(test* "半角含む? 11" #t
|
109
|
+
(include-alphabet-hankaku "カAタカナ"))
|
110
|
+
(test* "半角含む? 12" #t
|
111
|
+
(include-alphabet-hankaku "漢字ひらがなカAタカAナ"))
|
112
|
+
|
113
|
+
|
114
|
+
;;-------------------------------------------------------------------
|
115
|
+
(test-section "全角 include checker")
|
116
|
+
(test* "全角含む? 1" #t
|
117
|
+
(include-alphabet-zenkaku "abczABCZ"))
|
118
|
+
(test* "全角含む? 2" #t
|
119
|
+
(include-alphabet-zenkaku "!}"))
|
120
|
+
(test* "全角含む? 3" #t
|
121
|
+
(include-alphabet-zenkaku "!A}"))
|
122
|
+
(test* "全角含む? 3" #t
|
123
|
+
(include-alphabet-zenkaku "|A}"))
|
124
|
+
(test* "全角含む? 4" #t
|
125
|
+
(include-alphabet-zenkaku "AA"))
|
126
|
+
(test* "全角含む? 5" #f
|
127
|
+
(include-alphabet-zenkaku "!abcdefg}"))
|
128
|
+
(test* "全角含む? 6" #f
|
129
|
+
(include-alphabet-zenkaku "漢字"))
|
130
|
+
(test* "全角含む? 7" #f
|
131
|
+
(include-alphabet-zenkaku "ひらがな"))
|
132
|
+
(test* "全角含む? 8" #f
|
133
|
+
(include-alphabet-zenkaku "カタカナ"))
|
134
|
+
(test* "全角含む? 9" #t
|
135
|
+
(include-alphabet-zenkaku "漢A字"))
|
136
|
+
(test* "全角含む? 10" #t
|
137
|
+
(include-alphabet-zenkaku "ひAらがな"))
|
138
|
+
(test* "全角含む? 11" #t
|
139
|
+
(include-alphabet-zenkaku "カAタカナ"))
|
140
|
+
(test* "全角含む? 12" #t
|
141
|
+
(include-alphabet-zenkaku "漢字ひらがなカAタカAナ"))
|
142
|
+
|
143
|
+
|
144
|
+
;;-------------------------------------------------------------------
|
145
|
+
(test-section "半角->全角")
|
146
|
+
(test* "半角->全角 1"
|
147
|
+
"abczABCZ"
|
148
|
+
(gen-alphabet-han->zen "abczABCZ"))
|
149
|
+
(test* "半角->全角 2"
|
150
|
+
"!}"
|
151
|
+
(gen-alphabet-han->zen "!}"))
|
152
|
+
(test* "半角->全角 3"
|
153
|
+
"!abczABCZ}"
|
154
|
+
(gen-alphabet-han->zen "!abczABCZ}"))
|
155
|
+
(test* "半角->全角 4"
|
156
|
+
"ひAらがな"
|
157
|
+
(gen-alphabet-han->zen "ひAらがな"))
|
158
|
+
(test* "半角->全角 5"
|
159
|
+
"カAタカナ"
|
160
|
+
(gen-alphabet-han->zen "カAタカナ"))
|
161
|
+
(test* "半角->全角 6"
|
162
|
+
"漢字ひらがなカAタカAナ"
|
163
|
+
(gen-alphabet-han->zen "漢字ひらがなカAタカAナ"))
|
164
|
+
|
165
|
+
;;-------------------------------------------------------------------
|
166
|
+
(test-section "全角->半角")
|
167
|
+
(test* "全角->半角 1"
|
168
|
+
"abczABCZ"
|
169
|
+
(gen-alphabet-zen->han "abczABCZ"))
|
170
|
+
(test* "全角->半角 2"
|
171
|
+
"!}"
|
172
|
+
(gen-alphabet-zen->han "!}"))
|
173
|
+
(test* "全角->半角 3"
|
174
|
+
"!abcdefg}"
|
175
|
+
(gen-alphabet-zen->han "!abcdefg}"))
|
176
|
+
(test* "全角->半角 4"
|
177
|
+
"ひAらがな"
|
178
|
+
(gen-alphabet-zen->han "ひAらがな"))
|
179
|
+
(test* "全角->半角 5"
|
180
|
+
"カAタカナ"
|
181
|
+
(gen-alphabet-zen->han "カAタカナ"))
|
182
|
+
(test* "全角->半角 6"
|
183
|
+
"漢字ひらがなカAタカAナ"
|
184
|
+
(gen-alphabet-zen->han "漢字ひらがなカAタカAナ"))
|
185
|
+
|
186
|
+
|
187
|
+
;;===================================================================
|
188
|
+
(test-end)
|