ndtypes 0.2.0dev4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +50 -0
- data/Gemfile +2 -0
- data/History.md +0 -0
- data/README.md +19 -0
- data/Rakefile +125 -0
- data/ext/ruby_ndtypes/extconf.rb +55 -0
- data/ext/ruby_ndtypes/gc_guard.c +36 -0
- data/ext/ruby_ndtypes/gc_guard.h +12 -0
- data/ext/ruby_ndtypes/ndtypes/AUTHORS.txt +5 -0
- data/ext/ruby_ndtypes/ndtypes/INSTALL.txt +101 -0
- data/ext/ruby_ndtypes/ndtypes/LICENSE.txt +29 -0
- data/ext/ruby_ndtypes/ndtypes/MANIFEST.in +3 -0
- data/ext/ruby_ndtypes/ndtypes/Makefile.in +87 -0
- data/ext/ruby_ndtypes/ndtypes/README.rst +47 -0
- data/ext/ruby_ndtypes/ndtypes/config.guess +1530 -0
- data/ext/ruby_ndtypes/ndtypes/config.h.in +67 -0
- data/ext/ruby_ndtypes/ndtypes/config.sub +1782 -0
- data/ext/ruby_ndtypes/ndtypes/configure +5260 -0
- data/ext/ruby_ndtypes/ndtypes/configure.ac +161 -0
- data/ext/ruby_ndtypes/ndtypes/doc/Makefile +14 -0
- data/ext/ruby_ndtypes/ndtypes/doc/_static/copybutton.js +66 -0
- data/ext/ruby_ndtypes/ndtypes/doc/conf.py +26 -0
- data/ext/ruby_ndtypes/ndtypes/doc/grammar/grammar.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/index.rst +56 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/context.rst +131 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/encodings.rst +68 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/fields-values.rst +175 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/functions.rst +72 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/index.rst +43 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/init.rst +48 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/io.rst +100 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/memory.rst +124 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/predicates.rst +110 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/typedef.rst +31 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/types.rst +594 -0
- data/ext/ruby_ndtypes/ndtypes/doc/libndtypes/util.rst +166 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/buffer-protocol.rst +27 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/index.rst +21 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/pattern-matching.rst +330 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/quickstart.rst +144 -0
- data/ext/ruby_ndtypes/ndtypes/doc/ndtypes/types.rst +544 -0
- data/ext/ruby_ndtypes/ndtypes/doc/releases/index.rst +35 -0
- data/ext/ruby_ndtypes/ndtypes/install-sh +527 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.in +271 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/Makefile.vc +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/alloc.c +230 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.c +268 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/attr.h +109 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.in +73 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/Makefile.vc +70 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/README.txt +16 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.c +2179 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.h +134 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bpgrammar.y +428 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.c +2543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.h +735 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/bplexer.l +176 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/export.c +543 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/compat/import.c +110 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/context.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/copy.c +634 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/encodings.c +116 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/equal.c +288 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.c +3067 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.h +180 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/grammar.y +417 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/io.c +1658 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.c +2773 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.h +734 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/lexer.l +222 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/match.c +1132 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.c +2323 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/ndtypes.h.in +893 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/overflow.h +161 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.c +473 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parsefuncs.h +92 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/parser.c +246 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.c +269 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/seq.h +197 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.in +48 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/Makefile.vc +46 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/deserialize.c +1007 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/serialize/serialize.c +442 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/slice.h +42 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.c +238 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/substitute.h +50 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.c +371 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/symtable.h +100 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.in +55 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/Makefile.vc +45 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.c +82 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/alloc_fail.h +49 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/runtest.c +1657 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test.h +85 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_array.c +115 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_buffer.c +137 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_indent.c +201 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_match.c +2397 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_numba.c +57 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse.c +349 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_error.c +27839 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_parse_roundtrip.c +350 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_record.c +231 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typecheck.c +375 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/test_typedef.c +65 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tests/valgrind.supp +30 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/bench.c +79 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/indent.c +94 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/tools/print_ast.c +96 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/util.c +474 -0
- data/ext/ruby_ndtypes/ndtypes/libndtypes/values.c +228 -0
- data/ext/ruby_ndtypes/ndtypes/python/bench.py +49 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_randtype.py +409 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndt_support.py +14 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/__init__.py +70 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/_ndtypes.c +1332 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/docstrings.h +319 -0
- data/ext/ruby_ndtypes/ndtypes/python/ndtypes/pyndtypes.h +154 -0
- data/ext/ruby_ndtypes/ndtypes/python/test_ndtypes.py +1977 -0
- data/ext/ruby_ndtypes/ndtypes/setup.py +288 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/INSTALL.txt +41 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest32.bat +15 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/runtest64.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild32.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcbuild64.bat +38 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcclean.bat +13 -0
- data/ext/ruby_ndtypes/ndtypes/vcbuild/vcdistclean.bat +14 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.c +1003 -0
- data/ext/ruby_ndtypes/ruby_ndtypes.h +37 -0
- data/ext/ruby_ndtypes/ruby_ndtypes_internal.h +28 -0
- data/lib/ndtypes.rb +45 -0
- data/lib/ndtypes/errors.rb +2 -0
- data/lib/ndtypes/version.rb +6 -0
- data/ndtypes.gemspec +47 -0
- data/spec/gc_table_spec.rb +10 -0
- data/spec/ndtypes_spec.rb +289 -0
- data/spec/spec_helper.rb +241 -0
- metadata +242 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2017-2018, plures
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
|
9
|
+
*
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer.
|
|
12
|
+
*
|
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
* and/or other materials provided with the distribution.
|
|
16
|
+
*
|
|
17
|
+
* 3. Neither the name of the copyright holder nor the names of its
|
|
18
|
+
* contributors may be used to endorse or promote products derived from
|
|
19
|
+
* this software without specific prior written permission.
|
|
20
|
+
*
|
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#include <stdio.h>
|
|
35
|
+
#include "test.h"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const typecheck_testcase_t typecheck_tests[] = {
|
|
39
|
+
|
|
40
|
+
{ .signature="void -> float32",
|
|
41
|
+
.in={NULL},
|
|
42
|
+
.out={"float32"},
|
|
43
|
+
.broadcast={NULL},
|
|
44
|
+
.outer_dims=0,
|
|
45
|
+
.success=true },
|
|
46
|
+
|
|
47
|
+
{ .signature="T -> T",
|
|
48
|
+
.in={"T"},
|
|
49
|
+
.out={NULL},
|
|
50
|
+
.broadcast={NULL},
|
|
51
|
+
.outer_dims=0,
|
|
52
|
+
.success=false },
|
|
53
|
+
|
|
54
|
+
{ .signature="T -> T",
|
|
55
|
+
.in={"int64"},
|
|
56
|
+
.out={"int64"},
|
|
57
|
+
.broadcast={NULL},
|
|
58
|
+
.outer_dims=0,
|
|
59
|
+
.success=true },
|
|
60
|
+
|
|
61
|
+
{ .signature="M*N*T, N*P*T -> M*P*T",
|
|
62
|
+
.in={"2 * 3 * int64", "3 * 10 * int64"},
|
|
63
|
+
.out={"2 * 10 * int64"},
|
|
64
|
+
.broadcast={NULL},
|
|
65
|
+
.outer_dims=0,
|
|
66
|
+
.success=true },
|
|
67
|
+
|
|
68
|
+
{ .signature="Dims... *M*N*T, Dims... *N*P*T -> Dims... *M*P*T",
|
|
69
|
+
.in={"2 * 3 * int64", "3 * 10 * int64"},
|
|
70
|
+
.out={"2 * 10 * int64"},
|
|
71
|
+
.broadcast={NULL},
|
|
72
|
+
.outer_dims=0,
|
|
73
|
+
.success=true },
|
|
74
|
+
|
|
75
|
+
{ .signature="Dims... *M*N*T, Dims... *N*P*T -> Dims... *M*P*T",
|
|
76
|
+
.in={"100 * 2 * 3 * int64", "100 * 3 * 10 * int64"},
|
|
77
|
+
.out={"100 * 2 * 10 * int64"},
|
|
78
|
+
.broadcast={NULL},
|
|
79
|
+
.outer_dims=1,
|
|
80
|
+
.success=true },
|
|
81
|
+
|
|
82
|
+
{ .signature="Dims... *M*N*T, Dims... *N*P*T -> Dims... *M*P*T",
|
|
83
|
+
.in={"2 * 3 * int64", "3 * 10 * int32"},
|
|
84
|
+
.out={NULL},
|
|
85
|
+
.broadcast={NULL},
|
|
86
|
+
.outer_dims=0,
|
|
87
|
+
.success=false },
|
|
88
|
+
|
|
89
|
+
{ .signature="Dims... *M*N*T, Dims... *N*P*T -> Dims... *M*P*T",
|
|
90
|
+
.in={"3 * int64", "3 * 10 * int64"},
|
|
91
|
+
.out={NULL},
|
|
92
|
+
.broadcast={NULL},
|
|
93
|
+
.outer_dims=0,
|
|
94
|
+
.success=false },
|
|
95
|
+
|
|
96
|
+
{ .signature="Dims... * M*N*T, Dims... * N*P*T -> Dims... *M*T",
|
|
97
|
+
.in={"10 * 2 * 3 * int64", "10 * 3 * 10 * int64"},
|
|
98
|
+
.out={"10 * 2 * int64"},
|
|
99
|
+
.broadcast={NULL},
|
|
100
|
+
.outer_dims=1,
|
|
101
|
+
.success=true },
|
|
102
|
+
|
|
103
|
+
{ .signature="Dims... * M*T, Dims... * N*T -> Dims... * M*T",
|
|
104
|
+
.in={"2 * 3 * int64", "3 * 3 * int64"},
|
|
105
|
+
.out={NULL},
|
|
106
|
+
.broadcast={NULL},
|
|
107
|
+
.outer_dims=0,
|
|
108
|
+
.success=false },
|
|
109
|
+
|
|
110
|
+
{ .signature="Dims... * M*T, Dims... * N*T -> Dims... * M*T",
|
|
111
|
+
.in={"2 * 3 * int64", "3 * 3 * int64"},
|
|
112
|
+
.out={NULL},
|
|
113
|
+
.broadcast={NULL},
|
|
114
|
+
.outer_dims=0,
|
|
115
|
+
.success=false },
|
|
116
|
+
|
|
117
|
+
{ .signature="M*N*T, N*P*T -> M*P*T",
|
|
118
|
+
.in={"2 * 3 * int64", "2 * 10 * int64"},
|
|
119
|
+
.out={NULL},
|
|
120
|
+
.broadcast={NULL},
|
|
121
|
+
.outer_dims=0,
|
|
122
|
+
.success=false },
|
|
123
|
+
|
|
124
|
+
{ .signature="M*N*T, N*P*T -> M*P*T",
|
|
125
|
+
.in={"2 * 3 * int64", "3 * 10 * int32"},
|
|
126
|
+
.out={NULL},
|
|
127
|
+
.broadcast={NULL},
|
|
128
|
+
.outer_dims=0,
|
|
129
|
+
.success=false },
|
|
130
|
+
|
|
131
|
+
{ .signature="Dims... * M*N*T, Dims... * N*P*T -> Dims... *M*P*T",
|
|
132
|
+
.in={"3 * int64", "3 * 10 * int64"},
|
|
133
|
+
.out={NULL},
|
|
134
|
+
.broadcast={NULL},
|
|
135
|
+
.outer_dims=0,
|
|
136
|
+
.success=false },
|
|
137
|
+
|
|
138
|
+
{ .signature="Dims... * M*N*T, Dims... *N*P*T -> Dims... *M*P*T",
|
|
139
|
+
.in={"100 * 2 * 3 * int64", "100 * 3 * 10 * int64"},
|
|
140
|
+
.out={"100 * 2 * 10 * int64"},
|
|
141
|
+
.broadcast={NULL},
|
|
142
|
+
.outer_dims=1,
|
|
143
|
+
.success=true },
|
|
144
|
+
|
|
145
|
+
{ .signature="Dims... * M*N*T, Dims... *N*P*T -> Dims... *M*P*T",
|
|
146
|
+
.in={"400 * 2 * 3 * int64", "400 * 3 * 10 * int64"},
|
|
147
|
+
.out={"400 * 2 * 10 * int64"},
|
|
148
|
+
.broadcast={NULL},
|
|
149
|
+
.outer_dims=1,
|
|
150
|
+
.success=true },
|
|
151
|
+
|
|
152
|
+
{ .signature="Dims... * M*N*T, Dims... * N*P*T -> Dims... * M*P*T",
|
|
153
|
+
.in={"1000 * 400 * 2 * 3 * int64", "1000 * 400 * 3 * 10 * int64"},
|
|
154
|
+
.out={"1000 * 400 * 2 * 10 * int64"},
|
|
155
|
+
.broadcast={NULL},
|
|
156
|
+
.outer_dims=2,
|
|
157
|
+
.success=true },
|
|
158
|
+
|
|
159
|
+
{ .signature="Dims... * M*N*T, Dims... *N*P*T -> Dims... * M*P*T",
|
|
160
|
+
.in={"2 * 3 * 1000 * 400 * 2 * 3 * int64", "2 * 3 * 1000 * 400 * 3 * 10 * int64"},
|
|
161
|
+
.out={"2 * 3 * 1000 * 400 * 2 * 10 * int64"},
|
|
162
|
+
.broadcast={NULL},
|
|
163
|
+
.outer_dims=4,
|
|
164
|
+
.success=true },
|
|
165
|
+
|
|
166
|
+
{ .signature="D... * int64 -> D... * int64",
|
|
167
|
+
.in={"2 * 3 * int64"},
|
|
168
|
+
.out={"2 * 3 * int64"},
|
|
169
|
+
.broadcast={NULL},
|
|
170
|
+
.outer_dims=2,
|
|
171
|
+
.success=true },
|
|
172
|
+
|
|
173
|
+
{ .signature="... * int64 -> ... * int64",
|
|
174
|
+
.in={"2 * 3 * int64"},
|
|
175
|
+
.out={"2 * 3 * int64"},
|
|
176
|
+
.broadcast={"2 * 3 * int64"},
|
|
177
|
+
.outer_dims=2,
|
|
178
|
+
.success=true },
|
|
179
|
+
|
|
180
|
+
{ .signature="... * int64, ... * int64 -> ... * int64",
|
|
181
|
+
.in={"2 * 3 * int64", "10 * 2 * 3 * int64"},
|
|
182
|
+
.out={"10 * 2 * 3 * int64"},
|
|
183
|
+
.broadcast={"fixed(shape=10, step=0) * 2 * 3 * int64", "10 * 2 * 3 * int64"},
|
|
184
|
+
.outer_dims=3,
|
|
185
|
+
.success=true },
|
|
186
|
+
|
|
187
|
+
{ .signature="... * N * int64, ... * int64 -> ... * int64",
|
|
188
|
+
.in={"2 * 3 * int64", "10 * 2 * int64"},
|
|
189
|
+
.out={"10 * 2 * int64"},
|
|
190
|
+
.broadcast={"fixed(shape=10, step=0) * 2 * 3 * int64", "10 * 2 * int64"},
|
|
191
|
+
.outer_dims=2,
|
|
192
|
+
.success=true },
|
|
193
|
+
|
|
194
|
+
{ .signature="... * N * int64, ... * int64 -> ... * int64",
|
|
195
|
+
.in={"2 * 3 * int64", "20 * 10 * 2 * int64"},
|
|
196
|
+
.out={"20 * 10 * 2 * int64"},
|
|
197
|
+
.broadcast={"fixed(shape=20, step=0) * fixed(shape=10, step=0) * 2 * 3 * int64", "20 * 10 * 2 * int64"},
|
|
198
|
+
.outer_dims=3,
|
|
199
|
+
.success=true },
|
|
200
|
+
|
|
201
|
+
{ .signature="... * N * int64, ... * int64 -> ... * N * int64",
|
|
202
|
+
.in={"2 * 3 * int64", "20 * 10 * 2 * int64"},
|
|
203
|
+
.out={"20 * 10 * 2 * 3 * int64"},
|
|
204
|
+
.broadcast={"fixed(shape=20, step=0) * fixed(shape=10, step=0) * 2 * 3 * int64", "20 * 10 * 2 * int64"},
|
|
205
|
+
.outer_dims=3,
|
|
206
|
+
.success=true },
|
|
207
|
+
|
|
208
|
+
{ .signature="var... * int64 -> var... * int64",
|
|
209
|
+
.in={"2 * 3 * int64"},
|
|
210
|
+
.out={NULL},
|
|
211
|
+
.broadcast={NULL},
|
|
212
|
+
.outer_dims=0,
|
|
213
|
+
.success=false },
|
|
214
|
+
|
|
215
|
+
{ .signature="A... * int64 -> A... * int64",
|
|
216
|
+
.in={"var(offsets=[0,2]) * int64"},
|
|
217
|
+
.out={NULL},
|
|
218
|
+
.broadcast={NULL},
|
|
219
|
+
.outer_dims=0,
|
|
220
|
+
.success=false },
|
|
221
|
+
|
|
222
|
+
{ .signature="var... * int64 -> var... * int64",
|
|
223
|
+
.in={"var(offsets=[0,2]) * int64"},
|
|
224
|
+
.out={"var(offsets=[0,2]) * int64"},
|
|
225
|
+
.broadcast={NULL},
|
|
226
|
+
.outer_dims=1,
|
|
227
|
+
.success=true },
|
|
228
|
+
|
|
229
|
+
{ .signature="var... * int64 -> var... * int64",
|
|
230
|
+
.in={"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
231
|
+
.out={"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
232
|
+
.broadcast={NULL},
|
|
233
|
+
.outer_dims=2,
|
|
234
|
+
.success=true },
|
|
235
|
+
|
|
236
|
+
{ .signature="var... * int64 -> var... * int64",
|
|
237
|
+
.in={"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
238
|
+
.out={"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
239
|
+
.broadcast={NULL},
|
|
240
|
+
.outer_dims=2,
|
|
241
|
+
.success=true },
|
|
242
|
+
|
|
243
|
+
{ .signature="var... * int64, var... * int64 -> var... * int64",
|
|
244
|
+
.in={"var(offsets=[0,2]) * int64",
|
|
245
|
+
"var(offsets=[0,2]) * int64"},
|
|
246
|
+
.out={"var(offsets=[0,2]) * int64"},
|
|
247
|
+
.broadcast={NULL},
|
|
248
|
+
.outer_dims=1,
|
|
249
|
+
.success=true },
|
|
250
|
+
|
|
251
|
+
{ .signature="var... * int64, var... * int64 -> var... * int64",
|
|
252
|
+
.in={"var(offsets=[0,3]) * int64",
|
|
253
|
+
"var(offsets=[0,2]) * int64"},
|
|
254
|
+
.out={NULL},
|
|
255
|
+
.broadcast={NULL},
|
|
256
|
+
.outer_dims=0,
|
|
257
|
+
.success=false },
|
|
258
|
+
|
|
259
|
+
{ .signature="var... * int64, var... * int64 -> var... * int64",
|
|
260
|
+
.in={"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64",
|
|
261
|
+
"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
262
|
+
.out={"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
263
|
+
.broadcast={NULL},
|
|
264
|
+
.outer_dims=2,
|
|
265
|
+
.success=true },
|
|
266
|
+
|
|
267
|
+
{ .signature="var... * int64, var... * int64 -> var... * int64",
|
|
268
|
+
.in={"var(offsets=[0,2]) * var(offsets=[0,4,11]) * int64",
|
|
269
|
+
"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
270
|
+
.out={NULL},
|
|
271
|
+
.broadcast={NULL},
|
|
272
|
+
.outer_dims=0,
|
|
273
|
+
.success=false },
|
|
274
|
+
|
|
275
|
+
{ .signature="var... * int64, var... * int64 -> var... * int64",
|
|
276
|
+
.in={"var(offsets=[0,3]) * var(offsets=[0,4,10,20]) * int64",
|
|
277
|
+
"var(offsets=[0,2]) * var(offsets=[0,4,10]) * int64"},
|
|
278
|
+
.out={NULL},
|
|
279
|
+
.broadcast={NULL},
|
|
280
|
+
.outer_dims=0,
|
|
281
|
+
.success=false },
|
|
282
|
+
|
|
283
|
+
{ .signature="var * var * (int32, float64), int32 -> var * var * int32",
|
|
284
|
+
.in={"var(offsets=[0,3]) * var(offsets=[0,4,10,20]) * (int32, float64)",
|
|
285
|
+
"int32"},
|
|
286
|
+
.out={"var * var * int32"},
|
|
287
|
+
.broadcast={NULL},
|
|
288
|
+
.outer_dims=0,
|
|
289
|
+
.success=true },
|
|
290
|
+
|
|
291
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> ... * F[10 * 2 * float64]",
|
|
292
|
+
.in={"2 * 3 * float64", "!3 * 4 * float32"},
|
|
293
|
+
.out={"!10 * 2 * float64"},
|
|
294
|
+
.broadcast={"2 * 3 * float64", "!3 * 4 * float32"},
|
|
295
|
+
.outer_dims=0,
|
|
296
|
+
.success=true },
|
|
297
|
+
|
|
298
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> ... * F[10 * 2 * float64]",
|
|
299
|
+
.in={"20 * 2 * 3 * float64", "20 * !3 * 4 * float32"},
|
|
300
|
+
.out={"20 * !10 * 2 * float64"},
|
|
301
|
+
.broadcast={"20 * 2 * 3 * float64", "20 * !3 * 4 * float32"},
|
|
302
|
+
.outer_dims=1,
|
|
303
|
+
.success=true },
|
|
304
|
+
|
|
305
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> ... * F[10 * 2 * float64]",
|
|
306
|
+
.in={"20 * 2 * 3 * float64", "!3 * 4 * float32"},
|
|
307
|
+
.out={"20 * !10 * 2 * float64"},
|
|
308
|
+
.broadcast={"20 * 2 * 3 * float64", "fixed(shape=20, step=0) * !3 * 4 * float32"},
|
|
309
|
+
.outer_dims=1,
|
|
310
|
+
.success=true },
|
|
311
|
+
|
|
312
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> ... * F[10 * 2 * float64]",
|
|
313
|
+
.in={"2 * 3 * float64", "20 * 30 * !3 * 4 * float32"},
|
|
314
|
+
.out={"20 * 30 * !10 * 2 * float64"},
|
|
315
|
+
.broadcast={"fixed(shape=20, step=0) * fixed(shape=30, step=0) * 2 * 3 * float64",
|
|
316
|
+
"20 * 30 * !3 * 4 * float32"},
|
|
317
|
+
.outer_dims=2,
|
|
318
|
+
.success=true },
|
|
319
|
+
|
|
320
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> ... * C[10 * 2 * float64]",
|
|
321
|
+
.in={"2 * 3 * float64", "20 * 30 * !3 * 4 * float32"},
|
|
322
|
+
.out={"20 * 30 * 10 * 2 * float64"},
|
|
323
|
+
.broadcast={"fixed(shape=20, step=0) * fixed(shape=30, step=0) * 2 * 3 * float64",
|
|
324
|
+
"20 * 30 * !3 * 4 * float32"},
|
|
325
|
+
.outer_dims=2,
|
|
326
|
+
.success=true },
|
|
327
|
+
|
|
328
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> C[... * 10 * 2 * float64]",
|
|
329
|
+
.in={"2 * 3 * float64", "20 * 30 * !3 * 4 * float32"},
|
|
330
|
+
.out={"20 * 30 * 10 * 2 * float64"},
|
|
331
|
+
.broadcast={"fixed(shape=20, step=0) * fixed(shape=30, step=0) * 2 * 3 * float64",
|
|
332
|
+
"20 * 30 * !3 * 4 * float32"},
|
|
333
|
+
.outer_dims=2,
|
|
334
|
+
.success=true },
|
|
335
|
+
|
|
336
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> F[... * 10 * 2 * float64]",
|
|
337
|
+
.in={"2 * 3 * float64", "20 * 30 * !3 * 4 * float32"},
|
|
338
|
+
.out={"!20 * 30 * 10 * 2 * float64"},
|
|
339
|
+
.broadcast={"fixed(shape=20, step=0) * fixed(shape=30, step=0) * 2 * 3 * float64",
|
|
340
|
+
"20 * 30 * !3 * 4 * float32"},
|
|
341
|
+
.outer_dims=2,
|
|
342
|
+
.success=true },
|
|
343
|
+
|
|
344
|
+
{ .signature="... * C[2 * 3 * float64], ... * F[3 * 4 * float32] -> F[... * 20 * 30 * 10 * 2 * float64]",
|
|
345
|
+
.in={"2 * 3 * float64", "!3 * 4 * float32"},
|
|
346
|
+
.out={"!20 * 30 * 10 * 2 * float64"},
|
|
347
|
+
.broadcast={"2 * 3 * float64", "!3 * 4 * float32"},
|
|
348
|
+
.outer_dims=0,
|
|
349
|
+
.success=true },
|
|
350
|
+
|
|
351
|
+
{ .signature="C[... * 2 * 3 * int64], ... * F[3 * 4 * float32] -> F[... * 20 * 30 * 10 * 2 * float64]",
|
|
352
|
+
.in={"2 * 3 * int64", "!3 * 4 * float32"},
|
|
353
|
+
.out={"!20 * 30 * 10 * 2 * float64"},
|
|
354
|
+
.broadcast={"2 * 3 * int64", "!3 * 4 * float32"},
|
|
355
|
+
.outer_dims=0,
|
|
356
|
+
.success=true },
|
|
357
|
+
|
|
358
|
+
/* First argument is not C after broadcasting. */
|
|
359
|
+
{ .signature="C[... * 2 * 3 * int64], ... * F[2 * 3 * 4 * float32] -> F[... * 20 * 30 * 10 * 2 * float64]",
|
|
360
|
+
.in={"2 * 3 * float64", "!2 * 3 * 4 * float32"},
|
|
361
|
+
.out={NULL},
|
|
362
|
+
.broadcast={NULL},
|
|
363
|
+
.outer_dims=0,
|
|
364
|
+
.success=false },
|
|
365
|
+
|
|
366
|
+
/* Second argument is not F after broadcasting. */
|
|
367
|
+
{ .signature="... * C[2 * 3 * 4 * int64], F[... * 3 * 4 * float32] -> F[... * 20 * 30 * 10 * 2 * float64]",
|
|
368
|
+
.in={"3 * 4 * float64", "!3 * 4 * float32"},
|
|
369
|
+
.out={NULL},
|
|
370
|
+
.broadcast={NULL},
|
|
371
|
+
.outer_dims=0,
|
|
372
|
+
.success=false },
|
|
373
|
+
|
|
374
|
+
{ NULL, {NULL}, {NULL}, {NULL}, 0, false }
|
|
375
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2017-2018, plures
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
|
9
|
+
*
|
|
10
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
* this list of conditions and the following disclaimer.
|
|
12
|
+
*
|
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
* and/or other materials provided with the distribution.
|
|
16
|
+
*
|
|
17
|
+
* 3. Neither the name of the copyright holder nor the names of its
|
|
18
|
+
* contributors may be used to endorse or promote products derived from
|
|
19
|
+
* this software without specific prior written permission.
|
|
20
|
+
*
|
|
21
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
24
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
25
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
26
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
27
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
28
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
29
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
#include <stdio.h>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const char *typedef_tests[] = {
|
|
38
|
+
"",
|
|
39
|
+
"a",
|
|
40
|
+
"aa",
|
|
41
|
+
"aaa",
|
|
42
|
+
"aaaa",
|
|
43
|
+
"aaaa_t",
|
|
44
|
+
"ab",
|
|
45
|
+
"abb",
|
|
46
|
+
"abbb",
|
|
47
|
+
"abbb_t",
|
|
48
|
+
NULL
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const char *typedef_error_tests[] = {
|
|
52
|
+
"$",
|
|
53
|
+
"a$",
|
|
54
|
+
"aa$",
|
|
55
|
+
"aaa$",
|
|
56
|
+
"aaaa$",
|
|
57
|
+
"aaaa_t$",
|
|
58
|
+
"ab$",
|
|
59
|
+
"abb$",
|
|
60
|
+
"abbb$",
|
|
61
|
+
"abbb_t$",
|
|
62
|
+
NULL
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#
|
|
2
|
+
# The flex-generated lexer handles some allocation errors with a fatal error.
|
|
3
|
+
# The fatal error still calls fprintf() before exiting. We do the same as
|
|
4
|
+
# PostgreSQL and redefine fprintf() to a function that -- in our case -- calls
|
|
5
|
+
# longjmp(). The error is then handled in parser.c.
|
|
6
|
+
#
|
|
7
|
+
# With this scheme, blocks allocated by yy_scan_buffer() are still lost *if*
|
|
8
|
+
# an allocation failure is deliberately triggered within that function.
|
|
9
|
+
#
|
|
10
|
+
# IOW, this leak only occurs when tests/runtests is compiled with -DTEST_ALLOC
|
|
11
|
+
# and ndt_alloc_fail() is active.
|
|
12
|
+
#
|
|
13
|
+
|
|
14
|
+
{
|
|
15
|
+
flex_inadequate_error_handling_lexer
|
|
16
|
+
Memcheck:Leak
|
|
17
|
+
match-leak-kinds: all
|
|
18
|
+
...
|
|
19
|
+
fun:ndt_yy_scan_buffer
|
|
20
|
+
fun:_ndt_from_string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
{
|
|
24
|
+
flex_inadequate_error_handling_bplexer
|
|
25
|
+
Memcheck:Leak
|
|
26
|
+
match-leak-kinds: all
|
|
27
|
+
...
|
|
28
|
+
fun:ndt_bp_scan_buffer
|
|
29
|
+
fun:ndt_from_bpformat
|
|
30
|
+
}
|