-
Notifications
You must be signed in to change notification settings - Fork 0
Tests pyDocs
shaCode256 edited this page Mar 4, 2021
·
1 revision
TestNodeData()-
Tests that are made to check NodeData functions.
def test_creatingNewNodeAndGetKey(self):
"""
Test that we can create a new NodeData. and get it's key (in the beginning should be 0).
"""
def testCopyNodeData(self):
"""
Tests copy constructor. takes a NodeData named n and copies it into this self NodeData.
@return
"""
def testSetAndGetWeight(self):
"""
Testing set&gets methods of NodeData's weight
"""
def testSetAndGetTag(self):
"""
Testing set&gets methods of NodeData's tag
"""
def testSetAndGetTagB(self):
"""
Testing set&gets methods of NodeData's tag
"""
def testSetAndGetTagB(self):
"""
Testing set&gets methods of NodeData's tagB
"""
def testSetDub(self):
"""
This function tests the setDub function in NodeData
"""
def setCounter(self):
"""
This function tests the setConuter function in NodeData.
"""
TestDiGraph()-
Tests that are made to check DiGraph functions.
def setUp(self):
"""
The method build the central graph for all the tests. is activated before each test
"""
def test_sizes(self):
"""
The central graph contains 15 nodes and 9 edges. Total: 24 ganges. With those data we know to track the changes in the graph
"""
def test_removeEdge(self):
"""Test for removeEdge: in the graph, the dests of node 3 are nodes 2, 10, 13, and the sources of node 2 are nodes 3, 11.
1. remove 3-->2 - true
2. remove 3-->2 - the edge has already removed, false
3. remove 3-->10 - true
4. remove 2-->7 - the edge doesn't exist, false
5. remove 2-->11 - the edge doesn't exist, false
6. remove 11-->2 - true
7. remove 21-->5 - node 21 doesn't exist, false
Now, the graph contains only 6 edges, and it was change more 2 times, total: 27 changes"""
def test_removeNode(self):
"""Test for removeEdge: in the graph, the dests of node 3 are nodes 2, 10, 13, and the sources of node 2 are nodes 3, 11.
1. remove 3-->2 - true
2. remove 3-->2 - the edge has already removed, false
3. remove 3-->10 - true
4. remove 2-->7 - the edge doesn't exist, false
5. remove 2-->11 - the edge doesn't exist, false
6. remove 11-->2 - true
7. remove 21-->5 - node 21 doesn't exist, false
Now, the graph contains only 6 edges, and it was change more 2 times, total: 27 changes"""
TestGraphAlgo()- Tests that are made to check GraphAlgo functions.
def setUp(self):
"""The method creates 3 graphs for this unittest. connected graph and the other one isn't connected and
the last one is scc_graph. algo initialized on connected. is activated before each test"""
def tearDown(self):
"""This method is activated after eatch test is done, to calculate the time it ran"""
def test_save_load(self):
"""Initialization algo on Connected. Then, save Connected in file whose name is "OurGraph".
After this, replace the graph of algo to is_not_onnected.
Load algo on "myGraph" file. Now, algo operates Connected again, instead of is_not_onnected."""
def test_shortest_path_list(self):
"""Creating a graph and checking the shortestPathDist on it"""
def test_shortest_path_dist(self):
"""Creating a graph and checking the shortestPath on it"""
def test_scc(self):
"""Test for SCC:
1. print all the SCC's in connected: we have only one SCC, because the graph is connected
2. init algo on scc_graph
3. print all the SCC's in scc_graph
4. print SCC's of 0, 4, 3
5. check if we have 4 SCC in our graph
6. check if nodes 6, 8 have same SCC"""
def test_shortestPathCompare1(self):
"""Runs the shortestPath method from this project's algo, and runs it also through
netWorkX, to compare results and performance. runs on graph: G_10_80_1.json """
def test_shortestPathCompare2(self):
"""Runs the shortestPath method from this project's algo, and runs it also through
netWorkX, to compare results and performance. runs on graph: G_100_800_1.json """
def test_shortestPathCompare3(self):
"""Runs the shortestPath method from this project's algo, and runs it also through
netWorkX, to compare results and performance. runs on graph: G_1000_8000_1.json """
def test_shortestPathCompare4(self):
"""Runs the shortestPath method from this project's algo, and runs it also through
netWorkX, to compare results and performance. runs on graph: G_10000_80000_1.json """
def test_shortestPathCompare5(self):
"""Runs the shortestPath method from this project's algo, and runs it also through
netWorkX, to compare results and performance. runs on graph: G_20000_160000_1.json """
def test_shortestPathCompare6(self):
"""Runs the shortestPath method from this project's algo, and runs it also through
netWorkX, to compare results and performance. runs on graph: G_30000_240000_1.json """