note description: "[ Eiffel tests that can be executed by testing tool. ]" author: "EiffelStudio test wizard" date: "$Date$" revision: "$Revision$" testing: "type/manual" class ADJACENCY_MATRIX_WEIGHTED_GRAPH_TEST inherit EQA_TEST_SET feature -- Test routines test_weighted_graph local l_graph: ADJACENCY_MATRIX_WEIGHTED_GRAPH [STRING, STRING] do -- Create the graph create l_graph.make_simple_graph -- Put the nodes into the graph. l_graph.put_node ("a") l_graph.put_node ("b") l_graph.put_edge ("a", "b", "a-b", 5) assert ("Has edge a-b", l_graph.has_edge_between ("a", "b")) l_graph.prune_edge_between ("a", "b") assert ("Not has edge a-b", not l_graph.has_edge_between ("a", "b")) end test_weighted_graph_2 local l_graph: ADJACENCY_MATRIX_WEIGHTED_GRAPH [STRING, STRING] do -- Create the graph create l_graph.make_simple_graph -- Put the nodes into the graph. l_graph.put_node ("a") l_graph.put_node ("b") l_graph.put_node ("c") l_graph.put_node ("d") -- Put the nodes into the graph. l_graph.put_edge ("a", "b", "a-b", 1) l_graph.put_edge ("a", "c", "a-c", 4) l_graph.put_edge ("b", "c", "b-c", 2) l_graph.put_edge ("c", "d", "c-d", 3) assert ("Has edge a-b", l_graph.has_edge_between ("a", "b")) l_graph.prune_edge_between ("a", "b") assert ("Not has edge a-b", not l_graph.has_edge_between ("a", "b")) l_graph.find_path ("a", "b") assert ("Found", not l_graph.path_found) end test_weighted_edge_symmetric_graph local l_graph: ADJACENCY_MATRIX_WEIGHTED_GRAPH [STRING, STRING] do -- Create the graph create l_graph.make_symmetric_graph -- Put the nodes into the graph. l_graph.put_node ("a") l_graph.put_node ("b") l_graph.put_edge ("a", "b", "a-b", 3) assert ("Has edge a-b", l_graph.has_edge_between ("a", "b")) assert ("Has edge b-a", l_graph.has_edge_between ("b", "a")) l_graph.prune_edge_between ("a", "b") assert ("Not has edge a-b", not l_graph.has_edge_between ("a", "b")) assert ("has edge a-b", not l_graph.has_edge_between ("b", "a")) end end