Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixGenerator
Commits
36232f19
Commit
36232f19
authored
Jan 04, 2021
by
Pierre Aubert
Browse files
Add test to finished
parent
271ad962
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
24 deletions
+122
-24
TESTS/CMakeLists.txt
TESTS/CMakeLists.txt
+2
-0
TESTS/TEST_CLASS_CONFIG/main.cpp
TESTS/TEST_CLASS_CONFIG/main.cpp
+13
-13
TESTS/TEST_CMAKE_LIST_GENERATOR/CMakeLists.txt
TESTS/TEST_CMAKE_LIST_GENERATOR/CMakeLists.txt
+13
-0
TESTS/TEST_CMAKE_LIST_GENERATOR/main.cpp
TESTS/TEST_CMAKE_LIST_GENERATOR/main.cpp
+83
-0
src/PCMakeListsGenerator.pdata
src/PCMakeListsGenerator.pdata
+11
-11
No files found.
TESTS/CMakeLists.txt
View file @
36232f19
...
...
@@ -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)
TESTS/TEST_CLASS_CONFIG/main.cpp
View file @
36232f19
...
...
@@ -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
);
...
...
TESTS/TEST_CMAKE_LIST_GENERATOR/CMakeLists.txt
0 → 100644
View file @
36232f19
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
}
)
TESTS/TEST_CMAKE_LIST_GENERATOR/main.cpp
0 → 100644
View file @
36232f19
/***************************************
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
;
}
src/PCMakeListsGenerator.pdata
View file @
36232f19
#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
PL
ist<std::string> listLibDependecies;
std::l
ist<std::string> listLibDependecies;
///Lists of the sources
PL
ist<std::string> listSources;
std::l
ist<std::string> listSources;
///Lists of the headers
PL
ist<std::string> listHeaders;
std::l
ist<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
PL
ist<std::string> listDependecies;
std::l
ist<std::string> listDependecies;
///Lists of the sources
PL
ist<std::string> listSources;
std::l
ist<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
PL
ist<std::string> listPackage;
std::l
ist<std::string> listPackage;
///Lists of the include directories
PL
ist<std::string> listIncludeDirectories;
std::l
ist<std::string> listIncludeDirectories;
///Lists of the link directories
PL
ist<std::string> listLinkDirecories;
std::l
ist<std::string> listLinkDirecories;
///List of the libraries
PL
ist<PCMakeLibrary> listLibraries;
std::l
ist<PCMakeLibrary> listLibraries;
///List of the executable
PL
ist<PCMakeExecutable> listExecutable;
std::l
ist<PCMakeExecutable> listExecutable;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment