comparison data/model/test/MockWaveModel.cpp @ 1088:5fab8e4f5f19

Start making the FFT model tests into proper tests
author Chris Cannam
date Fri, 12 Jun 2015 12:41:19 +0100
parents dcf54a6964d0
children bdebff3265ae 6d550a16f7d6
comparison
equal deleted inserted replaced
1087:dcf54a6964d0 1088:5fab8e4f5f19
15 15
16 #include "MockWaveModel.h" 16 #include "MockWaveModel.h"
17 17
18 using namespace std; 18 using namespace std;
19 19
20 MockWaveModel::MockWaveModel(vector<Sort> sorts, int length) 20 MockWaveModel::MockWaveModel(vector<Sort> sorts, int length, int pad)
21 { 21 {
22 for (auto sort: sorts) { 22 for (auto sort: sorts) {
23 m_data.push_back(generate(sort, length)); 23 m_data.push_back(generate(sort, length, pad));
24 } 24 }
25 } 25 }
26 26
27 sv_frame_t 27 sv_frame_t
28 MockWaveModel::getData(int channel, sv_frame_t start, sv_frame_t count, 28 MockWaveModel::getData(int channel, sv_frame_t start, sv_frame_t count,
59 59
60 return min; 60 return min;
61 } 61 }
62 62
63 vector<float> 63 vector<float>
64 MockWaveModel::generate(Sort sort, int length) const 64 MockWaveModel::generate(Sort sort, int length, int pad) const
65 { 65 {
66 vector<float> data; 66 vector<float> data;
67 67
68 for (int i = 0; i < pad; ++i) {
69 data.push_back(0.f);
70 }
71
68 for (int i = 0; i < length; ++i) { 72 for (int i = 0; i < length; ++i) {
69 73
70 double v = 0.0; 74 double v = 0.0;
71 75
72 switch (sort) { 76 switch (sort) {
78 } 82 }
79 83
80 data.push_back(float(v)); 84 data.push_back(float(v));
81 } 85 }
82 86
87 for (int i = 0; i < pad; ++i) {
88 data.push_back(0.f);
89 }
90
83 return data; 91 return data;
84 } 92 }
85 93