bson 1.8.4 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bson might be problematic. Click here for more details.
- checksums.yaml +6 -14
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/VERSION +1 -1
- data/bson.gemspec +6 -3
- data/lib/bson/ordered_hash.rb +7 -6
- metadata +27 -50
- metadata.gz.sig +0 -0
- data/test/bson/binary_test.rb +0 -13
- data/test/bson/bson_test.rb +0 -762
- data/test/bson/byte_buffer_test.rb +0 -215
- data/test/bson/hash_with_indifferent_access_test.rb +0 -48
- data/test/bson/json_test.rb +0 -16
- data/test/bson/object_id_test.rb +0 -153
- data/test/bson/ordered_hash_test.rb +0 -247
- data/test/bson/timestamp_test.rb +0 -51
data/test/bson/timestamp_test.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TimestampTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_timestamp_to_s
|
6
|
-
t1 = Timestamp.new(5000, 200)
|
7
|
-
assert_equal "seconds: 5000, increment: 200", t1.to_s
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_timestamp_equality
|
11
|
-
t1 = Timestamp.new(5000, 200)
|
12
|
-
t2 = Timestamp.new(5000, 200)
|
13
|
-
assert_equal t2, t1
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_timestamp_range
|
17
|
-
t = 1;
|
18
|
-
while(t < 1_000_000_000 ) do
|
19
|
-
ts = Timestamp.new(t, 0)
|
20
|
-
doc = {:ts => ts}
|
21
|
-
bson = BSON::BSON_CODER.serialize(doc)
|
22
|
-
assert_equal doc[:ts], BSON::BSON_CODER.deserialize(bson)['ts']
|
23
|
-
t = t * 10
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_timestamp_32bit_compatibility
|
28
|
-
max_32bit_fixnum = (1 << 30) - 1
|
29
|
-
test_val = max_32bit_fixnum + 10
|
30
|
-
|
31
|
-
ts = Timestamp.new(test_val, test_val)
|
32
|
-
doc = {:ts => ts}
|
33
|
-
bson = BSON::BSON_CODER.serialize(doc)
|
34
|
-
assert_equal doc[:ts], BSON::BSON_CODER.deserialize(bson)['ts']
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_implements_array_for_backward_compatibility
|
38
|
-
silently do
|
39
|
-
ts = Timestamp.new(5000, 200)
|
40
|
-
assert_equal 200, ts[0]
|
41
|
-
assert_equal 5000, ts[1]
|
42
|
-
|
43
|
-
array = ts.map {|t| t }
|
44
|
-
assert_equal 2, array.length
|
45
|
-
|
46
|
-
assert_equal 200, array[0]
|
47
|
-
assert_equal 5000, array[1]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|