Imported Upstream version 3.2.2
[debian/gnuradio] / gnuradio-core / src / python / gnuradio / gr / qa_feval.py
index 7afc5ec0eea5b7366fe31e9f24878fb532c2bcf9..64bbe45ce7635c928ee1b47b9162243ff1ab5bd9 100755 (executable)
@@ -1,12 +1,12 @@
 #!/usr/bin/env python
 #
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
+# the Free Software Foundation; either version 3, or (at your option)
 # any later version.
 # 
 # GNU Radio is distributed in the hope that it will be useful,
@@ -34,6 +34,12 @@ class my_add2_cc(gr.feval_cc):
     def eval(self, x):
         return x + (2 - 2j)
 
+class my_feval(gr.feval):
+    def __init__(self):
+        gr.feval.__init__(self)
+        self.fired = False
+    def eval(self):
+        self.fired = True
 
 class test_feval(gr_unittest.TestCase):
 
@@ -87,6 +93,18 @@ class test_feval(gr_unittest.TestCase):
         actual_result = tuple([gr.feval_cc_example(f, x) for x in src_data])
         self.assertEqual(expected_result, actual_result)
         
+    def test_void_1(self):
+        # this is all in python
+        f = my_feval()
+        f.eval()
+        self.assertEqual(True, f.fired)
+
+    def test_void_2(self):
+        # this is python -> C++ -> python and back again
+        f = my_feval()
+        gr.feval_example(f)
+        self.assertEqual(True, f.fired)
+
 
 if __name__ == '__main__':
     gr_unittest.main ()