MCPcopy Create free account
hub / github.com/audacity/audacity / TestSetGarbageInput

Method TestSetGarbageInput

tests/SequenceTest.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

mainFunction · 0.80

Calls 2

AppendMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected