diff options
author | jcorgan | 2006-08-03 04:51:51 +0000 |
---|---|---|
committer | jcorgan | 2006-08-03 04:51:51 +0000 |
commit | 5d69a524f81f234b3fbc41d49ba18d6f6886baba (patch) | |
tree | b71312bf7f1e8d10fef0f3ac6f28784065e73e72 /gr-error-correcting-codes/src/lib/libecc/tests | |
download | gnuradio-5d69a524f81f234b3fbc41d49ba18d6f6886baba.tar.gz gnuradio-5d69a524f81f234b3fbc41d49ba18d6f6886baba.tar.bz2 gnuradio-5d69a524f81f234b3fbc41d49ba18d6f6886baba.zip |
Houston, we have a trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3122 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-error-correcting-codes/src/lib/libecc/tests')
6 files changed, 656 insertions, 0 deletions
diff --git a/gr-error-correcting-codes/src/lib/libecc/tests/Makefile.am b/gr-error-correcting-codes/src/lib/libecc/tests/Makefile.am new file mode 100644 index 000000000..79850ba74 --- /dev/null +++ b/gr-error-correcting-codes/src/lib/libecc/tests/Makefile.am @@ -0,0 +1,47 @@ +# +# Copyright 2001 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) +# 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +include $(top_srcdir)/Makefile.common + +INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) -I.. + +noinst_LTLIBRARIES = libecc-qa.la + +noinst_HEADERS = \ + qa_encoder_convolutional_ic1_ic1.h \ + qa_ecc.h + +libecc_qa_la_SOURCES = \ + qa_encoder_convolutional_ic1_ic1.cc \ + qa_ecc.cc + +# list of programs run by "make check" and "make distcheck" + +TESTS = test_all + +noinst_PROGRAMS = test_all + +LIBECC = ../libecc.la +LIBECCQA = libecc-qa.la $(LIBECC) + +test_all_SOURCES = test_all.cc +test_all_LDADD = $(LIBECCQA) \ + $(CPPUNIT_LIBS) diff --git a/gr-error-correcting-codes/src/lib/libecc/tests/qa_ecc.cc b/gr-error-correcting-codes/src/lib/libecc/tests/qa_ecc.cc new file mode 100644 index 000000000..03b185be6 --- /dev/null +++ b/gr-error-correcting-codes/src/lib/libecc/tests/qa_ecc.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2006 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) + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * This class gathers together all the test cases for the gr + * directory into a single test suite. As you create new test cases, + * add them here. + */ + +#include <qa_ecc.h> +#include <qa_encoder_convolutional_ic1_ic1.h> + +CppUnit::TestSuite* +qa_ecc::suite +() +{ + CppUnit::TestSuite* s = new CppUnit::TestSuite ("ecc"); + + s->addTest (qa_encoder_convolutional_ic1_ic1::suite ()); + + return (s); +} diff --git a/gr-error-correcting-codes/src/lib/libecc/tests/qa_ecc.h b/gr-error-correcting-codes/src/lib/libecc/tests/qa_ecc.h new file mode 100644 index 000000000..ef411673e --- /dev/null +++ b/gr-error-correcting-codes/src/lib/libecc/tests/qa_ecc.h @@ -0,0 +1,36 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 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) + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _QA_ECC_H_ +#define _QA_ECC_H_ + +#include <cppunit/TestSuite.h> + +//! collect all the tests for the gr directory + +class qa_ecc { +public: + //! return suite of tests for all of gr directory + static CppUnit::TestSuite *suite (); +}; + +#endif /* _QA_ECC_H_ */ diff --git a/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc b/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc new file mode 100644 index 000000000..6ea72b6f8 --- /dev/null +++ b/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.cc @@ -0,0 +1,430 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 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) + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "encoder_convolutional_ic1_ic1.h" +#include <qa_encoder_convolutional_ic1_ic1.h> +#include <cppunit/TestAssert.h> +#include <string.h> +#include <iostream> +#include <iomanip> +#include <stdio.h> + + +void +qa_encoder_convolutional_ic1_ic1::do_encoder_check +(const char** c_in, + const char** c_res, + int n_output_items, + int block_size_bits, + int n_code_inputs, + int n_code_outputs, + const int* code_generators, + const int* code_feedback) +{ + std::vector<int> t_code_generators; + t_code_generators.assign (n_code_inputs * n_code_outputs, 0); + for (int m = 0; m < n_code_inputs * n_code_outputs; m++) + t_code_generators[m] = code_generators[m]; + + encoder_convolutional_ic1_ic1* t_encoder; + + if (code_feedback) { + std::vector<int> t_code_feedback; + t_code_feedback.assign (n_code_inputs * n_code_outputs, 0); + for (int m = 0; m < n_code_inputs * n_code_outputs; m++) + t_code_feedback[m] = code_feedback[m]; + + t_encoder = new encoder_convolutional_ic1_ic1 + (block_size_bits, + n_code_inputs, + n_code_outputs, + t_code_generators, + t_code_feedback); + } else { + t_encoder = new encoder_convolutional_ic1_ic1 + (block_size_bits, + n_code_inputs, + n_code_outputs, + t_code_generators); + } + + char** t_out = new char*[n_code_outputs]; + for (int m = 0; m < n_code_outputs; m++) { + t_out[m] = new char[n_output_items]; + } + + t_encoder->encode (c_in, (char**) t_out, n_output_items); + + for (int m = 0; m < n_code_outputs; m++) { + for (int n = 0; n < n_output_items; n++) { + CPPUNIT_ASSERT_EQUAL (c_res[m][n], t_out[m][n]); + } + } + + delete t_encoder; + t_encoder = 0; + + for (int m = 0; m < n_code_outputs; m++) { + delete [] t_out[m]; + t_out[m] = 0; + } + delete [] t_out; + t_out = 0; +} + +// TEST 0 +// +// checking for SOAI realization (implicitely) +// no feedback, no termination + +const static int t0_code_generator[6] = {1, 0, 5, 0, 1, 6}; +const static int t0_n_code_inputs = 3; +const static int t0_n_code_outputs = 2; +const static int t0_n_input_items = 10; +const static int t0_n_output_items = 10; + +const static char t0_in_0[t0_n_input_items] = + {0, 1, 0, 0, 1, 0, 1, 0, 0, 0}; +const static char t0_in_1[t0_n_input_items] = + {0, 1, 0, 0, 0, 1, 1, 0, 0, 0}; +const static char t0_in_2[t0_n_input_items] = + {0, 0, 1, 1, 1, 1, 1, 0, 0, 0}; +const static char* t0_in[t0_n_code_inputs] = + {t0_in_0, t0_in_1, t0_in_2}; + +const static char t0_res_0[t0_n_output_items] = + {0, 1, 1, 1, 1, 0, 1, 1, 1, 0}; +const static char t0_res_1[t0_n_output_items] = + {0, 1, 0, 1, 0, 1, 1, 0, 1, 0}; +const static char* t0_res[t0_n_code_outputs] = + {t0_res_0, t0_res_1}; + +void +qa_encoder_convolutional_ic1_ic1::t0 +() +{ + do_encoder_check ((const char**) t0_in, (const char**) t0_res, + t0_n_output_items, 100, t0_n_code_inputs, + t0_n_code_outputs, (const int*) t0_code_generator); +} + +// TEST 1 +// +// checking for SIAO realization (implicitely) +// no feedback, no termination + +const static int t1_code_generator[6] = {1, 0, 0, 1, 5, 6}; +const static int t1_n_code_inputs = 2; +const static int t1_n_code_outputs = 3; +const static int t1_n_input_items = 9; +const static int t1_n_output_items = 9; + +const static char t1_in_0[t1_n_input_items] = + {0, 1, 1, 1, 0, 0, 0, 1, 0}; +const static char t1_in_1[t1_n_input_items] = + {0, 0, 0, 0, 0, 1, 1, 1, 0}; +const static char* t1_in[t1_n_code_inputs] = + {t1_in_0, t1_in_1}; + +const static char t1_res_0[t1_n_output_items] = + {0, 1, 1, 1, 0, 0, 0, 1, 0}; +const static char t1_res_1[t1_n_output_items] = + {0, 0, 0, 0, 0, 1, 1, 1, 0}; +const static char t1_res_2[t1_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 1, 0}; +const static char* t1_res[t1_n_code_outputs] = + {t1_res_0, t1_res_1, t1_res_2}; + +void +qa_encoder_convolutional_ic1_ic1::t1 +() +{ + do_encoder_check ((const char**) t1_in, (const char**) t1_res, + t1_n_output_items, 100, t1_n_code_inputs, + t1_n_code_outputs, (const int*) t1_code_generator); +} + +// TEST 2 +// +// checking for SIAO realization (implicitely) +// with same feedback, no termination + +const static int t2_code_generator[6] = {1, 0, 0, 1, 5, 6}; +const static int t2_code_feedback[6] = {0, 0, 0, 0, 7, 7}; +const static int t2_n_code_inputs = 2; +const static int t2_n_code_outputs = 3; +const static int t2_n_input_items = 19; +const static int t2_n_output_items = 19; + +const static char t2_in_0[t2_n_input_items] = + {0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0}; +const static char t2_in_1[t2_n_input_items] = + {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0}; +const static char* t2_in[t2_n_code_inputs] = + {t2_in_0, t2_in_1}; + +const static char t2_res_0[t2_n_output_items] = + {0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0}; +const static char t2_res_1[t2_n_output_items] = + {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0}; +const static char t2_res_2[t2_n_output_items] = + {0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0}; +const static char* t2_res[t2_n_code_outputs] = + {t2_res_0, t2_res_1, t2_res_2}; + +void +qa_encoder_convolutional_ic1_ic1::t2 +() +{ + do_encoder_check ((const char**) t2_in, (const char**) t2_res, + t2_n_output_items, 100, t2_n_code_inputs, + t2_n_code_outputs, (const int*) t2_code_generator, + (const int*) t2_code_feedback); +} + +// TEST 3 +// +// checking for SOAI realization (implicitely) +// with same feedback, no termination + +const static int t3_code_generator[6] = {1, 0, 5, 0, 1, 6}; +const static int t3_code_feedback[6] = {0, 0, 7, 0, 0, 7}; +const static int t3_n_code_inputs = 3; +const static int t3_n_code_outputs = 2; +const static int t3_n_input_items = 17; +const static int t3_n_output_items = 17; + +const static char t3_in_0[t3_n_input_items] = + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; +const static char t3_in_1[t3_n_input_items] = + {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const static char t3_in_2[t3_n_input_items] = + {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0}; +const static char* t3_in[t3_n_code_inputs] = + {t3_in_0, t3_in_1, t3_in_2}; + +const static char t3_res_0[t3_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0}; +const static char t3_res_1[t3_n_output_items] = + {0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0}; +const static char* t3_res[t3_n_code_outputs] = + {t3_res_0, t3_res_1}; + +void +qa_encoder_convolutional_ic1_ic1::t3 +() +{ + do_encoder_check ((const char**) t3_in, (const char**) t3_res, + t3_n_output_items, 100, t3_n_code_inputs, + t3_n_code_outputs, (const int*) t3_code_generator, + (const int*) t3_code_feedback); +} + +// TEST 4 +// +// checking for SIAO realization (implicitely), +// with different feedbacks, no termination + +const static int t4_code_generator[6] = {1, 4, 0, 3, 1, 6}; +const static int t4_code_feedback[6] = {0, 7, 0, 5, 0, 5}; +const static int t4_n_code_inputs = 2; +const static int t4_n_code_outputs = 3; +const static int t4_n_input_items = 20; +const static int t4_n_output_items = 20; + +const static char t4_in_0[t4_n_input_items] = + {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0}; +const static char t4_in_1[t4_n_input_items] = + {0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0}; +const static char* t4_in[t4_n_code_inputs] = + {t4_in_0, t4_in_1}; + +const static char t4_res_0[t4_n_output_items] = + {0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0}; +const static char t4_res_1[t4_n_output_items] = + {0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0}; +const static char t4_res_2[t4_n_output_items] = + {0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0}; +const static char* t4_res[t4_n_code_outputs] = + {t4_res_0, t4_res_1, t4_res_2}; + +void +qa_encoder_convolutional_ic1_ic1::t4 +() +{ + do_encoder_check ((const char**) t4_in, (const char**) t4_res, + t4_n_output_items, 100, t4_n_code_inputs, + t4_n_code_outputs, (const int*) t4_code_generator, + (const int*) t4_code_feedback); +} + +// TEST 5 +// +// checking for SOAI realization (implicitely), +// with different feedbacks, no termination + +const static int t5_code_generator[6] = {1, 0, 0, 1, 5, 7}; +const static int t5_code_feedback[6] = {0, 0, 0, 0, 7, 3}; +const static int t5_n_code_inputs = 2; +const static int t5_n_code_outputs = 3; +const static int t5_n_input_items = 19; +const static int t5_n_output_items = 19; + +const static char t5_in_0[t5_n_input_items] = + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; +const static char t5_in_1[t5_n_input_items] = + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; +const static char* t5_in[t5_n_code_inputs] = + {t5_in_0, t5_in_1}; + +const static char t5_res_0[t5_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0}; +const static char t5_res_1[t5_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0}; +const static char t5_res_2[t5_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0}; +const static char* t5_res[t5_n_code_outputs] = + {t5_res_0, t5_res_1, t5_res_2}; + +void +qa_encoder_convolutional_ic1_ic1::t5 +() +{ +#if 0 + do_encoder_check ((const char**) t5_in, (const char**) t5_res, + t5_n_output_items, 100, t5_n_code_inputs, + t5_n_code_outputs, (const int*) t5_code_generator); +#endif +} + +// TEST 6 +// +// checking for termination, no feedback + +const static int t6_code_generator[6] = {1, 0, 5, 0, 1, 6}; +const static int t6_n_code_inputs = 3; +const static int t6_n_code_outputs = 2; +const static int t6_n_input_items = 6; +const static int t6_n_output_items = 8; + +const static char t6_in_0[t6_n_input_items] = + {0, 1, 0, 0, 1, 0}; +const static char t6_in_1[t6_n_input_items] = + {0, 1, 0, 0, 0, 0}; +const static char t6_in_2[t6_n_input_items] = + {0, 0, 1, 1, 1, 0}; +const static char* t6_in[t6_n_code_inputs] = + {t6_in_0, t6_in_1, t6_in_2}; + +const static char t6_res_0[t6_n_output_items] = + {0, 1, 1, 1, 1, 1, 1, 0}; +const static char t6_res_1[t6_n_output_items] = + {0, 1, 0, 1, 0, 0, 1, 0}; +const static char* t6_res[t6_n_code_outputs] = + {t6_res_0, t6_res_1}; + +void +qa_encoder_convolutional_ic1_ic1::t6 +() +{ + do_encoder_check ((const char**) t6_in, (const char**) t6_res, + t6_n_output_items, 5, t6_n_code_inputs, + t6_n_code_outputs, (const int*) t6_code_generator); +} + +// TEST 7 +// +// checking for termination, with same feedback + +const static int t7_code_generator[6] = {1, 0, 5, 0, 1, 6}; +const static int t7_code_feedback[6] = {0, 0, 7, 0, 0, 7}; +const static int t7_n_code_inputs = 3; +const static int t7_n_code_outputs = 2; +const static int t7_n_input_items = 17; +const static int t7_n_output_items = 17; + +const static char t7_in_0[t7_n_input_items] = + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; +const static char t7_in_1[t7_n_input_items] = + {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const static char t7_in_2[t7_n_input_items] = + {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0}; +const static char* t7_in[t7_n_code_inputs] = + {t7_in_0, t7_in_1, t7_in_2}; + +const static char t7_res_0[t7_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0}; +const static char t7_res_1[t7_n_output_items] = + {0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0}; +const static char* t7_res[t7_n_code_outputs] = + {t7_res_0, t7_res_1}; + +void +qa_encoder_convolutional_ic1_ic1::t7 +() +{ +#if 0 + do_encoder_check ((const char**) t7_in, (const char**) t7_res, + t7_n_output_items, 5, t7_n_code_inputs, + t7_n_code_outputs, (const int*) t7_code_generator, + (const int*) t7_code_feedback); +#endif +} + +// TEST 8 +// +// checking for termination, with different feedback + +const static int t8_code_generator[6] = {1, 0, 5, 0, 1, 6}; +const static int t8_code_feedback[6] = {0, 0, 7, 0, 0, 3}; +const static int t8_n_code_inputs = 3; +const static int t8_n_code_outputs = 2; +const static int t8_n_input_items = 17; +const static int t8_n_output_items = 17; + +const static char t8_in_0[t8_n_input_items] = + {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0}; +const static char t8_in_1[t8_n_input_items] = + {0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +const static char t8_in_2[t8_n_input_items] = + {0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0}; +const static char* t8_in[t8_n_code_inputs] = + {t8_in_0, t8_in_1, t8_in_2}; + +const static char t8_res_0[t8_n_output_items] = + {0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0}; +const static char t8_res_1[t8_n_output_items] = + {0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0}; +const static char* t8_res[t8_n_code_outputs] = + {t8_res_0, t8_res_1}; + +void +qa_encoder_convolutional_ic1_ic1::t8 +() +{ +#if 0 + do_encoder_check ((const char**) t8_in, (const char**) t8_res, + t8_n_output_items, 5, t8_n_code_inputs, + t8_n_code_outputs, (const int*) t8_code_generator, + (const int*) t8_code_feedback); +#endif +} diff --git a/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.h b/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.h new file mode 100644 index 000000000..4449e9eb8 --- /dev/null +++ b/gr-error-correcting-codes/src/lib/libecc/tests/qa_encoder_convolutional_ic1_ic1.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 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) + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H +#define INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestCase.h> +#include <stdexcept> + +class qa_encoder_convolutional_ic1_ic1 : public CppUnit::TestCase { + + CPPUNIT_TEST_SUITE (qa_encoder_convolutional_ic1_ic1); + CPPUNIT_TEST (t0); + CPPUNIT_TEST (t1); + CPPUNIT_TEST (t2); + CPPUNIT_TEST (t3); + CPPUNIT_TEST (t4); + CPPUNIT_TEST (t5); + CPPUNIT_TEST (t6); + CPPUNIT_TEST (t7); + CPPUNIT_TEST (t8); + CPPUNIT_TEST_SUITE_END (); + + private: + void do_encoder_check (const char** c_t1_in, + const char** c_t1_res, + int n_output_items, + int block_size_bits, + int n_code_inputs, + int n_code_outputs, + const int* code_generators, + const int* code_feedback = 0); + + void t0 (); + void t1 (); + void t2 (); + void t3 (); + void t4 (); + void t5 (); + void t6 (); + void t7 (); + void t8 (); +}; + +#endif /* INCLUDED_QA_ENCODER_CONVOLUTIONAL_IC1_IC1_H */ diff --git a/gr-error-correcting-codes/src/lib/libecc/tests/test_all.cc b/gr-error-correcting-codes/src/lib/libecc/tests/test_all.cc new file mode 100644 index 000000000..2cd6f663e --- /dev/null +++ b/gr-error-correcting-codes/src/lib/libecc/tests/test_all.cc @@ -0,0 +1,38 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006 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) + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include <cppunit/TextTestRunner.h> +#include <qa_ecc.h> + +int +main +(int argc, + char **argv) +{ + CppUnit::TextTestRunner runner; + + runner.addTest (qa_ecc::suite ()); + + bool was_successful = runner.run ("", false); + + return ((was_successful == true) ? 0 : 1); +} |