@@ -7,141 +7,141 @@ defmodule BSONTest do
7
7
8
8
import BSON , only: [ decode: 1 ]
9
9
10
- @ map1 % { "hello" => "world" }
11
- @ bin1 << 22 , 0 , 0 , 0 , 2 , 104 , 101 , 108 , 108 , 111 , 0 , 6 , 0 , 0 , 0 , 119 , 111 , 114 , 108 , 100 , 0 , 0 >>
10
+ @ map_1 % { "hello" => "world" }
11
+ @ bin_1 << 22 , 0 , 0 , 0 , 2 , 104 , 101 , 108 , 108 , 111 , 0 , 6 , 0 , 0 , 0 , 119 , 111 , 114 , 108 , 100 , 0 , 0 >>
12
12
13
- @ map2 % { "BSON" => [ "awesome" , 5.05 , 1986 ] }
14
- @ bin2 << 49 , 0 , 0 , 0 , 4 , 66 , 83 , 79 , 78 , 0 , 38 , 0 , 0 , 0 , 2 , 48 , 0 , 8 , 0 , 0 , 0 , 97 , 119 , 101 , 115 , 111 , 109 , 101 , 0 , 1 , 49 , 0 , 51 , 51 , 51 , 51 , 51 , 51 , 20 , 64 , 16 , 50 , 0 , 194 , 7 , 0 , 0 , 0 , 0 >>
13
+ @ map_2 % { "BSON" => [ "awesome" , 5.05 , 1986 ] }
14
+ @ bin_2 << 49 , 0 , 0 , 0 , 4 , 66 , 83 , 79 , 78 , 0 , 38 , 0 , 0 , 0 , 2 , 48 , 0 , 8 , 0 , 0 , 0 , 97 , 119 , 101 , 115 , 111 , 109 , 101 , 0 , 1 , 49 , 0 , 51 , 51 , 51 , 51 , 51 , 51 , 20 , 64 , 16 , 50 , 0 , 194 , 7 , 0 , 0 , 0 , 0 >>
15
15
16
- @ map3 % { "a" => % { "b" => % { } , "c" => % { "d" => nil } } }
17
- @ bin3 << 32 , 0 , 0 , 0 , 3 , 97 , 0 , 24 , 0 , 0 , 0 , 3 , 98 , 0 , 5 , 0 , 0 , 0 , 0 , 3 , 99 , 0 , 8 , 0 , 0 , 0 , 10 , 100 , 0 , 0 , 0 , 0 >>
16
+ @ map_3 % { "a" => % { "b" => % { } , "c" => % { "d" => nil } } }
17
+ @ bin_3 << 32 , 0 , 0 , 0 , 3 , 97 , 0 , 24 , 0 , 0 , 0 , 3 , 98 , 0 , 5 , 0 , 0 , 0 , 0 , 3 , 99 , 0 , 8 , 0 , 0 , 0 , 10 , 100 , 0 , 0 , 0 , 0 >>
18
18
19
- @ map4 % { "a" => [ ] , "b" => [ 1 , 2 , 3 ] , "c" => [ 1.1 , "2" , true ] }
20
- @ bin4 << 74 , 0 , 0 , 0 , 4 , 97 , 0 , 5 , 0 , 0 , 0 , 0 , 4 , 98 , 0 , 26 , 0 , 0 , 0 , 16 , 48 , 0 , 1 , 0 , 0 , 0 , 16 , 49 , 0 , 2 , 0 , 0 , 0 , 16 , 50 , 0 , 3 , 0 , 0 , 0 , 0 , 4 , 99 , 0 , 29 , 0 , 0 , 0 , 1 , 48 , 0 , 154 , 153 , 153 , 153 , 153 , 153 , 241 , 63 , 2 , 49 , 0 , 2 , 0 , 0 , 0 , 50 , 0 , 8 , 50 ,
19
+ @ map_4 % { "a" => [ ] , "b" => [ 1 , 2 , 3 ] , "c" => [ 1.1 , "2" , true ] }
20
+ @ bin_4 << 74 , 0 , 0 , 0 , 4 , 97 , 0 , 5 , 0 , 0 , 0 , 0 , 4 , 98 , 0 , 26 , 0 , 0 , 0 , 16 , 48 , 0 , 1 , 0 , 0 , 0 , 16 , 49 , 0 , 2 , 0 , 0 , 0 , 16 , 50 , 0 , 3 , 0 , 0 , 0 , 0 , 4 , 99 , 0 , 29 , 0 , 0 , 0 , 1 , 48 , 0 , 154 , 153 , 153 , 153 , 153 , 153 , 241 , 63 , 2 , 49 , 0 , 2 , 0 , 0 , 0 , 50 , 0 , 8 , 50 ,
21
21
0 , 1 , 0 , 0 >>
22
22
23
- @ map5 % { "a" => 123.0 }
24
- @ bin5 << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 192 , 94 , 64 , 0 >>
23
+ @ map_5 % { "a" => 123.0 }
24
+ @ bin_5 << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 192 , 94 , 64 , 0 >>
25
25
26
- @ map6 % { "b" => "123" }
27
- @ bin6 << 16 , 0 , 0 , 0 , 2 , 98 , 0 , 4 , 0 , 0 , 0 , 49 , 50 , 51 , 0 , 0 >>
26
+ @ map_6 % { "b" => "123" }
27
+ @ bin_6 << 16 , 0 , 0 , 0 , 2 , 98 , 0 , 4 , 0 , 0 , 0 , 49 , 50 , 51 , 0 , 0 >>
28
28
29
- @ map7 % { "c" => % { } }
30
- @ bin7 << 13 , 0 , 0 , 0 , 3 , 99 , 0 , 5 , 0 , 0 , 0 , 0 , 0 >>
29
+ @ map_7 % { "c" => % { } }
30
+ @ bin_7 << 13 , 0 , 0 , 0 , 3 , 99 , 0 , 5 , 0 , 0 , 0 , 0 , 0 >>
31
31
32
- @ map8 % { "d" => [ ] }
33
- @ bin8 << 13 , 0 , 0 , 0 , 4 , 100 , 0 , 5 , 0 , 0 , 0 , 0 , 0 >>
32
+ @ map_8 % { "d" => [ ] }
33
+ @ bin_8 << 13 , 0 , 0 , 0 , 4 , 100 , 0 , 5 , 0 , 0 , 0 , 0 , 0 >>
34
34
35
- @ map9 % { "e" => % BSON.Binary { binary: << 1 , 2 , 3 >> , subtype: :generic } }
36
- @ bin9 << 16 , 0 , 0 , 0 , 5 , 101 , 0 , 3 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 0 >>
35
+ @ map_9 % { "e" => % BSON.Binary { binary: << 1 , 2 , 3 >> , subtype: :generic } }
36
+ @ bin_9 << 16 , 0 , 0 , 0 , 5 , 101 , 0 , 3 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 0 >>
37
37
38
- @ map10 % { "f" => % BSON.ObjectId { value: << 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 >> } }
39
- @ bin10 << 20 , 0 , 0 , 0 , 7 , 102 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 0 >>
38
+ @ map_10 % { "f" => % BSON.ObjectId { value: << 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 >> } }
39
+ @ bin_10 << 20 , 0 , 0 , 0 , 7 , 102 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 0 >>
40
40
41
- @ map11 % { "g" => true }
42
- @ bin11 << 9 , 0 , 0 , 0 , 8 , 103 , 0 , 1 , 0 >>
41
+ @ map_11 % { "g" => true }
42
+ @ bin_11 << 9 , 0 , 0 , 0 , 8 , 103 , 0 , 1 , 0 >>
43
43
44
- @ map12 % { "h" => DateTime . from_unix! ( 12_345 , :millisecond ) }
45
- @ bin12 << 16 , 0 , 0 , 0 , 9 , 104 , 0 , 57 , 48 , 0 , 0 , 0 , 0 , 0 , 0 , 0 >>
44
+ @ map_12 % { "h" => DateTime . from_unix! ( 12_345 , :millisecond ) }
45
+ @ bin_12 << 16 , 0 , 0 , 0 , 9 , 104 , 0 , 57 , 48 , 0 , 0 , 0 , 0 , 0 , 0 , 0 >>
46
46
47
- @ map13 % { "i" => nil }
48
- @ bin13 << 8 , 0 , 0 , 0 , 10 , 105 , 0 , 0 >>
47
+ @ map_13 % { "i" => nil }
48
+ @ bin_13 << 8 , 0 , 0 , 0 , 10 , 105 , 0 , 0 >>
49
49
50
- @ map14 % { "j" => % BSON.JavaScript { code: "1 + 2" } }
51
- @ bin14 << 18 , 0 , 0 , 0 , 13 , 106 , 0 , 6 , 0 , 0 , 0 , 49 , 32 , 43 , 32 , 50 , 0 , 0 >>
50
+ @ map_14 % { "j" => % BSON.JavaScript { code: "1 + 2" } }
51
+ @ bin_14 << 18 , 0 , 0 , 0 , 13 , 106 , 0 , 6 , 0 , 0 , 0 , 49 , 32 , 43 , 32 , 50 , 0 , 0 >>
52
52
53
- @ map15 % { "k" => % BSON.JavaScript { code: "a + b" , scope: % { "a" => 2 , "b" => 2 } } }
54
- @ bin15 << 41 , 0 , 0 , 0 , 15 , 107 , 0 , 33 , 0 , 0 , 0 , 6 , 0 , 0 , 0 , 97 , 32 , 43 , 32 , 98 , 0 , 19 , 0 , 0 , 0 , 16 , 97 , 0 , 2 , 0 , 0 , 0 , 16 , 98 , 0 , 2 , 0 , 0 , 0 , 0 , 0 >>
53
+ @ map_15 % { "k" => % BSON.JavaScript { code: "a + b" , scope: % { "a" => 2 , "b" => 2 } } }
54
+ @ bin_15 << 41 , 0 , 0 , 0 , 15 , 107 , 0 , 33 , 0 , 0 , 0 , 6 , 0 , 0 , 0 , 97 , 32 , 43 , 32 , 98 , 0 , 19 , 0 , 0 , 0 , 16 , 97 , 0 , 2 , 0 , 0 , 0 , 16 , 98 , 0 , 2 , 0 , 0 , 0 , 0 , 0 >>
55
55
56
- @ map16 % { "l" => 12_345 }
57
- @ bin16 << 12 , 0 , 0 , 0 , 16 , 108 , 0 , 57 , 48 , 0 , 0 , 0 >>
56
+ @ map_16 % { "l" => 12_345 }
57
+ @ bin_16 << 12 , 0 , 0 , 0 , 16 , 108 , 0 , 57 , 48 , 0 , 0 , 0 >>
58
58
59
- @ map17 % { "m" => % BSON.Timestamp { value: 1_423_458_185 , ordinal: 9 } }
60
- @ bin17 << 16 , 0 , 0 , 0 , 17 , 109 , 0 , 9 , 0 , 0 , 0 , 137 , 63 , 216 , 84 , 0 >>
59
+ @ map_17 % { "m" => % BSON.Timestamp { value: 1_423_458_185 , ordinal: 9 } }
60
+ @ bin_17 << 16 , 0 , 0 , 0 , 17 , 109 , 0 , 9 , 0 , 0 , 0 , 137 , 63 , 216 , 84 , 0 >>
61
61
62
- @ map18 % { "n" => 123_456_789_123_456 }
63
- @ bin18 << 16 , 0 , 0 , 0 , 18 , 110 , 0 , 128 , 145 , 15 , 134 , 72 , 112 , 0 , 0 , 0 >>
62
+ @ map_18 % { "n" => 123_456_789_123_456 }
63
+ @ bin_18 << 16 , 0 , 0 , 0 , 18 , 110 , 0 , 128 , 145 , 15 , 134 , 72 , 112 , 0 , 0 , 0 >>
64
64
65
- @ map19 % { "o" => :BSON_min }
66
- @ bin19 << 8 , 0 , 0 , 0 , 255 , 111 , 0 , 0 >>
65
+ @ map_19 % { "o" => :BSON_min }
66
+ @ bin_19 << 8 , 0 , 0 , 0 , 255 , 111 , 0 , 0 >>
67
67
68
- @ map20 % { "p" => :BSON_max }
69
- @ bin20 << 8 , 0 , 0 , 0 , 127 , 112 , 0 , 0 >>
68
+ @ map_20 % { "p" => :BSON_max }
69
+ @ bin_20 << 8 , 0 , 0 , 0 , 127 , 112 , 0 , 0 >>
70
70
71
- @ map21 % { "q" => % BSON.Binary { binary: << 1 , 2 , 3 >> , subtype: :binary_old } }
72
- @ bin21 << 20 , 0 , 0 , 0 , 5 , 113 , 0 , 7 , 0 , 0 , 0 , 2 , 3 , 0 , 0 , 0 , 1 , 2 , 3 , 0 >>
71
+ @ map_21 % { "q" => % BSON.Binary { binary: << 1 , 2 , 3 >> , subtype: :binary_old } }
72
+ @ bin_21 << 20 , 0 , 0 , 0 , 5 , 113 , 0 , 7 , 0 , 0 , 0 , 2 , 3 , 0 , 0 , 0 , 1 , 2 , 3 , 0 >>
73
73
74
- @ map22 % { "regex" => % BSON.Regex { pattern: "acme.*corp" , options: "i" } }
75
- @ bin22 << 25 , 0 , 0 , 0 , 11 , 114 , 101 , 103 , 101 , 120 , 0 , 97 , 99 , 109 , 101 , 46 , 42 , 99 , 111 , 114 , 112 , 0 , 105 , 0 , 0 >>
74
+ @ map_22 % { "regex" => % BSON.Regex { pattern: "acme.*corp" , options: "i" } }
75
+ @ bin_22 << 25 , 0 , 0 , 0 , 11 , 114 , 101 , 103 , 101 , 120 , 0 , 97 , 99 , 109 , 101 , 46 , 42 , 99 , 111 , 114 , 112 , 0 , 105 , 0 , 0 >>
76
76
77
- @ map23 % { "regex" => % BSON.Regex { pattern: "acme.*corp" } }
78
- @ bin23 << 24 , 0 , 0 , 0 , 11 , 114 , 101 , 103 , 101 , 120 , 0 , 97 , 99 , 109 , 101 , 46 , 42 , 99 , 111 , 114 , 112 , 0 , 0 , 0 >>
77
+ @ map_23 % { "regex" => % BSON.Regex { pattern: "acme.*corp" } }
78
+ @ bin_23 << 24 , 0 , 0 , 0 , 11 , 114 , 101 , 103 , 101 , 120 , 0 , 97 , 99 , 109 , 101 , 46 , 42 , 99 , 111 , 114 , 112 , 0 , 0 , 0 >>
79
79
80
- @ map24 % { "number" => % BSON.LongNumber { value: 123 } }
81
- @ bin24 << 21 , 0 , 0 , 0 , 18 , 110 , 117 , 109 , 98 , 101 , 114 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 >>
80
+ @ map_24 % { "number" => % BSON.LongNumber { value: 123 } }
81
+ @ bin_24 << 21 , 0 , 0 , 0 , 18 , 110 , 117 , 109 , 98 , 101 , 114 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 >>
82
82
83
- @ map25 % { "number" => Decimal . new ( "0.33" ) }
84
- @ bin25 << 29 , 0 , 0 , 0 , 19 , 110 , 117 , 109 , 98 , 101 , 114 , 0 , 33 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 60 , 48 , 0 >>
83
+ @ map_25 % { "number" => Decimal . new ( "0.33" ) }
84
+ @ bin_25 << 29 , 0 , 0 , 0 , 19 , 110 , 117 , 109 , 98 , 101 , 114 , 0 , 33 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 60 , 48 , 0 >>
85
85
86
- @ map26 % TestUser { }
87
- @ bin26 << 29 , 0 , 0 , 0 , 16 , 97 , 103 , 101 , 0 , 27 , 0 , 0 , 0 , 2 , 110 , 97 , 109 , 101 , 0 , 5 , 0 , 0 , 0 , 74 , 111 , 104 , 110 , 0 , 0 >>
86
+ @ map_26 % TestUser { }
87
+ @ bin_26 << 29 , 0 , 0 , 0 , 16 , 97 , 103 , 101 , 0 , 27 , 0 , 0 , 0 , 2 , 110 , 97 , 109 , 101 , 0 , 5 , 0 , 0 , 0 , 74 , 111 , 104 , 110 , 0 , 0 >>
88
88
89
89
test "encode" do
90
- assert encode ( @ map1 ) == @ bin1
91
- assert encode ( @ map2 ) == @ bin2
92
- assert encode ( @ map3 ) == @ bin3
93
- assert encode ( @ map4 ) == @ bin4
94
- assert encode ( @ map5 ) == @ bin5
95
- assert encode ( @ map6 ) == @ bin6
96
- assert encode ( @ map7 ) == @ bin7
97
- assert encode ( @ map8 ) == @ bin8
98
- assert encode ( @ map9 ) == @ bin9
99
- assert encode ( @ map10 ) == @ bin10
100
- assert encode ( @ map11 ) == @ bin11
101
- assert encode ( @ map12 ) == @ bin12
102
- assert encode ( @ map13 ) == @ bin13
103
- assert encode ( @ map14 ) == @ bin14
104
- assert encode ( @ map15 ) == @ bin15
105
- assert encode ( @ map16 ) == @ bin16
106
- assert encode ( @ map17 ) == @ bin17
107
- assert encode ( @ map18 ) == @ bin18
108
- assert encode ( @ map19 ) == @ bin19
109
- assert encode ( @ map20 ) == @ bin20
110
- assert encode ( @ map21 ) == @ bin21
111
- assert encode ( @ map22 ) == @ bin22
112
- assert encode ( @ map23 ) == @ bin23
113
- assert encode ( @ map24 ) == @ bin24
114
- assert encode ( @ map25 ) == @ bin25
115
- assert encode ( @ map26 ) == @ bin26
90
+ assert encode ( @ map_1 ) == @ bin_1
91
+ assert encode ( @ map_2 ) == @ bin_2
92
+ assert encode ( @ map_3 ) == @ bin_3
93
+ assert encode ( @ map_4 ) == @ bin_4
94
+ assert encode ( @ map_5 ) == @ bin_5
95
+ assert encode ( @ map_6 ) == @ bin_6
96
+ assert encode ( @ map_7 ) == @ bin_7
97
+ assert encode ( @ map_8 ) == @ bin_8
98
+ assert encode ( @ map_9 ) == @ bin_9
99
+ assert encode ( @ map_10 ) == @ bin_10
100
+ assert encode ( @ map_11 ) == @ bin_11
101
+ assert encode ( @ map_12 ) == @ bin_12
102
+ assert encode ( @ map_13 ) == @ bin_13
103
+ assert encode ( @ map_14 ) == @ bin_14
104
+ assert encode ( @ map_15 ) == @ bin_15
105
+ assert encode ( @ map_16 ) == @ bin_16
106
+ assert encode ( @ map_17 ) == @ bin_17
107
+ assert encode ( @ map_18 ) == @ bin_18
108
+ assert encode ( @ map_19 ) == @ bin_19
109
+ assert encode ( @ map_20 ) == @ bin_20
110
+ assert encode ( @ map_21 ) == @ bin_21
111
+ assert encode ( @ map_22 ) == @ bin_22
112
+ assert encode ( @ map_23 ) == @ bin_23
113
+ assert encode ( @ map_24 ) == @ bin_24
114
+ assert encode ( @ map_25 ) == @ bin_25
115
+ assert encode ( @ map_26 ) == @ bin_26
116
116
end
117
117
118
118
test "decode" do
119
- assert decode ( @ bin1 ) == @ map1
120
- assert decode ( @ bin2 ) == @ map2
121
- assert decode ( @ bin3 ) == @ map3
122
- assert decode ( @ bin4 ) == @ map4
123
- assert decode ( @ bin5 ) == @ map5
124
- assert decode ( @ bin6 ) == @ map6
125
- assert decode ( @ bin7 ) == @ map7
126
- assert decode ( @ bin8 ) == @ map8
127
- assert decode ( @ bin9 ) == @ map9
128
- assert decode ( @ bin10 ) == @ map10
129
- assert decode ( @ bin11 ) == @ map11
130
- assert decode ( @ bin12 ) == @ map12
131
- assert decode ( @ bin13 ) == @ map13
132
- assert decode ( @ bin14 ) == @ map14
133
- assert decode ( @ bin15 ) == @ map15
134
- assert decode ( @ bin16 ) == @ map16
135
- assert decode ( @ bin17 ) == @ map17
136
- assert decode ( @ bin18 ) == @ map18
137
- assert decode ( @ bin19 ) == @ map19
138
- assert decode ( @ bin20 ) == @ map20
139
- assert decode ( @ bin21 ) == @ map21
140
- assert decode ( @ bin22 ) == @ map22
141
- assert decode ( @ bin23 ) == @ map23
142
- assert decode ( @ bin24 ) == % { "number" => 123 }
143
- assert decode ( @ bin25 ) == @ map25
144
- assert decode ( @ bin26 ) == % { "name" => "John" , "age" => 27 }
119
+ assert decode ( @ bin_1 ) == @ map_1
120
+ assert decode ( @ bin_2 ) == @ map_2
121
+ assert decode ( @ bin_3 ) == @ map_3
122
+ assert decode ( @ bin_4 ) == @ map_4
123
+ assert decode ( @ bin_5 ) == @ map_5
124
+ assert decode ( @ bin_6 ) == @ map_6
125
+ assert decode ( @ bin_7 ) == @ map_7
126
+ assert decode ( @ bin_8 ) == @ map_8
127
+ assert decode ( @ bin_9 ) == @ map_9
128
+ assert decode ( @ bin_10 ) == @ map_10
129
+ assert decode ( @ bin_11 ) == @ map_11
130
+ assert decode ( @ bin_12 ) == @ map_12
131
+ assert decode ( @ bin_13 ) == @ map_13
132
+ assert decode ( @ bin_14 ) == @ map_14
133
+ assert decode ( @ bin_15 ) == @ map_15
134
+ assert decode ( @ bin_16 ) == @ map_16
135
+ assert decode ( @ bin_17 ) == @ map_17
136
+ assert decode ( @ bin_18 ) == @ map_18
137
+ assert decode ( @ bin_19 ) == @ map_19
138
+ assert decode ( @ bin_20 ) == @ map_20
139
+ assert decode ( @ bin_21 ) == @ map_21
140
+ assert decode ( @ bin_22 ) == @ map_22
141
+ assert decode ( @ bin_23 ) == @ map_23
142
+ assert decode ( @ bin_24 ) == % { "number" => 123 }
143
+ assert decode ( @ bin_25 ) == @ map_25
144
+ assert decode ( @ bin_26 ) == % { "name" => "John" , "age" => 27 }
145
145
end
146
146
147
147
test "keywords" do
@@ -155,51 +155,51 @@ defmodule BSONTest do
155
155
end
156
156
157
157
test "encode atom" do
158
- assert encode ( % { hello: "world" } ) == @ bin1
158
+ assert encode ( % { hello: "world" } ) == @ bin_1
159
159
end
160
160
161
161
test "encode atom value" do
162
- assert encode ( % { "hello" => :world } ) == @ bin1
162
+ assert encode ( % { "hello" => :world } ) == @ bin_1
163
163
end
164
164
165
165
test "decode BSON symbol into string" do
166
166
encoded = << 22 , 0 , 0 , 0 , 14 , 104 , 101 , 108 , 108 , 111 , 0 , 6 , 0 , 0 , 0 , 119 , 111 , 114 , 108 , 100 , 0 , 0 >>
167
- assert decode ( encoded ) == @ map1
167
+ assert decode ( encoded ) == @ map_1
168
168
end
169
169
170
- @ mapPosInf % { "a" => :inf }
171
- @ binPosInf << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 240 :: little - integer - size ( 8 ) , 127 :: little - integer - size ( 8 ) , 0 >>
170
+ @ map_pos_inf % { "a" => :inf }
171
+ @ bin_pos_inf << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 240 :: little - integer - size ( 8 ) , 127 :: little - integer - size ( 8 ) , 0 >>
172
172
173
- @ mapNegInf % { "a" => :"-inf" }
174
- @ binNegInf << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 240 :: little - integer - size ( 8 ) , 255 :: little - integer - size ( 8 ) , 0 >>
173
+ @ map_neg_inf % { "a" => :"-inf" }
174
+ @ bin_neg_inf << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 240 :: little - integer - size ( 8 ) , 255 :: little - integer - size ( 8 ) , 0 >>
175
175
176
- @ mapNaN % { "a" => :NaN }
177
- @ binNaN << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 248 :: little - integer - size ( 8 ) , 127 :: little - integer - size ( 8 ) , 0 >>
178
- @ binNaN2 << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 240 :: little - integer - size ( 8 ) , 127 :: little - integer - size ( 8 ) , 0 >>
176
+ @ map_nan % { "a" => :NaN }
177
+ @ bin_nan << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 248 :: little - integer - size ( 8 ) , 127 :: little - integer - size ( 8 ) , 0 >>
178
+ @ bin_nan2 << 16 , 0 , 0 , 0 , 1 , 97 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 240 :: little - integer - size ( 8 ) , 127 :: little - integer - size ( 8 ) , 0 >>
179
179
180
180
test "decode float NaN" do
181
- assert decode ( @ binNaN ) == @ mapNaN
182
- assert decode ( @ binNaN2 ) == @ mapNaN
181
+ assert decode ( @ bin_nan ) == @ map_nan
182
+ assert decode ( @ bin_nan2 ) == @ map_nan
183
183
end
184
184
185
185
test "encode float NaN" do
186
- assert encode ( @ mapNaN ) == @ binNaN
186
+ assert encode ( @ map_nan ) == @ bin_nan
187
187
end
188
188
189
189
test "decode float positive Infinity" do
190
- assert decode ( @ binPosInf ) == @ mapPosInf
190
+ assert decode ( @ bin_pos_inf ) == @ map_pos_inf
191
191
end
192
192
193
193
test "encode float positive Infinity" do
194
- assert encode ( @ mapPosInf ) == @ binPosInf
194
+ assert encode ( @ map_pos_inf ) == @ bin_pos_inf
195
195
end
196
196
197
197
test "decode float negative Infinity" do
198
- assert decode ( @ binNegInf ) == @ mapNegInf
198
+ assert decode ( @ bin_neg_inf ) == @ map_neg_inf
199
199
end
200
200
201
201
test "encode float negative Infinity" do
202
- assert encode ( @ mapNegInf ) == @ binNegInf
202
+ assert encode ( @ map_neg_inf ) == @ bin_neg_inf
203
203
end
204
204
205
205
test "mixing atoms with binaries" do
0 commit comments