MCPcopy Create free account
hub / github.com/danomatika/ofxLua / runTests

Method runTests

luaTests/src/ofApp.cpp:79–347  ·  view source on GitHub ↗

--------------------------------------------------------------

Source from the content-addressed store, hash-verified

77
78//--------------------------------------------------------------
79void ofApp::runTests() {
80
81 // do tests
82 //------
83 ofLog();
84 ofLog() << "*** BEGIN READ TEST ***";
85
86 // load a script with some variables we want
87 lua.doScript("variableTest.lua");
88
89 // prints global table if no table is pushed
90 //lua.printTable();
91
92 // print the glm module table
93 //lua.printTable("glm");
94
95 // print the variables in the script manually
96 ofLog() << "variableTest variables:";
97 ofLog() << " abool: " << lua.getBool("abool");
98 ofLog() << " anumber: " << lua.getNumber("anumber");
99 ofLog() << " astring: " << lua.getString("astring");
100
101 // load simple table arrays by type
102 stringstream line;
103
104 vector<bool> boolTable;
105 lua.getBoolVector("boolTable", boolTable);
106 line << " boolTable: ";
107 for(size_t i = 0; i < boolTable.size(); ++i) {
108 line << boolTable[i] << " ";
109 }
110 ofLog() << line.str() << "#: " << lua.tableSize("boolTable");
111 line.str(""); // clear
112
113 vector<lua_Number> numberTable;
114 lua.getNumberVector("numberTable", numberTable);
115 line << " numberTable: ";
116 for(size_t i = 0; i < numberTable.size(); ++i) {
117 line << numberTable[i] << " ";
118 }
119 ofLog() << line.str() << "#: " << lua.tableSize("numberTable");
120 line.str(""); // clear
121
122 vector<string> stringTable;
123 lua.getStringVector("stringTable", stringTable);
124 line << " stringTable: ";
125 for(size_t i = 0; i < stringTable.size(); ++i) {
126 line << "\"" << stringTable[i] << "\" ";
127 }
128 ofLog() << line.str() << "#: " << lua.tableSize("stringTable");
129 line.str(""); // clear
130
131 // try to load a mixed var table, should fail and issue warnings
132 ofLog() << " ### should be warnings here vvv";
133 vector<string> testStringVector;
134 lua.getStringVector("mixedTable", testStringVector);
135 ofLog() << " ### should be warnings here ^^^";
136

Callers

nothing calls this directly

Calls 15

doScriptMethod · 0.80
getBoolMethod · 0.80
getNumberMethod · 0.80
getStringMethod · 0.80
getBoolVectorMethod · 0.80
tableSizeMethod · 0.80
getNumberVectorMethod · 0.80
getStringVectorMethod · 0.80
pushTableMethod · 0.80
isBoolMethod · 0.80
isNumberMethod · 0.80
isStringMethod · 0.80

Tested by

no test coverage detected