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
PhoenixGraph
Commits
70bbb9bd
Commit
70bbb9bd
authored
Aug 27, 2020
by
Pierre Aubert
Browse files
Add test with string as index, OK
parent
a684216a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
0 deletions
+79
-0
TESTS/CMakeLists.txt
TESTS/CMakeLists.txt
+1
-0
TESTS/TEST_DOT_STR/CMakeLists.txt
TESTS/TEST_DOT_STR/CMakeLists.txt
+7
-0
TESTS/TEST_DOT_STR/main.cpp
TESTS/TEST_DOT_STR/main.cpp
+40
-0
src/list_index_utils_impl.h
src/list_index_utils_impl.h
+31
-0
No files found.
TESTS/CMakeLists.txt
View file @
70bbb9bd
...
...
@@ -7,4 +7,5 @@ add_subdirectory(TEST_DOT)
add_subdirectory
(
TEST_DOT_LOOP
)
add_subdirectory
(
TEST_DOT_TOTAL_LOOP
)
add_subdirectory
(
TEST_DOT_REMOVE
)
add_subdirectory
(
TEST_DOT_STR
)
TESTS/TEST_DOT_STR/CMakeLists.txt
0 → 100644
View file @
70bbb9bd
project
(
Phoenix
)
add_executable
(
test_graph_to_dot_str main.cpp
)
add_test
(
NAME TestGraphToDotStr
COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/test_graph_to_dot_str
)
TESTS/TEST_DOT_STR/main.cpp
0 → 100644
View file @
70bbb9bd
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include "Graph.h"
///Test the graph conversion to dot
void
testGraphToDot
(){
Graph
<
bool
,
std
::
string
>
graph
;
std
::
string
nodeA
(
"a"
);
std
::
string
nodeB
(
"b"
);
std
::
string
nodeC
(
"c"
);
std
::
string
nodeD
(
"d"
);
std
::
string
nodeE
(
"e"
);
//The first parameter is the data, second is the index and the third is the name
graph
.
createNode
(
true
,
nodeA
,
"var_"
+
nodeA
);
graph
.
createNode
(
true
,
nodeB
,
"var_"
+
nodeB
);
graph
.
createNode
(
true
,
nodeC
,
"var_"
+
nodeC
);
graph
.
createNode
(
true
,
nodeD
,
"var_"
+
nodeD
);
graph
.
createNode
(
true
,
nodeE
,
"var_"
+
nodeE
);
graph
.
connectNode
(
nodeA
,
nodeC
);
graph
.
connectNode
(
nodeB
,
nodeC
);
graph
.
connectNode
(
nodeC
,
nodeE
);
graph
.
connectNode
(
nodeD
,
nodeE
);
graph
.
savePng
(
"testGraph.png"
);
}
int
main
(
int
argc
,
char
**
argv
){
testGraphToDot
();
return
0
;
}
src/list_index_utils_impl.h
0 → 100644
View file @
70bbb9bd
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#ifndef __LIST_INDEX_UTILS_IMPL_H__
#define __LIST_INDEX_UTILS_IMPL_H__
#include "list_index_utils.h"
///Remove index from listIndex
/** @param[out] listIndex : list of index to be modified
* @param index : index to be removed from list of index
*/
template
<
typename
UIdx
>
void
listindex_remove
(
std
::
list
<
UIdx
>
&
listIndex
,
UIdx
index
){
if
(
listIndex
.
size
()
==
0lu
){
return
;}
typename
std
::
list
<
UIdx
>::
iterator
it
(
listIndex
.
begin
());
while
(
it
!=
listIndex
.
end
()){
if
(
*
it
==
index
){
it
=
listIndex
.
erase
(
it
);
}
else
{
++
it
;
}
}
}
#endif
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