comparison base/test/TestEventSeries.h @ 1635:e8e51f3ca120 single-point

Add getEventsWithin
author Chris Cannam
date Wed, 13 Mar 2019 10:01:02 +0000
parents 6ac92836cd86
children 7482da1cd920
comparison
equal deleted inserted replaced
1634:687a2453cc15 1635:e8e51f3ca120
423 s.add(a); 423 s.add(a);
424 s.add(cc); 424 s.add(cc);
425 s.add(dd); 425 s.add(dd);
426 s.add(e); 426 s.add(e);
427 QCOMPARE(s.getEventsSpanning(6, 2), EventVector({ a, b, c, cc, d, dd })); 427 QCOMPARE(s.getEventsSpanning(6, 2), EventVector({ a, b, c, cc, d, dd }));
428 }
429
430 void eventPatternWithin() {
431
432 EventSeries s;
433 Event a(0, 1.0f, 18, QString("a"));
434 Event b(3, 2.0f, 6, QString("b"));
435 Event c(5, 3.0f, 2, QString("c"));
436 Event cc(5, 3.1f, 2, QString("cc"));
437 Event d(6, 4.0f, 10, QString("d"));
438 Event dd(6, 4.5f, 10, QString("dd"));
439 Event e(14, 5.0f, 3, QString("e"));
440 s.add(b);
441 s.add(c);
442 s.add(d);
443 s.add(a);
444 s.add(cc);
445 s.add(dd);
446 s.add(e);
447 QCOMPARE(s.getEventsWithin(2, 7), EventVector({ b, c, cc }));
428 } 448 }
429 449
430 void eventPatternAddRemove() { 450 void eventPatternAddRemove() {
431 451
432 // This is mostly here to exercise the innards of EventSeries 452 // This is mostly here to exercise the innards of EventSeries