[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7373 - gnuradio/branches/developers/trondeau/receiver
From: |
trondeau |
Subject: |
[Commit-gnuradio] r7373 - gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general |
Date: |
Mon, 7 Jan 2008 15:31:04 -0700 (MST) |
Author: trondeau
Date: 2008-01-07 15:31:04 -0700 (Mon, 07 Jan 2008)
New Revision: 7373
Added:
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.cc
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.h
Modified:
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/Makefile.am
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_general.cc
Log:
Adding QA code for gr_math and slicers
Modified:
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/Makefile.am
===================================================================
---
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/Makefile.am
2008-01-07 22:29:48 UTC (rev 7372)
+++
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/Makefile.am
2008-01-07 22:31:04 UTC (rev 7373)
@@ -168,7 +168,8 @@
qa_gr_firdes.cc \
qa_gr_fxpt.cc \
qa_gr_fxpt_nco.cc \
- qa_gr_fxpt_vco.cc
+ qa_gr_fxpt_vco.cc \
+ qa_gr_math.cc
@@ -323,7 +324,8 @@
qa_gr_fxpt.h \
qa_gr_fxpt_nco.h \
qa_gr_fxpt_vco.h \
- sine_table.h
+ sine_table.h \
+ qa_gr_math.h
swiginclude_HEADERS = \
general.i \
Modified:
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_general.cc
===================================================================
---
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_general.cc
2008-01-07 22:29:48 UTC (rev 7372)
+++
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_general.cc
2008-01-07 22:31:04 UTC (rev 7373)
@@ -31,6 +31,7 @@
#include <qa_gr_fxpt.h>
#include <qa_gr_fxpt_nco.h>
#include <qa_gr_fxpt_vco.h>
+#include <qa_gr_math.h>
CppUnit::TestSuite *
qa_general::suite ()
@@ -42,6 +43,7 @@
s->addTest (qa_gr_fxpt::suite ());
s->addTest (qa_gr_fxpt_nco::suite ());
s->addTest (qa_gr_fxpt_vco::suite ());
+ s->addTest (qa_gr_math::suite ());
return s;
}
Added:
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.cc
===================================================================
---
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.cc
(rev 0)
+++
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.cc
2008-01-07 22:31:04 UTC (rev 7373)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 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 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gr_math.h>
+#include <qa_gr_math.h>
+#include <cppunit/TestAssert.h>
+#include <stdio.h>
+
+void
+qa_gr_math::test_binary_slicer1 ()
+{
+ float x[5] = {-1, -0.5, 0, 0.5, 1.0};
+ unsigned int z[5] = {0, 0, 1, 1, 1};
+ unsigned int y;
+
+ //printf("\nBinary\n");
+ for (unsigned int i = 0; i < 5; i++) {
+ y = gr_binary_slicer(x[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+
+ //printf("in: %f out: %d desired: %d\n", x[i], y, z[i]);
+ }
+
+ //printf("\nBranchless Binary\n");
+ for (unsigned int i = 0; i < 5; i++) {
+ y = gr_branchless_binary_slicer(x[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+
+ //printf("in: %f out: %d desired: %d\n", x[i], y, z[i]);
+ }
+}
+
+void
+qa_gr_math::test_quad_0deg_slicer1 ()
+{
+ gr_complex x[4] = {gr_complex(1, 0),
+ gr_complex(0, 1),
+ gr_complex(-1, 0),
+ gr_complex(0, -1)};
+
+ unsigned int z[4] = {0, 1, 2, 3};
+ unsigned int y;
+
+ //printf("\nQuad0\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_quad_0deg_slicer(x[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(),
x[i].imag(), y, z[i]);
+ }
+}
+
+void
+qa_gr_math::test_quad_45deg_slicer1 ()
+{
+ gr_complex x[4] = {gr_complex(0.707, 0.707),
+ gr_complex(-0.707, 0.707),
+ gr_complex(-0.707, -0.707),
+ gr_complex(0.707, -0.707)};
+
+ unsigned int z[4] = {0, 1, 2, 3};
+ unsigned int y;
+
+ //printf("\nQuad45\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_quad_45deg_slicer(x[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(),
x[i].imag(), y, z[i]);
+ }
+
+ //printf("\nBranchless Quad45\n");
+ for (unsigned int i = 0; i < 4; i++) {
+ y = gr_branchless_quad_45deg_slicer(x[i]);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(y, z[i], 1e-9);
+
+ //printf("in: %.4f+j%.4f out: %d desired: %d\n", x[i].real(),
x[i].imag(), y, z[i]);
+ }
+}
Added:
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.h
===================================================================
---
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.h
(rev 0)
+++
gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general/qa_gr_math.h
2008-01-07 22:31:04 UTC (rev 7373)
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef _QA_GR_MATH_H_
+#define _QA_GR_MATH_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_gr_math : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_gr_math);
+ CPPUNIT_TEST(test_binary_slicer1);
+ CPPUNIT_TEST(test_quad_0deg_slicer1);
+ CPPUNIT_TEST(test_quad_45deg_slicer1);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_binary_slicer1();
+ void test_quad_0deg_slicer1();
+ void test_quad_45deg_slicer1();
+};
+
+#endif /* _QA_GR_MATH_H_ */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7373 - gnuradio/branches/developers/trondeau/receiver/gnuradio-core/src/lib/general,
trondeau <=