From 463afd6be570e37397b10d4cd9089fd9e336d30a Mon Sep 17 00:00:00 2001 From: utkarshgautamnyu Date: Thu, 28 Sep 2017 11:12:26 -0700 Subject: [PATCH] made updates to fix building --- assignment-client/src/assets/AssetServer.cpp | 65 +++++++++---------- .../src/assets/BakeAssetTask.cpp | 9 ++- libraries/baking/src/JSBaker.cpp | 55 ++++++++-------- libraries/baking/src/JSBaker.h | 6 +- tests/baking/{CMakeLists => CMakeLists.txt} | 0 tests/baking/src/JSBakerTest.cpp | 16 ++--- tests/baking/src/JSBakerTest.h | 6 +- 7 files changed, 77 insertions(+), 80 deletions(-) rename tests/baking/{CMakeLists => CMakeLists.txt} (100%) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 9e3732762d..919cec6e2d 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -50,9 +50,9 @@ static const int INTERFACE_RUNNING_CHECK_FREQUENCY_MS = 1000; const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; -static const QStringList BAKEABLE_MODEL_EXTENSIONS = {"fbx"}; +static const QStringList BAKEABLE_MODEL_EXTENSIONS = { "fbx" }; static QStringList BAKEABLE_TEXTURE_EXTENSIONS; -static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = {"js"}; +static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = { "js" }; static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx"; static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx"; static const QString BAKED_SCRIPT_SIMPLE_NAME = "asset.js"; @@ -125,7 +125,7 @@ std::pair AssetServer::getAssetStatus(const AssetPath& pa return { Error, meta.lastBakeErrors }; } } - + return { Pending, "" }; } @@ -147,8 +147,8 @@ void AssetServer::maybeBake(const AssetPath& path, const AssetHash& hash) { void AssetServer::createEmptyMetaFile(const AssetHash& hash) { QString metaFilePath = "atp:/" + hash + "/meta.json"; - QFile metaFile { metaFilePath }; - + QFile metaFile{ metaFilePath }; + if (!metaFile.exists()) { qDebug() << "Creating metafile for " << hash; if (metaFile.open(QFile::WriteOnly)) { @@ -205,7 +205,7 @@ bool interfaceRunning() { bool result = false; #ifdef Q_OS_WIN - QSharedMemory sharedMemory { getInterfaceSharedMemoryName() }; + QSharedMemory sharedMemory{ getInterfaceSharedMemoryName() }; result = sharedMemory.attach(QSharedMemory::ReadOnly); if (result) { sharedMemory.detach(); @@ -226,7 +226,7 @@ void updateConsumedCores() { auto coreCount = std::thread::hardware_concurrency(); if (isInterfaceRunning) { coreCount = coreCount > MIN_CORES_FOR_MULTICORE ? CPU_AFFINITY_COUNT_HIGH : CPU_AFFINITY_COUNT_LOW; - } + } qCDebug(asset_server) << "Setting max consumed cores to " << coreCount; setMaxCores(coreCount); } @@ -235,8 +235,7 @@ void updateConsumedCores() { AssetServer::AssetServer(ReceivedMessage& message) : ThreadedAssignment(message), _transferTaskPool(this), - _bakingTaskPool(this) -{ + _bakingTaskPool(this) { // store the current state of image compression so we can reset it when this assignment is complete _wasColorTextureCompressionEnabled = image::isColorTexturesCompressionEnabled(); _wasGrayscaleTextureCompressionEnabled = image::isGrayscaleTexturesCompressionEnabled(); @@ -263,7 +262,7 @@ AssetServer::AssetServer(ReceivedMessage& message) : packetReceiver.registerListener(PacketType::AssetGetInfo, this, "handleAssetGetInfo"); packetReceiver.registerListener(PacketType::AssetUpload, this, "handleAssetUpload"); packetReceiver.registerListener(PacketType::AssetMappingOperation, this, "handleAssetMappingOperation"); - + #ifdef Q_OS_WIN updateConsumedCores(); QTimer* timer = new QTimer(this); @@ -287,7 +286,7 @@ void AssetServer::aboutToFinish() { // abort each of our still running bake tasks, remove pending bakes that were never put on the thread pool auto it = _pendingBakes.begin(); while (it != _pendingBakes.end()) { - auto pendingRunnable = _bakingTaskPool.tryTake(it->get()); + auto pendingRunnable = _bakingTaskPool.tryTake(it->get()); if (pendingRunnable) { it = _pendingBakes.erase(it); @@ -348,7 +347,7 @@ void AssetServer::completeSetup() { int maxBandwidth = maxBandwidthFloat * BITS_PER_MEGABITS; nodeList->setConnectionMaxBandwidth(maxBandwidth); qCInfo(asset_server) << "Set maximum bandwith per connection to" << maxBandwidthFloat << "Mb/s." - " (" << maxBandwidth << "bits/s)"; + " (" << maxBandwidth << "bits/s)"; } // get the path to the asset folder from the domain server settings @@ -362,7 +361,7 @@ void AssetServer::completeSetup() { } auto assetsPathString = assetsJSONValue.toString(); - QDir assetsPath { assetsPathString }; + QDir assetsPath{ assetsPathString }; QString absoluteFilePath = assetsPath.absolutePath(); if (assetsPath.isRelative()) { @@ -390,7 +389,7 @@ void AssetServer::completeSetup() { // Check the asset directory to output some information about what we have auto files = _filesDirectory.entryList(QDir::Files); - QRegExp hashFileRegex { ASSET_HASH_REGEX_STRING }; + QRegExp hashFileRegex{ ASSET_HASH_REGEX_STRING }; auto hashedFiles = files.filter(hashFileRegex); qCInfo(asset_server) << "There are" << hashedFiles.size() << "asset files in the asset directory."; @@ -409,7 +408,7 @@ void AssetServer::completeSetup() { } void AssetServer::cleanupUnmappedFiles() { - QRegExp hashFileRegex { "^[a-f0-9]{" + QString::number(SHA256_HASH_HEX_LENGTH) + "}" }; + QRegExp hashFileRegex{ "^[a-f0-9]{" + QString::number(SHA256_HASH_HEX_LENGTH) + "}" }; auto files = _filesDirectory.entryInfoList(QDir::Files); @@ -418,7 +417,7 @@ void AssetServer::cleanupUnmappedFiles() { for (const auto& fileInfo : files) { auto filename = fileInfo.fileName(); if (hashFileRegex.exactMatch(filename)) { - bool matched { false }; + bool matched{ false }; for (auto& pair : _fileMappings) { if (pair.second == filename) { matched = true; @@ -427,7 +426,7 @@ void AssetServer::cleanupUnmappedFiles() { } if (!matched) { // remove the unmapped file - QFile removeableFile { fileInfo.absoluteFilePath() }; + QFile removeableFile{ fileInfo.absoluteFilePath() }; if (removeableFile.remove()) { qCDebug(asset_server) << "\tDeleted" << filename << "from asset files directory since it is unmapped."; @@ -479,7 +478,7 @@ void AssetServer::handleAssetMappingOperation(QSharedPointer me void AssetServer::handleGetMappingOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket) { QString assetPath = message.readString(); - QUrl url { assetPath }; + QUrl url{ assetPath }; assetPath = url.path(); auto it = _fileMappings.find(assetPath); @@ -498,7 +497,7 @@ void AssetServer::handleGetMappingOperation(ReceivedMessage& message, SharedNode } else if (BAKEABLE_SCRIPT_EXTENSIONS.contains(assetPathExtension)) { bakedRootFile = BAKED_SCRIPT_SIMPLE_NAME; } - + auto originalAssetHash = it->second; QString redirectedAssetHash; QString bakedAssetPath; @@ -562,7 +561,7 @@ void AssetServer::handleGetAllMappingOperation(ReceivedMessage& message, SharedN replyPacket.writePrimitive(count); - for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++ it) { + for (auto it = _fileMappings.cbegin(); it != _fileMappings.cend(); ++it) { auto mapping = it->first; auto hash = it->second; replyPacket.writeString(mapping); @@ -603,7 +602,7 @@ void AssetServer::handleSetMappingOperation(ReceivedMessage& message, SharedNode void AssetServer::handleDeleteMappingsOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket) { if (senderNode->getCanWriteToAssetServer()) { - int numberOfDeletedMappings { 0 }; + int numberOfDeletedMappings{ 0 }; message.readPrimitive(&numberOfDeletedMappings); QStringList mappingsToDelete; @@ -653,7 +652,7 @@ void AssetServer::handleRenameMappingOperation(ReceivedMessage& message, SharedN void AssetServer::handleSetBakingEnabledOperation(ReceivedMessage& message, SharedNodePointer senderNode, NLPacketList& replyPacket) { if (senderNode->getCanWriteToAssetServer()) { - bool enabled { true }; + bool enabled{ true }; message.readPrimitive(&enabled); int numberOfMappings{ 0 }; @@ -696,7 +695,7 @@ void AssetServer::handleAssetGetInfo(QSharedPointer message, Sh replyPacket->write(assetHash); QString fileName = QString(hexHash); - QFileInfo fileInfo { _filesDirectory.filePath(fileName) }; + QFileInfo fileInfo{ _filesDirectory.filePath(fileName) }; if (fileInfo.exists() && fileInfo.isReadable()) { qCDebug(asset_server) << "Opening file: " << fileInfo.filePath(); @@ -827,7 +826,7 @@ bool AssetServer::loadMappingsFromFile() { auto mapFilePath = _resourcesDirectory.absoluteFilePath(MAP_FILE_NAME); - QFile mapFile { mapFilePath }; + QFile mapFile{ mapFilePath }; if (mapFile.exists()) { if (mapFile.open(QIODevice::ReadOnly)) { QJsonParseError error; @@ -883,7 +882,7 @@ bool AssetServer::loadMappingsFromFile() { bool AssetServer::writeMappingsToFile() { auto mapFilePath = _resourcesDirectory.absoluteFilePath(MAP_FILE_NAME); - QFile mapFile { mapFilePath }; + QFile mapFile{ mapFilePath }; if (mapFile.open(QIODevice::WriteOnly)) { QJsonObject root; @@ -891,7 +890,7 @@ bool AssetServer::writeMappingsToFile() { root[it.first] = it.second; } - QJsonDocument jsonDocument { root }; + QJsonDocument jsonDocument{ root }; if (mapFile.write(jsonDocument.toJson()) != -1) { qCDebug(asset_server) << "Wrote JSON mappings to file at" << mapFilePath; @@ -955,7 +954,7 @@ void AssetServer::removeBakedPathsForDeletedAsset(AssetHash hash) { // check if we had baked content for that file that should also now be removed // by calling deleteMappings for the hidden baked content folder for this hash - AssetPathList hiddenBakedFolder { HIDDEN_BAKED_CONTENT_FOLDER + hash + "/" }; + AssetPathList hiddenBakedFolder{ HIDDEN_BAKED_CONTENT_FOLDER + hash + "/" }; qCDebug(asset_server) << "Deleting baked content below" << hiddenBakedFolder << "since" << hash << "was deleted"; @@ -1003,7 +1002,7 @@ bool AssetServer::deleteMappings(const AssetPathList& paths) { hashesToCheckForDeletion << it->second; qCDebug(asset_server) << "Deleted a mapping:" << path << "=>" << it->second; - + _fileMappings.erase(it); } else { qCDebug(asset_server) << "Unable to delete a mapping that was not found:" << path; @@ -1026,7 +1025,7 @@ bool AssetServer::deleteMappings(const AssetPathList& paths) { // we now have a set of hashes that are unmapped - we will delete those asset files for (auto& hash : hashesToCheckForDeletion) { // remove the unmapped file - QFile removeableFile { _filesDirectory.absoluteFilePath(hash) }; + QFile removeableFile{ _filesDirectory.absoluteFilePath(hash) }; if (removeableFile.remove()) { qCDebug(asset_server) << "\tDeleted" << hash << "from asset files directory since it is now unmapped."; @@ -1173,7 +1172,7 @@ void AssetServer::handleFailedBake(QString originalAssetHash, QString assetPath, } void AssetServer::handleCompletedBake(QString originalAssetHash, QString originalAssetPath, QVector bakedFilePaths) { - bool errorCompletingBake { false }; + bool errorCompletingBake{ false }; QString errorReason; qDebug() << "Completing bake for " << originalAssetHash; @@ -1272,7 +1271,7 @@ std::pair AssetServer::readMetaFile(AssetHash hash) { auto it = _fileMappings.find(metaFilePath); if (it == _fileMappings.end()) { - return { false, {} }; + return { false,{} }; } auto metaFileHash = it->second; @@ -1309,7 +1308,7 @@ std::pair AssetServer::readMetaFile(AssetHash hash) { } } - return { false, {} }; + return { false,{} }; } bool AssetServer::writeMetaFile(AssetHash originalAssetHash, const AssetMeta& meta) { @@ -1358,7 +1357,7 @@ bool AssetServer::setBakingEnabled(const AssetPathList& paths, bool enabled) { auto extension = path.mid(dotIndex + 1); QString bakedFilename; - + if (BAKEABLE_MODEL_EXTENSIONS.contains(extension)) { bakedFilename = BAKED_MODEL_SIMPLE_NAME; } else if (BAKEABLE_TEXTURE_EXTENSIONS.contains(extension.toLocal8Bit()) && hasMetaFile(hash)) { diff --git a/assignment-client/src/assets/BakeAssetTask.cpp b/assignment-client/src/assets/BakeAssetTask.cpp index daff3a3834..65b6efb53a 100644 --- a/assignment-client/src/assets/BakeAssetTask.cpp +++ b/assignment-client/src/assets/BakeAssetTask.cpp @@ -20,8 +20,7 @@ BakeAssetTask::BakeAssetTask(const AssetHash& assetHash, const AssetPath& assetPath, const QString& filePath) : _assetHash(assetHash), _assetPath(assetPath), - _filePath(filePath) -{ + _filePath(filePath) { } @@ -32,7 +31,7 @@ void BakeAssetTask::run() { TextureBakerThreadGetter fn = []() -> QThread* { return QThread::currentThread(); }; if (_assetPath.endsWith(".fbx")) { - _baker = std::unique_ptr { + _baker = std::unique_ptr{ new FBXBaker(QUrl("file:///" + _filePath), fn, PathUtils::generateTemporaryDir()) }; } else if (_assetPath.endsWith(".js", Qt::CaseInsensitive)) { @@ -40,9 +39,9 @@ void BakeAssetTask::run() { new JSBaker(QUrl("file:///" + _filePath), PathUtils::generateTemporaryDir()) }; } else { - _baker = std::unique_ptr { + _baker = std::unique_ptr{ new TextureBaker(QUrl("file:///" + _filePath), image::TextureUsage::CUBE_TEXTURE, - PathUtils::generateTemporaryDir()) + PathUtils::generateTemporaryDir()) }; } diff --git a/libraries/baking/src/JSBaker.cpp b/libraries/baking/src/JSBaker.cpp index 079650d6d1..ffbc4f01dc 100644 --- a/libraries/baking/src/JSBaker.cpp +++ b/libraries/baking/src/JSBaker.cpp @@ -18,25 +18,24 @@ const int ASCII_CHARACTERS_UPPER_LIMIT = 126; JSBaker::JSBaker(const QUrl& jsURL, const QString& bakedOutputDir) : _jsURL(jsURL), - _bakedOutputDir(bakedOutputDir) -{ - + _bakedOutputDir(bakedOutputDir) { + }; void JSBaker::bake() { qCDebug(js_baking) << "JS Baker " << _jsURL << "bake starting"; - + // Import file to start baking QFile jsFile(_jsURL.toLocalFile()); if (!jsFile.open(QIODevice::ReadOnly | QIODevice::Text)) { handleError("Error opening " + _jsURL.fileName() + " for reading"); return; } - + // Read file into an array QByteArray inputJS = jsFile.readAll(); QByteArray outputJS; - + // Call baking on inputJS and store result in outputJS bool success = bakeJS(&inputJS, &outputJS); if (!success) { @@ -44,23 +43,23 @@ void JSBaker::bake() { handleError("Error unterminated multi line comment"); return; } - + // Bake Successful. Export the file auto fileName = _jsURL.fileName(); auto baseName = fileName.left(fileName.lastIndexOf('.')); auto bakedFilename = baseName + BAKED_JS_EXTENSION; _bakedJSFilePath = _bakedOutputDir + "/" + bakedFilename; - + QFile bakedFile; bakedFile.setFileName(_bakedJSFilePath); if (!bakedFile.open(QIODevice::WriteOnly)) { handleError("Error opening " + _bakedJSFilePath + " for writing"); return; } - + bakedFile.write(outputJS); - + // Export successful _outputFiles.push_back(_bakedJSFilePath); qCDebug(js_baking) << "Exported" << _jsURL << "with re-written paths to" << _bakedJSFilePath; @@ -71,7 +70,7 @@ void JSBaker::bake() { bool JSBaker::bakeJS(const QByteArray* inputFile, QByteArray* outputFile) { // Read from inputFile and write to outputFile per character - QTextStream in(*inputFile,QIODevice::ReadOnly); + QTextStream in(*inputFile, QIODevice::ReadOnly); QTextStream out(outputFile, QIODevice::WriteOnly); // Algorithm requires the knowledge of previous and next character for each character read @@ -79,19 +78,19 @@ bool JSBaker::bakeJS(const QByteArray* inputFile, QByteArray* outputFile) { QChar nextCharacter; // Initialize previousCharacter with new line QChar previousCharacter = '\n'; - + in >> currentCharacter; - + while (!in.atEnd()) { in >> nextCharacter; - + if (currentCharacter == '\r') { out << '\n'; } else if (currentCharacter == '/') { // Check if single line comment i.e. // if (nextCharacter == '/') { handleSingleLineComments(&in); - + //Start fresh after handling comments previousCharacter = '\n'; in >> currentCharacter; @@ -111,7 +110,7 @@ bool JSBaker::bakeJS(const QByteArray* inputFile, QByteArray* outputFile) { // If '/' is not followed by '/' or '*' print '/' out << currentCharacter; } - } else if (isSpaceOrTab(currentCharacter)) { + } else if (isSpaceOrTab(currentCharacter)) { // Check if white space or tab // Skip multiple spaces or tabs @@ -126,20 +125,20 @@ bool JSBaker::bakeJS(const QByteArray* inputFile, QByteArray* outputFile) { if (!canOmitSpace(previousCharacter, nextCharacter)) { out << ' '; } - } else if (currentCharacter == '\n') { + } else if (currentCharacter == '\n') { // Check if new line - + //Skip multiple new lines //Skip new line followed by space or tab while (nextCharacter == '\n' || isSpaceOrTab(nextCharacter)) { in >> nextCharacter; } - + // Check if new line can be omitted if (!canOmitNewLine(previousCharacter, nextCharacter)) { out << '\n'; } - } else if (isQuote(currentCharacter)) { + } else if (isQuote(currentCharacter)) { // Print the current quote and nextCharacter as is out << currentCharacter; out << nextCharacter; @@ -160,17 +159,17 @@ bool JSBaker::bakeJS(const QByteArray* inputFile, QByteArray* outputFile) { } else { // In all other cases write the currentCharacter to outputFile out << currentCharacter; - } + } previousCharacter = currentCharacter; currentCharacter = nextCharacter; } - + //write currentCharacter to output file when nextCharacter reaches EOF if (currentCharacter != '\n') { out << currentCharacter; } - + // Successful bake. Return true return true; } @@ -200,19 +199,19 @@ bool JSBaker::handleMultiLineComments(QTextStream* in) { bool JSBaker::canOmitSpace(QChar previousCharacter, QChar nextCharacter) { return(!((isAlphanum(previousCharacter) || isNonAscii(previousCharacter) || isSpecialCharacter(previousCharacter)) && - (isAlphanum(nextCharacter) || isNonAscii(nextCharacter) || isSpecialCharacter(nextCharacter))) - ); + (isAlphanum(nextCharacter) || isNonAscii(nextCharacter) || isSpecialCharacter(nextCharacter))) + ); } bool JSBaker::canOmitNewLine(QChar previousCharacter, QChar nextCharacter) { return (!((isAlphanum(previousCharacter) || isNonAscii(previousCharacter) || isSpecialCharacterPrevious(previousCharacter)) && - (isAlphanum(nextCharacter) || isNonAscii(nextCharacter) || isSpecialCharacterNext(nextCharacter))) - ); + (isAlphanum(nextCharacter) || isNonAscii(nextCharacter) || isSpecialCharacterNext(nextCharacter))) + ); } //Check if character is alphabet, number or one of the following: '_', '$', '\\' or a non-ASCII character bool JSBaker::isAlphanum(QChar c) { - return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') + return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c == '\\' || c > ASCII_CHARACTERS_UPPER_LIMIT); } diff --git a/libraries/baking/src/JSBaker.h b/libraries/baking/src/JSBaker.h index 695785a730..88cbbc8eb0 100644 --- a/libraries/baking/src/JSBaker.h +++ b/libraries/baking/src/JSBaker.h @@ -22,13 +22,13 @@ class JSBaker : public Baker { public: JSBaker(const QUrl& jsURL, const QString& bakedOutputDir); -public slots: - virtual void bake() override; + public slots: + virtual void bake() override; public: static bool bakeJS(const QByteArray* inputFile, QByteArray* outputFile); -private : +private: QUrl _jsURL; QString _bakedOutputDir; QString _bakedJSFilePath; diff --git a/tests/baking/CMakeLists b/tests/baking/CMakeLists.txt similarity index 100% rename from tests/baking/CMakeLists rename to tests/baking/CMakeLists.txt diff --git a/tests/baking/src/JSBakerTest.cpp b/tests/baking/src/JSBakerTest.cpp index c3398a8d67..b1cd991969 100644 --- a/tests/baking/src/JSBakerTest.cpp +++ b/tests/baking/src/JSBakerTest.cpp @@ -14,7 +14,7 @@ QTEST_MAIN(JSBakerTest) void JSBakerTest::setTestCases() { // Test cases contain a std::pair(input, desiredOutput) - + _testCases.emplace_back("var a=1;", "var a=1;"); _testCases.emplace_back("var a=1;//single line comment\nvar b=2;", "var a=1;var b=2;"); _testCases.emplace_back("a\rb", "a\nb"); @@ -22,8 +22,8 @@ void JSBakerTest::setTestCases() { _testCases.emplace_back("a/b", "a/b"); _testCases.emplace_back("var a = 1;", "var a=1;"); // Multiple spaces omitted _testCases.emplace_back("var a= 1;", "var a=1;"); // Multiple tabs omitted - - // Cases for space not omitted + + // Cases for space not omitted _testCases.emplace_back("var x", "var x"); _testCases.emplace_back("a '", "a '"); _testCases.emplace_back("a $", "a $"); @@ -42,7 +42,7 @@ void JSBakerTest::setTestCases() { _testCases.emplace_back("a\n\n b", "a\nb"); // Skip multiple new lines followed by whitespace _testCases.emplace_back("a\n\n b", "a\nb"); // Skip multiple new lines followed by tab - //Cases for new line not omitted + //Cases for new line not omitted _testCases.emplace_back("a\nb", "a\nb"); _testCases.emplace_back("a\n9", "a\n9"); _testCases.emplace_back("9\na", "9\na"); @@ -61,12 +61,12 @@ void JSBakerTest::setTestCases() { _testCases.emplace_back(")\na", ")\na"); _testCases.emplace_back("+\na", "+\na"); _testCases.emplace_back("-\na", "-\na"); - + // Cases to check quoted strings are not modified _testCases.emplace_back("'abcd1234$%^&[](){}'\na", "'abcd1234$%^&[](){}'\na"); _testCases.emplace_back("\"abcd1234$%^&[](){}\"\na", "\"abcd1234$%^&[](){}\"\na"); _testCases.emplace_back("`abcd1234$%^&[](){}`\na", "`abcd1234$%^&[](){}`a"); - + // Edge Cases //No semicolon to terminate an expression, instead a new line used for termination @@ -77,12 +77,12 @@ void JSBakerTest::setTestCases() { } void JSBakerTest::testJSBaking() { - + for (int i = 0;i < _testCases.size();i++) { QByteArray output; auto input = _testCases.at(i).first; JSBaker::bakeJS(&input, &output); - + auto desiredOutput = _testCases.at(i).second; QCOMPARE(output, desiredOutput); } diff --git a/tests/baking/src/JSBakerTest.h b/tests/baking/src/JSBakerTest.h index a1d1f73e9f..84d39deb64 100644 --- a/tests/baking/src/JSBakerTest.h +++ b/tests/baking/src/JSBakerTest.h @@ -15,12 +15,12 @@ #include #include "../../libraries/baking/src/JSBaker.h" -class JSBakerTest: public QObject { +class JSBakerTest : public QObject { Q_OBJECT -private slots: + private slots: void setTestCases(); - void testJSBaking(); + void testJSBaking(); private: std::vector> _testCases;