Revision 62:7c463642a0a7 test/TestNoteHypothesis.cpp
| test/TestNoteHypothesis.cpp | ||
|---|---|---|
| 53 | 53 |
|
| 54 | 54 |
BOOST_AUTO_TEST_CASE(emptyAccept) |
| 55 | 55 |
{
|
| 56 |
// An empty hypothesis should accept any estimate and enter |
|
| 57 |
// provisional state |
|
| 56 |
// An empty hypothesis should accept any estimate with a |
|
| 57 |
// non-negligible confidence, and enter provisional state |
|
| 58 |
NoteHypothesis h; |
|
| 59 |
NoteHypothesis::Estimate e; // default estimate has confidence 1 |
|
| 60 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::New); |
|
| 61 |
BOOST_CHECK(h.accept(e)); |
|
| 62 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Provisional); |
|
| 63 |
} |
|
| 64 |
|
|
| 65 |
BOOST_AUTO_TEST_CASE(noConfidence) |
|
| 66 |
{
|
|
| 67 |
// A hypothesis should reject any estimate that has a negligible |
|
| 68 |
// confidence |
|
| 69 |
NoteHypothesis h; |
|
| 70 |
NoteHypothesis::Estimate e; |
|
| 71 |
e.confidence = 0; |
|
| 72 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::New); |
|
| 73 |
BOOST_CHECK(!h.accept(e)); |
|
| 74 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Rejected); |
|
| 75 |
} |
|
| 76 |
|
|
| 77 |
BOOST_AUTO_TEST_CASE(noConfidenceIgnore) |
|
| 78 |
{
|
|
| 79 |
// But if we're already in process we don't go to rejected state, |
|
| 80 |
// we just ignore this hypothesis |
|
| 58 | 81 |
NoteHypothesis h; |
| 59 | 82 |
NoteHypothesis::Estimate e; |
| 60 | 83 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::New); |
| 61 | 84 |
BOOST_CHECK(h.accept(e)); |
| 62 | 85 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Provisional); |
| 86 |
e.confidence = 0; |
|
| 87 |
BOOST_CHECK(!h.accept(e)); |
|
| 88 |
BOOST_CHECK_EQUAL(h.getState(), NoteHypothesis::Provisional); |
|
| 63 | 89 |
} |
| 64 | 90 |
|
| 65 | 91 |
BOOST_AUTO_TEST_CASE(tooSlow) |
Also available in: Unified diff