Revision 54:751b43d119cf test

View differences:

test/TestAgentFeeder.cpp
31 31

  
32 32
static Vamp::RealTime ms(int n) { return Vamp::RealTime::fromMilliseconds(n); }
33 33

  
34
static const int low = 500, high = 700;
35

  
34 36
typedef NoteHypothesis::Estimate Est;
35 37

  
36 38
BOOST_AUTO_TEST_SUITE(TestAgentFeeder)
......
45 47

  
46 48
BOOST_AUTO_TEST_CASE(feederSingle)
47 49
{
48
    Est e0(1, ms(0), 1);
49
    Est e10(1, ms(10), 1);
50
    Est e20(1, ms(20), 1);
51
    Est e30(1, ms(30), 1);
50
    Est e0(low, ms(0), 1);
51
    Est e10(low, ms(10), 1);
52
    Est e20(low, ms(20), 1);
53
    Est e30(low, ms(30), 1);
52 54

  
53 55
    AgentFeeder f;
54 56
    f.feed(e0);
......
64 66

  
65 67
BOOST_AUTO_TEST_CASE(feederPairSeparate)
66 68
{
67
    Est e0(1, ms(0), 1);
68
    Est e10(1, ms(10), 1);
69
    Est e20(1, ms(20), 1);
70
    Est e30(1, ms(30), 1);
69
    Est e0(low, ms(0), 1);
70
    Est e10(low, ms(10), 1);
71
    Est e20(low, ms(20), 1);
72
    Est e30(low, ms(30), 1);
71 73

  
72
    Est f0(3, ms(2000), 1);
73
    Est f10(3, ms(2010), 1);
74
    Est f20(3, ms(2020), 1);
75
    Est f30(3, ms(2030), 1);
74
    Est f0(high, ms(2000), 1);
75
    Est f10(high, ms(2010), 1);
76
    Est f20(high, ms(2020), 1);
77
    Est f30(high, ms(2030), 1);
76 78

  
77 79
    AgentFeeder f;
78 80
    f.feed(e0);
......
98 100

  
99 101
    // (With fffffff stopping before eeee has expired.)
100 102

  
101
    // This should give us one hypothesis, eeee.
103
    // This should give us one hypothesis, eeee, because eeee is still
104
    // the current hypothesis by the time fffffff ends.
102 105

  
103
    Est e0(1, ms(0), 1);
104
    Est e10(1, ms(10), 1);
106
    Est e0(low, ms(0), 1);
107
    Est e10(low, ms(10), 1);
105 108

  
106
    Est e20(1, ms(20), 1);
107
    Est f20(3, ms(20), 1);
109
    Est e20(low, ms(20), 1);
110
    Est f20(high, ms(20), 1);
108 111

  
109
    Est e30(1, ms(30), 1);
110
    Est f30(3, ms(30), 1);
112
    Est e30(low, ms(30), 1);
113
    Est f30(high, ms(30), 1);
111 114

  
112
    Est f40(3, ms(40), 1);
113
    Est f50(3, ms(50), 1);
114
    Est f60(3, ms(60), 1);
115
    Est f70(3, ms(70), 1);
116
    Est f80(3, ms(80), 1);
115
    Est f40(high, ms(40), 1);
116
    Est f41(high, ms(41), 1);
117
    Est f42(high, ms(42), 1);
118
    Est f43(high, ms(43), 1);
119
    Est f44(high, ms(44), 1);
117 120

  
118 121
    AgentFeeder f;
119 122
    f.feed(e0);
......
123 126
    f.feed(e30);
124 127
    f.feed(f30);
125 128
    f.feed(f40);
126
    f.feed(f50);
127
    f.feed(f60);
128
    f.feed(f70);
129
    f.feed(f80);
129
    f.feed(f41);
130
    f.feed(f42);
131
    f.feed(f43);
132
    f.feed(f44);
130 133
    f.finish();
131 134

  
132 135
    AgentFeeder::Hypotheses accepted = f.getAcceptedHypotheses();
......
153 156
    // hypothesis ends, the fffffff one should replace it. So,
154 157
    // both should be recognised.
155 158

  
156
    Est e0(1, ms(0), 1);
157
    Est e10(1, ms(500), 1);
159
    Est e0(low, ms(0), 1);
160
    Est e10(low, ms(10), 1);
158 161

  
159
    Est e20(1, ms(1000), 1);
160
    Est f20(3, ms(1000), 1);
162
    Est e20(low, ms(20), 1);
163
    Est f20(high, ms(20), 1);
161 164

  
162
    Est e30(1, ms(1500), 1);
163
    Est f30(3, ms(1500), 1);
165
    Est e30(low, ms(30), 1);
166
    Est f30(high, ms(30), 1);
164 167

  
165
    Est f40(3, ms(2000), 1);
166
    Est f50(3, ms(2500), 1);
167
    Est f60(3, ms(3000), 1);
168
    Est f70(3, ms(3500), 1);
169
    Est f80(3, ms(4000), 1);
168
    Est f40(high, ms(40), 1);
169
    Est f50(high, ms(50), 1);
170
    Est f60(high, ms(60), 1);
171
    Est f70(high, ms(70), 1);
172
    Est f80(high, ms(80), 1);
170 173

  
171 174
    AgentFeeder f;
172 175
    f.feed(e0);
......
192 195
    BOOST_CHECK_EQUAL(i->getAcceptedEstimates().size(), size_t(4));
193 196
    ++i;
194 197

  
195
    BOOST_CHECK_EQUAL(i->getStartTime(), ms(1000)); 
198
    BOOST_CHECK_EQUAL(i->getStartTime(), ms(20)); 
196 199
    BOOST_CHECK_EQUAL(i->getAcceptedEstimates().size(), size_t(7));
197 200
    ++i;
198 201
}
......
208 211
    // satisfied hypothesis eeeeeeee while it is still in
209 212
    // progress.
210 213

  
211
    Est e0(1, ms(0), 1);
212
    Est e10(1, ms(10), 1);
213
    Est e20(1, ms(20), 1);
214
    Est e30(1, ms(30), 1);
215
    Est e40(1, ms(40), 1);
216
    Est e50(1, ms(50), 1);
217
    Est e60(1, ms(60), 1);
218
    Est e70(1, ms(70), 1);
214
    Est e0(low, ms(0), 1);
215
    Est e10(low, ms(10), 1);
216
    Est e20(low, ms(20), 1);
217
    Est e30(low, ms(30), 1);
218
    Est e40(low, ms(40), 1);
219
    Est e50(low, ms(50), 1);
220
    Est e60(low, ms(60), 1);
221
    Est e70(low, ms(70), 1);
219 222

  
220
    Est f20(3, ms(20), 1);
221
    Est f30(3, ms(30), 1);
222
    Est f40(3, ms(40), 1);
223
    Est f50(3, ms(50), 1);
223
    Est f20(high, ms(20), 1);
224
    Est f30(high, ms(30), 1);
225
    Est f40(high, ms(40), 1);
226
    Est f50(high, ms(50), 1);
224 227

  
225 228
    AgentFeeder f;
226 229

  

Also available in: Unified diff