Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit aaacd0e4 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add test

parent 01c08c19
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_subdirectory(TEST_BASE_CONFIG)
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
TableParameters{
///Position on the x axis
float x;
///Position on the y axis
float y;
}
......@@ -28,7 +28,7 @@ std::string ph5_licenceSaveStr(){
* @return corresponding string
*/
std::string ph5_backendTableHeaderOffset(const PTable & table){
std::string body("\t\t");
std::string body("");
const PVecAttribute & vecAttriute = table.getVecAttribute();
for(PVecAttribute::const_iterator it(vecAttriute.begin()); it != vecAttriute.end(); ++it){
body += "\t\tstatic size_t getOffset" + firstToUpper(it->getName()) + "();\n";
......@@ -121,7 +121,7 @@ std::string ph5_backendTableHeader(const PTable & table){
*/
std::string ph5_backendHeader(const PSource & source){
std::string body(ph5_licenceSaveStr());
std::string baseMacro("__" + strToUpper(source.getName()) + "_H__");
std::string baseMacro("__" + strToUpper(eraseExtension(source.getName())) + "_H__");
body += "#ifndef " + baseMacro + "\n";
body += "#define " + baseMacro + "\n\n";
body += "#include \"H5Cpp.h\"\n\n";
......@@ -354,7 +354,7 @@ std::string ph5_backendTableSource(const PTable & table){
*/
std::string ph5_backendSource(const PSource & source){
std::string body(ph5_licenceSaveStr());
body += "#include \""+source.getName()+".h\"\n\n";
body += "#include \""+eraseExtension(source.getName())+".h\"\n\n";
const PVecTable & vecTable = source.getVecTable();
for(PVecTable::const_iterator it(vecTable.begin()); it != vecTable.end(); ++it){
body += ph5_backendTableSource(*it);
......@@ -370,14 +370,14 @@ std::string ph5_backendSource(const PSource & source){
bool ph5_backend(const PSource & source, const std::string & outputDir){
std::string headerSrc(ph5_backendHeader(source));
std::string sourceSrc(ph5_backendSource(source));
std::string outputHeaderFile(outputDir + "/" + source.getName() + ".h");
std::string outputSourceFile(outputDir + "/" + source.getName() + ".cpp");
if(saveFileContent(outputHeaderFile, headerSrc)){
std::string baseFileName(eraseExtension(source.getName()));
std::string outputHeaderFile(outputDir + "/" + baseFileName + ".h");
std::string outputSourceFile(outputDir + "/" + baseFileName + ".cpp");
if(!saveFileContent(outputHeaderFile, headerSrc)){
std::cerr << "ph5_backend : cannot save header file '"<<outputHeaderFile<<"'" << std::endl;
return false;
}
if(saveFileContent(outputSourceFile, sourceSrc)){
if(!saveFileContent(outputSourceFile, sourceSrc)){
std::cerr << "ph5_backend : cannot save source file '"<<outputSourceFile<<"'" << std::endl;
return false;
}
......
......@@ -55,6 +55,7 @@ bool ConfigParser::parseFile(){
p_lastDocString = "";
PSource source;
source.setName(getFileName(p_parser->getFileName()));
p_parser->skipWhiteSpace();
//To parse the file we need to read char by char until we get something we know
while(!p_parser->isEndOfFile() && p_run){ //If we are not at the end of the file
PTable table;
......@@ -66,6 +67,7 @@ bool ConfigParser::parseFile(){
errorAt();
std::cerr << "ConfigParser::parseFile : unexpected token '"<<p_parser->getNextToken()<<"'" << std::endl;
}
p_parser->skipWhiteSpace();
}
p_vecSource.push_back(source);
return true;
......@@ -104,6 +106,7 @@ bool ConfigParser::parseDocString(){
*/
bool ConfigParser::parseTable(PTable & table){
std::string tableName(p_parser->getNextToken());
if(tableName == ""){return true;}
std::string dataSetName(tableName);
table.setDocString(p_lastDocString);
p_lastDocString = "";
......@@ -129,6 +132,7 @@ bool ConfigParser::parseTable(PTable & table){
std::cerr << "ConfigParser::parseTable : cannot parse attribute" << std::endl;
return true;
}
p_parser->skipWhiteSpace();
}
return true;
......@@ -185,6 +189,7 @@ bool ConfigParser::parseAttribute(PAttribute & attr){
}
attr.setName(varName);
attr.setColName(colName);
attr.setType(type);
return true;
}
......
......@@ -8,7 +8,9 @@
#include "convertToString.h"
#include "OptionParser.h"
#include "pxml_utils.h"
#include "FrontEnd/ConfigParser.h"
#include "BackEnd/backend.h"
using namespace std;
......@@ -34,8 +36,17 @@ OptionParser createOptionParser(){
* @return true on success, false otherwise
*/
bool createSourceFromConfig(const std::string & inputFile, const std::string & outputDir){
//TODO
return true;
ConfigParser parser;
if(!parser.load(inputFile)){
std::cerr << "createSourceFromConfig : cannot parse the input file '"<<inputFile<<"'" << std::endl;
return false;
}
PVecSource vecSource = parser.getVecSource();
bool b(ph5_backend(vecSource, outputDir));
if(!b){
std::cerr << "createSourceFromConfig : cannot save source/header from input file '"<<inputFile<<"'" << std::endl;
}
return b;
}
///Process all the input files
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment