root/experimental/components/SymbolSyncPoly/autotest_sources/SymbolSyncPoly_testsuite.h @ 3373

Revision 3373, 2.0 KB (checked in by jgaeddert, 6 years ago)

adding testsuite for ComputeFilterBankIndex?() method

Line 
1#ifndef __SYMBOLSYNCPOLYDSPTEST_H
2#define __SYMBOLSYNCPOLYDSPTEST_H
3
4#include <cxxtest/TestSuite.h>
5#include "../SymbolSyncPolyDSP.h"
6
7
8//
9// A simple test suite: Just inherit CxxTest::TestSuite and write tests!
10//
11
12// NOTE: " : public CxxTest::TestSuite" must be on the same line as the class
13//       definition, otherwise the python script does not recognize it
14//       as a test class
15class SymbolSyncPoly_testsuite1 : public CxxTest::TestSuite,
16    public SymbolSyncPolyDSP
17{
18public:
19
20    void test1() {
21        // initialize variables
22        mf_i  = -10;
23        dmf_i =  10;
24        mf_q  =  10;
25        dmf_q =  10;
26        GenerateErrorSignal();
27        TS_ASSERT_DELTA( q, 0.0f, 1e-6f );
28    }
29
30    void test2() {
31        // initialize variables
32        mf_i  =  30;
33        dmf_i =  5;
34        mf_q  =  20;
35        dmf_q =  1;
36        GenerateErrorSignal();
37        TS_ASSERT_DELTA( q, -85.0f, 1e-6f );
38    }
39
40};
41
42
43class SymbolSyncPoly_testsuite_ComputeFilterBankIndex : public CxxTest::TestSuite,
44    public SymbolSyncPolyDSP
45{
46  public:
47    void testShift() {
48        // Normal operation
49        Npfb = 32;
50        b_soft = 11.0f;
51        ComputeFilterBankIndex();
52        TS_ASSERT_EQUALS( b, 11 );
53        TS_ASSERT_DELTA( b_soft, 11.0f, 0.0001f );
54        TS_ASSERT_EQUALS( lc, SHIFT );
55    }
56
57    void testStuff() {
58        // Filter bank overflow
59        Npfb = 32;
60        b_soft = 32.1f;
61        ComputeFilterBankIndex();
62        TS_ASSERT_EQUALS( b, 0 );
63        TS_ASSERT_DELTA( b_soft, 0.1f, 0.0001f );
64        TS_ASSERT_EQUALS( lc, STUFF );
65    }
66
67    void testSkip() {
68        // Filter bank underflow
69        Npfb = 32;
70        b_soft = -2.1f;
71        ComputeFilterBankIndex();
72        TS_ASSERT_EQUALS( b, 30 );
73        TS_ASSERT_DELTA( b_soft, 29.9f, 0.0001f );
74        TS_ASSERT_EQUALS( lc, SKIP );
75    }
76
77};
78
79class SymbolSyncPoly_testsuite2: public CxxTest::TestSuite
80{
81public:
82
83    void xtestBasicSynchronization() {
84        SymbolSyncPolyDSP symbolSync;
85        TS_WARN("Test not implemented");
86    }
87
88
89};
90
91#endif
92
Note: See TracBrowser for help on using the browser.