level::level(int2D size, int tileSize) : _size(size), _tileSize(tileSize) { //We need a flashlight to initialize the flash light in the wall _flashLight = new light(); _readFile("test.txt"); ALchangeGain(0,0,0,0); }
// // setFile(): // void MadelineTable::setFile(const char *fileName){ _readFile(fileName); _getLineCount(); _allocateLineInformationVector(); _assignLinePointers(); _determineNumberOfBlocks(); _assignRecordTypes(); _checkDataBlockRectangularity(); _calculateColumnFillRates(); _determineNumberOfColumns(); _determineFieldBoundaries(); _parseHeader(); // // Now Handled downstream in DataTable instead: //_classifyColumns(); // This is basically obsoleted because DataTable now handles classification: //_resolveDeclaredVersusDiscoveredColumnTypes(); // _fillVectors(); // DEBUG: //display(); }
char* _spUtil_readFile (const char* path, int* length) { return _readFile(path, length); }
char* _spUtil_readFile(const char* path, int* length) { return _readFile(ofToDataPath(path).c_str(), length); }
INT32 _sptClassMetaInfo::_extractTroffInfo() { INT32 rc = SDB_OK ; stringstream ss ; INT64 fileSize = 4096 ; CHAR *pFileBuff = NULL ; multimap<string, string>::iterator it ; MAP_FUNC_META_INFO_IT it2 ; pFileBuff = (CHAR *)SDB_OSS_MALLOC( fileSize ) ; if ( !pFileBuff ) { rc = SDB_OOM ; ss << "Failed to alloc memory, rc = " << rc << ERROR_END ; goto error ; } for( it = _mapFiles.begin(); it != _mapFiles.end(); it++ ) { sptFuncMetaInfo metaInfo ; string className = it->first ; string filePath = it->second ; string funcName ; string fullName ; vector<string> syntax ; string desc ; ossMemset( pFileBuff, 0, fileSize ) ; rc = _readFile( filePath.c_str(), &pFileBuff, &fileSize ) ; if ( rc ) { ss << "Failed to read troff's contents from file [" << filePath.c_str() << ", rc = " << rc << ERROR_END ; goto error ; } rc = _getFuncName( filePath, funcName ) ; if ( rc ) { ss << "Failed to get the name of function, rc = " << rc << ERROR_END ; goto error ; } rc = _getFuncSynopsis( pFileBuff, fileSize, syntax ) ; if ( rc ) { ss << "Failed to get the syntax of function in file[" << filePath << "], rc = " << rc << ERROR_END ; goto error ; } rc = _getFuncDesc( pFileBuff, fileSize, desc ) ; if ( rc ) { ss << "Failed to get the description of function in file[" << filePath << "], rc = " << rc << ERROR_END ; goto error ; } metaInfo.funcName = funcName ; metaInfo.syntax = syntax ; metaInfo.desc = desc ; metaInfo.funcType = SPT_FUNC_INSTANCE ; metaInfo.path = filePath ; it2 = _map_func_meta_info.find( className ) ; if ( it2 != _map_func_meta_info.end() ) { it2->second.push_back( metaInfo ) ; } else { vector<sptFuncMetaInfo> vec ; vec.push_back( metaInfo ) ; _map_func_meta_info.insert( PAIR_FUNC_META_INFO( className, vec ) ) ; } fullName = className + SPT_CLASS_SEPARATOR + funcName ; _functions.push_back( fullName ) ; } done: if ( pFileBuff ) { SAFE_OSS_FREE( pFileBuff ) ; } return rc ; error: PRINT_ERROR ; goto done ; }
void ScriptTest::runTest() { // before we start remove any temporary files that we generated last time. _removeFile(_script + ".stdout.failed"); _removeFile(_script + ".stderr.failed"); _removeFile(_script + ".stdout.failed.stripped"); _removeFile(_script + ".stderr.failed.stripped"); _removeFile(_script + ".stdout.first"); _removeFile(_script + ".stderr.first"); _removeFile(_script + ".stdout.first.stripped"); _removeFile(_script + ".stderr.first.stripped"); _removeFile(_script + ".stdout.stripped"); _removeFile(_script + ".stderr.stripped"); _runProcess(); if (QFile(_script + ".stdout").exists() == false || QFile(_script + ".stderr").exists() == false) { LOG_WARN("STDOUT or STDERR doesn't exist for " + _script + "\n*************************\n" " This can be resolved by reviewing the output for correctness and then \n" " creating a new baseline. E.g.\n" " verify: \n" " less " + _script + ".stdout.first\n" " less " + _script + ".stderr.first\n" " ### NOTE: If the test is comparing against a known good file (e.g. .osm\n" " ### then it may be better to update that file. You'll have to look at\n" " ### the source files to be sure.\n" " Make a new baseline:\n" " mv " + _script + ".stdout.first " + _script + ".stdout\n" " mv " + _script + ".stderr.first " + _script + ".stderr\n" "*************************\n" ); _baseStderr = "<invalid/>"; _baseStdout = "<invalid/>"; _writeFile(_script + ".stdout.first", _stdout); _writeFile(_script + ".stderr.first", _stderr); _writeFile(_script + ".stdout.first.stripped", _removeIgnoredSubstrings(_stdout)); _writeFile(_script + ".stderr.first.stripped", _removeIgnoredSubstrings(_stderr)); CPPUNIT_ASSERT_MESSAGE(QString("STDOUT or STDERR does not exist").toStdString(), false); } _baseStderr = _readFile(_script + ".stderr"); _baseStdout = _readFile(_script + ".stdout"); bool failed = false; if (_removeIgnoredSubstrings(_baseStdout) != _removeIgnoredSubstrings(_stdout)) { _writeFile(_script + ".stdout.failed", _stdout); _writeFile(_script + ".stdout.failed.stripped", _removeIgnoredSubstrings(_stdout)); _writeFile(_script + ".stdout.stripped", _removeIgnoredSubstrings(_baseStdout)); if (_printDiff) { LOG_WARN("STDOUT does not match for:\n" + _script + ".stdout" + " " + _script + ".stdout.failed"); _runDiff(_script + ".stdout.stripped", _script + ".stdout.failed.stripped"); } else { LOG_WARN("STDOUT does not match for:\n" + _script + ".stdout.failed" + " " + _script + ".stdout\n" "\n*************************\n" " This can be resolved by reviewing the output for correctness and then \n" " creating a new baseline. E.g.\n" " verify: \n" " diff " + _script + ".stdout.stripped " + _script + ".stdout.failed.stripped\n" " ### NOTE: If the test is comparing against a known good file (e.g. .osm\n" " ### then it may be better to update that file. You'll have to look at\n" " ### the source files to be sure.\n" " Make a new baseline:\n" " mv " + _script + ".stdout.failed " + _script + ".stdout\n" "*************************\n" ); } failed = true; } if (_removeIgnoredSubstrings(_baseStderr) != _removeIgnoredSubstrings(_stderr)) { _writeFile(_script + ".stderr.failed", _stderr); _writeFile(_script + ".stderr.failed.stripped", _removeIgnoredSubstrings(_stderr)); _writeFile(_script + ".stderr.stripped", _removeIgnoredSubstrings(_baseStderr)); if (_printDiff) { LOG_WARN("STDERR does not match for:\n" + _script + ".stderr" + " " + _script + ".stderr.failed"); _runDiff(_script + ".stderr.stripped", _script + ".stderr.failed.stripped"); } else { LOG_WARN("STDERR does not match for:\n" + _script + ".stderr.failed" + " " + _script + ".stderr\n" "\n*************************\n" " This can be resolved by reviewing the output for correctness and then \n" " creating a new baseline. E.g.\n" " verify: \n" " diff " + _script + ".stderr.stripped " + _script + ".stderr.failed.stripped\n" " ### NOTE: If the test is comparing against a known good file (e.g. .osm\n" " ### then it may be better to update that file. You'll have to look at\n" " ### the source files to be sure.\n" " Make a new baseline:\n" " mv " + _script + ".stderr.failed " + _script + ".stderr\n" "*************************\n" ); } failed = true; } if (failed) { CPPUNIT_ASSERT_MESSAGE(QString("STDOUT or STDERR does not match").toStdString(), false); } }