summaryrefslogtreecommitdiff
path: root/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
diff options
context:
space:
mode:
authorMaximilian Stiefel <stiefel.maximilian@online.de>2018-03-17 13:46:07 +0100
committerMarcus Müller <marcus@hostalia.de>2018-03-22 23:35:40 +0100
commitf5d9d86bae8ed97a43a4501236daa4a34d54dcc0 (patch)
treef169e31221c33720de00ee580caa55fa01c0d0e0 /gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
parent38b6d3216652fcf329babfe81bdd5bfde1c4afef (diff)
Solved the issue without C++11 and introduced the proposed improvements. Fixes #1648
Diffstat (limited to 'gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py')
-rwxr-xr-xgr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py58
1 files changed, 35 insertions, 23 deletions
diff --git a/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py b/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
index bd1dfb0915..bbf58c473f 100755
--- a/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
+++ b/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright 2012-2018 Free Software Foundation, Inc.
+# Copyright 2012, 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -208,32 +208,44 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
self.assertEqual(correct_offsets[key], tag.offset)
self.assertTrue(all(tags_found.values()))
- @gr_unittest.unittest.skip("Skipping test with wrong input (caused SIGFPE earlier, now throws a simple std::invalid_argument with useful message)")
def test_004_t (self):
"""
- Provoking exception (earlier SIGFPE).
+ Provoking RuntimeError exceptions providing wrong user input (earlier invisible SIGFPE).
"""
fft_len = 6
- tx_symbols = (1, 2, 3)
- pilot_symbols = ()
- occupied_carriers = ((-1, 1, 2),)
- pilot_carriers = ()
- expected_result = (0, 0, 1, 0, 2, 3)
- src = blocks.vector_source_c(tx_symbols, False, 1)
- alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
- occupied_carriers,
- pilot_carriers,
- pilot_symbols, (),
- self.tsb_key)
- sink = blocks.tsb_vector_sink_c(fft_len)
- self.tb.connect(
- src,
- blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, 1, len(tx_symbols), self.tsb_key),
- alloc,
- sink
- )
- self.tb.run ()
- self.assertEqual(sink.data()[0], expected_result)
+
+ # Occupied carriers
+ with self.assertRaises(RuntimeError) as oc:
+ alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
+ (),
+ ((),),
+ ((),),
+ (),
+ self.tsb_key)
+
+ # Pilot carriers
+ with self.assertRaises(RuntimeError) as pc:
+ alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
+ ((),),
+ (),
+ ((),),
+ (),
+ self.tsb_key)
+
+ # Pilot carrier symbols
+ with self.assertRaises(RuntimeError) as ps:
+ alloc = digital.ofdm_carrier_allocator_cvc(fft_len,
+ ((),),
+ ((),),
+ (),
+ (),
+ self.tsb_key)
+
+
+ self.assertEqual(str(oc.exception), "Occupied carriers must be of type vector of vector i.e. ((),).")
+ self.assertEqual(str(pc.exception), "Pilot carriers must be of type vector of vector i.e. ((),).")
+ self.assertEqual(str(ps.exception), "Pilot symbols must be of type vector of vector i.e. ((),).")
+
if __name__ == '__main__':
gr_unittest.run(qa_digital_carrier_allocator_cvc, "qa_digital_carrier_allocator_cvc.xml")