trying to use coverage tool with travis

master
dmatetelki 8 years ago
parent eb7f6bc383
commit 035b2b2847

@ -5,12 +5,13 @@ compiler:
- gcc
env:
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
global:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "dG3gXqI65d45f7S6KrlqCgFun0id9Tw5tYOSud9lEYVvri6Qh6nJXEiqqVAsaZhZ7I/0cLMCQNmof3voFmOXpU+3NgQ3+t/vpe6PW65phR5O7hQl05YMApyP5ipq+KozLUL6ZAgX7eaU95rI/iPGYMfcZ2W3Jl7szGpxaZZOKrM="
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
@ -45,4 +46,4 @@ addons:
#build_command_prepend: "./configure; make clean"
build_command_prepend: "cmake ."
build_command: "make -j 4"
branch_pattern: master
branch_pattern: master

@ -1,4 +1,4 @@
Playing with a graph as a data structure and the algorithms.
Build status (on Travis CI) [![Build Status](https://travis-ci.org/cs0rbagomba/graph.png)](https://travis-ci.org/cs0rbagomba/graph)
Coverage status (scan.coverity.com) [![Coverity Status](https://scan.coverity.com/projects/cs0rbagomba/graph)](https://scan.coverity.com/projects/cs0rbagomba-graph)
Coverage status (scan.coverity.com) [![Coverity Status](https://scan.coverity.com/projects/cs0rbagomba/graph.png)](https://scan.coverity.com/projects/cs0rbagomba-graph)

@ -10,11 +10,12 @@
/**
the graph is:
- not weighed
- not directed. There are 2 edges for each connection, both direction
- not directed. There are 2 edges added for each connection, both direction
- no multi/self edges
- Stored as an unordered map where the keys are vertices and values are arrays of edges.
The multimap is picked since neighboursOf is the most critical operation.
- Stored as an \ref std::unordered_map map where the keys are vertices and values are \ref std::vector of edges.
The multimap is picked since \ref neighboursOf is the most critical operation.
@note maybe \ref std::set is a better option for the edges?
- V expected to be cheap to copy
- V should have operator== and be hashable (for the internal std::unordered_map):

@ -96,6 +96,21 @@ TEST_CASE( "Graph creation", "[graph][data_structure]" ) {
}
}
TEST_CASE( "Graph equality", "[graph][data_structure]" ) {
SECTION("Simple comparisions") {
Graph<int> g;
Graph<int> g1 = { {1, 2}, {1, 3}, {3, 4} };
Graph<int> g2 = { {1, 3}, {3, 4}, {1, 2} }; // shuffled g1
Graph<int> g3 = { {3, 1}, {4, 3}, {1, 2} }; // shuffled g1 with switched src,dst
REQUIRE( g == g );
REQUIRE( g != g1 );
REQUIRE( g1 == g2 );
REQUIRE( g1 == g3 );
}
}
TEST_CASE( "Graph adding vertices", "[graph][data_structure]" ) {
SECTION("One element") {

Loading…
Cancel
Save