rroonga 6.0.0 → 6.0.2

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.
@@ -186,6 +186,19 @@ class ExpressionBuilderTest < Test::Unit::TestCase
186
186
  result.collect {|record| record.key.key})
187
187
  end
188
188
 
189
+ def test_and_array_nested
190
+ result = @users.select do |record|
191
+ conditions = []
192
+ conditions << [(record.hp > 100)]
193
+ conditions << []
194
+ conditions << [[[(record.hp < 200)]]]
195
+ conditions << [[]]
196
+ conditions
197
+ end
198
+ assert_equal(["gunyara-kun"],
199
+ result.collect {|record| record.key.key})
200
+ end
201
+
189
202
  def test_or
190
203
  result = @users.select do |record|
191
204
  (record["hp"] == 150) | (record["hp"] > 150)
@@ -675,7 +688,6 @@ EOC
675
688
  end
676
689
 
677
690
  def test_search
678
- omit("TODO: Enable me when Groonga 6.0.1 is released.")
679
691
  result = @tags.select do |record|
680
692
  record.key.fuzzy_search("Toym", :with_transposition => true)
681
693
  end
data/test/test-hash.rb CHANGED
@@ -1,7 +1,5 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
1
  # Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
4
- # Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
2
+ # Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
5
3
  #
6
4
  # This library is free software; you can redistribute it and/or
7
5
  # modify it under the terms of the GNU Lesser General Public
@@ -443,4 +441,25 @@ class HashTest < Test::Unit::TestCase
443
441
  user_names = users.each.collect(&:key)
444
442
  assert_equal(["Alice", "Bob", "Carl"], user_names)
445
443
  end
444
+
445
+ class KeyLargeTest < self
446
+ def test_default
447
+ paths = Groonga::Hash.create(:name => "Paths",
448
+ :key_type => "ShortText")
449
+ inspected = context.execute_command("object_inspect",
450
+ :name => paths.name)
451
+ assert_equal((4 * 1024 * 1024 * 1024) - 1,
452
+ inspected.body["key"]["max_total_size"])
453
+ end
454
+
455
+ def test_enable
456
+ paths = Groonga::Hash.create(:name => "Paths",
457
+ :key_type => "ShortText",
458
+ :key_large => true)
459
+ inspected = context.execute_command("object_inspect",
460
+ :name => paths.name)
461
+ assert_equal((1 * 1024 * 1024 * 1024 * 1024) - 1,
462
+ inspected.body["key"]["max_total_size"])
463
+ end
464
+ end
446
465
  end
@@ -0,0 +1,46 @@
1
+ # Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
+
16
+ class RequestCancelerTest < Test::Unit::TestCase
17
+ include GroongaTestUtils
18
+
19
+ def setup
20
+ @request_id = "request-29"
21
+ end
22
+
23
+ def teardown
24
+ Groonga::RequestCanceler.unregister(@request_id)
25
+ end
26
+
27
+ def test_cancel
28
+ assert do
29
+ not Groonga::RequestCanceler.cancel(@request_id)
30
+ end
31
+ Groonga::RequestCanceler.register(@request_id)
32
+ assert do
33
+ Groonga::RequestCanceler.cancel(@request_id)
34
+ end
35
+ end
36
+
37
+ def test_cancel_all
38
+ assert do
39
+ not Groonga::RequestCanceler.cancel_all
40
+ end
41
+ Groonga::RequestCanceler.register(@request_id)
42
+ assert do
43
+ Groonga::RequestCanceler.cancel_all
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,40 @@
1
+ # Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
+
16
+ class RequestTimerTest < Test::Unit::TestCase
17
+ include GroongaTestUtils
18
+
19
+ def setup
20
+ @request_id = "request-29"
21
+ @timeout = 2.9
22
+ end
23
+
24
+ def teardown
25
+ end
26
+
27
+ def test_register
28
+ timer_id = Groonga::RequestTimer.register(@request_id, @timeout)
29
+ assert do
30
+ timer_id.is_a?(Groonga::RequestTimerID)
31
+ end
32
+ Groonga::RequestTimer.unregister(timer_id)
33
+ end
34
+
35
+ def test_deafult_timeout
36
+ assert_in_delta(0.0, Groonga::RequestTimer.default_timeout, 0.01)
37
+ Groonga::RequestTimer.default_timeout = @timeout
38
+ assert_in_delta(@timeout, Groonga::RequestTimer.default_timeout, 0.01)
39
+ end
40
+ end
data/test/test-table.rb CHANGED
@@ -302,13 +302,49 @@ class TableTest < Test::Unit::TestCase
302
302
  end
303
303
  end
304
304
 
305
- def test_remove
306
- bookmarks_path = @tables_dir + "bookmarks"
307
- bookmarks = Groonga::Array.create(:name => "Bookmarks",
308
- :path => bookmarks_path.to_s)
309
- assert_predicate(bookmarks_path, :exist?)
310
- bookmarks.remove
311
- assert_not_predicate(bookmarks_path, :exist?)
305
+ class RemoveTest < self
306
+ def test_default
307
+ bookmarks_path = @tables_dir + "bookmarks"
308
+ bookmarks = Groonga::Array.create(:name => "Bookmarks",
309
+ :path => bookmarks_path.to_s)
310
+ assert_predicate(bookmarks_path, :exist?)
311
+ bookmarks.remove
312
+ assert_not_predicate(bookmarks_path, :exist?)
313
+ end
314
+
315
+ def test_dependent
316
+ names_path = @tables_dir + "names"
317
+ names = Groonga::Hash.create(:name => "Names",
318
+ :path => names_path.to_s,
319
+ :key_type => "ShortText")
320
+ users_path = @tables_dir + "users"
321
+ Groonga::Hash.create(:name => "Users",
322
+ :path => users_path.to_s,
323
+ :key_type => "Names")
324
+ administrators_path = @tables_dir + "administrators"
325
+ Groonga::Hash.create(:name => "Administrator",
326
+ :path => administrators_path.to_s,
327
+ :key_type => "Names")
328
+ members_path = @tables_dir + "members"
329
+ members = Groonga::Hash.create(:name => "Members",
330
+ :path => members_path.to_s,
331
+ :key_type => "ShortText")
332
+ members_name_path = @columns_dir + "name"
333
+ members.define_column("name", "Names",
334
+ :path => members_name_path.to_s)
335
+
336
+ assert {names_path.exist?}
337
+ assert {users_path.exist?}
338
+ assert {administrators_path.exist?}
339
+ assert {members_path.exist?}
340
+ assert {members_name_path.exist?}
341
+ names.remove(:dependent => true)
342
+ assert {not names_path.exist?}
343
+ assert {not users_path.exist?}
344
+ assert {not administrators_path.exist?}
345
+ assert {members_path.exist?}
346
+ assert {not members_name_path.exist?}
347
+ end
312
348
  end
313
349
 
314
350
  def test_temporary_add
data/test/test-type.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2012 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
2
2
  # Copyright (C) 2015 Masafumi Yokoyama <yokoyama@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -91,6 +91,106 @@ class TypeTest < Test::Unit::TestCase
91
91
  assert_false(Groonga["UInt32"].geo_point?)
92
92
  end
93
93
 
94
+ class TextFamilyTest < self
95
+ def test_short_text
96
+ assert do
97
+ Groonga["ShortText"].text_family?
98
+ end
99
+ end
100
+
101
+ def test_text
102
+ assert do
103
+ Groonga["Text"].text_family?
104
+ end
105
+ end
106
+
107
+ def test_long_text
108
+ assert do
109
+ Groonga["LongText"].text_family?
110
+ end
111
+ end
112
+
113
+ def test_under_short_text
114
+ assert do
115
+ not Groonga["Time"].text_family?
116
+ end
117
+ end
118
+
119
+ def test_over_long_text
120
+ assert do
121
+ not Groonga["TokyoGeoPoint"].text_family?
122
+ end
123
+ end
124
+ end
125
+
126
+ class NumberFamilyTest < self
127
+ def test_int8
128
+ assert do
129
+ Groonga["Int8"].number_family?
130
+ end
131
+ end
132
+
133
+ def test_uint8
134
+ assert do
135
+ Groonga["UInt8"].number_family?
136
+ end
137
+ end
138
+
139
+ def test_int16
140
+ assert do
141
+ Groonga["Int16"].number_family?
142
+ end
143
+ end
144
+
145
+ def test_uint16
146
+ assert do
147
+ Groonga["UInt16"].number_family?
148
+ end
149
+ end
150
+
151
+ def test_int32
152
+ assert do
153
+ Groonga["Int32"].number_family?
154
+ end
155
+ end
156
+
157
+ def test_uint32
158
+ assert do
159
+ Groonga["UInt32"].number_family?
160
+ end
161
+ end
162
+
163
+ def test_int64
164
+ assert do
165
+ Groonga["Int64"].number_family?
166
+ end
167
+ end
168
+
169
+ def test_uint64
170
+ assert do
171
+ Groonga["UInt64"].number_family?
172
+ end
173
+ end
174
+
175
+ def test_float
176
+ assert do
177
+ Groonga["Float"].number_family?
178
+ end
179
+ end
180
+
181
+ def test_under_int8
182
+ assert do
183
+ not Groonga["Bool"].number_family?
184
+ end
185
+ end
186
+
187
+ def test_over_float
188
+ assert do
189
+ not Groonga["Time"].number_family?
190
+ end
191
+ end
192
+ end
193
+
94
194
  def test_builtins
95
195
  assert_equal_type("Object", Groonga::Type::OBJECT) # FIXME!!!
96
196
  assert_equal_type("Bool", Groonga::Type::BOOLEAN)
@@ -125,7 +225,9 @@ class TypeTest < Test::Unit::TestCase
125
225
  "builtin - Time" => "Time")
126
226
  def test_builtin?(name)
127
227
  type = Groonga[name]
128
- assert_predicate(type, :builtin?)
228
+ assert do
229
+ type.builtin?
230
+ end
129
231
  end
130
232
 
131
233
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rroonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-03-06 00:00:00.000000000 Z
15
+ date: 2016-05-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pkg-config
@@ -84,20 +84,6 @@ dependencies:
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: 3.0.0
87
- - !ruby/object:Gem::Dependency
88
- name: test-unit-notify
89
- requirement: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- type: :development
95
- prerelease: false
96
- version_requirements: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: '0'
101
87
  - !ruby/object:Gem::Dependency
102
88
  name: rake
103
89
  requirement: !ruby/object:Gem::Requirement
@@ -208,9 +194,9 @@ email:
208
194
  - y.hayamizu@gmail.com
209
195
  - dara@shidara.net
210
196
  executables:
197
+ - grntest-log-analyze
211
198
  - groonga-database-inspect
212
199
  - grndump
213
- - grntest-log-analyze
214
200
  - groonga-index-dump
215
201
  extensions:
216
202
  - ext/groonga/extconf.rb
@@ -288,6 +274,9 @@ files:
288
274
  - ext/groonga/rb-grn-query-logger.c
289
275
  - ext/groonga/rb-grn-record.c
290
276
  - ext/groonga/rb-grn-regexp-operator.c
277
+ - ext/groonga/rb-grn-request-canceler.c
278
+ - ext/groonga/rb-grn-request-timer-id.c
279
+ - ext/groonga/rb-grn-request-timer.c
291
280
  - ext/groonga/rb-grn-snippet.c
292
281
  - ext/groonga/rb-grn-table-cursor-key-support.c
293
282
  - ext/groonga/rb-grn-table-cursor.c
@@ -367,6 +356,8 @@ files:
367
356
  - test/test-query-logger.rb
368
357
  - test/test-record.rb
369
358
  - test/test-remote.rb
359
+ - test/test-request-canceler.rb
360
+ - test/test-request-timer.rb
370
361
  - test/test-schema-create-table.rb
371
362
  - test/test-schema-dumper.rb
372
363
  - test/test-schema-type.rb
@@ -419,67 +410,69 @@ specification_version: 4
419
410
  summary: Ruby bindings for Groonga that provide full text search and column store
420
411
  features.
421
412
  test_files:
422
- - test/run-test.rb
423
- - test/test-error-message.rb
413
+ - test/test-context.rb
424
414
  - test/test-normalizer.rb
425
- - test/test-database.rb
426
- - test/test-schema-type.rb
427
- - test/test-convert.rb
428
- - test/test-memory-pool.rb
429
- - test/test-gqtp.rb
430
- - test/test-schema-create-table.rb
431
- - test/test-query-logger.rb
432
- - test/test-pagination.rb
433
- - test/test-expression-builder.rb
434
- - test/test-table-group.rb
435
- - test/test-schema.rb
436
- - test/test-operator.rb
415
+ - test/test-double-array-trie.rb
416
+ - test/test-token-regexp.rb
417
+ - test/test-remote.rb
437
418
  - test/test-expression.rb
419
+ - test/test-schema-dumper.rb
438
420
  - test/test-patricia-trie.rb
439
- - test/test-command-select.rb
440
- - test/test-context.rb
441
- - test/test-variable-size-column.rb
442
- - test/test-variable.rb
443
- - test/test-sub-records.rb
444
- - test/test-index-cursor.rb
445
- - test/test-double-array-trie.rb
421
+ - test/test-table-group.rb
446
422
  - test/test-table-select.rb
423
+ - test/test-encoding.rb
447
424
  - test/test-windows-event-logger.rb
425
+ - test/test-plugin.rb
426
+ - test/test-table-select-normalize.rb
427
+ - test/test-hash.rb
428
+ - test/test-gqtp.rb
429
+ - test/test-table-dumper.rb
430
+ - test/test-pagination.rb
431
+ - test/test-column.rb
448
432
  - test/test-table-traverse.rb
449
- - test/test-exception.rb
433
+ - test/test-type.rb
434
+ - test/test-package-label.rb
435
+ - test/groonga-test-utils.rb
436
+ - test/test-thread.rb
437
+ - test/test-procedure.rb
438
+ - test/test-query-logger.rb
450
439
  - test/test-index-column.rb
451
- - test/test-geo-point.rb
452
440
  - test/test-vector-column.rb
453
- - test/test-lock-timeout.rb
454
- - test/test-array.rb
455
- - test/test-schema-dumper.rb
456
441
  - test/test-fix-size-column.rb
457
- - test/test-table-select-mecab.rb
458
- - test/test-procedure.rb
442
+ - test/test-error-message.rb
443
+ - test/test-operator.rb
459
444
  - test/test-database-dumper.rb
460
- - test/test-database-inspector.rb
461
- - test/test-package-label.rb
462
- - test/test-table-key-support.rb
463
- - test/test-table-offset-and-limit.rb
464
- - test/test-accessor.rb
465
- - test/test-remote.rb
466
- - test/test-plugin.rb
467
- - test/groonga-test-utils.rb
468
- - test/test-column.rb
469
- - test/test-record.rb
470
- - test/test-hash.rb
445
+ - test/run-test.rb
446
+ - test/test-index-cursor.rb
447
+ - test/test-schema-type.rb
448
+ - test/test-database.rb
449
+ - test/test-request-canceler.rb
471
450
  - test/test-logger.rb
472
- - test/test-table-select-weight.rb
451
+ - test/test-table.rb
452
+ - test/test-record.rb
473
453
  - test/test-version.rb
474
- - test/test-table-select-normalize.rb
475
- - test/test-config.rb
454
+ - test/test-table-select-mecab.rb
455
+ - test/test-lock-timeout.rb
456
+ - test/test-table-select-weight.rb
457
+ - test/test-geo-point.rb
458
+ - test/test-array.rb
459
+ - test/test-request-timer.rb
460
+ - test/test-sub-records.rb
461
+ - test/test-schema-create-table.rb
462
+ - test/test-schema.rb
463
+ - test/test-command-select.rb
464
+ - test/test-expression-builder.rb
465
+ - test/test-convert.rb
466
+ - test/test-memory-pool.rb
476
467
  - test/test-flushable.rb
477
- - test/test-encoding.rb
478
- - test/test-thread.rb
479
- - test/test-snippet.rb
480
- - test/test-type.rb
481
- - test/test-table.rb
482
- - test/test-table-dumper.rb
468
+ - test/test-table-offset-and-limit.rb
469
+ - test/test-exception.rb
470
+ - test/test-variable-size-column.rb
471
+ - test/test-config.rb
472
+ - test/test-table-key-support.rb
473
+ - test/test-database-inspector.rb
474
+ - test/test-variable.rb
483
475
  - test/test-statistic-measurer.rb
484
- - test/test-token-regexp.rb
476
+ - test/test-snippet.rb
477
+ - test/test-accessor.rb
485
478
  has_rdoc: