Jamoma API  0.6.0.a19
DSP/extensions/SoundfileLib/test.cpp
1 //
2 // test.cpp
3 // JamomaTest
4 //
5 // Created by Nathan Wolek on 11/20/13.
6 // NOTE: When copying to other projects, be sure to customize the lines indicated
7 // This file will find all classes with a common tag and run any "test" methods present in those classes.
8 // If running any test fails, the build of the project will either fail or complete with errors.
9 // If not test method is found, the terminal output will suggest that you should create a test.
10 //
11 
12 #include <iostream>
13 #include "TTFoundationAPI.h"
14 #include "../libsndfile/sndfile.h"
15 
16 extern "C" TTErr TTLoadJamomaExtension_SoundfileLib(void); // CUSTOMIZE
17 
18 int main(int argc, const char * argv[])
19 {
20  std::cout << "BEGIN testing for SoundfileLib...\n"; // CUSTOMIZE
21  TTLoadJamomaExtension_SoundfileLib(); // CUSTOMIZE
22 
23  TTValue classNames;
24 
25  // if the follow group tag is present within the thisTTClassTags definition, the class will be tested
26  TTValue testClassesWithTheseTags(TT("dspSoundFileLib")); // CUSTOMIZE
27  TTObject::GetRegisteredClassNamesForTags(classNames, testClassesWithTheseTags);
28 
29  for (int i=0; i<classNames.size(); i++) {
30  TTSymbol name = classNames[i];
31 
32  try {
33  TTObject obj(name);
34  std::cout << "TESTING " << name.string() << std::endl;
35  obj.send("test");
36  }
37  catch (...) {
38  TTLogMessage("UnitTest Failure to instantiate object of class %s! \n", name.c_str());
39  continue;
40  }
41  }
42 
43  std::cout << "END testing of SoundfileLib!\n"; // CUSTOMIZE
44  return 0;
45 }
Create and use Jamoma object instances.
Definition: TTObject.h:29
size_type size() const noexcept
Return the number of elements.
static TTErr GetRegisteredClassNamesForTags(TTValue &classNames, const TTValue &searchTags)
Query TTEnvironment for names of all registered TTObjectBase classes that share specific tags...
Definition: TTObject.cpp:78
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
Definition: TTSymbol.h:155
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
const char * c_str() const
Return a pointer to the internal string as a C-string.
Definition: TTSymbol.h:77
void TTFOUNDATION_EXPORT TTLogMessage(TTImmutableCString message,...)
Platform and host independent method for posting log messages.
Definition: TTBase.cpp:534
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34