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
a18a1a26
Commit
a18a1a26
authored
Jun 24, 2021
by
Pierre Aubert
Browse files
Add test to check the clas parsing
parent
cd4ca817
Pipeline
#126252
passed with stages
in 4 minutes and 23 seconds
Changes
5
Pipelines
7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
0 deletions
+87
-0
TESTS/CMakeLists.txt
TESTS/CMakeLists.txt
+2
-0
TESTS/TEST_CLASS_PARSING/CMakeLists.txt
TESTS/TEST_CLASS_PARSING/CMakeLists.txt
+13
-0
TESTS/TEST_CLASS_PARSING/ConfigShadok.pdata
TESTS/TEST_CLASS_PARSING/ConfigShadok.pdata
+13
-0
TESTS/TEST_CLASS_PARSING/PNestedCall.pdata
TESTS/TEST_CLASS_PARSING/PNestedCall.pdata
+22
-0
TESTS/TEST_CLASS_PARSING/main.cpp
TESTS/TEST_CLASS_PARSING/main.cpp
+37
-0
No files found.
TESTS/CMakeLists.txt
View file @
a18a1a26
add_subdirectory
(
TEST_CLASS_CONFIG
)
add_subdirectory
(
TEST_CLASS_PARSING
)
# TODO : finish the following test
# add_subdirectory(TEST_CMAKE_LIST_GENERATOR)
TESTS/TEST_CLASS_PARSING/CMakeLists.txt
0 → 100644
View file @
a18a1a26
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
}
)
TESTS/TEST_CLASS_PARSING/ConfigShadok.pdata
0 → 100644
View file @
a18a1a26
///@brief Test Shadok
ConfigShadok {
///Age of the Shadok
int age;
///Name of the Shadok
std::string name;
}
TESTS/TEST_CLASS_PARSING/PNestedCall.pdata
0 → 100644
View file @
a18a1a26
#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;
}
TESTS/TEST_CLASS_PARSING/main.cpp
0 → 100644
View file @
a18a1a26
/***************************************
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
;
}
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