data: Fixes and features for loading Coati into Coati
This change facilitates loading Coati into Coati: * removed error logs for TokenComponent setting * fixed edge checks regarding template stuff * separated CommonSettings to be inherited by Project- and ApplicationSettings for common settings * pluralized SourcePaths setting in xml to allow for loading multiple directories and single files * added CompilerFlags section to settings * passing Compiler arguments to Parser via struct Parser::Arguments * setting -isystem for all header search paths to avoid distinction between "" and <> headers * parsing all headers from the SourcePaths, even the ones that are not included * fixed parsing time measurement and display * added utility.h file for general utility functionality
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
#include "cxxtest/TestSuite.h"
|
||||
|
||||
#include "ApplicationSettings.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/parser/cxx/CxxParser.h"
|
||||
#include "data/parser/ParseFunction.h"
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ParserClient.h"
|
||||
#include "data/parser/ParseTypeUsage.h"
|
||||
#include "data/parser/ParseVariable.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
#include "helper/TestFileManager.h"
|
||||
|
||||
@@ -2247,7 +2248,7 @@ public:
|
||||
std::vector<FilePath> filePaths;
|
||||
filePaths.push_back(FilePath("data/CxxParserTestSuite/header.h"));
|
||||
filePaths.push_back(FilePath("data/CxxParserTestSuite/code.cpp"));
|
||||
parser.parseFiles(filePaths, std::vector<std::string>(), std::vector<std::string>());
|
||||
parser.parseFiles(filePaths, Parser::Arguments());
|
||||
|
||||
TS_ASSERT_EQUALS(client.errors.size(), 0);
|
||||
|
||||
@@ -2576,19 +2577,21 @@ private:
|
||||
|
||||
std::shared_ptr<TestParserClient> parseCode(std::string code, bool logErrors = true)
|
||||
{
|
||||
if (!m_systemHeaderSearchPaths.size())
|
||||
if (!m_args.headerSearchPaths.size())
|
||||
{
|
||||
std::shared_ptr<ApplicationSettings> settings = ApplicationSettings::getInstance();
|
||||
settings->load("data/TestSettings.xml");
|
||||
m_systemHeaderSearchPaths = settings->getHeaderSearchPaths();
|
||||
m_args.headerSearchPaths = settings->getHeaderSearchPaths();
|
||||
}
|
||||
|
||||
m_args.logErrors = logErrors;
|
||||
|
||||
TestFileManager fm;
|
||||
std::shared_ptr<TestParserClient> client = std::make_shared<TestParserClient>();
|
||||
CxxParser parser(client.get(), &fm);
|
||||
parser.parseFile(TextAccess::createFromString(code), m_systemHeaderSearchPaths, logErrors);
|
||||
parser.parseFile(TextAccess::createFromString(code), m_args);
|
||||
return client;
|
||||
}
|
||||
|
||||
std::vector<std::string> m_systemHeaderSearchPaths;
|
||||
Parser::Arguments m_args;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "cxxtest/TestSuite.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/type/DataType.h"
|
||||
#include "data/type/modifier/DataTypeModifierArray.h"
|
||||
#include "data/type/modifier/DataTypeModifierPointer.h"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "cxxtest/TestSuite.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/graph/Graph.h"
|
||||
#include "data/graph/token_component/TokenComponentName.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <cxxtest/TestSuite.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "cxxtest/TestSuite.h"
|
||||
|
||||
#include "data/search/SearchIndex.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/search/SearchIndex.h"
|
||||
#include "data/search/SearchMatch.h"
|
||||
|
||||
class SearchIndexTestSuite : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#include <cxxtest/TestSuite.h>
|
||||
|
||||
#include "ProjectSettings.h"
|
||||
#include "Settings.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "settings/Settings.h"
|
||||
|
||||
class SettingsTestSuite : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
void test_settings_get_loaded_from_file()
|
||||
{
|
||||
Settings settings;
|
||||
TestSettings settings;
|
||||
TS_ASSERT(settings.load("data/SettingsTestSuite/settings.xml"));
|
||||
}
|
||||
|
||||
void test_settings_get_not_loaded_from_file()
|
||||
{
|
||||
Settings settings;
|
||||
TestSettings settings;
|
||||
TS_ASSERT(!settings.load("data/SettingsTestSuite/wrong_settings.xml"));
|
||||
}
|
||||
|
||||
@@ -114,7 +114,10 @@ public:
|
||||
void test_load_source_path_from_file()
|
||||
{
|
||||
ProjectSettings::getInstance()->load("data/SettingsTestSuite/settings.xml");
|
||||
TS_ASSERT_EQUALS(ProjectSettings::getInstance()->getSourcePath(), "data");
|
||||
std::vector<std::string> paths = ProjectSettings::getInstance()->getSourcePaths();
|
||||
|
||||
TS_ASSERT_EQUALS(paths.size(), 1);
|
||||
TS_ASSERT_EQUALS(paths[0], "data");
|
||||
}
|
||||
|
||||
void test_load_header_search_paths_from_file()
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "cxxtest/TestSuite.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/graph/StorageGraph.h"
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
#include "data/search/SearchIndex.h"
|
||||
|
||||
class StorageGraphTestSuite : public CxxTest::TestSuite
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "cxxtest/TestSuite.h"
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentAbstraction.h"
|
||||
#include "data/graph/token_component/TokenComponentAccess.h"
|
||||
#include "data/graph/token_component/TokenComponentSignature.h"
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
void TestStorage::parseCxxCode(std::string code)
|
||||
{
|
||||
clear();
|
||||
|
||||
TestFileManager fm;
|
||||
CxxParser parser(this, &fm);
|
||||
parser.parseFile(TextAccess::createFromString(code), std::vector<std::string>(), true);
|
||||
parser.parseFile(TextAccess::createFromString(code), Parser::Arguments());
|
||||
}
|
||||
|
||||
const Graph& TestStorage::getGraph() const
|
||||
|
||||
Reference in New Issue
Block a user