Jamoma API  0.6.0.a19
Modular/library/test.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularLibrary
4  *
5  * @brief Unit tests for the Modular library
6  *
7  * @details ...
8  *
9  * @authors Théo de la Hogue
10  *
11  * @copyright Copyright © 2014, Théo de la Hogue @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 #include "TTModular.h"
17 
18 int main(int argc, const char * argv[])
19 {
20  TTLogMessage("BEGIN testing for Modular library ...\n"); // CUSTOMIZE
21 
22  TTModularInit(); // CUSTOMIZE
23 
24  TTValue classNames;
25 
26  // if the follow group tag is present within the thisTTClassTags definition, the class will be tested
27  TTValue testClassesWithTheseTags(TTSymbol("modularLibrary")); // CUSTOMIZE
28  TTObject::GetRegisteredClassNamesForTags(classNames, testClassesWithTheseTags);
29 
30  for (int i=0; i<classNames.size(); i++) {
31 
32  TTSymbol name = classNames[i];
33 
34  try {
35  TTObject obj(name);
36 
37  TTLogMessage("TESTING %s\n", name.c_str());
38 
39  obj.send("test");
40  }
41  catch (...) {
42  TTLogMessage("UnitTest Failure to instantiate object of class %s! \n", name.c_str());
43  continue;
44  }
45  }
46 
47  TTLogMessage("END testing for Modular library.\n"); // CUSTOMIZE
48  return 0;
49 }
50 
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
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
void TTMODULAR_EXPORT TTModularInit(const char *binaries=nullptr, bool loadFromBuiltinPaths=false)
Initialize the Modular library and intanciate the TTModular object.
Definition: TTModular.cpp:45
the Modular Application Programming Interface
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34