xnd 0.2.0dev5 → 0.2.0dev6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/Rakefile +15 -45
- data/ext/ruby_xnd/extconf.rb +6 -2
- data/ext/ruby_xnd/float_pack_unpack.h +8 -0
- data/ext/ruby_xnd/ruby_xnd.c +57 -23
- data/ext/ruby_xnd/util.c +165 -0
- data/ext/ruby_xnd/util.h +7 -116
- data/lib/xnd.rb +11 -3
- data/lib/xnd/version.rb +1 -1
- data/xnd.gemspec +3 -2
- metadata +21 -25
- data/ext/ruby_xnd/include/xnd.h +0 -449
- data/ext/ruby_xnd/lib/libxnd.a +0 -0
- data/ext/ruby_xnd/lib/libxnd.so +0 -1
- data/ext/ruby_xnd/lib/libxnd.so.0 +0 -1
- data/ext/ruby_xnd/lib/libxnd.so.0.2.0dev3 +0 -0
- data/lib/ruby_xnd.so +0 -0
- data/lib/xnd/monkeys.rb +0 -29
- data/spec/debug_spec.rb +0 -9
- data/spec/gc_guard_spec.rb +0 -10
- data/spec/leakcheck.rb +0 -9
- data/spec/spec_helper.rb +0 -877
- data/spec/type_inference_spec.rb +0 -81
- data/spec/xnd_spec.rb +0 -2921
data/ext/ruby_xnd/lib/libxnd.a
DELETED
Binary file
|
data/ext/ruby_xnd/lib/libxnd.so
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ext/ruby_xnd/lib/libxnd.so.0.2.0dev3
|
@@ -1 +0,0 @@
|
|
1
|
-
ext/ruby_xnd/lib/libxnd.so.0.2.0dev3
|
Binary file
|
data/lib/ruby_xnd.so
DELETED
Binary file
|
data/lib/xnd/monkeys.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
class String
|
2
|
-
# Force encode string to ASCII-8BIT.
|
3
|
-
#
|
4
|
-
# Reference: https://idiosyncratic-ruby.com/56-us-ascii-8bit.html
|
5
|
-
# FIXME: Hopefully find a better way of doing this soon.
|
6
|
-
def b
|
7
|
-
self.force_encoding "ASCII-8BIT"
|
8
|
-
end
|
9
|
-
|
10
|
-
# Encode string as UTF-16.
|
11
|
-
def u16!
|
12
|
-
self.encode! Encoding::UTF_16
|
13
|
-
end
|
14
|
-
|
15
|
-
# Encode string as UTF-16.
|
16
|
-
def u16
|
17
|
-
self.encode Encoding::UTF_16
|
18
|
-
end
|
19
|
-
|
20
|
-
# Encode string as UTF-32.
|
21
|
-
def u32!
|
22
|
-
self.encode! Encoding::UTF_32
|
23
|
-
end
|
24
|
-
|
25
|
-
# Encode string as UTF-32.
|
26
|
-
def u32
|
27
|
-
self.encode Encoding::UTF_32
|
28
|
-
end
|
29
|
-
end
|
data/spec/debug_spec.rb
DELETED
data/spec/gc_guard_spec.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RubyXND::GCGuard do
|
4
|
-
it "stores objects as key and corresponding mblock object as value" do
|
5
|
-
xnd = XND.new([[1,2,3]])
|
6
|
-
|
7
|
-
gc_table = RubyXND::GCGuard.instance_variable_get(:@__gc_guard_table)
|
8
|
-
expect(gc_table.keys.size >= 1).to eq(true)
|
9
|
-
end
|
10
|
-
end
|
data/spec/leakcheck.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,877 +0,0 @@
|
|
1
|
-
require 'xnd'
|
2
|
-
require 'pry'
|
3
|
-
|
4
|
-
def expect_strict_equal x1, x2
|
5
|
-
expect(x1.strict_equal(x2)).to eq(true)
|
6
|
-
expect(x1).to eq(x2)
|
7
|
-
end
|
8
|
-
|
9
|
-
def expect_strict_unequal x1, x2
|
10
|
-
expect(x1.strict_equal(x2)).to eq(false)
|
11
|
-
expect(x1).not_to eq(x2)
|
12
|
-
end
|
13
|
-
|
14
|
-
def expect_with_exception func, x, y
|
15
|
-
return if (x.value.nil? || y.nil?) #|| (x.value&.abs == 0 && y&.abs == 0)
|
16
|
-
|
17
|
-
xerr = nil
|
18
|
-
begin
|
19
|
-
xres = x.send(func)
|
20
|
-
rescue StandardError => e
|
21
|
-
xerr = e.class
|
22
|
-
end
|
23
|
-
|
24
|
-
yerr = nil
|
25
|
-
begin
|
26
|
-
yres = y.send(func)
|
27
|
-
rescue StandardError => e
|
28
|
-
yerr = e.class
|
29
|
-
end
|
30
|
-
|
31
|
-
if xerr.nil? && yerr.nil?
|
32
|
-
expect(xres).to eq(yres)
|
33
|
-
else
|
34
|
-
expect(xerr).to eq(yerr)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def get_inf_or_normal_range start, stop, exclude_end
|
39
|
-
if start == Float::INFINITY && stop != Float::INFINITY
|
40
|
-
Range.new 0, stop, exclude_end
|
41
|
-
elsif start != Float::INFINITY && stop == Float::INFINITY
|
42
|
-
Range.new start, 9999, exclude_end
|
43
|
-
elsif start == Float::INFINITY && stop == Float::INFINITY
|
44
|
-
Range.new 0, 9999, exclude_end
|
45
|
-
else
|
46
|
-
Range.new start, stop, exclude_end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# ======================================================================
|
51
|
-
# Primitive types
|
52
|
-
# ======================================================================
|
53
|
-
|
54
|
-
PRIMITIVE = [
|
55
|
-
'int8', 'int16', 'int32', 'int64',
|
56
|
-
'uint8', 'uint16', 'uint32', 'uint64',
|
57
|
-
'float32', 'float64',
|
58
|
-
'complex64', 'complex128'
|
59
|
-
]
|
60
|
-
|
61
|
-
BOOL_PRIMITIVE = ['bool']
|
62
|
-
|
63
|
-
EMPTY_TEST_CASES = [
|
64
|
-
[0, "%s"],
|
65
|
-
[[], "0 * %s"],
|
66
|
-
[[0], "1 * %s"],
|
67
|
-
[[0, 0], "var(offsets=[0, 2]) * %s"],
|
68
|
-
[[{"a" => 0, "b" => 0}] * 3, "3 * {a: int64, b: %s}"]
|
69
|
-
]
|
70
|
-
|
71
|
-
def empty_test_cases(val=0)
|
72
|
-
[
|
73
|
-
[val, "%s"],
|
74
|
-
[[], "0 * %s"],
|
75
|
-
[[val], "1 * %s"],
|
76
|
-
[[val, val], "var(offsets=[0, 2]) * %s"],
|
77
|
-
[[{"a" => 0, "b" => val}] * 3, "3 * {a: int64, b: %s}"]
|
78
|
-
]
|
79
|
-
end
|
80
|
-
|
81
|
-
# ======================================================================
|
82
|
-
# Typed values
|
83
|
-
# ======================================================================
|
84
|
-
|
85
|
-
DTYPE_EMPTY_TEST_CASES = [
|
86
|
-
# Tuples
|
87
|
-
[[], "()"],
|
88
|
-
[[0], "(int8)"],
|
89
|
-
[[0, 0], "(int8, int64)"],
|
90
|
-
[[0, [0+0i]], "(uint16, (complex64))"],
|
91
|
-
[[0, [0+0i]], "(uint16, (complex64), pack=1)"],
|
92
|
-
[[0, [0+0i]], "(uint16, (complex64), pack=2)"],
|
93
|
-
[[0, [0+0i]], "(uint16, (complex64), pack=4)"],
|
94
|
-
[[0, [0+0i]], "(uint16, (complex64), pack=8)"],
|
95
|
-
[[0, [0+0i]], "(uint16, (complex64), align=16)"],
|
96
|
-
[[[]], "(0 * bytes)"],
|
97
|
-
[[[], []], "(0 * bytes, 0 * string)"],
|
98
|
-
[[[''], [0.0i] * 2, [""] * 3], "(1 * bytes, 2 * complex128, 3 * string)"],
|
99
|
-
[[[""], [[0.0i, [[""] * 2] * 10]] * 2, [""] * 3], "(1 * bytes, 2 * (complex128, 10 * 2 * string), 3 * string)"],
|
100
|
-
[[0, [[[[0.0] * 5] * 4] * 3] * 2], "(int64, 2 * 3 * Some(4 * 5 * float64))"],
|
101
|
-
[[0, [[[[0.0] * 5] * 4] * 3] * 2], "(int64, 2 * 3 * ref(4 * 5 * float64))"],
|
102
|
-
|
103
|
-
# Optional tuples
|
104
|
-
[nil, "?()"],
|
105
|
-
[nil, "?(int8)"],
|
106
|
-
[nil, "?(int8, int64)"],
|
107
|
-
[nil, "?(uint16, (complex64))"],
|
108
|
-
[nil, "?(uint16, (complex64), pack=1)"],
|
109
|
-
[nil, "?(uint16, (complex64), pack=2)"],
|
110
|
-
[nil, "?(uint16, (complex64), pack=4)"],
|
111
|
-
[nil, "?(uint16, (complex64), pack=8)"],
|
112
|
-
[nil, "?(uint16, (complex64), align=16)"],
|
113
|
-
[nil, "?(0 * bytes)"],
|
114
|
-
[nil, "?(0 * bytes, 0 * string)"],
|
115
|
-
[nil, "?(1 * bytes, 2 * complex128, 3 * string)"],
|
116
|
-
[nil, "?(1 * bytes, 2 * (complex128, 10 * 2 * string), 3 * string)"],
|
117
|
-
|
118
|
-
# Tuples with optional elements
|
119
|
-
[[nil], "(?int8)"],
|
120
|
-
[[nil, 0], "(?int8, int64)"],
|
121
|
-
[[0, nil], "(int8, ?int64)"],
|
122
|
-
[[nil, nil], "(?int8, ?int64)"],
|
123
|
-
[nil, "?(?int8, ?int64)"],
|
124
|
-
|
125
|
-
[[0, nil], "(uint16, ?(complex64))"],
|
126
|
-
[[0, [nil]], "(uint16, (?complex64))"],
|
127
|
-
[[0, nil], "(uint16, ?(?complex64))"],
|
128
|
-
|
129
|
-
[[nil, [0+0i]], "(?uint16, (complex64), pack=1)"],
|
130
|
-
[[0, nil], "(uint16, ?(complex64), pack=1)"],
|
131
|
-
[[0, [nil]], "(uint16, (?complex64), pack=1)"],
|
132
|
-
|
133
|
-
[[[]], "(0 * ?bytes)"],
|
134
|
-
[[[nil]], "(1 * ?bytes)"],
|
135
|
-
[[[nil] * 10], "(10 * ?bytes)"],
|
136
|
-
[[[], []], "(0 * ?bytes, 0 * ?string)"],
|
137
|
-
[[[nil] * 5, [""] * 2], "(5 * ?bytes, 2 * string)"],
|
138
|
-
[[[""] * 5, [nil] * 2], "(5 * bytes, 2 * ?string)"],
|
139
|
-
[[[nil] * 5, [nil] * 2], "(5 * ?bytes, 2 * ?string)"],
|
140
|
-
|
141
|
-
[[[nil], [nil] * 2, [nil] * 3], "(1 * ?bytes, 2 * ?complex128, 3 * ?string)"],
|
142
|
-
|
143
|
-
[[[nil], [ [0.0i, [ [""] * 2 ] * 10 ] ] * 2, [""] * 3 ], "(1 * ?bytes, 2 * (complex128, 10 * 2 * string), 3 * string)"],
|
144
|
-
[[[""], [nil] * 2, [""] * 3], "(1 * bytes, 2 * ?(complex128, 10 * 2 * string), 3 * string)"],
|
145
|
-
[[[""], [[0.0i, [[""] * 2] * 10]] * 2, [nil] * 3], "(1 * bytes, 2 * (complex128, 10 * 2 * string), 3 * ?string)"],
|
146
|
-
[[[nil], [nil] * 2, [""] * 3], "(1 * ?bytes, 2 * ?(complex128, 10 * 2 * string), 3 * string)"],
|
147
|
-
[[[nil], [[0.0i, [[""] * 2] * 10]] * 2, [nil] * 3], "(1 * ?bytes, 2 * (complex128, 10 * 2 * string), 3 * ?string)"],
|
148
|
-
[[[nil], [nil] * 2, [nil] * 3], "(1 * ?bytes, 2 * ?(complex128, 10 * 2 * string), 3 * ?string)"],
|
149
|
-
|
150
|
-
[[[""],[[0.0i, [[nil] * 2] * 10]] * 2, [""] * 3], "(1 * bytes, 2 * (complex128, 10 * 2 * ?string), 3 * string)"],
|
151
|
-
[[[nil], [[0.0i, [[nil] * 2] * 10]] * 2, [""] * 3], "(1 * ?bytes, 2 * (complex128, 10 * 2 * ?string), 3 * string)"],
|
152
|
-
[[[nil], [[nil , [[nil] * 2] * 10]] * 2, [""] * 3], "(1 * ?bytes, 2 * (?complex128, 10 * 2 * ?string), 3 * string)"],
|
153
|
-
[[[""], [[nil, [[nil] * 2] * 10]] * 2, [nil] * 3], "(1 * bytes, 2 * (?complex128, 10 * 2 * ?string), 3 * ?string)"],
|
154
|
-
|
155
|
-
[[0, [[[[nil] * 5] * 4] * 3] * 2], "(int64, 2 * 3 * Some(4 * 5 * ?float64))"],
|
156
|
-
[[0, [[[[nil] * 5] * 4] * 3] * 2], "(int64, 2 * 3 * ref(4 * 5 * ?float64))"],
|
157
|
-
|
158
|
-
# Records
|
159
|
-
[{}, "{}"],
|
160
|
-
[{'x' => 0}, "{x: int8}"],
|
161
|
-
[{'x' => 0, 'y' => 0}, "{x: int8, y: int64}"],
|
162
|
-
[{'x' => 0, 'y' => {'z' => 0+0i}}, "{x: uint16, y: {z: complex64}}"],
|
163
|
-
[{'x' => 0, 'y' => {'z' => 0+0i}}, "{x: uint16, y: {z: complex64}, pack=1}"],
|
164
|
-
[{'x' => 0, 'y' => {'z' => 0+0i}}, "{x: uint16, y: {z: complex64}, pack=2}"],
|
165
|
-
[{'x' => 0, 'y' => {'z' => 0+0i}}, "{x: uint16, y: {z: complex64}, pack=4}"],
|
166
|
-
[{'x' => 0, 'y' => {'z' => 0+0i}}, "{x: uint16, y: {z: complex64}, pack=8}"],
|
167
|
-
[{'x' => 0, 'y' => {'z' => 0+0i}}, "{x: uint16, y: {z: complex64}, align=16}"],
|
168
|
-
[{'x' => []}, "{x: 0 * bytes}"],
|
169
|
-
[{'x' => [], 'y' => []}, "{x: 0 * bytes, y: 0 * string}"],
|
170
|
-
[{'x' => [""], 'y' => [0.0i] * 2, 'z' => [""] * 3}, "{x: 1 * bytes, y: 2 * complex128, z: 3 * string}"],
|
171
|
-
[{'x' => [""], 'y' => [{'a' => 0.0i, 'b' => [[""] * 2] * 10}] * 2, 'z' => [""] * 3}, "{x: 1 * bytes, y: 2 * {a: complex128, b: 10 * 2 * string}, z: 3 * string}"],
|
172
|
-
[{'x' => 0, 'y' => [[[[0.0] * 5] * 4] * 3] * 2}, "{x: int64, y: 2 * 3 * Some(4 * 5 * float64)}"],
|
173
|
-
[{'x' => 0, 'y' => [[[[0.0] * 5] * 4] * 3] * 2}, "{x: int64, y: 2 * 3 * ref(4 * 5 * float64)}"],
|
174
|
-
|
175
|
-
# Optional records
|
176
|
-
[nil, "?{}"],
|
177
|
-
[nil, "?{x: int8}"],
|
178
|
-
[nil, "?{x: int8, y: int64}"],
|
179
|
-
[nil, "?{x: uint16, y: {z: complex64}}"],
|
180
|
-
[nil, "?{x: uint16, y: {z: complex64}, pack=1}"],
|
181
|
-
[nil, "?{x: uint16, y: {z: complex64}, pack=2}"],
|
182
|
-
[nil, "?{x: uint16, y: {z: complex64}, pack=4}"],
|
183
|
-
[nil, "?{x: uint16, y: {z: complex64}, pack=8}"],
|
184
|
-
[nil, "?{x: uint16, y: {z: complex64}, align=16}"],
|
185
|
-
[nil, "?{x: 0 * bytes}"],
|
186
|
-
[nil, "?{x: 0 * bytes, y: 0 * string}"],
|
187
|
-
[nil, "?{x: 1 * bytes, y: 2 * complex128, z: 3 * string}"],
|
188
|
-
[nil, "?{x: 1 * bytes, y: 2 * {a: complex128, b: 10 * 2 * string}, z: 3 * string}"],
|
189
|
-
|
190
|
-
# Records with optional elements
|
191
|
-
[{'x' => nil}, "{x: ?int8}"],
|
192
|
-
[{'x' => nil, 'y' => 0}, "{x: ?int8, y: int64}"],
|
193
|
-
[{'x' => 0, 'y' => nil}, "{x: int8, y: ?int64}"],
|
194
|
-
[{'x' => nil, 'y' => nil}, "{x: ?int8, y: ?int64}"],
|
195
|
-
[nil, "?{x: ?int8, y: ?int64}"],
|
196
|
-
|
197
|
-
[{'x' => 0, 'y' => nil}, " {x: uint16, y: ?{z: complex64}}"],
|
198
|
-
[{'x' => 0, 'y' => {'z' => nil}}, "{x: uint16, y: {z: ?complex64}}"],
|
199
|
-
[{'x' => 0, 'y' => nil}, "{x: uint16, y: ?{z: ?complex64}}"],
|
200
|
-
|
201
|
-
[{'x' => nil, 'y' => {'z' => 0+0i}}, "{x: ?uint16, y: {z: complex64}, pack=1}"],
|
202
|
-
[{'x' => 0, 'y' => nil}, "{x: uint16, y: ?{z: complex64}, pack=1}"],
|
203
|
-
[{'x' => 0, 'y' => {'z' => nil}}, "{x: uint16, y: {z: ?complex64}, pack=1}"],
|
204
|
-
|
205
|
-
[{'x' => []}, "{x: 0 * ?bytes}"],
|
206
|
-
[{'x' => [nil] * 1}, "{x: 1 * ?bytes}"],
|
207
|
-
[{'x' => [nil] * 10}, "{x: 10 * ?bytes}"],
|
208
|
-
[{'x' => [], 'y' => []}, "{x: 0 * ?bytes, y: 0 * ?string}"],
|
209
|
-
[{'x' => [nil] * 5, 'y' => [""] * 2}, "{x: 5 * ?bytes, y: 2 * string}"],
|
210
|
-
[{'x' => [""] * 5, 'y' => [nil] * 2}, "{x: 5 * bytes, y: 2 * ?string}"],
|
211
|
-
[{'x' => [nil] * 5, 'y' => [nil] * 2}, "{x: 5 * ?bytes, y: 2 * ?string}"],
|
212
|
-
|
213
|
-
[{'x' => [nil], 'y' => [nil] * 2, 'z' => [nil] * 3}, "{x: 1 * ?bytes, y: 2 * ?complex128, z: 3 * ?string}"],
|
214
|
-
[{'x' => [nil], 'y' => [{'a' => 0.0i, 'b' => [[""] * 2] * 10}] * 2, 'z' => [""] * 3}, "{x: 1 * ?bytes, y: 2 * {a: complex128, b: 10 * 2 * string}, z: 3 * string}"],
|
215
|
-
[{'x' => [""], 'y' => [nil] * 2, 'z' => [""] * 3}, "{x: 1 * bytes, y: 2 * ?{a: complex128, b: 10 * 2 * string}, z: 3 * string}"],
|
216
|
-
[{'x' => [""], 'y' => [{'a' => 0.0i, 'b' => [[""] * 2] * 10}] * 2, 'z' => [nil] * 3}, "{x: 1 * bytes, y: 2 * {a: complex128, b: 10 * 2 * string}, z: 3 * ?string}"],
|
217
|
-
[{'x' => [nil], 'y' => [nil] * 2, 'z' => [""] * 3}, "{x: 1 * ?bytes, y: 2 * ?{a: complex128, b: 10 * 2 * string}, z: 3 * string}"],
|
218
|
-
[{'x' => [nil], 'y' => [{'a' => 0.0i, 'b' => [[""] * 2] * 10}] * 2, 'z' => [nil] * 3}, "{x: 1 * ?bytes, y: 2 * {a: complex128, b: 10 * 2 * string}, z: 3 * ?string}"],
|
219
|
-
[{'x' => [nil], 'y' => [nil] * 2, 'z' => [nil] * 3}, "{x: 1 * ?bytes, y: 2 * ?{a: complex128, b: 10 * 2 * string}, z: 3 * ?string}"],
|
220
|
-
|
221
|
-
[{'x' => [""], 'y' => [{'a' => 0.0i, 'b' => [[nil] * 2] * 10}] * 2, 'z' => [""] * 3}, "{x: 1 * bytes, y: 2 * {a: complex128, b: 10 * 2 * ?string}, z: 3 * string}"],
|
222
|
-
[{'x' => [nil], 'y' => [{'a' => 0.0i, 'b' => [[nil] * 2] * 10}] * 2, 'z' => [""] * 3}, "{x: 1 * ?bytes, y: 2 * {a: complex128, b: 10 * 2 * ?string}, z: 3 * string}"],
|
223
|
-
[{'x' => [nil], 'y' => [{'a' => nil, 'b' => [[nil] * 2] * 10}] * 2, 'z' => [""] * 3}, "{x: 1 * ?bytes, y: 2 * {a: ?complex128, b: 10 * 2 * ?string}, z: 3 * string}"],
|
224
|
-
[{'x' => [""], 'y' => [{'a' => nil, 'b' => [[nil] * 2] * 10}] * 2, 'z' => [nil] * 3}, "{x: 1 * bytes, y: 2 * {a: ?complex128, b: 10 * 2 * ?string}, z: 3 * ?string}"],
|
225
|
-
|
226
|
-
[{'x' => 0, 'y' => [[[[nil] * 5] * 4] * 3] * 2}, "{x: int64, y: 2 * 3 * Some(4 * 5 * ?float64)}"],
|
227
|
-
[{'x' => 0, 'y' => [[[[nil] * 5] * 4] * 3] * 2}, "{x: int64, y: 2 * 3 * ref(4 * 5 * ?float64)}"],
|
228
|
-
|
229
|
-
# Primitive types
|
230
|
-
[false, "bool"],
|
231
|
-
|
232
|
-
[0, "int8"],
|
233
|
-
[0, "int16"],
|
234
|
-
[0, "int32"],
|
235
|
-
[0, "int64"],
|
236
|
-
|
237
|
-
[0, "uint8"],
|
238
|
-
[0, "uint16"],
|
239
|
-
[0, "uint32"],
|
240
|
-
[0, "uint64"],
|
241
|
-
|
242
|
-
[0.0, "float32"],
|
243
|
-
[0.0, "float64"],
|
244
|
-
|
245
|
-
[0+0i, "complex64"],
|
246
|
-
[0+0i, "complex128"],
|
247
|
-
|
248
|
-
[0+0i, "complex64"],
|
249
|
-
[0+0i, "complex128"],
|
250
|
-
|
251
|
-
# Optional primitive types
|
252
|
-
[nil, "?bool"],
|
253
|
-
|
254
|
-
[nil, "?int8"],
|
255
|
-
[nil, "?int16"],
|
256
|
-
[nil, "?int32"],
|
257
|
-
[nil, "?int64"],
|
258
|
-
|
259
|
-
[nil, "?uint8"],
|
260
|
-
[nil, "?uint16"],
|
261
|
-
[nil, "?uint32"],
|
262
|
-
[nil, "?uint64"],
|
263
|
-
|
264
|
-
[nil, "?float32"],
|
265
|
-
[nil, "?float64"],
|
266
|
-
|
267
|
-
[nil, "?complex64"],
|
268
|
-
[nil, "?complex128"],
|
269
|
-
|
270
|
-
[nil, "?complex64"],
|
271
|
-
[nil, "?complex128"],
|
272
|
-
|
273
|
-
# References
|
274
|
-
[false, "&bool"],
|
275
|
-
|
276
|
-
[0, "&int8"],
|
277
|
-
[0, "&int16"],
|
278
|
-
[0, "&int32"],
|
279
|
-
[0, "&int64"],
|
280
|
-
|
281
|
-
[0, "ref(uint8)"],
|
282
|
-
[0, "ref(uint16)"],
|
283
|
-
[0, "ref(uint32)"],
|
284
|
-
[0, "ref(uint64)"],
|
285
|
-
|
286
|
-
[0, "ref(ref(uint8))"],
|
287
|
-
[0, "ref(ref(uint16))"],
|
288
|
-
[0, "ref(ref(uint32))"],
|
289
|
-
[0, "ref(ref(uint64))"],
|
290
|
-
|
291
|
-
[0.0, "ref(float32)"],
|
292
|
-
[0.0, "ref(float64)"],
|
293
|
-
|
294
|
-
[0+0i, "ref(complex64)"],
|
295
|
-
[0+0i, "ref(complex128)"],
|
296
|
-
|
297
|
-
[[], "ref(0 * bool)"],
|
298
|
-
[[0], "ref(1 * int16)"],
|
299
|
-
[[0] * 2, "ref(2 * int32)"],
|
300
|
-
[[[0] * 3] * 2, "ref(2 * 3 * int8)"],
|
301
|
-
|
302
|
-
[[], "ref(ref(0 * bool))"],
|
303
|
-
[[0], "ref(ref(1 * int16))"],
|
304
|
-
[[0] * 2, "ref(ref(2 * int32))"],
|
305
|
-
[[[0] * 3] * 2, "ref(ref(2 * 3 * int8))"],
|
306
|
-
|
307
|
-
[[], "ref(!0 * bool)"],
|
308
|
-
[[0], "ref(!1 * int16)"],
|
309
|
-
[[0] * 2, "ref(!2 * int32)"],
|
310
|
-
[[[0] * 3] * 2, "ref(!2 * 3 * int8)"],
|
311
|
-
|
312
|
-
[[], "ref(ref(!0 * bool))"],
|
313
|
-
[[0], "ref(ref(!1 * int16))"],
|
314
|
-
[[0] * 2, "ref(ref(!2 * int32))"],
|
315
|
-
[[[0] * 3] * 2, "ref(ref(!2 * 3 * int8))"],
|
316
|
-
|
317
|
-
# Optional references
|
318
|
-
[nil, "?&bool"],
|
319
|
-
|
320
|
-
[nil, "?&int8"],
|
321
|
-
[nil, "?&int16"],
|
322
|
-
[nil, "?&int32"],
|
323
|
-
[nil, "?&int64"],
|
324
|
-
|
325
|
-
[nil, "?ref(uint8)"],
|
326
|
-
[nil, "?ref(uint16)"],
|
327
|
-
[nil, "?ref(uint32)"],
|
328
|
-
[nil, "?ref(uint64)"],
|
329
|
-
|
330
|
-
[nil, "?ref(ref(uint8))"],
|
331
|
-
[nil, "?ref(ref(uint16))"],
|
332
|
-
[nil, "?ref(ref(uint32))"],
|
333
|
-
[nil, "?ref(ref(uint64))"],
|
334
|
-
|
335
|
-
[nil, "?ref(float32)"],
|
336
|
-
[nil, "?ref(float64)"],
|
337
|
-
|
338
|
-
[nil, "?ref(complex64)"],
|
339
|
-
[nil, "?ref(complex128)"],
|
340
|
-
|
341
|
-
[nil, "?ref(0 * bool)"],
|
342
|
-
[nil, "?ref(1 * int16)"],
|
343
|
-
[nil, "?ref(2 * int32)"],
|
344
|
-
[nil, "?ref(2 * 3 * int8)"],
|
345
|
-
|
346
|
-
[nil, "?ref(ref(0 * bool))"],
|
347
|
-
[nil, "ref(?ref(0 * bool))"],
|
348
|
-
[nil, "?ref(?ref(0 * bool))"],
|
349
|
-
[nil, "?ref(ref(1 * int16))"],
|
350
|
-
[nil, "ref(?ref(1 * int16))"],
|
351
|
-
[nil, "?ref(?ref(1 * int16))"],
|
352
|
-
[nil, "?ref(ref(2 * int32))"],
|
353
|
-
|
354
|
-
[nil, "?ref(!2 * 3 * int8)"],
|
355
|
-
[nil, "?ref(ref(!2 * 3 * int32))"],
|
356
|
-
|
357
|
-
# References to types with optional data
|
358
|
-
[nil, "&?bool"],
|
359
|
-
|
360
|
-
[nil, "&?int8"],
|
361
|
-
[nil, "&?int16"],
|
362
|
-
[nil, "&?int32"],
|
363
|
-
[nil, "&?int64"],
|
364
|
-
|
365
|
-
[nil, "ref(?uint8)"],
|
366
|
-
[nil, "ref(?uint16)"],
|
367
|
-
[nil, "ref(?uint32)"],
|
368
|
-
[nil, "ref(?uint64)"],
|
369
|
-
|
370
|
-
[nil, "ref(ref(?uint8))"],
|
371
|
-
[nil, "ref(ref(?uint16))"],
|
372
|
-
[nil, "ref(ref(?uint32))"],
|
373
|
-
[nil, "ref(ref(?uint64))"],
|
374
|
-
|
375
|
-
[nil, "ref(?float32)"],
|
376
|
-
[nil, "ref(?float64)"],
|
377
|
-
|
378
|
-
[nil, "ref(?complex64)"],
|
379
|
-
[nil, "ref(?complex128)"],
|
380
|
-
|
381
|
-
[[], "ref(0 * ?bool)"],
|
382
|
-
[[nil], "ref(1 * ?int16)"],
|
383
|
-
[[nil] * 2, "ref(2 * ?int32)"],
|
384
|
-
[[[nil] * 3] * 2, "ref(2 * 3 * ?int8)"],
|
385
|
-
|
386
|
-
[[], "ref(ref(0 * ?bool))"],
|
387
|
-
[[nil], "ref(ref(1 * ?int16))"],
|
388
|
-
[[nil] * 2, "ref(ref(2 * ?int32))"],
|
389
|
-
|
390
|
-
[[[nil] * 3] * 2, "ref(!2 * 3 * ?int8)"],
|
391
|
-
[[[nil] * 3] * 2, "ref(ref(!2 * 3 * ?int8))"],
|
392
|
-
|
393
|
-
# Constructors
|
394
|
-
[false, "Some(bool)"],
|
395
|
-
|
396
|
-
[0, "Some(int8)"],
|
397
|
-
[0, "Some(int16)"],
|
398
|
-
[0, "Some(int32)"],
|
399
|
-
[0, "Some(int64)"],
|
400
|
-
|
401
|
-
[0, "Some(uint8)"],
|
402
|
-
[0, "Some(uint16)"],
|
403
|
-
[0, "Some(uint32)"],
|
404
|
-
[0, "Some(uint64)"],
|
405
|
-
|
406
|
-
[0.0, "Some(float32)"],
|
407
|
-
[0.0, "Some(float64)"],
|
408
|
-
|
409
|
-
[0+0i, "Some(complex64)"],
|
410
|
-
[0+0i, "Some(complex128)"],
|
411
|
-
|
412
|
-
[[0], "ThisGuy(1 * int16)"],
|
413
|
-
[[0] * 2, "ThisGuy(2 * int32)"],
|
414
|
-
[[[0.0] * 3] * 2, "ThisGuy(2 * 3 * float32)"],
|
415
|
-
|
416
|
-
[[[0.0] * 3] * 2, "ThisGuy(!2 * 3 * float32)"],
|
417
|
-
|
418
|
-
# Optional constructors
|
419
|
-
[nil, "?Some(bool)"],
|
420
|
-
|
421
|
-
[nil, "?Some(int8)"],
|
422
|
-
[nil, "?Some(int16)"],
|
423
|
-
[nil, "?Some(int32)"],
|
424
|
-
[nil, "?Some(int64)"],
|
425
|
-
|
426
|
-
[nil, "?Some(uint8)"],
|
427
|
-
[nil, "?Some(uint16)"],
|
428
|
-
[nil, "?Some(uint32)"],
|
429
|
-
[nil, "?Some(uint64)"],
|
430
|
-
|
431
|
-
[nil, "?Some(float32)"],
|
432
|
-
[nil, "?Some(float64)"],
|
433
|
-
|
434
|
-
[nil, "?Some(complex64)"],
|
435
|
-
[nil, "?Some(complex128)"],
|
436
|
-
|
437
|
-
[nil, "?ThisGuy(0 * int16)"],
|
438
|
-
[nil, "?ThisGuy(1 * int16)"],
|
439
|
-
[nil, "?ThisGuy(2 * int32)"],
|
440
|
-
[nil, "?ThisGuy(2 * 3 * float32)"],
|
441
|
-
|
442
|
-
[nil, "?ThisGuy(!2 * 3 * float32)"],
|
443
|
-
|
444
|
-
# Constructors with an optional data type argument
|
445
|
-
[nil, "Some(?bool)"],
|
446
|
-
|
447
|
-
[nil, "Some(?int8)"],
|
448
|
-
[nil, "Some(?int16)"],
|
449
|
-
[nil, "Some(?int32)"],
|
450
|
-
[nil, "Some(?int64)"],
|
451
|
-
|
452
|
-
[nil, "Some(?uint8)"],
|
453
|
-
[nil, "Some(?uint16)"],
|
454
|
-
[nil, "Some(?uint32)"],
|
455
|
-
[nil, "Some(?uint64)"],
|
456
|
-
|
457
|
-
[nil, "Some(?float32)"],
|
458
|
-
[nil, "Some(?float64)"],
|
459
|
-
|
460
|
-
[nil, "Some(?complex64)"],
|
461
|
-
[nil, "Some(?complex128)"],
|
462
|
-
|
463
|
-
[[], "ThisGuy(0 * ?int16)"],
|
464
|
-
[[nil], "ThisGuy(1 * ?int16)"],
|
465
|
-
[[nil] * 2, "ThisGuy(2 * ?int32)"],
|
466
|
-
[[[nil] * 3] * 2, "ThisGuy(2 * 3 * ?float32)"],
|
467
|
-
|
468
|
-
[[[nil] * 3] * 2, "ThisGuy(!2 * 3 * ?float32)"],
|
469
|
-
]
|
470
|
-
|
471
|
-
#
|
472
|
-
# Test case for richcompare:
|
473
|
-
# v: value
|
474
|
-
# t: type of v
|
475
|
-
# u: equivalent type for v
|
476
|
-
# w: value different from v
|
477
|
-
# eq: expected comparison result
|
478
|
-
#
|
479
|
-
Struct.new("T", :v, :t, :u, :w, :eq)
|
480
|
-
T = Struct::T
|
481
|
-
|
482
|
-
EQUAL_TEST_CASES = [
|
483
|
-
# Tuples
|
484
|
-
T.new([],
|
485
|
-
"()",
|
486
|
-
nil,
|
487
|
-
nil,
|
488
|
-
true),
|
489
|
-
|
490
|
-
T.new([100],
|
491
|
-
"(int8)",
|
492
|
-
"?(int8)",
|
493
|
-
[101],
|
494
|
-
true),
|
495
|
-
|
496
|
-
T.new([2**7-1, 2**63-1],
|
497
|
-
"(int8, int64)",
|
498
|
-
"(int8, ?int64) ",
|
499
|
-
[2**7-2, 2**63-1],
|
500
|
-
true),
|
501
|
-
|
502
|
-
T.new([2**16-1, [1.2312222+28i]],
|
503
|
-
"(uint16, (complex64))",
|
504
|
-
"(uint16, ?(complex64))",
|
505
|
-
[2**16-1, [1.23122+28i]],
|
506
|
-
true),
|
507
|
-
|
508
|
-
T.new([1, [1e22+2i]],
|
509
|
-
"(uint32, (complex64), pack=1)",
|
510
|
-
"(uint32, (complex64), align=16)",
|
511
|
-
[1, [1e22+3i]],
|
512
|
-
true),
|
513
|
-
|
514
|
-
T.new([[]],
|
515
|
-
"(0 * bytes)",
|
516
|
-
nil,
|
517
|
-
nil,
|
518
|
-
true),
|
519
|
-
|
520
|
-
T.new([[], []],
|
521
|
-
"(0 * bytes, 0 * string)",
|
522
|
-
nil,
|
523
|
-
nil,
|
524
|
-
true),
|
525
|
-
|
526
|
-
T.new([['x'], [1.2i] * 2, ["abc"] * 3],
|
527
|
-
"(1 * bytes, 2 * complex128, 3 * string)",
|
528
|
-
"(1 * bytes, 2 * ?complex128, 3 * string)",
|
529
|
-
[['x'], [1.2i] * 2, ["ab"] * 3],
|
530
|
-
true),
|
531
|
-
|
532
|
-
T.new([['123'], [[3e22+0.2i, [["xyz"] * 2] * 10]] * 2, ["1"] * 3],
|
533
|
-
"(1 * bytes, 2 * (complex128, 10 * 2 * string), 3 * string)",
|
534
|
-
"(1 * bytes, 2 * ?(complex128, 10 * 2 * string), 3 * string)",
|
535
|
-
[['1234'], [[3e22+0.2i, [["xyz"] * 2] * 10]] * 2, ["1"] * 3],
|
536
|
-
true),
|
537
|
-
|
538
|
-
T.new([10001, [[[[2.250] * 5] * 4] * 3] * 2],
|
539
|
-
"(int64, 2 * 3 * Some(4 * 5 * float64))",
|
540
|
-
"(int64, 2 * 3 * Some(4 * 5 * ?float64))",
|
541
|
-
[10001, [[[[2.251] * 5] * 4] * 3] * 2],
|
542
|
-
true),
|
543
|
-
|
544
|
-
T.new([-2**63, [[[[10.1] * 5] * 4] * 3] * 2],
|
545
|
-
"(int64, 2 * 3 * ref(4 * 5 * float64))",
|
546
|
-
"(int64, 2 * 3 * ?ref(4 * 5 * float64))",
|
547
|
-
[-2**63+1, [[[[10.1] * 5] * 4] * 3] * 2],
|
548
|
-
true),
|
549
|
-
|
550
|
-
# Optional tuples
|
551
|
-
T.new(nil,
|
552
|
-
"?()",
|
553
|
-
nil,
|
554
|
-
nil,
|
555
|
-
false),
|
556
|
-
|
557
|
-
T.new(nil,
|
558
|
-
"?(int8)",
|
559
|
-
nil,
|
560
|
-
nil,
|
561
|
-
false),
|
562
|
-
|
563
|
-
T.new(nil,
|
564
|
-
"?(1 * bytes, 2 * (complex128, 10 * 2 * string), 3 * string)",
|
565
|
-
nil,
|
566
|
-
nil,
|
567
|
-
false),
|
568
|
-
|
569
|
-
# Tuples with optional elements
|
570
|
-
T.new([nil],
|
571
|
-
"(?int8)",
|
572
|
-
nil,
|
573
|
-
nil,
|
574
|
-
false),
|
575
|
-
|
576
|
-
T.new([nil, 0],
|
577
|
-
"(?int8, int64)",
|
578
|
-
nil,
|
579
|
-
nil,
|
580
|
-
false),
|
581
|
-
|
582
|
-
T.new([0, nil],
|
583
|
-
"(int8, ?int64)",
|
584
|
-
nil,
|
585
|
-
nil,
|
586
|
-
false),
|
587
|
-
|
588
|
-
T.new([nil, nil],
|
589
|
-
"(?int8, ?int64)",
|
590
|
-
nil,
|
591
|
-
nil,
|
592
|
-
false),
|
593
|
-
|
594
|
-
T.new(nil,
|
595
|
-
"?(?int8, ?int64)",
|
596
|
-
nil,
|
597
|
-
nil,
|
598
|
-
false),
|
599
|
-
|
600
|
-
T.new([0, nil],
|
601
|
-
"(uint16, ?(complex64))",
|
602
|
-
nil,
|
603
|
-
nil,
|
604
|
-
false),
|
605
|
-
|
606
|
-
T.new([0, [nil]],
|
607
|
-
"(uint16, (?complex64))",
|
608
|
-
nil,
|
609
|
-
nil,
|
610
|
-
false),
|
611
|
-
|
612
|
-
T.new([0, nil],
|
613
|
-
"(uint16, ?(?complex64))",
|
614
|
-
nil,
|
615
|
-
nil,
|
616
|
-
false),
|
617
|
-
|
618
|
-
T.new([nil, [0+0i]],
|
619
|
-
"(?uint16, (complex64), pack=1)",
|
620
|
-
nil,
|
621
|
-
nil,
|
622
|
-
false),
|
623
|
-
|
624
|
-
T.new([0, nil],
|
625
|
-
"(uint16, ?(complex64), pack=1)",
|
626
|
-
nil,
|
627
|
-
nil,
|
628
|
-
false),
|
629
|
-
|
630
|
-
T.new([0, [nil]],
|
631
|
-
"(uint16, (?complex64), pack=1)",
|
632
|
-
nil,
|
633
|
-
nil,
|
634
|
-
false),
|
635
|
-
|
636
|
-
# Records
|
637
|
-
T.new({},
|
638
|
-
"{}",
|
639
|
-
nil,
|
640
|
-
nil,
|
641
|
-
true),
|
642
|
-
|
643
|
-
T.new({'x' => 2**31-1},
|
644
|
-
"{x: int32}",
|
645
|
-
"{x: ?int32}",
|
646
|
-
{'x' => 2**31-2},
|
647
|
-
true),
|
648
|
-
|
649
|
-
T.new({'x' => -128, 'y' => -1},
|
650
|
-
"{x: int8, y: int64}",
|
651
|
-
"{x: int8, y: int64, pack=1}",
|
652
|
-
{'x' => -127, 'y' => -1},
|
653
|
-
true),
|
654
|
-
|
655
|
-
T.new({'x' => 2**32-1, 'y' => {'z' => 10000001e3+36.1e7i}},
|
656
|
-
"{x: uint32, y: {z: complex64}}",
|
657
|
-
"{x: uint32, y: {z: complex64}}",
|
658
|
-
{'x' => 2**32-2, 'y' => {'z' => 10000001e3+36.1e7i}},
|
659
|
-
true),
|
660
|
-
|
661
|
-
T.new({'x' => 255, 'y' => {'z' => 2+3i}},
|
662
|
-
"{x: uint8, y: {z: complex64}, pack=1}",
|
663
|
-
"{x: uint8, y: {z: complex64}, pack=4}",
|
664
|
-
{'x' => 255, 'y' => {'z' => 3+3i}},
|
665
|
-
true),
|
666
|
-
|
667
|
-
T.new({'x' => 10001, 'y' => {'z' => "abc"}},
|
668
|
-
"{x: uint16, y: {z: fixed_string(100)}, pack=2}",
|
669
|
-
"{x: uint16, y: {z: fixed_string(100)}, align=8}",
|
670
|
-
{'x' => 10001, 'y' => {'z' => "abcd"}},
|
671
|
-
true),
|
672
|
-
|
673
|
-
T.new({'x' => []},
|
674
|
-
"{x: 0 * bytes}",
|
675
|
-
nil,
|
676
|
-
nil,
|
677
|
-
true),
|
678
|
-
|
679
|
-
T.new({'x' => [], 'y' => []},
|
680
|
-
"{x: 0 * bytes, y: 0 * string}",
|
681
|
-
nil,
|
682
|
-
nil,
|
683
|
-
true),
|
684
|
-
|
685
|
-
T.new({'x' => ["".b], 'y' => [2.0i] * 2, 'z' => ["y"] * 3},
|
686
|
-
"{x: 1 * fixed_bytes(size=10), y: 2 * complex128, z: 3 * string}",
|
687
|
-
"{x: 1 * fixed_bytes(size=10, align=256), y: 2 * complex128, z: 3 * string}",
|
688
|
-
nil,
|
689
|
-
true),
|
690
|
-
|
691
|
-
T.new({'x' => 100, 'y' => [[[[301.0] * 5] * 4] * 3] * 2},
|
692
|
-
"{x: int64, y: 2 * 3 * Some(4 * 5 * ?float64)}",
|
693
|
-
"{x: int64, y: 2 * 3 * ?Some(4 * 5 * ?float64)}",
|
694
|
-
{'x' => 100, 'y' => [[[[nil] * 5] * 4] * 3] * 2},
|
695
|
-
true),
|
696
|
-
|
697
|
-
# Optional records
|
698
|
-
T.new(nil,
|
699
|
-
"?{}",
|
700
|
-
"?{}",
|
701
|
-
nil,
|
702
|
-
false),
|
703
|
-
|
704
|
-
T.new(nil,
|
705
|
-
"?{x: int8}",
|
706
|
-
"?{x: int8}",
|
707
|
-
nil,
|
708
|
-
false),
|
709
|
-
|
710
|
-
T.new({'x' => 101},
|
711
|
-
"?{x: int8}",
|
712
|
-
"{x: int8}",
|
713
|
-
{'x' => 100},
|
714
|
-
true),
|
715
|
-
|
716
|
-
T.new(nil,
|
717
|
-
"?{x: 0 * bytes}",
|
718
|
-
"?{x: 0 * bytes}",
|
719
|
-
nil,
|
720
|
-
false),
|
721
|
-
|
722
|
-
T.new(nil,
|
723
|
-
"?{x: 0 * bytes, y: 0 * string}",
|
724
|
-
"?{x: 0 * bytes, y: 0 * string}",
|
725
|
-
nil,
|
726
|
-
false),
|
727
|
-
|
728
|
-
# Records with optional elements
|
729
|
-
T.new({'x' => nil},
|
730
|
-
"{x: ?int8}",
|
731
|
-
"{x: ?int8}",
|
732
|
-
nil,
|
733
|
-
false),
|
734
|
-
|
735
|
-
T.new({'x' => nil, 'y' => 0},
|
736
|
-
"{x: ?int8, y: int64}",
|
737
|
-
"{x: ?int8, y: int64}",
|
738
|
-
{'x' => 0, 'y' => 0},
|
739
|
-
false),
|
740
|
-
|
741
|
-
T.new({'x' => 100, 'y' => nil},
|
742
|
-
"{x: int8, y: ?int64}",
|
743
|
-
"{x: int8, y: ?int64}",
|
744
|
-
{'x' => 100, 'y' => 10},
|
745
|
-
false),
|
746
|
-
|
747
|
-
T.new({'x' => nil, 'y' => nil},
|
748
|
-
"{x: ?int8, y: ?int64}",
|
749
|
-
"{x: ?int8, y: ?int64}",
|
750
|
-
{'x' => 1, 'y' => 1},
|
751
|
-
false),
|
752
|
-
|
753
|
-
T.new(nil,
|
754
|
-
"?{x: ?int8, y: ?int64}",
|
755
|
-
"?{x: ?int8, y: ?int64}",
|
756
|
-
nil,
|
757
|
-
false),
|
758
|
-
|
759
|
-
T.new({'x' => 0, 'y' => nil},
|
760
|
-
"{x: uint16, y: ?{z: complex64}}",
|
761
|
-
"{x: uint16, y: ?{z: complex64}}",
|
762
|
-
{'x' => 1, 'y' => nil},
|
763
|
-
false),
|
764
|
-
|
765
|
-
# FIXME: The 'z' => 2 does not seem to bode well with XND. Fix.
|
766
|
-
# T.new({'x' => 0, 'y' => {'z' => nil}},
|
767
|
-
# "{x: uint16, y: {z: ?complex64}}",
|
768
|
-
# "{x: uint16, y: {z: ?complex64}}",
|
769
|
-
# {'x' => 0, 'y' => {'z' => 2}},
|
770
|
-
# false),
|
771
|
-
|
772
|
-
T.new({'x' => 0, 'y' => nil},
|
773
|
-
"{x: uint16, y: ?{z: ?complex64}}",
|
774
|
-
"{x: uint16, y: ?{z: ?complex64}}",
|
775
|
-
{'x' => 0, 'y' => {'z' => 1+10i}},
|
776
|
-
false),
|
777
|
-
|
778
|
-
T.new({'x' => nil, 'y' => {'z' => 0+0i}},
|
779
|
-
"{x: ?uint16, y: {z: complex64}, pack=1}",
|
780
|
-
"{x: ?uint16, y: {z: complex64}, align=16}",
|
781
|
-
{'x' => 256, 'y' => {'z' => 0+0i}},
|
782
|
-
false),
|
783
|
-
|
784
|
-
T.new({'x' => 0, 'y' => nil},
|
785
|
-
"{x: uint16, y: ?{z: complex64}, pack=1}",
|
786
|
-
"{x: uint16, y: ?{z: complex64}, pack=1}",
|
787
|
-
{'x' => 0, 'y' => {'z' => 0+1i}},
|
788
|
-
false),
|
789
|
-
|
790
|
-
T.new({'x' => 0, 'y' => {'z' => nil}},
|
791
|
-
"{x: ?uint16, y: {z: ?complex64}, pack=1}",
|
792
|
-
"{x: ?uint16, y: {z: ?complex64}, pack=1}",
|
793
|
-
{'x' => nil, 'y' => {'z' => nil}},
|
794
|
-
false),
|
795
|
-
|
796
|
-
T.new({'x' => []},
|
797
|
-
"{x: 0 * ?bytes}",
|
798
|
-
"{x: 0 * ?bytes}",
|
799
|
-
nil,
|
800
|
-
true),
|
801
|
-
|
802
|
-
T.new({'x' => [nil] * 1},
|
803
|
-
"{x: 1 * ?bytes}",
|
804
|
-
"{x: 1 * ?bytes}",
|
805
|
-
nil,
|
806
|
-
false),
|
807
|
-
|
808
|
-
T.new({'x' => [nil] * 10},
|
809
|
-
"{x: 10 * ?bytes}",
|
810
|
-
"{x: 10 * ?bytes}",
|
811
|
-
{'x' => ["123"] * 10},
|
812
|
-
false),
|
813
|
-
|
814
|
-
T.new({'x' => [], 'y' => []},
|
815
|
-
"{x: 0 * ?bytes, y: 0 * ?string}",
|
816
|
-
"{x: 0 * ?bytes, y: 0 * ?string}",
|
817
|
-
nil,
|
818
|
-
true),
|
819
|
-
|
820
|
-
T.new({'x' => ["123"] * 5, 'y' => ["abc"] * 2},
|
821
|
-
"{x: 5 * ?bytes, y: 2 * string}",
|
822
|
-
"{x: 5 * bytes, y: 2 * string}",
|
823
|
-
{'x' => ["12345"] * 5, 'y' => ["abc"] * 2},
|
824
|
-
true),
|
825
|
-
|
826
|
-
T.new({'x' => ["-123"], 'y' => [1e200+10i] * 2, 'z' => ["t" * 100] * 3},
|
827
|
-
"{x: 1 * ?bytes, y: 2 * ?complex128, z: 3 * ?string}",
|
828
|
-
"{x: 1 * ?bytes, y: 2 * ?complex128, z: 3 * ?string}",
|
829
|
-
{'x' => ["-123"], 'y' => [1e200+10i] * 2, 'z' => ["t" * 100 + "u"] * 3},
|
830
|
-
true),
|
831
|
-
|
832
|
-
T.new({'x' => ["x"], 'y' => [{'a' => 0.0i, 'b' => [["c"] * 2] * 10}] * 2, 'z' => ["a"] * 3},
|
833
|
-
"{x: 1 * ?bytes, y: 2 * {a: complex128, b: 10 * 2 * string}, z: 3 * string}",
|
834
|
-
"{x: 1 * ?bytes, y: 2 * {a: complex128, b: 10 * 2 * ?string}, z: 3 * string}",
|
835
|
-
{'x' => ["x"], 'y' => [{'a' => 1.0i, 'b' => [["c"] * 2] * 10}] * 2, 'z' => ["a"] * 3},
|
836
|
-
true),
|
837
|
-
|
838
|
-
# Primitive types
|
839
|
-
T.new(false, "bool", "?bool", true, true),
|
840
|
-
T.new(0, "?bool", "bool", 1, true),
|
841
|
-
|
842
|
-
T.new(127, "int8", "?int8", 100, true),
|
843
|
-
T.new(127, "?int8", "int8", 100, true),
|
844
|
-
|
845
|
-
T.new(-127, "int16", "?int16", 100, true),
|
846
|
-
T.new(-127, "?int16", "int16", 100, true),
|
847
|
-
|
848
|
-
T.new(127, "int32", "?int32", 100, true),
|
849
|
-
T.new(127, "?int32", "int32", 100, true),
|
850
|
-
|
851
|
-
T.new(127, "int64", "?int64", 100, true),
|
852
|
-
T.new(127, "?int64", "int64", 100, true),
|
853
|
-
|
854
|
-
T.new(127, "uint8", "?uint8", 100, true),
|
855
|
-
T.new(127, "?uint8", "uint8", 100, true),
|
856
|
-
|
857
|
-
T.new(127, "uint16", "?uint16", 100, true),
|
858
|
-
T.new(127, "?uint16", "uint16", 100, true),
|
859
|
-
|
860
|
-
T.new(127, "uint32", "?uint32", 100, true),
|
861
|
-
T.new(127, "?uint32", "uint32", 100, true),
|
862
|
-
|
863
|
-
T.new(127, "uint64", "?uint64", 100, true),
|
864
|
-
T.new(127, "?uint64", "uint64", 100, true),
|
865
|
-
|
866
|
-
T.new(1.122e11, "float32", "?float32", 2.111, true),
|
867
|
-
T.new(1.233e10, "?float32", "float32", 3.111, true),
|
868
|
-
|
869
|
-
T.new(1.122e11, "float64", "?float64", 2.111, true),
|
870
|
-
T.new(1.233e10, "?float64", "float64", 3.111, true),
|
871
|
-
|
872
|
-
T.new(1.122e11+1i, "complex64", "?complex64", 1.122e11+2i, true),
|
873
|
-
T.new(1.122e11+1i, "?complex64", "complex64", 1.1e11+1i, true),
|
874
|
-
|
875
|
-
T.new(1.122e11-100i, "complex128", "?complex128", 1.122e11-101i, true),
|
876
|
-
T.new(1.122e11-100i, "?complex128", "complex128", 1.122e10-100i, true),
|
877
|
-
]
|