oklahoma_mixer 0.2.0 → 0.3.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/CHANGELOG.rdoc +7 -0
- data/README.rdoc +4 -0
- data/Rakefile +1 -1
- data/TODO.rdoc +2 -3
- data/lib/oklahoma_mixer.rb +7 -20
- data/lib/oklahoma_mixer/array_list.rb +21 -7
- data/lib/oklahoma_mixer/array_list/c.rb +9 -1
- data/lib/oklahoma_mixer/b_tree_database.rb +25 -9
- data/lib/oklahoma_mixer/b_tree_database/c.rb +5 -0
- data/lib/oklahoma_mixer/cursor.rb +3 -0
- data/lib/oklahoma_mixer/cursor/c.rb +2 -0
- data/lib/oklahoma_mixer/error.rb +2 -0
- data/lib/oklahoma_mixer/extensible_string.rb +4 -2
- data/lib/oklahoma_mixer/extensible_string/c.rb +2 -0
- data/lib/oklahoma_mixer/fixed_length_database.rb +11 -3
- data/lib/oklahoma_mixer/fixed_length_database/c.rb +2 -0
- data/lib/oklahoma_mixer/hash_database.rb +24 -7
- data/lib/oklahoma_mixer/hash_database/c.rb +2 -0
- data/lib/oklahoma_mixer/hash_map.rb +42 -0
- data/lib/oklahoma_mixer/hash_map/c.rb +27 -0
- data/lib/oklahoma_mixer/query.rb +73 -0
- data/lib/oklahoma_mixer/query/c.rb +51 -0
- data/lib/oklahoma_mixer/table_database.rb +402 -0
- data/lib/oklahoma_mixer/table_database/c.rb +104 -0
- data/lib/oklahoma_mixer/utilities.rb +26 -1
- data/test/{b_tree_binary_data_test.rb → b_tree_database/b_tree_binary_data_test.rb} +2 -2
- data/test/{b_tree_tuning_test.rb → b_tree_database/b_tree_tuning_test.rb} +2 -2
- data/test/{cursor_based_iteration_test.rb → b_tree_database/cursor_based_iteration_test.rb} +2 -2
- data/test/{duplicate_storage_test.rb → b_tree_database/duplicate_storage_test.rb} +18 -12
- data/test/{binary_data_test.rb → core_database/binary_data_test.rb} +2 -2
- data/test/{file_system_test.rb → core_database/file_system_test.rb} +0 -0
- data/test/{getting_and_setting_keys_test.rb → core_database/getting_and_setting_keys_test.rb} +31 -60
- data/test/{iteration_test.rb → core_database/iteration_test.rb} +2 -2
- data/test/{transactions_test.rb → core_database/transactions_test.rb} +0 -0
- data/test/core_database/tuning_test.rb +31 -0
- data/test/{fixed_length_tuning_test.rb → fixed_length_database/fixed_length_tuning_test.rb} +0 -0
- data/test/{getting_and_setting_by_id_test.rb → fixed_length_database/getting_and_setting_by_id_test.rb} +8 -0
- data/test/{shared_binary_data.rb → shared/binary_data_tests.rb} +1 -1
- data/test/{tuning_test.rb → shared/hash_tuning_tests.rb} +18 -42
- data/test/{shared_iteration.rb → shared/iteration_tests.rb} +8 -7
- data/test/{key_range_test.rb → shared/key_range_test.rb} +0 -0
- data/test/{order_test.rb → shared/order_test.rb} +0 -0
- data/test/shared/storage_tests.rb +65 -0
- data/test/{top_level_interface_test.rb → shared/top_level_interface_test.rb} +39 -2
- data/test/{shared_tuning.rb → shared/tuning_tests.rb} +1 -1
- data/test/table_database/document_iteration_test.rb +22 -0
- data/test/table_database/document_storage_test.rb +225 -0
- data/test/table_database/index_test.rb +57 -0
- data/test/table_database/query_test.rb +866 -0
- data/test/table_database/table_tuning_test.rb +56 -0
- data/test/test_helper.rb +27 -0
- metadata +35 -36
@@ -0,0 +1,56 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "shared/hash_tuning_tests"
|
3
|
+
|
4
|
+
class TestTableTuning < Test::Unit::TestCase
|
5
|
+
def teardown
|
6
|
+
remove_db_files
|
7
|
+
end
|
8
|
+
|
9
|
+
include HashTuningTests
|
10
|
+
|
11
|
+
def test_records_cached_can_be_set_with_other_cache_defaults
|
12
|
+
records = rand(1_000) + 1
|
13
|
+
assert_option_calls([:setcache, records, 0, 0], :rcnum => records)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_records_cached_is_converted_to_an_int
|
17
|
+
assert_option_calls([:setcache, 42, 0, 0], :rcnum => "42")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_leaf_nodes_cached_can_be_set_with_other_cache_defaults
|
21
|
+
nodes = rand(1_000) + 1
|
22
|
+
assert_option_calls([:setcache, 0, nodes, 0], :lcnum => nodes)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_leaf_nodes_cached_is_converted_to_an_int
|
26
|
+
assert_option_calls([:setcache, 0, 42, 0], :lcnum => "42")
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_non_leaf_nodes_cached_can_be_set_with_other_cache_defaults
|
30
|
+
nodes = rand(1_000) + 1
|
31
|
+
assert_option_calls([:setcache, 0, 0, nodes], :ncnum => nodes)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_non_leaf_nodes_cached_is_converted_to_an_int
|
35
|
+
assert_option_calls([:setcache, 0, 0, 42], :ncnum => "42")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_multiple_cache_parameters_can_be_set_at_the_same_time
|
39
|
+
l_nodes = rand(1_000) + 1
|
40
|
+
n_nodes = rand(1_000) + 1
|
41
|
+
assert_option_calls( [:setcache, 0, l_nodes, n_nodes],
|
42
|
+
:lcnum => l_nodes, :ncnum => n_nodes )
|
43
|
+
end
|
44
|
+
|
45
|
+
#######
|
46
|
+
private
|
47
|
+
#######
|
48
|
+
|
49
|
+
def lib
|
50
|
+
OKMixer::TableDatabase::C
|
51
|
+
end
|
52
|
+
|
53
|
+
def db(*args, &block)
|
54
|
+
tdb(*args, &block)
|
55
|
+
end
|
56
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "rbconfig"
|
1
2
|
require "stringio"
|
2
3
|
require "test/unit"
|
3
4
|
|
@@ -6,6 +7,28 @@ require "rubygems" # for FFI
|
|
6
7
|
require "oklahoma_mixer"
|
7
8
|
|
8
9
|
module TestHelper
|
10
|
+
def run_ruby(code)
|
11
|
+
# find Ruby and OklahomaMixer
|
12
|
+
exe = File::join( *Config::CONFIG.values_at( *%w[ bindir
|
13
|
+
ruby_install_name ] ) ) <<
|
14
|
+
Config::CONFIG["EXEEXT"]
|
15
|
+
lib = File.join(File.dirname(__FILE__), *%w[.. lib])
|
16
|
+
|
17
|
+
# escape for the shell
|
18
|
+
[exe, lib].each do |path|
|
19
|
+
path.gsub!(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\')
|
20
|
+
path.gsub!(/\n/, "'\n'")
|
21
|
+
path.sub!(/\A\z/, "''")
|
22
|
+
end
|
23
|
+
|
24
|
+
# run the program and read the results
|
25
|
+
open("| #{exe} -I #{lib} -rubygems -r oklahoma_mixer", "r+") do |program|
|
26
|
+
program << code
|
27
|
+
program.close_write
|
28
|
+
@output = program.read.to_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
9
32
|
def capture_stderr
|
10
33
|
$stderr = StringIO.new
|
11
34
|
yield
|
@@ -40,6 +63,10 @@ module TestHelper
|
|
40
63
|
def fdb(*args, &block)
|
41
64
|
OKMixer.open(db_path("tcf"), *args, &block)
|
42
65
|
end
|
66
|
+
|
67
|
+
def tdb(*args, &block)
|
68
|
+
OKMixer.open(db_path("tct"), *args, &block)
|
69
|
+
end
|
43
70
|
|
44
71
|
def remove_db_files
|
45
72
|
Dir.glob(db_path("*")) do |file|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oklahoma_mixer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Edward Gray II
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-09 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -63,27 +63,40 @@ files:
|
|
63
63
|
- lib/oklahoma_mixer/fixed_length_database.rb
|
64
64
|
- lib/oklahoma_mixer/hash_database/c.rb
|
65
65
|
- lib/oklahoma_mixer/hash_database.rb
|
66
|
+
- lib/oklahoma_mixer/hash_map/c.rb
|
67
|
+
- lib/oklahoma_mixer/hash_map.rb
|
68
|
+
- lib/oklahoma_mixer/query/c.rb
|
69
|
+
- lib/oklahoma_mixer/query.rb
|
70
|
+
- lib/oklahoma_mixer/table_database/c.rb
|
71
|
+
- lib/oklahoma_mixer/table_database.rb
|
66
72
|
- lib/oklahoma_mixer/utilities.rb
|
67
73
|
- lib/oklahoma_mixer.rb
|
68
|
-
- test/b_tree_binary_data_test.rb
|
69
|
-
- test/b_tree_tuning_test.rb
|
70
|
-
- test/
|
71
|
-
- test/
|
72
|
-
- test/
|
73
|
-
- test/file_system_test.rb
|
74
|
-
- test/
|
75
|
-
- test/
|
76
|
-
- test/
|
77
|
-
- test/
|
78
|
-
- test/
|
79
|
-
- test/
|
80
|
-
- test/
|
81
|
-
- test/
|
82
|
-
- test/
|
74
|
+
- test/b_tree_database/b_tree_binary_data_test.rb
|
75
|
+
- test/b_tree_database/b_tree_tuning_test.rb
|
76
|
+
- test/b_tree_database/cursor_based_iteration_test.rb
|
77
|
+
- test/b_tree_database/duplicate_storage_test.rb
|
78
|
+
- test/core_database/binary_data_test.rb
|
79
|
+
- test/core_database/file_system_test.rb
|
80
|
+
- test/core_database/getting_and_setting_keys_test.rb
|
81
|
+
- test/core_database/iteration_test.rb
|
82
|
+
- test/core_database/transactions_test.rb
|
83
|
+
- test/core_database/tuning_test.rb
|
84
|
+
- test/fixed_length_database/fixed_length_tuning_test.rb
|
85
|
+
- test/fixed_length_database/getting_and_setting_by_id_test.rb
|
86
|
+
- test/shared/binary_data_tests.rb
|
87
|
+
- test/shared/hash_tuning_tests.rb
|
88
|
+
- test/shared/iteration_tests.rb
|
89
|
+
- test/shared/key_range_test.rb
|
90
|
+
- test/shared/order_test.rb
|
91
|
+
- test/shared/storage_tests.rb
|
92
|
+
- test/shared/top_level_interface_test.rb
|
93
|
+
- test/shared/tuning_tests.rb
|
94
|
+
- test/table_database/document_iteration_test.rb
|
95
|
+
- test/table_database/document_storage_test.rb
|
96
|
+
- test/table_database/index_test.rb
|
97
|
+
- test/table_database/query_test.rb
|
98
|
+
- test/table_database/table_tuning_test.rb
|
83
99
|
- test/test_helper.rb
|
84
|
-
- test/top_level_interface_test.rb
|
85
|
-
- test/transactions_test.rb
|
86
|
-
- test/tuning_test.rb
|
87
100
|
- AUTHORS.rdoc
|
88
101
|
- CHANGELOG.rdoc
|
89
102
|
- INSTALL.rdoc
|
@@ -122,19 +135,5 @@ rubygems_version: 1.3.5
|
|
122
135
|
signing_key:
|
123
136
|
specification_version: 3
|
124
137
|
summary: An full featured and robust FFI interface to Tokyo Cabinet.
|
125
|
-
test_files:
|
126
|
-
|
127
|
-
- test/b_tree_tuning_test.rb
|
128
|
-
- test/binary_data_test.rb
|
129
|
-
- test/cursor_based_iteration_test.rb
|
130
|
-
- test/duplicate_storage_test.rb
|
131
|
-
- test/file_system_test.rb
|
132
|
-
- test/fixed_length_tuning_test.rb
|
133
|
-
- test/getting_and_setting_by_id_test.rb
|
134
|
-
- test/getting_and_setting_keys_test.rb
|
135
|
-
- test/iteration_test.rb
|
136
|
-
- test/key_range_test.rb
|
137
|
-
- test/order_test.rb
|
138
|
-
- test/top_level_interface_test.rb
|
139
|
-
- test/transactions_test.rb
|
140
|
-
- test/tuning_test.rb
|
138
|
+
test_files: []
|
139
|
+
|