dub 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/dub.gemspec +3 -2
- data/lib/dub/argument.rb +43 -35
- data/lib/dub/function.rb +50 -2
- data/lib/dub/function_group.rb +6 -8
- data/lib/dub/group.rb +14 -0
- data/lib/dub/klass.rb +2 -2
- data/lib/dub/lua/class.cpp.erb +7 -3
- data/lib/dub/lua/class_gen.rb +15 -7
- data/lib/dub/lua/function_gen.rb +31 -11
- data/lib/dub/lua/group.cpp.erb +1 -2
- data/lib/dub/lua/namespace_gen.rb +4 -2
- data/lib/dub/member_extraction.rb +9 -5
- data/lib/dub/namespace.rb +3 -2
- data/lib/dub/version.rb +1 -1
- data/test/argument_test.rb +107 -4
- data/test/fixtures/app/include/matrix.h +14 -1
- data/test/fixtures/app/xml/classdub_1_1_matrix.xml +28 -4
- data/test/fixtures/app/xml/classdub_1_1_t_mat.xml +14 -14
- data/test/fixtures/app/xml/index.xml +1 -0
- data/test/fixtures/app/xml/matrix_8h.xml +59 -55
- data/test/fixtures/app/xml/namespacedub.xml +2 -2
- data/test/fixtures/classcv_1_1_scalar__.xml +269 -0
- data/test/function_group_test.rb +13 -4
- data/test/function_test.rb +128 -1
- data/test/klass_test.rb +77 -2
- metadata +3 -2
@@ -0,0 +1,269 @@
|
|
1
|
+
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
2
|
+
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.6.3">
|
3
|
+
<compounddef id="classcv_1_1_scalar__" kind="class" prot="public">
|
4
|
+
<compoundname>cv::Scalar_</compoundname>
|
5
|
+
<basecompoundref refid="classcv_1_1_vec" prot="public" virt="non-virtual">cv::Vec< _Tp, 4 ></basecompoundref>
|
6
|
+
<includes refid="cxcore_8hpp" local="no">cxcore.hpp</includes>
|
7
|
+
<templateparamlist>
|
8
|
+
<param>
|
9
|
+
<type>typename</type>
|
10
|
+
<declname>_Tp</declname>
|
11
|
+
<defname>_Tp</defname>
|
12
|
+
</param>
|
13
|
+
</templateparamlist>
|
14
|
+
<sectiondef kind="public-func">
|
15
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1ae1f585cbf709bbce60762f802c571211" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
16
|
+
<type></type>
|
17
|
+
<definition>cv::Scalar_< _Tp >::Scalar_</definition>
|
18
|
+
<argsstring>()</argsstring>
|
19
|
+
<name>Scalar_</name>
|
20
|
+
<briefdescription>
|
21
|
+
</briefdescription>
|
22
|
+
<detaileddescription>
|
23
|
+
</detaileddescription>
|
24
|
+
<inbodydescription>
|
25
|
+
</inbodydescription>
|
26
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="427"/>
|
27
|
+
</memberdef>
|
28
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1ae64e021266b9f7661f66a3c77d175c1f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
29
|
+
<type></type>
|
30
|
+
<definition>cv::Scalar_< _Tp >::Scalar_</definition>
|
31
|
+
<argsstring>(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0)</argsstring>
|
32
|
+
<name>Scalar_</name>
|
33
|
+
<param>
|
34
|
+
<type>_Tp</type>
|
35
|
+
<declname>v0</declname>
|
36
|
+
</param>
|
37
|
+
<param>
|
38
|
+
<type>_Tp</type>
|
39
|
+
<declname>v1</declname>
|
40
|
+
</param>
|
41
|
+
<param>
|
42
|
+
<type>_Tp</type>
|
43
|
+
<declname>v2</declname>
|
44
|
+
<defval>0</defval>
|
45
|
+
</param>
|
46
|
+
<param>
|
47
|
+
<type>_Tp</type>
|
48
|
+
<declname>v3</declname>
|
49
|
+
<defval>0</defval>
|
50
|
+
</param>
|
51
|
+
<briefdescription>
|
52
|
+
</briefdescription>
|
53
|
+
<detaileddescription>
|
54
|
+
</detaileddescription>
|
55
|
+
<inbodydescription>
|
56
|
+
</inbodydescription>
|
57
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="428"/>
|
58
|
+
</memberdef>
|
59
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1ad882af49ebbea352268959dbcb4b2a0c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
60
|
+
<type></type>
|
61
|
+
<definition>cv::Scalar_< _Tp >::Scalar_</definition>
|
62
|
+
<argsstring>(const CvScalar &s)</argsstring>
|
63
|
+
<name>Scalar_</name>
|
64
|
+
<param>
|
65
|
+
<type>const <ref refid="struct_cv_scalar" kindref="compound">CvScalar</ref> &</type>
|
66
|
+
<declname>s</declname>
|
67
|
+
</param>
|
68
|
+
<briefdescription>
|
69
|
+
</briefdescription>
|
70
|
+
<detaileddescription>
|
71
|
+
</detaileddescription>
|
72
|
+
<inbodydescription>
|
73
|
+
</inbodydescription>
|
74
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="429"/>
|
75
|
+
</memberdef>
|
76
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1a3929afa654b588e2d9b2dde86060e689" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
|
77
|
+
<type></type>
|
78
|
+
<definition>cv::Scalar_< _Tp >::Scalar_</definition>
|
79
|
+
<argsstring>(_Tp v0)</argsstring>
|
80
|
+
<name>Scalar_</name>
|
81
|
+
<param>
|
82
|
+
<type>_Tp</type>
|
83
|
+
<declname>v0</declname>
|
84
|
+
</param>
|
85
|
+
<briefdescription>
|
86
|
+
</briefdescription>
|
87
|
+
<detaileddescription>
|
88
|
+
</detaileddescription>
|
89
|
+
<inbodydescription>
|
90
|
+
</inbodydescription>
|
91
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="430"/>
|
92
|
+
</memberdef>
|
93
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1a7e82b74016e7134955bd5e4f3ea43eaf" prot="public" static="no" const="yes" explicit="no" inline="no" virt="non-virtual">
|
94
|
+
<type></type>
|
95
|
+
<definition>cv::Scalar_< _Tp >::operator CvScalar</definition>
|
96
|
+
<argsstring>() const </argsstring>
|
97
|
+
<name>operator CvScalar</name>
|
98
|
+
<reimplements refid="classcv_1_1_vec_1a6bba31a2f784e19509f23161d1ae2490">operator CvScalar</reimplements>
|
99
|
+
<briefdescription>
|
100
|
+
</briefdescription>
|
101
|
+
<detaileddescription>
|
102
|
+
</detaileddescription>
|
103
|
+
<inbodydescription>
|
104
|
+
</inbodydescription>
|
105
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="432"/>
|
106
|
+
</memberdef>
|
107
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1a5cdacdd7b9b4d6f3aebbf7c9c830cdde" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
|
108
|
+
<templateparamlist>
|
109
|
+
<param>
|
110
|
+
<type>typename T2</type>
|
111
|
+
</param>
|
112
|
+
</templateparamlist>
|
113
|
+
<type></type>
|
114
|
+
<definition>cv::Scalar_< _Tp >::operator Scalar_< T2 ></definition>
|
115
|
+
<argsstring>() const </argsstring>
|
116
|
+
<name>operator Scalar_< T2 ></name>
|
117
|
+
<briefdescription>
|
118
|
+
</briefdescription>
|
119
|
+
<detaileddescription>
|
120
|
+
</detaileddescription>
|
121
|
+
<inbodydescription>
|
122
|
+
</inbodydescription>
|
123
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="434"/>
|
124
|
+
</memberdef>
|
125
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1a9220cda4988b7af1fd62d72419baaa54" prot="public" static="no" const="yes" explicit="no" inline="no" virt="non-virtual">
|
126
|
+
<type><ref refid="classcv_1_1_scalar__" kindref="compound">Scalar_</ref>< _Tp ></type>
|
127
|
+
<definition>Scalar_<_Tp> cv::Scalar_< _Tp >::mul</definition>
|
128
|
+
<argsstring>(const Scalar_< _Tp > &t, double scale=1) const </argsstring>
|
129
|
+
<name>mul</name>
|
130
|
+
<param>
|
131
|
+
<type>const <ref refid="classcv_1_1_scalar__" kindref="compound">Scalar_</ref>< _Tp > &</type>
|
132
|
+
<declname>t</declname>
|
133
|
+
</param>
|
134
|
+
<param>
|
135
|
+
<type>double</type>
|
136
|
+
<declname>scale</declname>
|
137
|
+
<defval>1</defval>
|
138
|
+
</param>
|
139
|
+
<briefdescription>
|
140
|
+
</briefdescription>
|
141
|
+
<detaileddescription>
|
142
|
+
</detaileddescription>
|
143
|
+
<inbodydescription>
|
144
|
+
</inbodydescription>
|
145
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="436"/>
|
146
|
+
</memberdef>
|
147
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1a95f3a5ffa3f17e545c84c731acba4082" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
|
148
|
+
<templateparamlist>
|
149
|
+
<param>
|
150
|
+
<type>typename T2</type>
|
151
|
+
</param>
|
152
|
+
</templateparamlist>
|
153
|
+
<type>void</type>
|
154
|
+
<definition>void cv::Scalar_< _Tp >::convertTo</definition>
|
155
|
+
<argsstring>(T2 *buf, int channels, int unroll_to=0) const </argsstring>
|
156
|
+
<name>convertTo</name>
|
157
|
+
<param>
|
158
|
+
<type>T2 *</type>
|
159
|
+
<declname>buf</declname>
|
160
|
+
</param>
|
161
|
+
<param>
|
162
|
+
<type>int</type>
|
163
|
+
<declname>channels</declname>
|
164
|
+
</param>
|
165
|
+
<param>
|
166
|
+
<type>int</type>
|
167
|
+
<declname>unroll_to</declname>
|
168
|
+
<defval>0</defval>
|
169
|
+
</param>
|
170
|
+
<briefdescription>
|
171
|
+
</briefdescription>
|
172
|
+
<detaileddescription>
|
173
|
+
</detaileddescription>
|
174
|
+
<inbodydescription>
|
175
|
+
</inbodydescription>
|
176
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="437"/>
|
177
|
+
</memberdef>
|
178
|
+
</sectiondef>
|
179
|
+
<sectiondef kind="public-static-func">
|
180
|
+
<memberdef kind="function" id="classcv_1_1_scalar___1ac1509a4b8454fe7fe29db069e13a2e6f" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
|
181
|
+
<type><ref refid="classcv_1_1_scalar__" kindref="compound">Scalar_</ref>< _Tp ></type>
|
182
|
+
<definition>static Scalar_<_Tp> cv::Scalar_< _Tp >::all</definition>
|
183
|
+
<argsstring>(_Tp v0)</argsstring>
|
184
|
+
<name>all</name>
|
185
|
+
<reimplements refid="classcv_1_1_vec_1a86371c4948f9dbb4496cfd7a559c51b4">all</reimplements>
|
186
|
+
<param>
|
187
|
+
<type>_Tp</type>
|
188
|
+
<declname>v0</declname>
|
189
|
+
</param>
|
190
|
+
<briefdescription>
|
191
|
+
</briefdescription>
|
192
|
+
<detaileddescription>
|
193
|
+
</detaileddescription>
|
194
|
+
<inbodydescription>
|
195
|
+
</inbodydescription>
|
196
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="431"/>
|
197
|
+
</memberdef>
|
198
|
+
</sectiondef>
|
199
|
+
<briefdescription>
|
200
|
+
</briefdescription>
|
201
|
+
<detaileddescription>
|
202
|
+
</detaileddescription>
|
203
|
+
<inheritancegraph>
|
204
|
+
<node id="347">
|
205
|
+
<label>cv::Scalar_< _Tp ></label>
|
206
|
+
<link refid="classcv_1_1_scalar__"/>
|
207
|
+
<childnode refid="348" relation="public-inheritance">
|
208
|
+
</childnode>
|
209
|
+
</node>
|
210
|
+
<node id="348">
|
211
|
+
<label>cv::Vec< _Tp, 4 ></label>
|
212
|
+
<link refid="classcv_1_1_vec"/>
|
213
|
+
</node>
|
214
|
+
</inheritancegraph>
|
215
|
+
<collaborationgraph>
|
216
|
+
<node id="349">
|
217
|
+
<label>cv::Scalar_< _Tp ></label>
|
218
|
+
<link refid="classcv_1_1_scalar__"/>
|
219
|
+
<childnode refid="350" relation="public-inheritance">
|
220
|
+
</childnode>
|
221
|
+
</node>
|
222
|
+
<node id="350">
|
223
|
+
<label>cv::Vec< _Tp, 4 ></label>
|
224
|
+
<link refid="classcv_1_1_vec"/>
|
225
|
+
<childnode refid="351" relation="usage">
|
226
|
+
<edgelabel>val</edgelabel>
|
227
|
+
</childnode>
|
228
|
+
</node>
|
229
|
+
<node id="351">
|
230
|
+
<label>_Tp</label>
|
231
|
+
</node>
|
232
|
+
</collaborationgraph>
|
233
|
+
<location file="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" line="425" bodyfile="/Users/gaspard/git/opencv/opencv/include/opencv/cxcore.hpp" bodystart="424" bodyend="438"/>
|
234
|
+
<listofallmembers>
|
235
|
+
<member refid="classcv_1_1_scalar___1ac1509a4b8454fe7fe29db069e13a2e6f" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>all</name></member>
|
236
|
+
<member refid="classcv_1_1_vec_1acee7fcb659e3761ecc7ced13e399c33fae9575073c9a06ece6f8f689cfdaffda1" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>channels</name></member>
|
237
|
+
<member refid="classcv_1_1_scalar___1a95f3a5ffa3f17e545c84c731acba4082" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>convertTo</name></member>
|
238
|
+
<member refid="classcv_1_1_vec_1a0a747642fbef7c45bd089b8255327423" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>cross</name></member>
|
239
|
+
<member refid="classcv_1_1_vec_1a7657dfa378030b145035425d227306ad" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>ddot</name></member>
|
240
|
+
<member refid="classcv_1_1_vec_1acee7fcb659e3761ecc7ced13e399c33fac384741a50c6182a73308a227f912207" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>depth</name></member>
|
241
|
+
<member refid="classcv_1_1_vec_1ab621963ce41a34ebea38468e68beecf7" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>dot</name></member>
|
242
|
+
<member refid="classcv_1_1_scalar___1a9220cda4988b7af1fd62d72419baaa54" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>mul</name></member>
|
243
|
+
<member refid="classcv_1_1_scalar___1a7e82b74016e7134955bd5e4f3ea43eaf" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>operator CvScalar</name></member>
|
244
|
+
<member refid="classcv_1_1_scalar___1a5cdacdd7b9b4d6f3aebbf7c9c830cdde" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>operator Scalar_< T2 ></name></member>
|
245
|
+
<member refid="classcv_1_1_vec_1a5355e4a1861b19224f92932e47ded71a" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>operator Vec< T2, cn ></name></member>
|
246
|
+
<member refid="classcv_1_1_vec_1af49eab1e1f471c1b24297415f6538d6e" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>operator[]</name></member>
|
247
|
+
<member refid="classcv_1_1_vec_1ac65f71f08e6af6e807ba4ca47ffd0d90" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>operator[]</name></member>
|
248
|
+
<member refid="classcv_1_1_scalar___1ae1f585cbf709bbce60762f802c571211" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Scalar_</name></member>
|
249
|
+
<member refid="classcv_1_1_scalar___1ae64e021266b9f7661f66a3c77d175c1f" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Scalar_</name></member>
|
250
|
+
<member refid="classcv_1_1_scalar___1ad882af49ebbea352268959dbcb4b2a0c" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Scalar_</name></member>
|
251
|
+
<member refid="classcv_1_1_scalar___1a3929afa654b588e2d9b2dde86060e689" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Scalar_</name></member>
|
252
|
+
<member refid="classcv_1_1_vec_1acee7fcb659e3761ecc7ced13e399c33fa6b9faf6f7c5de5b8d02cd192d847cba0" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>type</name></member>
|
253
|
+
<member refid="classcv_1_1_vec_1a915665691f65a3a0ad247446384a95b2" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>val</name></member>
|
254
|
+
<member refid="classcv_1_1_vec_1adca5e5fb1c491d3f253c9110777969aa" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>value_type</name></member>
|
255
|
+
<member refid="classcv_1_1_vec_1a72bcb5232e9c11542886319edb9809a9" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
256
|
+
<member refid="classcv_1_1_vec_1a70931c51a1f6c84bc8f1863b8f35fadc" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
257
|
+
<member refid="classcv_1_1_vec_1ab3c6059e273514f79aebefc2825ea06c" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
258
|
+
<member refid="classcv_1_1_vec_1a72280b48a5d716939114289dc0930ba6" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
259
|
+
<member refid="classcv_1_1_vec_1a4860aebf83282553be32c021cf9726bc" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
260
|
+
<member refid="classcv_1_1_vec_1ae50afd23b21fbd313dbfc8476db849b2" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
261
|
+
<member refid="classcv_1_1_vec_1a841ae2e0076c9393b42baee62f1ddafc" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
262
|
+
<member refid="classcv_1_1_vec_1a78a6c4b0bd6932de02c191365a4e7d87" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
263
|
+
<member refid="classcv_1_1_vec_1af133aa5b6e162a522a72a999a7130786" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
264
|
+
<member refid="classcv_1_1_vec_1a25667a57fe49571f285bf5b65e8e76d0" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
265
|
+
<member refid="classcv_1_1_vec_1a74ba63687a0a3878d9a3ded1e0990622" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
266
|
+
<member refid="classcv_1_1_vec_1a2bcc2be2e6fc71d00a03f109e445f86b" prot="public" virt="non-virtual"><scope>cv::Scalar_</scope><name>Vec</name></member>
|
267
|
+
</listofallmembers>
|
268
|
+
</compounddef>
|
269
|
+
</doxygen>
|
data/test/function_group_test.rb
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
require 'helper'
|
2
|
+
require 'dub/lua'
|
2
3
|
|
3
4
|
class FunctionGroupTest < Test::Unit::TestCase
|
4
5
|
|
5
6
|
context 'A FunctionGroup' do
|
6
|
-
|
7
|
-
# namespacecv_xml = Dub.parse(fixture('namespacecv.xml'))
|
7
|
+
should 'keep its members sorted by overloaded_index' do
|
8
8
|
@group = namespacecv_xml[:cv][:divide]
|
9
|
+
assert_equal [1, 2, 3, 4], @group.map {|f| f.overloaded_index}
|
9
10
|
end
|
10
11
|
|
11
|
-
should '
|
12
|
-
|
12
|
+
should 'not use top__ in chooser if all methods have same arg count' do
|
13
|
+
@method = namespacecv_xml[:cv][:Mat][:diag]
|
14
|
+
Dub::Lua.bind(@method)
|
15
|
+
assert_no_match %r{top__}, Dub::Lua.function_generator.chooser_body(@method)
|
16
|
+
end
|
17
|
+
|
18
|
+
should 'use top__ in chooser if some methods have different arg count' do
|
19
|
+
@method = namespacecv_xml[:cv][:Mat][:Mat]
|
20
|
+
Dub::Lua.bind(@method)
|
21
|
+
assert_match %r{top__}, Dub::Lua.function_generator.chooser_body(@method)
|
13
22
|
end
|
14
23
|
end
|
15
24
|
end
|
data/test/function_test.rb
CHANGED
@@ -178,6 +178,38 @@ class FunctionTest < Test::Unit::TestCase
|
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
|
+
context 'A function with list arguments' do
|
182
|
+
setup do
|
183
|
+
@namespace = namespacecv_xml[:cv]
|
184
|
+
Dub::Lua.bind(@namespace)
|
185
|
+
@group = @namespace[:calcHist]
|
186
|
+
@function = @group[1]
|
187
|
+
end
|
188
|
+
|
189
|
+
# should 'mark argument as list on arg_is_list' do
|
190
|
+
# @function.arg_is_list(0, 1)
|
191
|
+
# assert @function.arguments[0].is_list?
|
192
|
+
# assert !@function.arguments[0].is_list_count?
|
193
|
+
# assert @function.arguments[1].is_list_count?
|
194
|
+
# end
|
195
|
+
|
196
|
+
should 'respond true to has_class_pointer_arguments' do
|
197
|
+
assert @function.has_class_pointer_arguments?
|
198
|
+
end
|
199
|
+
|
200
|
+
should 'be removed from group list' do
|
201
|
+
assert_nil @group.members
|
202
|
+
end
|
203
|
+
|
204
|
+
should 'remove group from member declaration' do
|
205
|
+
assert_no_match %r{cv_calcHist}, @namespace.gen.functions_registration(@namespace)
|
206
|
+
end
|
207
|
+
|
208
|
+
should 'not be instanciated' do
|
209
|
+
assert_equal '', @group.to_s
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
181
213
|
context 'A method without arguments' do
|
182
214
|
setup do
|
183
215
|
@function = namespacecv_xml[:cv][:getCPUTickCount]
|
@@ -214,7 +246,6 @@ class FunctionTest < Test::Unit::TestCase
|
|
214
246
|
|
215
247
|
context 'A constructor' do
|
216
248
|
setup do
|
217
|
-
# namespacecv_xml = Dub.parse(fixture('app/xml/namespacedub.xml'))
|
218
249
|
@method = namespacedub_xml[:dub][:Matrix][:Matrix].first
|
219
250
|
end
|
220
251
|
|
@@ -249,4 +280,100 @@ class FunctionTest < Test::Unit::TestCase
|
|
249
280
|
end
|
250
281
|
end
|
251
282
|
end
|
283
|
+
|
284
|
+
context 'A static method in a class' do
|
285
|
+
setup do
|
286
|
+
@method = namespacedub_xml[:dub][:Matrix][:MakeMatrix]
|
287
|
+
end
|
288
|
+
|
289
|
+
should 'know it is static' do
|
290
|
+
assert @method.static?
|
291
|
+
end
|
292
|
+
|
293
|
+
should 'append class in call_name' do
|
294
|
+
assert_equal 'Matrix::MakeMatrix', @method.call_name
|
295
|
+
end
|
296
|
+
|
297
|
+
should 'parse return type' do
|
298
|
+
assert_equal 'Matrix', @method.return_value.type
|
299
|
+
end
|
300
|
+
|
301
|
+
context 'bound to a generator' do
|
302
|
+
setup do
|
303
|
+
Dub::Lua.bind(@method)
|
304
|
+
end
|
305
|
+
|
306
|
+
should 'not try to find self' do
|
307
|
+
assert_no_match %r{self__}, @method.to_s
|
308
|
+
end
|
309
|
+
|
310
|
+
should 'insert the function into the namespace' do
|
311
|
+
@class = namespacedub_xml[:dub][:Matrix]
|
312
|
+
Dub::Lua.bind(@class)
|
313
|
+
result = @class.to_s
|
314
|
+
member_methods_registration = result[/Matrix_member_methods([^;]*);/,1]
|
315
|
+
namespace_methods_registration = result[/Matrix_namespace_methods([^;]*);/,1]
|
316
|
+
assert_no_match %r{Matrix_MakeMatrix}, member_methods_registration
|
317
|
+
assert_match %r{Matrix_MakeMatrix.*Matrix_MakeMatrix}, namespace_methods_registration
|
318
|
+
end
|
319
|
+
|
320
|
+
should 'use class name in call' do
|
321
|
+
assert_match %r{Matrix::MakeMatrix\(}, @method.gen.call_string(@method)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
# This is something like template<typename T2> foo() inside a templated class
|
327
|
+
context 'A template method' do
|
328
|
+
setup do
|
329
|
+
@class = namespacecv_xml[:cv][:Scalar]
|
330
|
+
@method = @class.template_method(:convertTo)
|
331
|
+
end
|
332
|
+
|
333
|
+
should 'know it is a template' do
|
334
|
+
assert @method.template?
|
335
|
+
end
|
336
|
+
|
337
|
+
context 'bound to a generator' do
|
338
|
+
setup do
|
339
|
+
Dub::Lua.bind(@class)
|
340
|
+
end
|
341
|
+
|
342
|
+
should 'be ignored in class members' do
|
343
|
+
assert !@class.members.include?(@method)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
context 'A method in a class defined from a template' do
|
349
|
+
setup do
|
350
|
+
@class = namespacecv_xml[:cv][:Scalar]
|
351
|
+
@method = @class[:all]
|
352
|
+
end
|
353
|
+
|
354
|
+
should 'resolve its arguments' do
|
355
|
+
assert_equal 'double', @method.arguments[0].type
|
356
|
+
assert_equal 'Scalar', @method.return_value.type
|
357
|
+
end
|
358
|
+
|
359
|
+
should 'not be seen as a template' do
|
360
|
+
assert !@method.template?
|
361
|
+
end
|
362
|
+
|
363
|
+
should 'not be seen as having complex types' do
|
364
|
+
assert !@method.has_complex_arguments?
|
365
|
+
end
|
366
|
+
|
367
|
+
context 'bound to a generator' do
|
368
|
+
setup do
|
369
|
+
Dub::Lua.bind(@class)
|
370
|
+
end
|
371
|
+
|
372
|
+
should 'not be ignored in class members' do
|
373
|
+
assert @class.members.include?(@method)
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
|
252
379
|
end
|
data/test/klass_test.rb
CHANGED
@@ -46,7 +46,7 @@ class KlassTest < Test::Unit::TestCase
|
|
46
46
|
assert_kind_of Array, @class.class_methods
|
47
47
|
end
|
48
48
|
|
49
|
-
context 'bound member list' do
|
49
|
+
context 'with a bound member list' do
|
50
50
|
setup do
|
51
51
|
Dub::Lua.bind(@class)
|
52
52
|
@list = @class.members.map {|m| m.name}
|
@@ -100,6 +100,10 @@ class KlassTest < Test::Unit::TestCase
|
|
100
100
|
assert_kind_of Dub::Function, @class[:rows]
|
101
101
|
end
|
102
102
|
|
103
|
+
should 'find static methods with array index' do
|
104
|
+
assert_kind_of Dub::Function, @class[:MakeMatrix]
|
105
|
+
end
|
106
|
+
|
103
107
|
should 'return header name on header' do
|
104
108
|
assert_equal 'matrix.h', @class.header
|
105
109
|
end
|
@@ -160,6 +164,17 @@ class KlassTest < Test::Unit::TestCase
|
|
160
164
|
assert_match %r{__tostring}, @class.to_s
|
161
165
|
end
|
162
166
|
|
167
|
+
should 'use custom format if provided for tostring' do
|
168
|
+
@class.string_format = "%dx%d"
|
169
|
+
@class.string_args = "(*userdata)->rows, (*userdata)->cols"
|
170
|
+
assert_match %r{\(\*userdata\)->rows, \(\*userdata\)->cols}, @class.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
should 'use a default method for tostring if no custom string_format is provided' do
|
174
|
+
@class.string_format = nil
|
175
|
+
assert_match %r{<dub.Matrix: %p>}, @class.to_s
|
176
|
+
end
|
177
|
+
|
163
178
|
should 'implement tostring' do
|
164
179
|
assert_match %r{Matrix__tostring\(lua_State}, @class.to_s
|
165
180
|
end
|
@@ -195,6 +210,52 @@ class KlassTest < Test::Unit::TestCase
|
|
195
210
|
@tclass = namespacecv_xml[:cv].template_class(:Size_)
|
196
211
|
assert_equal @class, @tclass.instanciations[['int']]
|
197
212
|
end
|
213
|
+
|
214
|
+
context 'with a bound member list' do
|
215
|
+
setup do
|
216
|
+
@class = namespacedub_xml[:dub][:FMatrix]
|
217
|
+
Dub::Lua.bind(@class)
|
218
|
+
@list = @class.members.map {|m| m.name}
|
219
|
+
end
|
220
|
+
|
221
|
+
should 'ignore template methods in member list' do
|
222
|
+
assert !@list.include?("give_me_tea")
|
223
|
+
end
|
224
|
+
|
225
|
+
should 'ignore template methods in member registration' do
|
226
|
+
assert_no_match %r{give_me_tea}, @class.gen.method_registration(@class)
|
227
|
+
end
|
228
|
+
|
229
|
+
should 'ignore template methods in method istanciation' do
|
230
|
+
assert_no_match %r{give_me_tea}, @class.to_s
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# strangely, the bug does not show up with "FMatrix"
|
236
|
+
context 'Another class defined from a template' do
|
237
|
+
setup do
|
238
|
+
@class = namespacecv_xml[:cv][:Scalar]
|
239
|
+
end
|
240
|
+
|
241
|
+
context 'with a bound member list' do
|
242
|
+
setup do
|
243
|
+
Dub::Lua.bind(@class)
|
244
|
+
@list = @class.members.map {|m| m.name}
|
245
|
+
end
|
246
|
+
|
247
|
+
should 'ignore template methods in member list' do
|
248
|
+
assert !@list.include?("convertTo")
|
249
|
+
end
|
250
|
+
|
251
|
+
should 'ignore template methods in member registration' do
|
252
|
+
assert_no_match %r{convertTo}, @class.gen.method_registration(@class)
|
253
|
+
end
|
254
|
+
|
255
|
+
should 'ignore template methods in method istanciation' do
|
256
|
+
assert_no_match %r{convertTo}, @class.to_s
|
257
|
+
end
|
258
|
+
end
|
198
259
|
end
|
199
260
|
|
200
261
|
context 'A class with alias names' do
|
@@ -253,7 +314,21 @@ class KlassTest < Test::Unit::TestCase
|
|
253
314
|
|
254
315
|
should 'declare chooser' do
|
255
316
|
result = @class.gen.method_registration(@class)
|
256
|
-
assert_match %r{"
|
317
|
+
assert_match %r{"diag"\s*,\s*Mat_diag\}}, result
|
318
|
+
assert_no_match %r{diag1}, result
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
context 'A class with overloaded static methods' do
|
323
|
+
setup do
|
324
|
+
# namespacecv_xml = Dub.parse(fixture('app/xml/namespacedub.xml'))
|
325
|
+
@class = namespacecv_xml[:cv][:Mat]
|
326
|
+
Dub::Lua.bind(@class)
|
327
|
+
end
|
328
|
+
|
329
|
+
should 'declare chooser' do
|
330
|
+
result = @class.gen.namespace_methods_registration(@class)
|
331
|
+
assert_match %r{"Mat_zeros"\s*,\s*Mat_zeros\}}, result
|
257
332
|
assert_no_match %r{zeros1}, result
|
258
333
|
end
|
259
334
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gaspard Bucher
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-11 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- test/fixtures/app/xml/namespacedub.xml
|
165
165
|
- test/fixtures/classcv_1_1_mat.xml
|
166
166
|
- test/fixtures/classcv_1_1_point__.xml
|
167
|
+
- test/fixtures/classcv_1_1_scalar__.xml
|
167
168
|
- test/fixtures/classcv_1_1_size__.xml
|
168
169
|
- test/fixtures/group___magic_type.xml
|
169
170
|
- test/fixtures/namespacecv.xml
|