jeudi 27 octobre 2016

How to test methods of heavy data structures using Google Test?

Suppose we have the following class:

class Graph {
 public:

  Graph(int num_vertices, int num_edges, const EdgeList& edge_list)
    : num_vertices_(num_vertices), num_edges_(num_edges), edge_list_(edge_list) { }

  int GetNumberOfComponents() { ... }

 private:
  int num_vertices_;
  int num_edges_;
  EdgeList edge_list;
}

The goal is to check that GetNumberOfComponents() works correctly using Google Test framework.

Please provide below the code how we can test the method in case Graph contains 1000 vertices and 10000 edges for example.

Aucun commentaire:

Enregistrer un commentaire