25 int testAssertionCount = 0;
33 this->init(1,
"myFirstBuffer");
34 this->setAttributeValue(
"lengthInSamples", 50);
36 TTTestLog(
"\nTest checkout of first SampleMatrix...");
40 this->checkOutMatrix(myFirstCheckOut);
42 TTBoolean result1 = { myFirstCheckOut != NULL };
44 TTTestAssertion(
"checkOutMatrix returns a valid pointer",
51 return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
59 TTBoolean result2 = { test2expect == test2return };
61 TTTestAssertion(
"numChannels is set properly",
68 TTTestLog(
"Expected a value of %i, but returned value was %i", test2expect, test2return);
77 TTBoolean result3 = { test3expect == test3return };
79 TTTestAssertion(
"userCount reports proper value",
86 TTTestLog(
"Expected a value of %i, but returned value was %i", test3expect, test3return);
95 TTBoolean result4 = { test4expect == test4return };
97 TTTestAssertion(
"bufferPoolStage reports proper value",
104 TTTestLog(
"Expected a value of %i, but returned value was %i", test4expect, test4return);
107 TTTestLog(
"\nTest second checkout of first SampleMatrix...");
111 this->checkOutMatrix(myFirstCheckOut2);
113 TTBoolean result5 = { myFirstCheckOut == myFirstCheckOut2 };
115 TTTestAssertion(
"checkOutMatrix returns the same pointer",
126 TTBoolean result6 = { test6expect == test6return };
128 TTTestAssertion(
"userCount reports proper value after second checkout",
135 TTTestLog(
"Expected a value of %i, but returned value was %i", test6expect, test6return);
138 TTTestLog(
"\nTest if changing lengthInSamples attribute spawns new SampleMatrix...");
142 this->setAttributeValue(
"lengthInSamples", 100);
143 this->checkOutMatrix(mySecondCheckOut);
145 TTBoolean result7 = { mySecondCheckOut != myFirstCheckOut };
147 TTTestAssertion(
"checkOutMatrix returns pointer to different SampleMatrix",
158 TTBoolean result8 = { test8expect == test8return };
160 TTTestAssertion(
"userCount reports proper value",
167 TTTestLog(
"Expected a value of %i, but returned value was %i", test8expect, test8return);
170 TTTestLog(
"\nRepeat with numChannels attribute...");
174 this->setAttributeValue(
"numChannels", 2);
175 this->checkOutMatrix(myThirdCheckOut);
177 TTBoolean result9 = { mySecondCheckOut != myThirdCheckOut && myFirstCheckOut != myThirdCheckOut};
179 TTTestAssertion(
"checkOutMatrix returns pointer to different SampleMatrix",
190 TTBoolean result10 = { test10expect == test10return };
192 TTTestAssertion(
"userCount reports proper value",
199 TTTestLog(
"Expected a value of %i, but returned value was %i", test10expect, test10return);
204 TTTestLog(
"\nAt this point, 3 SampleMatrix objects are checked out via 4 pointers:");
212 TTTestLog(
"\nTesting check in process...");
215 this->checkInMatrix(myFirstCheckOut);
217 TTBoolean result11 = { myFirstCheckOut == NULL };
219 TTTestAssertion(
"checkInMatrix(myFirstCheckOut) resets pointer to NULL",
225 TTBoolean result12 = { myFirstCheckOut2 != NULL };
227 TTTestAssertion(
"myFirstCheckOut2 is still a valid pointer",
234 myFirstCheckOut2->poke(10,0,test13expect);
237 myFirstCheckOut2->peek(10,0,test13return);
239 TTBoolean result13 = TTTestFloatEquivalence(test13expect,test13return);
241 TTTestAssertion(
"poke/peek sample value still works",
248 TTTestLog(
"Expected a value of %i, but returned value was %i", test13expect, test13return);
252 this->checkInMatrix(myFirstCheckOut2);
254 TTBoolean result14 = { myFirstCheckOut2 == NULL };
256 TTTestAssertion(
"checkInMatrix(myFirstCheckOut2) resets pointer to NULL",
262 this->checkInMatrix(mySecondCheckOut);
264 TTBoolean result15 = { mySecondCheckOut == NULL };
266 TTTestAssertion(
"checkInMatrix(mySecondCheckOut) resets pointer to NULL",
272 this->checkInMatrix(myThirdCheckOut);
274 TTBoolean result16 = { myThirdCheckOut == NULL };
276 TTTestAssertion(
"checkInMatrix(myThirdCheckOut) resets pointer to NULL",
285 this->setAttributeValue(kTTSym_sampleRate, sampleRate17);
287 TTValue testBufferSampleRate17;
292 TTTestAssertion(
"getting sampleRate after setting reports no error",
298 this->checkOutMatrix(myMatrix17);
300 TTValue testSampleMatrixSampleRate17;
303 TTBoolean result17b = { testBufferSampleRate17[0] == testSampleMatrixSampleRate17[0] };
305 TTTestAssertion(
"checked out SampleMatrix reports same sampleRate as Buffer",
310 this->checkInMatrix(myMatrix17);
319 return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
no longer active, but waiting for remaining users to check in
TTErr getAttributeValue(const TTSymbol name, TTValue &value)
Get an attribute value for an object.
Container object that holds some audio in a chunk of memory.
TTUInt16 getUserCount()
Report the current user count.
in use and pointer to this TTSampleMatrix will be given to users at check out
std::int32_t TTInt32
32 bit signed integer
TTBoolean isBufferPoolStage(TTBufferPoolStageEnum testValue)
Test to see if current bufferPoolStage matches a test value.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
virtual TTErr test(TTValue &)
Default (empty) template for unit tests.
TTBuffer manages the check-in/out of TTSampleMatrix pointers.
TTFloat64 TTSampleValue
A value representing a single audio sample.
[doxygenAppendixC_copyExample]
TTFOUNDATION_EXPORT TTFloat64 TTRandom64()
Produces a random-valued 64-bit floating-point number in the range [0.0, 1.0].