| 87 | } |
| 88 | |
| 89 | void TestSetGarbageInput() |
| 90 | { |
| 91 | std::cout << "\tSequence::Set() should return false (and not crash) if given garbage input..." << std::flush; |
| 92 | |
| 93 | /* Create 10 samples in the sequence so the Set requests will |
| 94 | * be valid */ |
| 95 | samplePtr appendBuf = NewSamples(10, floatSample); |
| 96 | mSequence->Append(appendBuf, floatSample, 10); |
| 97 | |
| 98 | /* should fail, "set" buffer should not be null */ |
| 99 | assert(mSequence->Set(NULL, floatSample, 0, 10) == false); |
| 100 | |
| 101 | /* should fail, -5 is not a sample format */ |
| 102 | assert(mSequence->Set(appendBuf, (sampleFormat)-5, 0, 10) == false); |
| 103 | |
| 104 | /* should fail, -1 is not a valid offset */ |
| 105 | assert(mSequence->Set(appendBuf, floatSample, -1, 10) == false); |
| 106 | |
| 107 | /* should fail, the sequence is only 10 samples long */ |
| 108 | assert(mSequence->Set(appendBuf, floatSample, 0, 15) == false); |
| 109 | |
| 110 | std::cout << "ok\n"; |
| 111 | } |
| 112 | |
| 113 | void TestGetGarbageInput() |
| 114 | { |