groonga 0.9.1 → 1.0.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.
Files changed (186) hide show
  1. metadata +38 -227
  2. data/AUTHORS +0 -5
  3. data/NEWS.ja.rdoc +0 -114
  4. data/NEWS.rdoc +0 -116
  5. data/README.ja.rdoc +0 -63
  6. data/README.rdoc +0 -64
  7. data/Rakefile +0 -216
  8. data/benchmark/common.rb +0 -49
  9. data/benchmark/read-write-many-small-items.rb +0 -144
  10. data/benchmark/write-many-small-items.rb +0 -135
  11. data/example/bookmark.rb +0 -161
  12. data/example/index-html.rb +0 -89
  13. data/example/search/config.ru +0 -211
  14. data/example/search/public/css/groonga.css +0 -122
  15. data/ext/.gitignore +0 -2
  16. data/ext/rb-grn-accessor.c +0 -52
  17. data/ext/rb-grn-array-cursor.c +0 -36
  18. data/ext/rb-grn-array.c +0 -210
  19. data/ext/rb-grn-column.c +0 -570
  20. data/ext/rb-grn-context.c +0 -655
  21. data/ext/rb-grn-database.c +0 -415
  22. data/ext/rb-grn-encoding-support.c +0 -64
  23. data/ext/rb-grn-encoding.c +0 -257
  24. data/ext/rb-grn-exception.c +0 -1110
  25. data/ext/rb-grn-expression-builder.c +0 -75
  26. data/ext/rb-grn-expression.c +0 -732
  27. data/ext/rb-grn-fix-size-column.c +0 -166
  28. data/ext/rb-grn-hash-cursor.c +0 -38
  29. data/ext/rb-grn-hash.c +0 -294
  30. data/ext/rb-grn-index-column.c +0 -488
  31. data/ext/rb-grn-logger.c +0 -325
  32. data/ext/rb-grn-object.c +0 -1335
  33. data/ext/rb-grn-operation.c +0 -198
  34. data/ext/rb-grn-patricia-trie-cursor.c +0 -39
  35. data/ext/rb-grn-patricia-trie.c +0 -488
  36. data/ext/rb-grn-procedure.c +0 -52
  37. data/ext/rb-grn-query.c +0 -260
  38. data/ext/rb-grn-record.c +0 -40
  39. data/ext/rb-grn-snippet.c +0 -328
  40. data/ext/rb-grn-table-cursor-key-support.c +0 -69
  41. data/ext/rb-grn-table-cursor.c +0 -246
  42. data/ext/rb-grn-table-key-support.c +0 -731
  43. data/ext/rb-grn-table.c +0 -2038
  44. data/ext/rb-grn-type.c +0 -181
  45. data/ext/rb-grn-utils.c +0 -769
  46. data/ext/rb-grn-variable-size-column.c +0 -36
  47. data/ext/rb-grn-variable.c +0 -108
  48. data/ext/rb-grn.h +0 -684
  49. data/ext/rb-groonga.c +0 -113
  50. data/extconf.rb +0 -216
  51. data/html/bar.svg +0 -153
  52. data/html/developer.html +0 -121
  53. data/html/developer.svg +0 -469
  54. data/html/download.svg +0 -253
  55. data/html/favicon.ico +0 -0
  56. data/html/favicon.xcf +0 -0
  57. data/html/footer.html.erb +0 -28
  58. data/html/head.html.erb +0 -4
  59. data/html/header.html.erb +0 -17
  60. data/html/index.html +0 -147
  61. data/html/install.svg +0 -636
  62. data/html/logo.xcf +0 -0
  63. data/html/ranguba.css +0 -248
  64. data/html/tutorial.svg +0 -559
  65. data/lib/groonga.rb +0 -83
  66. data/lib/groonga/expression-builder.rb +0 -285
  67. data/lib/groonga/patricia-trie.rb +0 -53
  68. data/lib/groonga/record.rb +0 -276
  69. data/lib/groonga/schema.rb +0 -916
  70. data/license/GPL +0 -340
  71. data/license/LGPL +0 -504
  72. data/license/RUBY +0 -59
  73. data/misc/grnop2ruby.rb +0 -49
  74. data/pkg-config.rb +0 -333
  75. data/src/rb-grn-table-cursor.c +0 -296
  76. data/test-unit/Rakefile +0 -40
  77. data/test-unit/TODO +0 -5
  78. data/test-unit/bin/testrb +0 -5
  79. data/test-unit/html/classic.html +0 -15
  80. data/test-unit/html/index.html +0 -25
  81. data/test-unit/html/index.html.ja +0 -27
  82. data/test-unit/lib/test/unit.rb +0 -323
  83. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  84. data/test-unit/lib/test/unit/assertions.rb +0 -1230
  85. data/test-unit/lib/test/unit/attribute.rb +0 -125
  86. data/test-unit/lib/test/unit/autorunner.rb +0 -353
  87. data/test-unit/lib/test/unit/collector.rb +0 -36
  88. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  89. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  90. data/test-unit/lib/test/unit/collector/load.rb +0 -136
  91. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  92. data/test-unit/lib/test/unit/color-scheme.rb +0 -102
  93. data/test-unit/lib/test/unit/color.rb +0 -96
  94. data/test-unit/lib/test/unit/diff.rb +0 -724
  95. data/test-unit/lib/test/unit/error.rb +0 -130
  96. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  97. data/test-unit/lib/test/unit/failure.rb +0 -136
  98. data/test-unit/lib/test/unit/fixture.rb +0 -176
  99. data/test-unit/lib/test/unit/notification.rb +0 -129
  100. data/test-unit/lib/test/unit/omission.rb +0 -191
  101. data/test-unit/lib/test/unit/pending.rb +0 -150
  102. data/test-unit/lib/test/unit/priority.rb +0 -181
  103. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  104. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  105. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  106. data/test-unit/lib/test/unit/testcase.rb +0 -476
  107. data/test-unit/lib/test/unit/testresult.rb +0 -89
  108. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  109. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  110. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -464
  111. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  112. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
  113. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
  114. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  115. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  116. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  117. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  118. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  119. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  120. data/test-unit/lib/test/unit/version.rb +0 -7
  121. data/test-unit/sample/adder.rb +0 -13
  122. data/test-unit/sample/subtracter.rb +0 -12
  123. data/test-unit/sample/test_adder.rb +0 -20
  124. data/test-unit/sample/test_subtracter.rb +0 -20
  125. data/test-unit/sample/test_user.rb +0 -23
  126. data/test-unit/test/collector/test-descendant.rb +0 -133
  127. data/test-unit/test/collector/test-load.rb +0 -329
  128. data/test-unit/test/collector/test_dir.rb +0 -406
  129. data/test-unit/test/collector/test_objectspace.rb +0 -100
  130. data/test-unit/test/run-test.rb +0 -15
  131. data/test-unit/test/test-attribute.rb +0 -86
  132. data/test-unit/test/test-color-scheme.rb +0 -67
  133. data/test-unit/test/test-color.rb +0 -47
  134. data/test-unit/test/test-diff.rb +0 -518
  135. data/test-unit/test/test-emacs-runner.rb +0 -60
  136. data/test-unit/test/test-fixture.rb +0 -287
  137. data/test-unit/test/test-notification.rb +0 -33
  138. data/test-unit/test/test-omission.rb +0 -81
  139. data/test-unit/test/test-pending.rb +0 -70
  140. data/test-unit/test/test-priority.rb +0 -119
  141. data/test-unit/test/test-testcase.rb +0 -554
  142. data/test-unit/test/test_assertions.rb +0 -1151
  143. data/test-unit/test/test_error.rb +0 -26
  144. data/test-unit/test/test_failure.rb +0 -33
  145. data/test-unit/test/test_testresult.rb +0 -113
  146. data/test-unit/test/test_testsuite.rb +0 -129
  147. data/test-unit/test/testunit-test-util.rb +0 -14
  148. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  149. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  150. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  151. data/test-unit/test/util/test_observable.rb +0 -102
  152. data/test-unit/test/util/test_procwrapper.rb +0 -36
  153. data/test/.gitignore +0 -1
  154. data/test/groonga-test-utils.rb +0 -106
  155. data/test/run-test.rb +0 -58
  156. data/test/test-array.rb +0 -97
  157. data/test/test-column.rb +0 -298
  158. data/test/test-context.rb +0 -73
  159. data/test/test-database.rb +0 -113
  160. data/test/test-encoding.rb +0 -33
  161. data/test/test-exception.rb +0 -93
  162. data/test/test-expression-builder.rb +0 -156
  163. data/test/test-expression.rb +0 -133
  164. data/test/test-fix-size-column.rb +0 -65
  165. data/test/test-gqtp.rb +0 -70
  166. data/test/test-hash.rb +0 -312
  167. data/test/test-index-column.rb +0 -81
  168. data/test/test-patricia-trie.rb +0 -189
  169. data/test/test-procedure.rb +0 -37
  170. data/test/test-query.rb +0 -22
  171. data/test/test-record.rb +0 -268
  172. data/test/test-remote.rb +0 -53
  173. data/test/test-schema.rb +0 -416
  174. data/test/test-snippet.rb +0 -121
  175. data/test/test-table-cursor.rb +0 -153
  176. data/test/test-table-offset-and-limit.rb +0 -102
  177. data/test/test-table-select-normalize.rb +0 -48
  178. data/test/test-table-select.rb +0 -145
  179. data/test/test-table.rb +0 -642
  180. data/test/test-type.rb +0 -61
  181. data/test/test-variable-size-column.rb +0 -98
  182. data/test/test-variable.rb +0 -28
  183. data/test/test-vector-column.rb +0 -76
  184. data/test/test-version.rb +0 -31
  185. data/text/TUTORIAL.ja.rdoc +0 -392
  186. data/text/expression.rdoc +0 -284
data/test/test-context.rb DELETED
@@ -1,73 +0,0 @@
1
- # Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
2
- #
3
- # This library is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU Lesser General Public
5
- # License version 2.1 as published by the Free Software Foundation.
6
- #
7
- # This library is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
- # Lesser General Public License for more details.
11
- #
12
- # You should have received a copy of the GNU Lesser General Public
13
- # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
-
16
- class ContextTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- def test_default
20
- context = Groonga::Context.default
21
- assert_equal(Groonga::Encoding.default, context.encoding)
22
- end
23
-
24
- def test_default_options
25
- Groonga::Context.default_options = {
26
- :encoding => :utf8,
27
- }
28
- context = Groonga::Context.default
29
- assert_equal(Groonga::Encoding::UTF8, context.encoding)
30
- end
31
-
32
- def test_encoding
33
- context = Groonga::Context.new
34
- assert_equal(Groonga::Encoding.default, context.encoding)
35
-
36
- context = Groonga::Context.new(:encoding => :utf8)
37
- assert_equal(Groonga::Encoding::UTF8, context.encoding)
38
- end
39
-
40
- def test_inspect
41
- context = Groonga::Context.new(:encoding => Groonga::Encoding::UTF8)
42
- assert_equal("#<Groonga::Context " +
43
- "encoding: <:utf8>, " +
44
- "database: <nil>>",
45
- context.inspect)
46
- end
47
-
48
- def test_inspect_with_database
49
- db = Groonga::Database.create
50
- context = Groonga::Context.default
51
- assert_equal("#<Groonga::Context " +
52
- "encoding: <#{Groonga::Encoding.default.inspect}>, " +
53
- "database: <#{db.inspect}>>",
54
- context.inspect)
55
- end
56
-
57
- def test_array_reference_by_string
58
- Groonga::Database.create
59
- context = Groonga::Context.default
60
- assert_equal("Int32", context["<int>"].name)
61
- end
62
-
63
- def test_array_reference_by_symbol
64
- Groonga::Database.create
65
- context = Groonga::Context.default
66
- assert_equal("Bool", context[:Bool].name)
67
- end
68
-
69
- def test_shortcut_access
70
- Groonga::Database.create
71
- assert_equal("ShortText", Groonga["ShortText"].name)
72
- end
73
- end
@@ -1,113 +0,0 @@
1
- # Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
2
- #
3
- # This library is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU Lesser General Public
5
- # License version 2.1 as published by the Free Software Foundation.
6
- #
7
- # This library is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
- # Lesser General Public License for more details.
11
- #
12
- # You should have received a copy of the GNU Lesser General Public
13
- # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
-
16
- class DatabaseTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- def test_create
20
- assert_nil(Groonga::Context.default.database)
21
-
22
- db_path = @tmp_dir + "db"
23
- assert_not_predicate(db_path, :exist?)
24
- database = Groonga::Database.create(:path => db_path.to_s)
25
- assert_predicate(db_path, :exist?)
26
- assert_not_predicate(database, :closed?)
27
-
28
- assert_equal(database, Groonga::Context.default.database)
29
- end
30
-
31
- def test_temporary
32
- before_files = @tmp_dir.children
33
- database = Groonga::Database.create
34
- assert_nil(database.name)
35
- assert_equal(before_files, @tmp_dir.children)
36
- end
37
-
38
- def test_open
39
- db_path = @tmp_dir + "db"
40
- database = Groonga::Database.create(:path => db_path.to_s)
41
-
42
- called = false
43
- Groonga::Database.open(db_path.to_s) do |_database|
44
- database = _database
45
- assert_not_predicate(database, :closed?)
46
- called = true
47
- end
48
- assert_true(called)
49
- assert_predicate(database, :closed?)
50
- end
51
-
52
- def test_new
53
- db_path = @tmp_dir + "db"
54
- assert_raise(Groonga::NoMemoryAvailable) do
55
- Groonga::Database.new(db_path.to_s)
56
- end
57
-
58
- database = Groonga::Database.create(:path => db_path.to_s)
59
-
60
- assert_not_predicate(Groonga::Database.new(db_path.to_s), :closed?)
61
- end
62
-
63
- def test_each
64
- db_path = @tmp_dir + "db"
65
- database = Groonga::Database.create(:path => db_path.to_s)
66
- default_object_names = database.collect {|object| object.name}.sort
67
- assert_send([default_object_names, :include?, "Bool"])
68
- end
69
-
70
- def test_encoding
71
- assert_equal(Groonga::Encoding.default,
72
- Groonga::Database.create.encoding)
73
- end
74
-
75
- def test_lock
76
- database = Groonga::Database.create
77
-
78
- assert_not_predicate(database, :locked?)
79
- database.lock
80
- assert_predicate(database, :locked?)
81
- database.unlock
82
- assert_not_predicate(database, :locked?)
83
- end
84
-
85
- def test_lock_failed
86
- database = Groonga::Database.create
87
-
88
- database.lock
89
- assert_raise(Groonga::ResourceDeadlockAvoided) do
90
- database.lock
91
- end
92
- end
93
-
94
- def test_lock_block
95
- database = Groonga::Database.create
96
-
97
- assert_not_predicate(database, :locked?)
98
- database.lock do
99
- assert_predicate(database, :locked?)
100
- end
101
- assert_not_predicate(database, :locked?)
102
- end
103
-
104
- def test_clear_lock
105
- database = Groonga::Database.create
106
-
107
- assert_not_predicate(database, :locked?)
108
- database.lock
109
- assert_predicate(database, :locked?)
110
- database.clear_lock
111
- assert_not_predicate(database, :locked?)
112
- end
113
- end
@@ -1,33 +0,0 @@
1
- # Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
2
- #
3
- # This library is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU Lesser General Public
5
- # License version 2.1 as published by the Free Software Foundation.
6
- #
7
- # This library is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
- # Lesser General Public License for more details.
11
- #
12
- # You should have received a copy of the GNU Lesser General Public
13
- # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
-
16
- class EncodingTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- def test_constants
20
- assert_equal(:default, Groonga::Encoding::DEFAULT)
21
- assert_equal(:none, Groonga::Encoding::NONE)
22
- assert_equal(:euc_jp, Groonga::Encoding::EUC_JP)
23
- assert_equal(:sjis, Groonga::Encoding::SJIS)
24
- assert_equal(:utf8, Groonga::Encoding::UTF8)
25
- assert_equal(:latin1, Groonga::Encoding::LATIN1)
26
- assert_equal(:koi8r, Groonga::Encoding::KOI8R)
27
- end
28
-
29
- def test_default
30
- Groonga::Encoding.default = :utf8
31
- assert_equal(:utf8, Groonga::Encoding.default)
32
- end
33
- end
@@ -1,93 +0,0 @@
1
- # Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com>
2
- #
3
- # This library is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU Lesser General Public
5
- # License version 2.1 as published by the Free Software Foundation.
6
- #
7
- # This library is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
- # Lesser General Public License for more details.
11
- #
12
- # You should have received a copy of the GNU Lesser General Public
13
- # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
-
16
- class ExceptionTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- def test_defined
20
- assert_not_const_defined(Groonga, :Success)
21
-
22
- assert_const_defined(Groonga, :Error)
23
- assert_const_defined(Groonga, :ObjectClosed)
24
-
25
- assert_const_defined(Groonga, :EndOfData)
26
- assert_const_defined(Groonga, :UnknownError)
27
- assert_const_defined(Groonga, :OperationNotPermitted)
28
- assert_const_defined(Groonga, :NoSuchFileOrDirectory)
29
- assert_const_defined(Groonga, :NoSuchProcess)
30
- assert_const_defined(Groonga, :InterruptedFunctionCall)
31
- assert_const_defined(Groonga, :InputOutputError)
32
- assert_const_defined(Groonga, :NoSuchDeviceOrAddress)
33
- assert_const_defined(Groonga, :ArgumentListTooLong)
34
- assert_const_defined(Groonga, :ExecFormatError)
35
- assert_const_defined(Groonga, :BadFileDescriptor)
36
- assert_const_defined(Groonga, :NoChildProcesses)
37
- assert_const_defined(Groonga, :ResourceTemporarilyUnavailable)
38
- assert_const_defined(Groonga, :NotEnoughSpace)
39
- assert_const_defined(Groonga, :PermissionDenied)
40
- assert_const_defined(Groonga, :BadAddress)
41
- assert_const_defined(Groonga, :ResourceBusy)
42
- assert_const_defined(Groonga, :FileExists)
43
- assert_const_defined(Groonga, :ImproperLink)
44
- assert_const_defined(Groonga, :NoSuchDevice)
45
- assert_const_defined(Groonga, :NotADirectory)
46
- assert_const_defined(Groonga, :IsADirectory)
47
- assert_const_defined(Groonga, :InvalidArgument)
48
- assert_const_defined(Groonga, :TooManyOpenFilesInSystem)
49
- assert_const_defined(Groonga, :TooManyOpenFiles)
50
- assert_const_defined(Groonga, :InappropriateIOControlOperation)
51
- assert_const_defined(Groonga, :FileTooLarge)
52
- assert_const_defined(Groonga, :NoSpaceLeftOnDevice)
53
- assert_const_defined(Groonga, :InvalidSeek)
54
- assert_const_defined(Groonga, :ReadOnlyFileSystem)
55
- assert_const_defined(Groonga, :TooManyLinks)
56
- assert_const_defined(Groonga, :BrokenPipe)
57
- assert_const_defined(Groonga, :DomainError)
58
- assert_const_defined(Groonga, :ResultTooLarge)
59
- assert_const_defined(Groonga, :ResourceDeadlockAvoided)
60
- assert_const_defined(Groonga, :NoMemoryAvailable)
61
- assert_const_defined(Groonga, :FilenameTooLong)
62
- assert_const_defined(Groonga, :NoLocksAvailable)
63
- assert_const_defined(Groonga, :FunctionNotImplemented)
64
- assert_const_defined(Groonga, :DirectoryNotEmpty)
65
- assert_const_defined(Groonga, :IllegalByteSequence)
66
- assert_const_defined(Groonga, :SocketNotInitialized)
67
- assert_const_defined(Groonga, :OperationWouldBlock)
68
- assert_const_defined(Groonga, :AddressIsNotAvailable)
69
- assert_const_defined(Groonga, :NetworkIsDown)
70
- assert_const_defined(Groonga, :NoBuffer)
71
- assert_const_defined(Groonga, :SocketIsAlreadyConnected)
72
- assert_const_defined(Groonga, :SocketIsNotConnected)
73
- assert_const_defined(Groonga, :SocketIsAlreadyShutdowned)
74
- assert_const_defined(Groonga, :OperationTimeout)
75
- assert_const_defined(Groonga, :ConnectionRefused)
76
- assert_const_defined(Groonga, :RangeError)
77
- assert_const_defined(Groonga, :TokenizerError)
78
- assert_const_defined(Groonga, :FileCorrupt)
79
- assert_const_defined(Groonga, :InvalidFormat)
80
- assert_const_defined(Groonga, :ObjectCorrupt)
81
- assert_const_defined(Groonga, :TooManySymbolicLinks)
82
- assert_const_defined(Groonga, :NotSocket)
83
- assert_const_defined(Groonga, :OperationNotSupported)
84
- assert_const_defined(Groonga, :AddressIsInUse)
85
- assert_const_defined(Groonga, :ZLibError)
86
- assert_const_defined(Groonga, :LZOError)
87
- assert_const_defined(Groonga, :StackOverFlow)
88
- assert_const_defined(Groonga, :SyntaxError)
89
- assert_const_defined(Groonga, :RetryMax)
90
- assert_const_defined(Groonga, :IncompatibleFileFormat)
91
- assert_const_defined(Groonga, :UpdateNotAllowed)
92
- end
93
- end
@@ -1,156 +0,0 @@
1
- # Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
2
- #
3
- # This library is free software; you can redistribute it and/or
4
- # modify it under the terms of the GNU Lesser General Public
5
- # License version 2.1 as published by the Free Software Foundation.
6
- #
7
- # This library is distributed in the hope that it will be useful,
8
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
- # Lesser General Public License for more details.
11
- #
12
- # You should have received a copy of the GNU Lesser General Public
13
- # License along with this library; if not, write to the Free Software
14
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
-
16
- class ExpressionBuilderTest < Test::Unit::TestCase
17
- include GroongaTestUtils
18
-
19
- setup :setup_database
20
- setup :setup_tables
21
- setup :setup_data
22
-
23
- def setup_tables
24
- @users = Groonga::Hash.create(:name => "Users")
25
- @name = @users.define_column("name", "ShortText")
26
- @hp = @users.define_column("hp", "UInt32")
27
-
28
- @terms = Groonga::PatriciaTrie.create(:name => "Terms",
29
- :default_tokenizer => "TokenBigram")
30
- @terms.define_index_column("user-name", @users, :source => @name)
31
-
32
- @bookmarks = Groonga::Array.create(:name => "Bookmarks")
33
- @bookmarks.define_column("user", @users)
34
- @bookmarks.define_column("uri", "ShortText")
35
- end
36
-
37
- def setup_data
38
- @morita = @users.add("morita",
39
- :name => "mori daijiro",
40
- :hp => 100)
41
- @gunyara_kun = @users.add("gunyara-kun",
42
- :name => "Tasuku SUENAGA",
43
- :hp => 150)
44
- @yu = @users.add("yu",
45
- :name => "Yutaro Shimamura",
46
- :hp => 200)
47
-
48
- @groonga = @bookmarks.add(:user => @morita, :uri => "http://groonga.org/")
49
- @ruby = @bookmarks.add(:user => @morita, :uri => "http://ruby-lang.org/")
50
- @nico_dict = @bookmarks.add(:user => @gunyara_kun,
51
- :uri => "http://dic.nicovideo.jp/")
52
- end
53
-
54
- def test_equal
55
- result = @users.select do |record|
56
- record["name"] == "mori daijiro"
57
- end
58
- assert_equal(["morita"],
59
- result.collect {|record| record.key.key})
60
- end
61
-
62
- def test_not_equal
63
- omit("not supported yet!!!")
64
- result = @users.select do |record|
65
- record["name"] != "mori daijiro"
66
- end
67
- assert_equal(["gunyara-kun", "yu"],
68
- result.collect {|record| record.key.key})
69
- end
70
-
71
- def test_less
72
- result = @users.select do |record|
73
- record["hp"] < 150
74
- end
75
- assert_equal(["morita"], result.collect {|record| record.key.key})
76
- end
77
-
78
- def test_less_equal
79
- result = @users.select do |record|
80
- record["hp"] <= 150
81
- end
82
- assert_equal(["morita", "gunyara-kun"],
83
- result.collect {|record| record.key.key})
84
- end
85
-
86
- def test_greater
87
- result = @users.select do |record|
88
- record["hp"] > 150
89
- end
90
- assert_equal(["yu"], result.collect {|record| record.key.key})
91
- end
92
-
93
- def test_greater_equal
94
- result = @users.select do |record|
95
- record["hp"] >= 150
96
- end
97
- assert_equal(["gunyara-kun", "yu"],
98
- result.collect {|record| record.key.key})
99
- end
100
-
101
- def test_and
102
- result = @users.select do |record|
103
- (record["hp"] > 100) & (record["hp"] <= 200)
104
- end
105
- assert_equal(["gunyara-kun", "yu"],
106
- result.collect {|record| record.key.key})
107
- end
108
-
109
- def test_match
110
- result = @users.select do |record|
111
- record["name"] =~ "ro"
112
- end
113
- assert_equal(["morita", "yu"],
114
- result.collect {|record| record.key.key})
115
- end
116
-
117
- def test_query_string
118
- result = @users.select("name:%ro")
119
- assert_equal(["morita", "yu"],
120
- result.collect {|record| record.key.key})
121
- end
122
-
123
- def test_record
124
- result = @bookmarks.select do |record|
125
- record["user"] == @morita
126
- end
127
- assert_equal(["http://groonga.org/", "http://ruby-lang.org/"],
128
- result.collect {|record| record.key["uri"]})
129
- end
130
-
131
- def test_record_id
132
- result = @bookmarks.select do |record|
133
- record["user"] == @morita.id
134
- end
135
- assert_equal(["http://groonga.org/", "http://ruby-lang.org/"],
136
- result.collect {|record| record.key["uri"]})
137
- end
138
-
139
- def test_nested_column
140
- result = @bookmarks.select do |record|
141
- record[".user.name"] == @morita["name"]
142
- end
143
- assert_equal(["http://groonga.org/", "http://ruby-lang.org/"],
144
- result.collect {|record| record.key["uri"]})
145
- end
146
-
147
- def test_nil_match
148
- @users.select do |record|
149
- exception = ArgumentError.new("match word should not be nil: Users.name")
150
- assert_raise(exception) do
151
- record["name"] =~ nil
152
- end
153
- record["name"] == "dummy"
154
- end
155
- end
156
- end