13 Control (uint t = 0) : tick (t) {}
15 compare_order (
const Control &a,
const Control &b)
17 return Ase::Aux::compare_lesser (a.tick, b.tick);
20 struct Note : Control {
22 Note (uint t = 0, uint k = 0) : Control (t), key (k) {}
24 compare_order (
const Note &a,
const Note &b)
26 int cmp = Control::compare_order (a, b);
28 cmp = Ase::Aux::compare_lesser (a.key, b.key);
35 struct CompareKey {
int operator() (
const Note &a,
const Note &b) {
return int (a.key) -
int (b.key); } };
36 struct CompareTick {
int operator() (
const Note &a,
const Note &b) {
return Note::compare_order (a, b); } };
38 OrderedNoteList::ConstP notesp;
42 note_events.insert (Note());
TASSERT (modified == +1);
43 note_events.insert (Note());
TASSERT (modified == 0);
44 cnote = note_events.lookup (Note());
TASSERT (cnote !=
nullptr);
45 ret = note_events.remove (Note());
TASSERT (ret && modified == -1);
47 ret = note_events.remove (Note());
TASSERT (!ret && modified == -99);
48 note_events.insert (Note (33, 3));
TASSERT (modified == +1);
49 cnote = note_events.first();
TASSERT (cnote && cnote->key == 3);
50 note_events.insert (Note (15, 5));
TASSERT (modified == +1);
51 note_events.insert (Note (21, 1));
TASSERT (modified == +1);
52 cnote = note_events.first();
TASSERT (cnote && cnote->key == 1);
53 ret = note_events.last() - cnote + 1;
TASSERT (ret == 3);
54 cnote = note_events.last();
TASSERT (cnote && cnote->key == 5);
55 cnote = note_events.lookup_after (Note (0, 2));
TASSERT (cnote && cnote->key == 3);
56 cnote += 1;
TASSERT (cnote && cnote->key == 5);
57 notesp = note_events.ordered_events<OrderedNoteList>();
58 note_events.clear_silently();
59 ret = note_events.size();
TASSERT (ret == 0);
62 const auto ¬es = *notesp;
67 cnote = notes.lookup (Note (33, 3));
TASSERT (cnote && cnote == ¬es.back());
68 cnote = notes.lookup_after (Note (17, 0));
TASSERT (cnote && cnote->key == 1);
69 cnote = notes.lookup_after (Note (0, 0));
TASSERT (cnote && cnote == ¬es.front());
Maintain an array of unique Event structures with change notification.
#define TEST_INTEGRITY(FUNC)
Register func as an integrity test.
uint32_t uint
Provide 'uint' as convenience type.
Container for a sorted array of opaque Event structures with binary lookup.
#define TASSERT(cond)
Unconditional test assertion, enters breakpoint if not fullfilled.