Skip to content

Commit 3a1d97d

Browse files
committed
Move files to framework sub folder + add old test file and README.md
1 parent 20a429e commit 3a1d97d

File tree

10 files changed

+49
-5
lines changed

10 files changed

+49
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ $ mkdir build && cd build
55
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ../
66
$ make
77
```
8-
The unit tests in the test directory shows you how to use certain parts of the colouring algorithm.
9-
The File [tests/io/graph_io_test.cpp](tests/io/graph_io_test.cpp), for instance, contains an example how to use graph data structure.
8+
9+
File [tests/main.cpp] [tests/main.cpp] contains an example how to use graph data structure.
1010

1111
```sh
1212
$ build/tests/test_graph input/cti.graph
@@ -21,4 +21,4 @@ So far these are the graphs from the DIMACS coloring chalenge. You can find desc
2121

2222
# Benchmarking
2323
Please create your own branch with the name <your_surname>.
24-
You can write scripts that can be executed on the benchmark server in [test.sh](test.sh). Every file that is in ```results/``` after your script will be downloadable later - so output your timings there! To run your benchmarks and get your results, click on "Pipelines". Click on the arrow next to your commit and select "benchmark". Once your run finishes, it will say "passed". Click on "passed" -> "benchmark". Here you can see the output of your script. On the right hand side there is a link "Download" where you can download an archive with your files.
24+
You can write scripts that can be executed on the benchmark server in [test.sh](test.sh). Every file that is in ```results/``` after your script will be downloadable later - so output your timings there! To run your benchmarks and get your results, click on "Pipelines". Click on the arrow next to your commit and select "benchmark". Once your run finishes, it will say "passed". Click on "passed" -> "benchmark". Here you can see the output of your script. On the right hand side there is a link "Download" where you can download an archive with your files.

tests/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ include_directories(SYSTEM "${googletest_SOURCE_DIR}/googlemock/include")
1616
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
1717

1818
file(GLOB_RECURSE TEST_SRCS
19-
"*.cpp")
19+
"framework/*.cpp"
20+
"test_main.cpp")
2021

22+
# Google Test executable
2123
add_executable(colouring_test ${INCLUDE} ${TEST_SRCS})
2224
target_link_libraries(colouring_test ${CORE_LIBS} gtest gmock)
23-
add_test(colouring_test colouring_test)
25+
add_test(colouring_test colouring_test)
26+
27+
#Just a simple test file
28+
add_executable(main ${INCLUDE} main.cpp)
29+
target_link_libraries(main ${CORE_LIBS})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/main.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <data_structure/graph.h>
2+
#include <data_structure/io/graph_io.h>
3+
4+
#include <iostream>
5+
6+
int main(int argc, const char* argv[]) {
7+
graph_access G;
8+
std::string graph_filename = argv[1];
9+
10+
graph_io::readGraphWeighted(G, graph_filename);
11+
12+
size_t num_nodes = 0;
13+
for(NodeID n = 0; n < G.number_of_nodes(); ++n) {
14+
++num_nodes;
15+
}
16+
17+
size_t num_edges = 0;
18+
for(NodeID n = 0; n < G.number_of_nodes(); ++n) {
19+
for (auto neighbour : G.neighbours(n)) {
20+
++num_edges;
21+
}
22+
}
23+
24+
if (num_edges != G.number_of_edges()) {
25+
std::cout << "Error!" << std::endl;
26+
}
27+
28+
num_edges = 0;
29+
for(NodeID n = 0; n < G.number_of_nodes(); ++n) {
30+
num_edges += G.getNodeDegree(n);
31+
}
32+
33+
if (num_edges != G.number_of_edges()) {
34+
std::cout << "Error!" << std::endl;
35+
}
36+
37+
std::cout << "Max degree = " << G.getMaxDegree() << std::endl;
38+
}

0 commit comments

Comments
 (0)