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

Commit 36232f19 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add test to finished

parent 271ad962
......@@ -2,4 +2,6 @@ project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_subdirectory(TEST_CLASS_CONFIG)
# TODO : finish the following test
# add_subdirectory(TEST_CMAKE_LIST_GENERATOR)
......@@ -31,15 +31,15 @@ bool testClassConfig(){
PClassConfig conf;
PClassAttribute attrA(createClassAttribute("int", "attr1", "some attribute doc")), attrB, attrC, attrD;
attrB = createClassAttribute("int", "attr2", false, true, "some attribute doc");
attrC = createClassAttribute("double", "attr3", true, false, "some attribute doc");
attrD = createClassAttribute("float", "attr4", true, true, "some attribute doc");
PClassAttribute attrA(createClassAttribute("int", "attr1", "///some attribute doc")), attrB, attrC, attrD;
attrB = createClassAttribute("int", "attr2", false, true, "///some attribute doc");
attrC = createClassAttribute("double", "attr3", true, false, "///some attribute doc");
attrD = createClassAttribute("float", "attr4", true, true, "///some attribute doc");
printPClassAttribute(attrA);
printPClassAttributeConst(attrA);
conf.setClassDocumentation("Some documentation of the class");
conf.setClassDocumentation("///Some documentation of the class");
conf.setName("Shadok");
std::list<PClassAttribute> listAttribute1, listAttribute2;
......@@ -69,15 +69,15 @@ bool testClassConfigInheritance(){
PClassConfig conf;
PClassAttribute attrA(createClassAttribute("int", "attr1", false, false, "some attribute doc")), attrB, attrC, attrD;
attrB = createClassAttribute("int", "attr2", false, true, "some attribute doc");
attrC = createClassAttribute("double", "attr3", true, false, "some attribute doc");
attrD = createClassAttribute("float", "attr4", true, true, "some attribute doc");
PClassAttribute attrA(createClassAttribute("int", "attr1", false, false, "///some attribute doc")), attrB, attrC, attrD;
attrB = createClassAttribute("int", "attr2", false, true, "///some attribute doc");
attrC = createClassAttribute("double", "attr3", true, false, "///some attribute doc");
attrD = createClassAttribute("float", "attr4", true, true, "///some attribute doc");
printPClassAttribute(attrA);
printPClassAttributeConst(attrA);
conf.setClassDocumentation("Some documentation of the class");
conf.setClassDocumentation("///Some documentation of the class");
conf.setName("Shadok");
conf.addParentClass("SomeParent");
......@@ -99,9 +99,9 @@ bool testClassConfigInheritance(){
listClassConfig.push_back(conf);
std::list<std::string> listInclude;
listInclude.push_back("SomeParent");
listInclude.push_back("OtherParent");
listInclude.push_back("OtherParent2");
listInclude.push_back("<SomeParent.h>");
listInclude.push_back("\"OtherParent.h\"");
listInclude.push_back("\"OtherParent2.h\"");
b &= saveClassImplDecl(listClassConfig, "ShadokParent", listInclude);
......
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_executable(test_pcmakelist_generator main.cpp)
target_link_libraries(test_pcmakelist_generator phoenix_generator file_parser string_utils)
add_test(NAME TestCMakeListsGenerator
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_pcmakelist_generator
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <iostream>
#include "cmakelist_generator.h"
///Print PCMakeLibrary
/** @param[out] attr : PClassAttribute to be printed
*/
void printPCMakeLibrary(PClassAttribute & attr){
std::cout << "PCMakeLibrary(type = '" << attr.getType() << "', name = '"<<attr.getName()<<"', isPointer = " << attr.getIsPointer() << ", isReference = " << attr.getIsReference() << ", doc = '"<<attr.getDocumentation()<<"'" << std::endl;
}
///Print PCMakeLibrary
/** @param[out] attr : PCMakeLibrary to be printed
*/
void printPClassAttributeConst(const PCMakeLibrary & attr){
std::cout << "const PCMakeLibrary(type = '" << attr.getType() << "', name = '"<<attr.getName()<<"', isPointer = " << attr.getIsPointer() << ", isReference = " << attr.getIsReference() << ", doc = '"<<attr.getDocumentation()<<"'" << std::endl;
}
///Print PCMakeExecutable
/** @param[out] attr : PClassAttribute to be printed
*/
void printPCMakeExecutable(PClassAttribute & attr){
std::cout << "PCMakeExecutable(type = '" << attr.getType() << "', name = '"<<attr.getName()<<"', isPointer = " << attr.getIsPointer() << ", isReference = " << attr.getIsReference() << ", doc = '"<<attr.getDocumentation()<<"'" << std::endl;
}
///Print PCMakeExecutable
/** @param[out] attr : PCMakeExecutable to be printed
*/
void printPCMakeExecutableConst(const PCMakeExecutable & attr){
std::cout << "const PCMakeExecutable(type = '" << attr.getType() << "', name = '"<<attr.getName()<<"', isPointer = " << attr.getIsPointer() << ", isReference = " << attr.getIsReference() << ", doc = '"<<attr.getDocumentation()<<"'" << std::endl;
}
///Test the PCMakeListsGenerator
/** @return true on success, false otherwise
*/
bool testCMakeListsGenerator(){
bool b(true);
PCMakeListsGenerator conf;
PClassAttribute attrA(createClassAttribute("int", "attr1", "///some attribute doc")), attrB, attrC, attrD;
attrB = createClassAttribute("int", "attr2", false, true, "///some attribute doc");
attrC = createClassAttribute("double", "attr3", true, false, "///some attribute doc");
attrD = createClassAttribute("float", "attr4", true, true, "///some attribute doc");
printPClassAttribute(attrA);
printPClassAttributeConst(attrA);
conf.setClassDocumentation("///Some documentation of the class");
conf.setName("Shadok");
std::list<PClassAttribute> listAttribute1, listAttribute2;
listAttribute1.push_back(attrA);
listAttribute1.push_back(attrB);
listAttribute2.push_back(attrD);
conf.setListAttribute(listAttribute1);
conf.addAttribute(attrC);
conf.addListAttribute(listAttribute2);
std::list<PCMakeListsGenerator> listCMakeListsGenerator;
listCMakeListsGenerator.push_back(conf);
b &= saveClassImplDecl(listCMakeListsGenerator, "Shadok");
return b;
}
int main(int argc, char ** argv){
bool b(testCMakeListsGenerator());
return b - 1;
}
#include <string>
#include <fstream>
#include "PLists/PList.h"
#include <list>
///Describes a CMake library
PCMakeLibrary{
......@@ -10,11 +10,11 @@ PCMakeLibrary{
///Name of the install directory of the library
std::string installDirectory;
///List of the library libraries dependencies
PList<std::string> listLibDependecies;
std::list<std::string> listLibDependecies;
///Lists of the sources
PList<std::string> listSources;
std::list<std::string> listSources;
///Lists of the headers
PList<std::string> listHeaders;
std::list<std::string> listHeaders;
///String to pass to the remove_definitions
std::string removeDefinitions;
///String to pass to the add_definitions
......@@ -34,9 +34,9 @@ PCMakeExecutable{
///Name of the install directory of the executable
std::string installDirectory;
///List of the executable libraries dependencies
PList<std::string> listDependecies;
std::list<std::string> listDependecies;
///Lists of the sources
PList<std::string> listSources;
std::list<std::string> listSources;
///String to pass to the remove_definitions
std::string removeDefinitions;
///String to pass to the add_definitions
......@@ -54,13 +54,13 @@ PCMakeListsGenerator{
///CMAKE_MODULE_PATH variable
std::string cmakeModulePath;
///List of the packages dependencies
PList<std::string> listPackage;
std::list<std::string> listPackage;
///Lists of the include directories
PList<std::string> listIncludeDirectories;
std::list<std::string> listIncludeDirectories;
///Lists of the link directories
PList<std::string> listLinkDirecories;
std::list<std::string> listLinkDirecories;
///List of the libraries
PList<PCMakeLibrary> listLibraries;
std::list<PCMakeLibrary> listLibraries;
///List of the executable
PList<PCMakeExecutable> listExecutable;
std::list<PCMakeExecutable> listExecutable;
}
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