hallelujah-cassandra-cql 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +203 -0
  4. data/README.rdoc +71 -0
  5. data/Rakefile +151 -0
  6. data/hallelujah-cassandra-cql.gemspec +33 -0
  7. data/lib/cassandra-cql.rb +49 -0
  8. data/lib/cassandra-cql/0.8.rb +7 -0
  9. data/lib/cassandra-cql/0.8/result.rb +23 -0
  10. data/lib/cassandra-cql/0.8/statement.rb +38 -0
  11. data/lib/cassandra-cql/1.0.rb +7 -0
  12. data/lib/cassandra-cql/1.0/result.rb +6 -0
  13. data/lib/cassandra-cql/1.0/statement.rb +6 -0
  14. data/lib/cassandra-cql/1.1.rb +7 -0
  15. data/lib/cassandra-cql/1.1/result.rb +6 -0
  16. data/lib/cassandra-cql/1.1/statement.rb +6 -0
  17. data/lib/cassandra-cql/database.rb +127 -0
  18. data/lib/cassandra-cql/result.rb +133 -0
  19. data/lib/cassandra-cql/row.rb +54 -0
  20. data/lib/cassandra-cql/schema.rb +108 -0
  21. data/lib/cassandra-cql/statement.rb +116 -0
  22. data/lib/cassandra-cql/types/abstract_type.rb +47 -0
  23. data/lib/cassandra-cql/types/ascii_type.rb +25 -0
  24. data/lib/cassandra-cql/types/boolean_type.rb +25 -0
  25. data/lib/cassandra-cql/types/bytes_type.rb +21 -0
  26. data/lib/cassandra-cql/types/date_type.rb +25 -0
  27. data/lib/cassandra-cql/types/decimal_type.rb +25 -0
  28. data/lib/cassandra-cql/types/double_type.rb +25 -0
  29. data/lib/cassandra-cql/types/float_type.rb +25 -0
  30. data/lib/cassandra-cql/types/integer_type.rb +27 -0
  31. data/lib/cassandra-cql/types/long_type.rb +27 -0
  32. data/lib/cassandra-cql/types/utf8_type.rb +25 -0
  33. data/lib/cassandra-cql/types/uuid_type.rb +27 -0
  34. data/lib/cassandra-cql/utility.rb +37 -0
  35. data/lib/cassandra-cql/uuid.rb +21 -0
  36. data/lib/cassandra-cql/version.rb +19 -0
  37. data/spec/column_family_spec.rb +105 -0
  38. data/spec/comparator_spec.rb +249 -0
  39. data/spec/conf/0.8/cassandra.in.sh +41 -0
  40. data/spec/conf/0.8/cassandra.yaml +61 -0
  41. data/spec/conf/0.8/log4j-server.properties +40 -0
  42. data/spec/conf/0.8/schema.txt +10 -0
  43. data/spec/conf/1.0/cassandra.in.sh +41 -0
  44. data/spec/conf/1.0/cassandra.yaml +416 -0
  45. data/spec/conf/1.0/log4j-server.properties +40 -0
  46. data/spec/conf/1.0/schema.txt +10 -0
  47. data/spec/conf/1.1/cassandra.in.sh +41 -0
  48. data/spec/conf/1.1/cassandra.yaml +560 -0
  49. data/spec/conf/1.1/log4j-server.properties +44 -0
  50. data/spec/conf/1.1/schema.txt +10 -0
  51. data/spec/database_spec.rb +25 -0
  52. data/spec/result_spec.rb +173 -0
  53. data/spec/row_spec.rb +49 -0
  54. data/spec/rowkey_spec.rb +233 -0
  55. data/spec/schema_spec.rb +51 -0
  56. data/spec/spec_helper.rb +30 -0
  57. data/spec/statement_spec.rb +226 -0
  58. data/spec/utility_spec.rb +26 -0
  59. data/spec/uuid_spec.rb +26 -0
  60. data/spec/validation_spec.rb +272 -0
  61. data/vendor/0.8/gen-rb/cassandra.rb +2210 -0
  62. data/vendor/0.8/gen-rb/cassandra_constants.rb +10 -0
  63. data/vendor/0.8/gen-rb/cassandra_types.rb +811 -0
  64. data/vendor/1.0/gen-rb/cassandra.rb +2212 -0
  65. data/vendor/1.0/gen-rb/cassandra_constants.rb +10 -0
  66. data/vendor/1.0/gen-rb/cassandra_types.rb +854 -0
  67. data/vendor/1.1/gen-rb/cassandra.rb +2511 -0
  68. data/vendor/1.1/gen-rb/cassandra_constants.rb +13 -0
  69. data/vendor/1.1/gen-rb/cassandra_types.rb +928 -0
  70. metadata +230 -0
@@ -0,0 +1,27 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ module CassandraCQL
18
+ module Types
19
+ class IntegerType < AbstractType
20
+ def self.cast(value)
21
+ bytes_to_int(value)
22
+ end
23
+ end
24
+
25
+ class Int32Type < IntegerType; end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ module CassandraCQL
18
+ module Types
19
+ class LongType < AbstractType
20
+ def self.cast(value)
21
+ bytes_to_long(value)
22
+ end
23
+ end
24
+
25
+ class CounterColumnType < LongType; end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ module CassandraCQL
18
+ module Types
19
+ class UTF8Type < AbstractType
20
+ def self.cast(value)
21
+ RUBY_VERSION >= "1.9" ? value.to_s.dup.force_encoding('UTF-8') : value.to_s.dup
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ module CassandraCQL
18
+ module Types
19
+ class UUIDType < AbstractType
20
+ def self.cast(value)
21
+ UUID.new(value)
22
+ end
23
+ end
24
+
25
+ class TimeUUIDType < UUIDType; end
26
+ end
27
+ end
@@ -0,0 +1,37 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ require 'zlib'
18
+
19
+ module CassandraCQL
20
+ class Utility
21
+ def self.compress(source, level=2)
22
+ Zlib::Deflate.deflate(source, level)
23
+ end
24
+
25
+ def self.decompress(source)
26
+ Zlib::Inflate.inflate(source)
27
+ end
28
+
29
+ def self.binary_data?(string)
30
+ if RUBY_VERSION >= "1.9"
31
+ string.encoding.name == "ASCII-8BIT"
32
+ else
33
+ string.count("\x00-\x7F", "^ -~\t\r\n").fdiv(string.size) > 0.3 || string.index("\x00") unless string.empty?
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ require 'simple_uuid'
18
+
19
+ module CassandraCQL
20
+ class UUID < SimpleUUID::UUID; end
21
+ end
@@ -0,0 +1,19 @@
1
+ =begin
2
+ Copyright 2011 Inside Systems, Inc.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ module CassandraCQL
18
+ VERSION = "1.0.4"
19
+ end
@@ -0,0 +1,105 @@
1
+ require File.expand_path('spec_helper.rb', File.dirname(__FILE__))
2
+ include CassandraCQL
3
+
4
+ describe "ColumnFamily class" do
5
+ before(:each) do
6
+ @connection = setup_cassandra_connection
7
+ @connection.execute("USE system")
8
+ @super_column_family = @connection.schema.column_families["HintsColumnFamily"]
9
+ @standard_column_family = @connection.schema.column_families["NodeIdInfo"]
10
+ end
11
+
12
+ context "initialize" do
13
+ it "should set a cf_def" do
14
+ @super_column_family.cf_def.should_not be_nil
15
+ @standard_column_family.cf_def.should_not be_nil
16
+ end
17
+
18
+ it "should have some common attributes" do
19
+ [@standard_column_family, @super_column_family].each do |column|
20
+ column.name.should_not be_nil
21
+ column.id.should_not be_nil
22
+ column.column_type.should_not be_nil
23
+ end
24
+ end
25
+
26
+ it "should super method_missing" do
27
+ expect {
28
+ @standard_column_family.this_method_does_not_exist
29
+ }.to raise_error NoMethodError
30
+ expect {
31
+ @super_column_family.this_method_does_not_exist
32
+ }.to raise_error NoMethodError
33
+ end
34
+ end
35
+
36
+ context "with a standard column family" do
37
+ it "should be standard" do
38
+ @standard_column_family.super?.should be_false
39
+ @standard_column_family.standard?.should be_true
40
+ @standard_column_family.type.should eq("Standard")
41
+ end
42
+ end
43
+
44
+ context "with a super column family" do
45
+ it "should be super" do
46
+ @super_column_family.super?.should be_true
47
+ @super_column_family.standard?.should be_false
48
+ @super_column_family.type.should eq("Super")
49
+ end
50
+ end
51
+
52
+ context "when calling self.cast" do
53
+ it "should turn UUID bytes into a UUID object" do
54
+ uuid = UUID.new
55
+ ColumnFamily.cast(uuid.bytes, "TimeUUIDType").should eq(uuid)
56
+ end
57
+
58
+ it "should turn a UUID bytes into a UUID object" do
59
+ uuid = UUID.new
60
+ ColumnFamily.cast(uuid.bytes, "UUIDType").should eq(uuid)
61
+ end
62
+
63
+ it "should turn a packed long into a number" do
64
+ number = 2**33
65
+ packed = [number >> 32, number].pack("N*")
66
+
67
+ ColumnFamily.cast(packed, "LongType").should eq(number)
68
+ ColumnFamily.cast(packed, "CounterColumnType").should eq(number)
69
+ end
70
+
71
+ it "should turn a packed negative long into a negative number" do
72
+ number = -2**33
73
+ packed = [number >> 32, number].pack("N*")
74
+
75
+ ColumnFamily.cast(packed, "LongType").should eq(number)
76
+ ColumnFamily.cast(packed, "CounterColumnType").should eq(number)
77
+ end
78
+
79
+ it "should call to_s with AsciiType" do
80
+ obj = double("String")
81
+ obj.stub(:to_s) { "string" }
82
+ obj.should_receive(:to_s)
83
+ ColumnFamily.cast(obj, "AsciiType")
84
+ end
85
+
86
+ it "should call to_s with UTF8Type" do
87
+ obj = double("String")
88
+ obj.stub(:to_s) { "string" }
89
+ obj.should_receive(:to_s)
90
+ ColumnFamily.cast(obj, "UTF8Type")
91
+ end
92
+
93
+ it "should return self with BytesType" do
94
+ obj = Object.new
95
+ ColumnFamily.cast(obj, "BytesType").object_id.should eq(obj.object_id)
96
+ end
97
+
98
+ it "should return nil for all types of nil" do
99
+ %w(TimeUUIDType UUIDType LongType IntegerType
100
+ UTF8Type AsciiType CounterColumnType).each do |type|
101
+ ColumnFamily.cast(nil, type).should eq(nil)
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,249 @@
1
+ # encoding: utf-8
2
+ require File.expand_path('spec_helper.rb', File.dirname(__FILE__))
3
+ include CassandraCQL
4
+
5
+ describe "Comparator Roundtrip tests" do
6
+ before(:each) do
7
+ @connection = setup_cassandra_connection
8
+ end
9
+
10
+ def create_and_fetch_column(column_family, name)
11
+ @connection.execute("insert into #{column_family} (id, ?) values (?, ?)", name, 'test', 'test')
12
+ row = @connection.execute("select ? from #{column_family} where id = ?", name, 'test').fetch
13
+ row.column_names[0]
14
+ end
15
+
16
+ def create_column_family(name, comparator_type)
17
+ if !@connection.schema.column_family_names.include?(name)
18
+ @connection.execute("CREATE COLUMNFAMILY #{name} (id text PRIMARY KEY) WITH comparator=?", comparator_type)
19
+ end
20
+ end
21
+
22
+ context "with ascii comparator" do
23
+ let(:cf_name) { "comparator_cf_ascii" }
24
+ before(:each) { create_column_family(cf_name, 'AsciiType') }
25
+
26
+ it "should return an ascii string" do
27
+ create_and_fetch_column(cf_name, "test string").should eq("test string")
28
+ end
29
+ end
30
+
31
+ context "with bigint comparator" do
32
+ let(:cf_name) { "comparator_cf_bigint" }
33
+ before(:each) { create_column_family(cf_name, 'LongType') }
34
+
35
+ def test_for_value(value)
36
+ create_and_fetch_column(cf_name, value).should eq(value)
37
+ create_and_fetch_column(cf_name, value*-1).should eq(value*-1)
38
+ end
39
+
40
+ it "should properly convert integer values that fit into 1 byte" do
41
+ test_for_value(1)
42
+ end
43
+ it "should properly convert integer values that fit into 2 bytes" do
44
+ test_for_value(2**8 + 80)
45
+ end
46
+ it "should properly convert integer values that fit into 3 bytes" do
47
+ test_for_value(2**16 + 622)
48
+ end
49
+ it "should properly convert integer values that fit into 4 bytes" do
50
+ test_for_value(2**24 + 45820)
51
+ end
52
+ it "should properly convert integer values that fit into 5 bytes" do
53
+ test_for_value(2**32 + 618387)
54
+ end
55
+ end
56
+
57
+ context "with blob comparator" do
58
+ let(:cf_name) { "comparator_cf_blob" }
59
+ before(:each) { create_column_family(cf_name, 'BytesType') }
60
+
61
+ it "should return a blob" do
62
+ bytes = "binary\x00"
63
+ bytes = bytes.force_encoding('ASCII-8BIT') if RUBY_VERSION >= "1.9"
64
+ create_and_fetch_column(cf_name, bytes).should eq(bytes)
65
+ end
66
+ end
67
+
68
+ context "with boolean comparator" do
69
+ let(:cf_name) { "comparator_cf_boolean" }
70
+ before(:each) { create_column_family(cf_name, 'BooleanType') }
71
+
72
+ it "should return true" do
73
+ create_and_fetch_column(cf_name, true).should be_true
74
+ end
75
+
76
+ it "should return false" do
77
+ create_and_fetch_column(cf_name, false).should be_false
78
+ end
79
+ end
80
+
81
+ context "with date comparator" do
82
+ let(:cf_name) { "comparator_cf_date" }
83
+ before(:each) { create_column_family(cf_name, 'DateType') }
84
+
85
+ it "should return a Time object" do
86
+ ts = Time.new
87
+ res = create_and_fetch_column(cf_name, ts)
88
+ res.to_f.should be_within(0.001).of(ts.to_f)
89
+ res.should be_kind_of(Time)
90
+ end
91
+
92
+ it "should return a timestamp given a date" do
93
+ date = Date.today
94
+ res = create_and_fetch_column(cf_name, date)
95
+ [:year, :month, :day].each do |sym|
96
+ res.send(sym).should eq(date.send(sym))
97
+ end
98
+ res.class.should eq(Time)
99
+ end
100
+ end
101
+
102
+ if CASSANDRA_VERSION.to_f >= 1.0
103
+ context "with decimal comparator" do
104
+ let(:cf_name) { "comparator_cf_decimal" }
105
+ before(:each) { create_column_family(cf_name, 'DecimalType') }
106
+
107
+ def test_for_value(value)
108
+ create_and_fetch_column(cf_name, value).should eq(value)
109
+ create_and_fetch_column(cf_name, value*-1).should eq(value*-1)
110
+ end
111
+
112
+ it "should return a small decimal" do
113
+ test_for_value(15.333)
114
+ end
115
+ it "should return a huge decimal" do
116
+ test_for_value(BigDecimal.new('129182739481237481341234123411.1029348102934810293481039'))
117
+ end
118
+ end
119
+ end
120
+
121
+ context "with double comparator" do
122
+ let(:cf_name) { "comparator_cf_double" }
123
+ before(:each) { create_column_family(cf_name, 'DoubleType') }
124
+
125
+ def test_for_value(value)
126
+ create_and_fetch_column(cf_name, value).should be_within(0.1).of(value)
127
+ create_and_fetch_column(cf_name, value*-1).should be_within(0.1).of(value*-1)
128
+ end
129
+
130
+ it "should properly convert some float values" do
131
+ test_for_value(1.125)
132
+ test_for_value(384.125)
133
+ test_for_value(65540.125)
134
+ test_for_value(16777217.125)
135
+ test_for_value(109911627776.125)
136
+ end
137
+ end
138
+
139
+ context "with float comparator" do
140
+ let(:cf_name) { "comparator_cf_float" }
141
+ before(:each) { create_column_family(cf_name, 'FloatType') }
142
+
143
+ def test_for_value(value)
144
+ create_and_fetch_column(cf_name, value*-1).should eq(value*-1)
145
+ create_and_fetch_column(cf_name, value).should eq(value)
146
+ end
147
+
148
+ it "should properly convert some float values" do
149
+ test_for_value(1.125)
150
+ test_for_value(384.125)
151
+ test_for_value(65540.125)
152
+ end
153
+ end
154
+
155
+ if CASSANDRA_VERSION.to_f >= 1.0
156
+ #Int32Type was added in 1.0 (CASSANDRA-3031)
157
+ context "with int comparator" do
158
+ let(:cf_name) { "comparator_cf_int" }
159
+ before(:each) { create_column_family(cf_name, 'Int32Type') }
160
+
161
+ def test_for_value(value)
162
+ create_and_fetch_column(cf_name, value).should eq(value)
163
+ create_and_fetch_column(cf_name, value*-1).should eq(value*-1)
164
+ end
165
+
166
+ it "should properly convert integer values that fit into 1 byte" do
167
+ test_for_value(1)
168
+ end
169
+ it "should properly convert integer values that fit into 2 bytes" do
170
+ test_for_value(2**8 + 80)
171
+ end
172
+ it "should properly convert integer values that fit into 3 bytes" do
173
+ test_for_value(2**16 + 622)
174
+ end
175
+ it "should properly convert integer values that fit into 4 bytes" do
176
+ test_for_value(2**24 + 45820)
177
+ end
178
+ end
179
+ end
180
+
181
+ context "with text comparator" do
182
+ let(:cf_name) { "comparator_cf_text" }
183
+ before(:each) { create_column_family(cf_name, 'UTF8Type') }
184
+
185
+ it "should return a non-multibyte string" do
186
+ create_and_fetch_column(cf_name, "snark").should eq("snark")
187
+ end
188
+
189
+ it "should return a multibyte string" do
190
+ create_and_fetch_column(cf_name, "snårk").should eq("snårk")
191
+ end
192
+ end
193
+
194
+ context "with timestamp comparator" do
195
+ let(:cf_name) { "comparator_cf_timestamp" }
196
+ before(:each) { create_column_family(cf_name, 'TimeUUIDType') }
197
+
198
+ it "should return a timestamp" do
199
+ uuid = UUID.new
200
+ create_and_fetch_column(cf_name, uuid).should eq(uuid)
201
+ end
202
+ end
203
+
204
+ context "with uuid comparator" do
205
+ let(:cf_name) { "comparator_cf_uuid" }
206
+ before(:each) { create_column_family(cf_name, 'UUIDType') }
207
+
208
+ it "should return a uuid" do
209
+ uuid = UUID.new
210
+ create_and_fetch_column(cf_name, uuid).should eq(uuid)
211
+ end
212
+ end
213
+
214
+ context "with varchar comparator" do
215
+ let(:cf_name) { "comparator_cf_varchar" }
216
+ before(:each) { create_column_family(cf_name, 'UTF8Type') }
217
+
218
+ it "should return a non-multibyte string" do
219
+ create_and_fetch_column(cf_name, "snark").should eq("snark")
220
+ end
221
+
222
+ it "should return a multibyte string" do
223
+ create_and_fetch_column(cf_name, "snårk").should eq("snårk")
224
+ end
225
+ end
226
+
227
+ context "with varint comparator" do
228
+ let(:cf_name) { "comparator_cf_varint" }
229
+ before(:each) { create_column_family(cf_name, 'IntegerType') }
230
+
231
+ def test_for_value(value)
232
+ create_and_fetch_column(cf_name, value).should eq(value)
233
+ create_and_fetch_column(cf_name, value*-1).should eq(value*-1)
234
+ end
235
+
236
+ it "should properly convert integer values that fit into 1 byte" do
237
+ test_for_value(1)
238
+ end
239
+ it "should properly convert integer values that fit into 2 bytes" do
240
+ test_for_value(2**8 + 80)
241
+ end
242
+ it "should properly convert integer values that fit into 3 bytes" do
243
+ test_for_value(2**16 + 622)
244
+ end
245
+ it "should properly convert integer values that fit into more than 8 bytes" do
246
+ test_for_value(2**256)
247
+ end
248
+ end
249
+ end