root/experimental/components/DigitalModem/trunk/DigitalModem/atsrc/DigitalModulator_testsuite.h @ 4745

Revision 4745, 2.3 KB (checked in by jgaeddert, 6 years ago)

adding test; fixing bits->symbol conversion method

  • Property svn:eol-style set to native
Line 
1#ifndef __DIGITALMODULATORTEST_H__
2#define __DIGITALMODULATORTEST_H__
3
4#include <cxxtest/TestSuite.h>
5#include "src/DigitalModem.h"
6//
7// A simple test suite: Just inherit CxxTest::TestSuite and write tests!
8//
9
10// NOTE: " : public CxxTest::TestSuite" must be on the same line as the class
11//       definition, otherwise the python script does not recognize it
12//       as a test class
13class DigitalModulator_TestMiscellaneousFunctions : public CxxTest::TestSuite,
14    public DigitalModem
15{
16public:
17
18    void test_ConvertBitsToSymbol_01() {
19        char b[2] = {BIT0, BIT1};
20       
21        unsigned short s;
22       
23        SetModulationScheme( SigProc::BPSK );
24
25        for (unsigned int i=0; i<2; i++) {
26            ConvertBitsToSymbol(b+i*bitsPerSymbol, s);
27            TS_ASSERT_EQUALS( s, i );
28        }
29    }
30
31    void test_ConvertBitsToSymbol_02() {
32        char b[8] = {BIT0, BIT0,
33                     BIT0, BIT1,
34                     BIT1, BIT0,
35                     BIT1, BIT1};
36       
37        unsigned short s;
38       
39        SetModulationScheme( SigProc::QPSK );
40
41        for (unsigned int i=0; i<4; i++) {
42            ConvertBitsToSymbol(b+i*bitsPerSymbol, s);
43            TS_ASSERT_EQUALS( s, i );
44        }
45    }
46
47    void test_ConvertBitsToSymbol_03() {
48        char b[24] = {BIT0, BIT0, BIT0,
49                      BIT0, BIT0, BIT1,
50                      BIT0, BIT1, BIT0,
51                      BIT0, BIT1, BIT1,
52                      BIT1, BIT0, BIT0,
53                      BIT1, BIT0, BIT1,
54                      BIT1, BIT1, BIT0,
55                      BIT1, BIT1, BIT1};
56       
57        unsigned short s;
58       
59        SetModulationScheme( SigProc::PSK8 );
60
61        for (unsigned int i=0; i<8; i++) {
62            ConvertBitsToSymbol(b+i*bitsPerSymbol, s);
63            TS_ASSERT_EQUALS( s, i );
64        }
65    }
66};
67
68// NOTE: " : public CxxTest::TestSuite" must be on the same line as the class
69//       definition, otherwise the python script does not recognize it
70//       as a test class
71class DigitalModulator_TestModulation : public CxxTest::TestSuite,
72    public DigitalModem
73{
74public:
75
76    void test_ModulateBPSK() {
77    }
78
79    void test_ModulateQPSK() {
80    }
81
82    void test_Modulate8PSK() {
83    }
84
85    void test_Modulate16QAM() {
86    }
87
88    void test_Modulate4PAM() {
89    }
90
91};
92
93#endif
94
Note: See TracBrowser for help on using the browser.