Beispiel #1
0
 def test_simple_V2E3(self):
     bException = False
     try:
         self.simple = generators.simple(3, 2)
     except ValueError:
         bException = True
     self.assertTrue(self.simple is not None and bException is False)
Beispiel #2
0
 def test_simple_V2E2(self):
     bException = False
     try:
         self.simple = generators.simple(1, 1)
     except ValueError:
         bException = True
     self.assertTrue(self.simple is None and bException is True)
Beispiel #3
0
 def test_simple_V1E1(self):
     bException = False
     try:
         self.simple = generators.simple(-1, -1)
     except ValueError:
         bException = True
     self.assertTrue(self.simple is None and bException)
Beispiel #4
0
 def test_simple_valid_values(self):
     #On teste tous les nombres d'arêtes possibles pour le nombre de sommets choisi
     for nbVertices in range(0, 10):
         for nbEdges in range(0, nbVertices * (nbVertices - 1) // 2):
             graph = generators.simple(nbVertices, nbEdges)
             self.assertEqual(graph.V(), nbVertices)
             self.assertEqual(graph.E(), nbEdges)
    def test_simple_graph_vertices_equals_edges(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(2, 2)
        except:
            exceptionWasRaised = True

        self.assertFalse(exceptionWasRaised and self.simpleGraph is not None)
    def test_simple_graph_vertices_smaller_than_edges(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(2, 4)
        except:
            exceptionWasRaised = True

        self.assertTrue(exceptionWasRaised)
    def test_simple_graph_number_of_edges_equals_zero(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(4, 0)
        except:
            exceptionWasRaised = True

        self.assertFalse(exceptionWasRaised)
    def test_simple_graph_number_of_vertices_equals_zero(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(0, 4)
        except Exception as ex:
            exceptionWasRaised = True

        self.assertTrue(exceptionWasRaised)
    def test_simple_graph_number_of_vertices_is_less_than_zero(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(-1, 4)
        except Exception:
            exceptionWasRaised = True

        self.assertTrue(exceptionWasRaised)
Beispiel #10
0
    def test_simple_graph_E_greater_than_G1(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(4, 4)
        except:
            exceptionWasRaised = True

        self.assertFalse(exceptionWasRaised
                         and self.simpleGraphWithProbility is not None)
Beispiel #11
0
    def test_simple_graph_E_smaller_than_zero(self):
        exceptionWasRaised = False

        try:
            self.simpleGraph = simple(4, -1.0)
        except:
            exceptionWasRaised = True

        self.assertTrue(exceptionWasRaised
                        and self.simpleGraphWithProbility is None)
    def test_simple_graph_v_greater_than_e(self):
        exceptionWasRaised = False

        try:
            # <{v = 4}, {e = 2}>
            self.simpleGraph = simple(4, 2)
        except Exception:
            exceptionWasRaised = True

        self.assertTrue(self.simpleGraph is not None
                        and exceptionWasRaised is False)