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.

@@ -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