Commit 70bbb9bd authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add test with string as index, OK

parent a684216a
......@@ -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)
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)
/***************************************
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;
}
/***************************************
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
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