Revision 63:d19bbfc055ab

View differences:

Test.cpp
192 192
}
193 193

  
194 194
void
195
Test::dumpFeature(const Plugin::Feature &f, bool showValues)
195
Test::dumpFeature(const Plugin::Feature &f, bool showValues,
196
                  const Plugin::Feature *other)
196 197
{
197 198
    cout << "    Timestamp: " << (!f.hasTimestamp ? "(none)" : f.timestamp.toText()) << endl;
198 199
    cout << "    Duration: " << (!f.hasDuration ? "(none)" : f.duration.toText()) << endl;
199 200
    cout << "    Label: " << (f.label == "" ? "(none)" : f.label) << endl;
200 201
    if (showValues) {
201 202
        cout << "    Values (" << f.values.size() << "): " << (f.values.empty() ? "(none)" : "");
202
        for (int j = 0; j < (int)f.values.size(); ++j) {
203
            cout << f.values[j] << " ";
203
        int n = f.values.size();
204
        if (!other) {
205
            for (int j = 0; j < n; ++j) {
206
                cout << f.values[j] << " ";
207
            }
208
        } else {
209
            int samecount = 0;
210
            int diffcount = 0;
211
            for (int j = 0; j <= n; ++j) {
212
                if (j < n && f.values[j] == other->values[j]) {
213
                    ++samecount;
214
                } else {
215
                    if (samecount > 0) {
216
                        cout << "(" << samecount << " identical) ";
217
                    }
218
                    samecount = 0;
219
                    if (j < n) {
220
                        ++diffcount;
221
                        if (diffcount > 20 && j + 10 < n) {
222
                            cout << "(remaining " << n - j << " values elided)";
223
                            break;
224
                        } else {
225
                            cout << f.values[j] << " [diff "
226
                                 << f.values[j] - other->values[j] << "] ";
227
                        }
228
                    }
229
                }
230
            }
204 231
        }
205 232
        cout << endl;
206 233
    } else {
......
271 298
                while (afi != ai->second.end()) {
272 299
                    if (!(*afi == *bfi)) {
273 300
                        if (diffcount == 0) {
274
                            bool differInValues = (afi->values != bfi->values);
301
                            bool differInValues =
302
                                (afi->values.size() == bfi->values.size() &&
303
                                 afi->values != bfi->values);
275 304
                            if (afi->hasTimestamp != bfi->hasTimestamp) {
276 305
                                cout << "*** Feature " << fno << " differs in presence of timestamp (" << afi->hasTimestamp << " vs " << bfi->hasTimestamp << ")" << endl;
277 306
                            }
......
287 316
                            if (afi->label != bfi->label) {
288 317
                                cout << "*** Feature " << fno << " differs in label" << endl;
289 318
                            }
319
                            if (afi->values.size() != bfi->values.size()) {
320
                                cout << "*** Feature " << fno << " differs in number of values (" << afi->values.size() << " vs " << bfi->values.size() << ")" << endl;
321
                            }
290 322
                            if (differInValues) {
291 323
                                cout << "*** Feature " << fno << " differs in values" << endl;
292 324
                            }
293 325
                            cout << "  First output:" << endl;
294 326
                            dumpFeature(*afi, differInValues);
295 327
                            cout << "  Second output:" << endl;
296
                            dumpFeature(*bfi, differInValues);
328
                            dumpFeature(*bfi, differInValues, &(*afi));
297 329
                        }
298 330
                        ++diffcount;
299 331
                    }
Test.h
112 112

  
113 113
    bool containsTimestamps(const Vamp::Plugin::FeatureSet &);
114 114

  
115
    void dumpFeature(const Vamp::Plugin::Feature &, bool showValues);
115
    void dumpFeature(const Vamp::Plugin::Feature &, bool showValues,
116
                     const Vamp::Plugin::Feature *other = 0);
116 117
    void dump(const Vamp::Plugin::FeatureSet &, bool showValues = true);
117 118
    void dumpTwo(const Result &r,
118 119
                 const Vamp::Plugin::FeatureSet &,

Also available in: Unified diff