📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

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

Add test to check the clas parsing

parent cd4ca817
Pipeline #126252 passed with stages
in 4 minutes and 23 seconds
add_subdirectory(TEST_CLASS_CONFIG)
add_subdirectory(TEST_CLASS_PARSING)
# TODO : finish the following test
# add_subdirectory(TEST_CMAKE_LIST_GENERATOR)
add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(test_pclass_parsing main.cpp)
target_link_libraries(test_pclass_parsing phoenix_generator file_parser string_utils)
add_test(NAME TestPClassParsing
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_pclass_parsing
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
///@brief Test Shadok
ConfigShadok {
///Age of the Shadok
int age;
///Name of the Shadok
std::string name;
}
#include <string>
#include <vector>
///@brief Nested string or variable call
PNestedStr{
///String which can be a call to an other variable or a simple string
std::string value;
///True if the PNestedStr calls a variable
bool isVarCall;
}
///@brief Class used to parse nested call variables
PNestedCall{
///Name of the Variable
std::string name;
///Vector of PNestedStr
std::vector<PNestedStr> vecNestedStr;
}
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <iostream>
#include "class_attribute_utils.h"
#include "saveClassConfig.h"
#include "saveClassConfigTest.h"
#include "parserClassConfig.h"
///Test the PClassConfig
/** @param classConfig : class configuration file to be read
* @param enableDataStream : true to enable data stream save, false otherwise
* @return true on success, false otherwise
*/
bool testClassConfigDataStream(const std::string & classConfig, bool enableDataStream){
bool b(true);
b &= saveParserClassConfig("Shadok", classConfig, enableDataStream);
std::cout << "testClassConfigDataStream : b = " << b << std::endl;
return b;
}
int main(int argc, char ** argv){
bool b(true);
b &= testClassConfigDataStream(CURRENT_SOURCE_DIR "/ConfigShadok.pdata", false);
b &= testClassConfigDataStream(CURRENT_SOURCE_DIR "/ConfigShadok.pdata", true);
b &= testClassConfigDataStream(CURRENT_SOURCE_DIR "/PNestedCall.pdata", false);
b &= testClassConfigDataStream(CURRENT_SOURCE_DIR "/PNestedCall.pdata", true);
return b - 1;
}
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