From 9734fa3e9355173311a516220ab10c0ca64df24b Mon Sep 17 00:00:00 2001 From: Hans Baier Date: Mon, 9 Feb 2009 08:49:57 +0000 Subject: [PATCH] * Sequence: added asserts * sequence.cpp completed first test git-svn-id: svn://localhost/ardour2/branches/3.0@4504 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/evoral/src/Sequence.cpp | 4 +++- libs/evoral/test/sequence.cpp | 2 ++ libs/evoral/test/sequence.hpp | 32 +++++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index cc102f6c22..dd597aa5fa 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -219,6 +219,8 @@ Sequence::const_iterator::const_iterator(const Sequence& seq, T t) debugout << " : " << hex << (int)((MIDIEvent*)_event.get())->type(); debugout << " @ " << _event->time() << endl; } + + assert(_event && _event->size() > 0); //assert(_is_end || (_event->buffer() && _event->buffer()[0] != '\0')); } @@ -240,7 +242,7 @@ Sequence::const_iterator::operator++() } debugout << "Iterator ++" << endl; - assert(_event->buffer() && _event->size() > 0); + assert(_event && _event->buffer() && _event->size() > 0); const MIDIEvent& ev = *((MIDIEvent*)_event.get()); diff --git a/libs/evoral/test/sequence.cpp b/libs/evoral/test/sequence.cpp index 1398274841..82ea71d939 100644 --- a/libs/evoral/test/sequence.cpp +++ b/libs/evoral/test/sequence.cpp @@ -13,6 +13,7 @@ SequenceTest::createTest (void) CPPUNIT_ASSERT(seq->notes().begin() == seq->notes().end()); } + void SequenceTest::preserveEventOrderingTest (void) { @@ -50,6 +51,7 @@ SequenceTest::preserveEventOrderingTest (void) seq->end_write(); TestSink