Statistics
| Branch: | Tag: | Revision:

root / gnuradio-core / src / guile / tests / general_ctors.test @ a444c2a5

History | View | Annotate | Download (10.7 kB)

1
;;; -*- Scheme -*-
2
;;;
3
;;; Copyright 2010 Free Software Foundation, Inc.
4
;;;
5
;;; This file is part of GNU Radio
6
;;;
7
;;; GNU Radio is free software; you can redistribute it and/or modify
8
;;; it under the terms of the GNU General Public License as published by
9
;;; the Free Software Foundation; either version 3, or (at your option)
10
;;; any later version.
11
;;;
12
;;; GNU Radio is distributed in the hope that it will be useful,
13
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
;;; GNU General Public License for more details.
16
;;;
17
;;; You should have received a copy of the GNU General Public License
18
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
;;;
20
21
;;; If you're using Emacs's Scheme mode:
22
;;;   (put 'with-test-prefix 'scheme-indent-function 1)
23
24
;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests.
25
;;; See also the very end of the file, where the test-equal, test-eqv
26
;;; and test-eq macros are defined.
27
28
(use-modules (gnuradio test-suite lib))
29
(use-modules (gnuradio core))
30
(use-modules (oop goops))
31
(use-modules (ice-9 format))
32
33
34
;;; Test complex<float> scalars
35
(pass-if (equal? 5.0+5.0i (gr:complex-scalar-test0)))
36
(pass-if (equal? 1.5+0.5i (gr:complex-scalar-test1 1+1i)))
37
38
;;; Test complex<float> vectors
39
(pass-if (verbose-equal? #(0+0i 1+1i 2+2i 3+3i 4+4i)
40
			 (gr:complex-vec-test0)))
41
42
(pass-if (verbose-equal? #(1.5+0.5i 2.5+1.5i 3.5+2.5i)
43
			 (gr:complex-vec-test1 #(1+1i 2+2i 3+3i))))
44
45
46
;;; Add test code for all constructors in these files
47
48
;;; ./general/gr_additive_scrambler_bb.h
49
(pass-if (true? (gr:additive-scrambler-bb 0 0 0 0)))
50
51
;; Here's one that will throw if its arg is 0
52
(pass-if (true? (gr:unpack-k-bits-bb 10)))
53
(pass-if-throw "confirm throw gr:unpack-k-bits-bb" #t (true? (gr:unpack-k-bits-bb 0)))
54
55
;;; ./general/gr_agc2_cc.h
56
(pass-if (true? (gr:agc2-cc 1e-1 1e-2 1.0 1.0 0.0)))
57
58
;;; ./general/gr_agc2_ff.h
59
(pass-if (true? (gr:agc2-ff 0 0 0 0 0)))
60
61
;;; ./general/gr_agc_cc.h
62
(pass-if (true? (gr:agc-cc 0 0 0 0)))
63
64
;;; ./general/gr_agc_ff.h
65
(pass-if (true? (gr:agc-ff 0 0 0 0)))
66
67
;;; ./general/gr_align_on_samplenumbers_ss.h
68
(pass-if (true? (gr:align-on-samplenumbers-ss 2 128)))
69
(pass-if-throw "confirm throw gr:align-on-samplenumbers-ss" #t (true? (gr:align-on-samplenumbers-ss 0 0)))
70
71
;;; ./general/gr_bin_statistics_f.h WONTFIX: requires gr_feval_dd & swig directors
72
;;;(pass-if (true? (gr:bin-statistics-f 1 (gr:msg-queue) 0 0 0)))
73
74
;;; ./general/gr_bytes_to_syms.h
75
(pass-if (true? (gr:bytes-to-syms)))
76
77
;;; ./general/gr_char_to_float.h
78
(pass-if (true? (gr:char-to-float)))
79
80
;;; ./general/gr_check_counting_s.h
81
(pass-if (true? (gr:check-counting-s #f)))
82
83
;;; ./general/gr_check_lfsr_32k_s.h
84
(pass-if (true? (gr:check-lfsr-32k-s)))
85
86
;;; ./general/gr_complex_to_interleaved_short.h
87
(pass-if (true? (gr:complex-to-interleaved-short)))
88
89
;;; ./general/gr_complex_to_xxx.h
90
(pass-if (true? (gr:complex-to-float 1)))
91
(pass-if (true? (gr:complex-to-real 1)))
92
(pass-if (true? (gr:complex-to-imag 1)))
93
(pass-if (true? (gr:complex-to-mag 1)))
94
(pass-if (true? (gr:complex-to-mag-squared 1)))
95
(pass-if (true? (gr:complex-to-arg 1)))
96
97
;;; ./general/gr_conjugate_cc.h
98
(pass-if (true? (gr:conjugate-cc)))
99
100
;;; ./general/gr_copy.h
101
(pass-if (true? (gr:copy 1)))
102
103
;;; ./general/gr_cpfsk_bc.h
104
(pass-if (true? (gr:cpfsk-bc 1 1 1)))
105
106
;;; ./general/gr_ctcss_squelch_ff.h
107
(pass-if (true? (gr:ctcss-squelch-ff 0 0 0 0 0 #t)))
108
109
;;; ./general/gr_decode_ccsds_27_fb.h
110
(pass-if (true? (gr:decode-ccsds-27-fb)))
111
112
;;; ./general/gr_deinterleave.h
113
(pass-if (true? (gr:deinterleave 1)))
114
115
;;; ./general/gr_delay.h
116
(pass-if (true? (gr:delay 1 1)))
117
 
118
;;; ./general/gr_descrambler_bb.h
119
(pass-if (true? (gr:descrambler-bb 0 0 0)))
120
121
;;; ./general/gr_diff_decoder_bb.h
122
(pass-if (true? (gr:diff-decoder-bb 0)))
123
124
;;; ./general/gr_diff_encoder_bb.h
125
(pass-if (true? (gr:diff-encoder-bb 0)))
126
127
;;; ./general/gr_diff_phasor_cc.h
128
(pass-if (true? (gr:diff-phasor-cc)))
129
130
;;; ./general/gr_dpll_bb.h
131
(pass-if (true? (gr:dpll-bb 0 0)))
132
133
;;; ./general/gr_encode_ccsds_27_bb.h
134
(pass-if (true? (gr:encode-ccsds-27-bb)))
135
136
;;; ./general/gr_fake_channel_coder_pp.h
137
(pass-if (true? (gr:fake-channel-encoder-pp 1 1)))
138
(pass-if-throw "confirm throw" #t (true? (gr:fake-channel-encoder-pp -1 1)))
139
140
;;; ./general/gr_feedforward_agc_cc.h
141
(pass-if (true? (gr:feedforward-agc-cc 1 1)))
142
143
;;; ./general/gr_fft_vcc.h
144
(pass-if (true? (gr:fft-vcc 1 #f #(1.0 2.0) #t)))
145
146
;;; ./general/gr_fft_vfc.h
147
(pass-if (true? (gr:fft-vfc 4 #t #(1.0 2.0 3.0 4.0))))
148
(pass-if-throw "confirm throw gr:fft-vfc" #t (true? (gr:fft-vfc 4 #f #(1.0 2.0 3.0 4.0))))
149
150
;;; ./general/gr_fll_band_edge_cc.h
151
(pass-if (true? (gr:fll-band-edge-cc 0 0 0 0 0)))
152
153
;; ;;; ./general/gr_float_to_char.h
154
(pass-if (true? (gr:float-to-char)))
155
156
;; ;;; ./general/gr_float_to_complex.h
157
(pass-if (true? (gr:float-to-complex 1)))
158
159
;;; ./general/gr_float_to_short.h
160
(pass-if (true? (gr:float-to-short)))
161
162
;;; ./general/gr_float_to_uchar.h
163
(pass-if (true? (gr:float-to-uchar)))
164
165
;;; ./general/gr_fmdet_cf.h
166
(pass-if (true? (gr:fmdet-cf 0 0 0 0)))
167
168
;;; ./general/gr_framer_sink_1.h
169
(pass-if (true? (gr:framer-sink-1 (gr:msg-queue))))
170
171
;;; ./general/gr_frequency_modulator_fc.h
172
(pass-if (true? (gr:frequency-modulator-fc 0)))
173
174
;;; ./general/gr_glfsr_source_b.h
175
(pass-if (true? (gr:glfsr-source-b 1 #t 0 1)))
176
(pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_b 33 #t 0 0)))
177
178
;;; ./general/gr_glfsr_source_f.h
179
(pass-if (true? (gr:glfsr-source-f 1 #t 1 1)))
180
(pass-if-throw "confirm throw" #t (true? (gr:glfsr_source_f 33 #t 0 0)))
181
182
;;; ./general/gr_head.h
183
(pass-if (true? (gr:head 1 1)))
184
185
;;; ./general/gr_interleave.h
186
(pass-if (true? (gr:interleave 1)))
187
188
;;; ./general/gr_interleaved_short_to_complex.h
189
(pass-if (true? (gr:interleaved-short-to-complex)))
190
191
;;; ./general/gr_keep_one_in_n.h
192
(pass-if (true? (gr:keep-one-in-n 1 1)))
193
194
;;; ./general/gr_kludge_copy.h
195
(pass-if (true? (gr:kludge-copy 1)))
196
197
;;; ./general/gr_lfsr_32k_source_s.h
198
(pass-if (true? (gr:lfsr-32k-source-s)))
199
200
;;; ./general/gr_map_bb.h
201
(pass-if (true? (gr:map-bb #(1 2))))
202
203
;;; ./general/gr_mpsk_receiver_cc.h
204
(pass-if (true? (gr:mpsk-receiver-cc 1 1 1 1 1 1 1 1 1 1 1)))
205
206
;;; ./general/gr_nlog10_ff.h
207
(pass-if (true? (gr:nlog10-ff 1 1 1)))
208
209
;;; ./general/gr_nop.h
210
(pass-if (true? (gr:nop 1)))
211
212
;;; ./general/gr_null_sink.h
213
(pass-if (true? (gr:null-sink 1)))
214
215
;;; ./general/gr_null_source.h
216
(pass-if (true? (gr:null-source 1)))
217
218
;;; ./general/gr_ofdm_cyclic_prefixer.h
219
(pass-if (true? (gr:ofdm-cyclic-prefixer 1 1)))
220
221
;;; ./general/gr_ofdm_frame_acquisition.h
222
(pass-if (true? (gr:ofdm-frame-acquisition 1 1 1 #(1+3i 23+5i) 1)))
223
224
;;; ./general/gr_ofdm_frame_sink.h
225
(pass-if (true? (gr:ofdm-frame-sink #(1+3i 23+5i) #(0 1) (gr:msg-queue) 128 0.25 0)))
226
227
;;; ./general/gr_ofdm_insert_preamble.h FIXME: "Wrong type argument in position ~A: ~S"
228
;;;                                     WONTFIX: Need vector<vector<complex<float>>>
229
;;(pass-if (true? (gr:ofdm-insert-preamble 2 #(#(1+3i 23+5i) #(1+3i 23+5i)))))
230
231
;;; ./general/gr_ofdm_mapper_bcv.h
232
(pass-if (true? (gr:ofdm-mapper-bcv #(0+1i 0-1i) 1 100 128)))
233
(pass-if-throw "confirm throw gr:ofdm-mapper-bcv" #t
234
  (true? (gr:ofdm-mapper-bcv #(0+1i 0-1i) 1 10 128)))
235
236
237
;;; ./general/gr_ofdm_sampler.h
238
(pass-if (true? (gr:ofdm-sampler 1 1 1)))
239
240
;;; ./general/gr_pa_2x2_phase_combiner.h
241
(pass-if (true? (gr:pa-2x2-phase-combiner)))
242
243
;;; ./general/gr_packet_sink.h
244
(pass-if (true? (gr:packet-sink #(1 2) (gr:msg-queue) -1)))
245
246
;;; ./general/gr_peak_detector2_fb.h
247
(pass-if (true? (gr:peak-detector2-fb 0 0 0)))
248
249
;;; ./general/gr_phase_modulator_fc.h
250
(pass-if (true? (gr:phase-modulator-fc 0)))
251
252
;;; ./general/gr_pll_carriertracking_cc.h
253
(pass-if (true? (gr:pll-carriertracking-cc 0 0 0 0)))
254
255
;;; ./general/gr_pll_freqdet_cf.h
256
(pass-if (true? (gr:pll-freqdet-cf 0 0 0 0)))
257
258
;;; ./general/gr_pll_refout_cc.h
259
(pass-if (true? (gr:pll-refout-cc 0 0 0 0)))
260
261
;;; ./general/gr_pn_correlator_cc.h
262
(pass-if (true? (gr:pn-correlator-cc 1 1 1)))
263
264
;;; ./general/gr_probe_avg_mag_sqrd_c.h
265
(pass-if (true? (gr:probe-avg-mag-sqrd-c 0 0)))
266
267
;;; ./general/gr_probe_avg_mag_sqrd_cf.h
268
(pass-if (true? (gr:probe-avg-mag-sqrd-cf 0 0)))
269
270
;;; ./general/gr_probe_avg_mag_sqrd_f.h
271
(pass-if (true? (gr:probe-avg-mag-sqrd-f 0 0)))
272
273
;;; ./general/gr_probe_density_b.h
274
(pass-if (true? (gr:probe-density-b 0)))
275
276
;;; ./general/gr_probe_mpsk_snr_c.h
277
(pass-if (true? (gr:probe-mpsk-snr-c 0)))
278
279
;;; ./general/gr_probe_signal_f.h
280
(pass-if (true? (gr:probe-signal-f)))
281
282
;;; ./general/gr_pwr_squelch_cc.h
283
(pass-if (true? (gr:pwr-squelch-cc 0 0 0 #f)))
284
285
;;; ./general/gr_pwr_squelch_ff.h
286
(pass-if (true? (gr:pwr-squelch-ff 0.0 0.0 0 #f)))
287
288
;;; ./general/gr_quadrature_demod_cf.h
289
(pass-if (true? (gr:quadrature-demod-cf 0)))
290
291
;;; ./general/gr_rail_ff.h
292
(pass-if (true? (gr:rail-ff 0 0)))
293
294
;;; ./general/gr_regenerate_bb.h
295
(pass-if (true? (gr:regenerate-bb 0 0)))
296
297
;;; ./general/gr_repeat.h
298
(pass-if (true? (gr:repeat 1 1)))
299
300
;;; ./general/gr_rms_cf.h
301
(pass-if (true? (gr:rms-cf 0)))
302
303
;;; ./general/gr_rms_ff.h
304
(pass-if (true? (gr:rms-ff 0)))
305
306
;;; ./general/gr_scrambler_bb.h
307
(pass-if (true? (gr:scrambler-bb 0 0 0)))
308
309
;;; ./general/gr_short_to_float.h
310
(pass-if (true? (gr:short-to-float)))
311
312
;;; ./general/gr_simple_correlator.h
313
(pass-if (true? (gr:simple-correlator 0)))
314
315
;;; ./general/gr_simple_framer.h
316
(pass-if (true? (gr:simple-framer 0)))
317
318
;;; ./general/gr_simple_squelch_cc.h
319
(pass-if (true? (gr:simple-squelch-cc 0 0)))
320
321
;;; ./general/gr_skiphead.h
322
(pass-if (true? (gr:skiphead 1 1)))
323
324
;;; ./general/gr_squash_ff.h
325
(pass-if (true? (gr:squash-ff #(1.0 2.0 3.0 4.0 5.0) #(1.0 2.0 3.0 4.0 5.0))))
326
327
;;; ./general/gr_squelch_base_cc.h WONTFIX: not wrapped
328
;;; (pass-if (true? (gr:squelch-base-cc "foo" 0 #f)))
329
330
;;; ./general/gr_squelch_base_ff.h WONTFIX: not wrapped
331
;; (pass-if (true? (gr:squelch-base-ff "foo" 0 #f)))
332
333
;;; ./general/gr_stream_mux.h
334
(pass-if (true? (gr:stream-mux 1 #(1 2))))
335
336
;;; ./general/gr_stream_to_streams.h
337
(pass-if (true? (gr:stream-to-streams 1 1)))
338
339
;;; ./general/gr_stream_to_vector.h
340
(pass-if (true? (gr:stream-to-vector 1 1)))
341
342
;;; ./general/gr_streams_to_stream.h
343
(pass-if (true? (gr:streams-to-stream 1 1)))
344
345
;;; ./general/gr_streams_to_vector.h
346
(pass-if (true? (gr:streams-to-vector 1 1)))
347
348
;;; ./general/gr_stretch_ff.h
349
(pass-if (true? (gr:stretch-ff 1 1)))
350
351
;;; ./general/gr_test.h
352
(pass-if (true? (gr:test "foo" 1 1 1 1 1 1 1 1)))
353
354
;;; ./general/gr_threshold_ff.h
355
(pass-if (true? (gr:threshold-ff 0 0)))
356
357
;;; ./general/gr_throttle.h
358
(pass-if (true? (gr:throttle 1 1)))
359
360
;;; ./general/gr_uchar_to_float.h
361
(pass-if (true? (gr:uchar-to-float)))
362
363
;;; ./general/gr_vco_f.h
364
(pass-if (true? (gr:vco-f 0 0 0)))
365
366
;;; ./general/gr_vector_to_stream.h
367
(pass-if (true? (gr:vector-to-stream 1 1)))
368
369
;;; ./general/gr_vector_to_streams.h
370
(pass-if (true? (gr:vector-to-streams 1 1)))
371
372
;;; ./general/gr_wavelet_ff.h
373
(pass-if (true? (gr:wavelet-ff 1024 20 #t)))
374
375
;;; ./general/gr_wvps_ff.h
376
(pass-if (true? (gr:wvps-ff 2)))