Jamoma API  0.6.0.a19
DSP/extensions/AnalysisLib/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 
15 extern "C" TTErr TTLoadJamomaExtension_AnalysisLib(void); // CUSTOMIZE
16 
17 int main(int argc, const char * argv[])
18 {
19  std::cout << "BEGIN testing for AnalysisLib...\n"; // CUSTOMIZE
20  TTLoadJamomaExtension_AnalysisLib(); // CUSTOMIZE
21 
22  TTValue classNames;
23 
24  // if the follow group tag is present within the thisTTClassTags definition, the class will be tested
25  TTValue testClassesWithTheseTags(TT("dspAnalysisLib")); // CUSTOMIZE
26  TTObject::GetRegisteredClassNamesForTags(classNames, testClassesWithTheseTags);
27 
28  for (int i=0; i<classNames.size(); i++) {
29  TTSymbol name = classNames[i];
30 
31  try {
32  TTObject obj(name);
33  std::cout << "TESTING " << name.string() << std::endl;
34  obj.send("test");
35  }
36  catch (...) {
37  TTLogMessage("UnitTest Failure to instantiate object of class %s! \n", name.c_str());
38  continue;
39  }
40  }
41 
42  std::cout << "END testing of AnalysisLib!\n"; // CUSTOMIZE
43  return 0;
44 }
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
TT_EXTENSION_EXPORT TTErr TTLoadJamomaExtension_AnalysisLib(void)
Load AnalysisLib extension and register the various classes of the extension.
Definition: AnalysisLib.cpp:23
#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