Fix formating

This commit is contained in:
Patrick Niklaus
2018-03-22 18:26:40 +00:00
parent 993f5badf1
commit c0dd5d7c76
39 changed files with 244 additions and 149 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
struct TemporaryFile
{
TemporaryFile() : path(boost::filesystem::unique_path()) {}
TemporaryFile(const std::string& path) : path(path){}
TemporaryFile(const std::string &path) : path(path) {}
~TemporaryFile() { boost::filesystem::remove(path); }
+7 -4
View File
@@ -7,7 +7,6 @@
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(tar)
using namespace osrm;
@@ -25,7 +24,7 @@ BOOST_AUTO_TEST_CASE(read_write_hsgr)
TestEdge{3, 1, 1},
TestEdge{4, 3, 1},
TestEdge{5, 1, 1}};
auto reference_graph = QueryGraph {6, toEdges<QueryEdge>(makeGraph(edges))};
auto reference_graph = QueryGraph{6, toEdges<QueryEdge>(makeGraph(edges))};
std::vector<std::vector<bool>> reference_filters = {
{false, false, true, true, false, false, true},
{true, false, true, false, true, false, true},
@@ -33,8 +32,12 @@ BOOST_AUTO_TEST_CASE(read_write_hsgr)
{true, true, true, true, true, true, true},
};
TemporaryFile tmp {TEST_DATA_DIR "/read_write_hsgr_test.osrm.hsgr"};
contractor::files::writeGraph(tmp.path, reference_checksum, reference_graph, reference_filters, reference_connectivity_checksum);
TemporaryFile tmp{TEST_DATA_DIR "/read_write_hsgr_test.osrm.hsgr"};
contractor::files::writeGraph(tmp.path,
reference_checksum,
reference_graph,
reference_filters,
reference_connectivity_checksum);
unsigned checksum;
unsigned connectivity_checksum;
+6 -4
View File
@@ -22,17 +22,19 @@ inline contractor::ContractorGraph makeGraph(const std::vector<TestEdge> &edges)
std::tie(start, target, weight) = edge;
max_id = std::max(std::max(start, target), max_id);
input_edges.push_back(contractor::ContractorEdge{
start, target, contractor::ContractorEdgeData{weight, weight * 2, id++, 0, false, true, false}});
start,
target,
contractor::ContractorEdgeData{weight, weight * 2, id++, 0, false, true, false}});
input_edges.push_back(contractor::ContractorEdge{
target, start, contractor::ContractorEdgeData{weight, weight * 2, id++, 0, false, false, true}});
target,
start,
contractor::ContractorEdgeData{weight, weight * 2, id++, 0, false, false, true}});
}
std::sort(input_edges.begin(), input_edges.end());
return contractor::ContractorGraph{max_id + 1, std::move(input_edges)};
}
}
}
#endif
+2 -2
View File
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(check_name_table_fill)
"X", "Y", "Z", "", "", "", "", "", "", "", "0", ""};
auto data = PrapareNameTableData(expected_names, true);
NameTable name_table {data};
NameTable name_table{data};
for (std::size_t index = 0; index < expected_names.size(); ++index)
{
@@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(check_name_table_nofill)
"X", "Y", "Z", "", "", "", "", "", "", "", "0", ""};
auto data = PrapareNameTableData(expected_names, false);
NameTable name_table {data};
NameTable name_table{data};
// CALLGRIND_START_INSTRUMENTATION;
for (std::size_t index = 0; index < expected_names.size(); ++index)
+5 -2
View File
@@ -56,8 +56,11 @@ BOOST_AUTO_TEST_CASE(tar_serialize_int_vector)
{
TemporaryFile tmp;
{
std::vector<std::vector<int>> data = {
{}, {0}, {1, -2, 3}, {4, -5, 6, -7, 8, -9, 10, -11}, {-12, 13, -14, 15, -16, 17, -18, 19, -20}};
std::vector<std::vector<int>> data = {{},
{0},
{1, -2, 3},
{4, -5, 6, -7, 8, -9, 10, -11},
{-12, 13, -14, 15, -16, 17, -18, 19, -20}};
for (const auto &v : data)
{
{
+72 -8
View File
@@ -97,13 +97,76 @@ BOOST_AUTO_TEST_CASE(continue_write_tar_file)
TemporaryFile tmp{TEST_DATA_DIR "/tar_continue_write_test.tar"};
// more than 64 values to ensure we fill up more than one tar block of 512 bytes
std::vector<std::uint64_t> vector_64bit = {
0, 1, 2, 3, 4, 1ULL << 62, 0, 1 << 22, 0xFFFFFFFFFFFFFFFF, 0xFF00FF0000FF00FF, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70
};
std::vector<std::uint64_t> vector_64bit = {0,
1,
2,
3,
4,
1ULL << 62,
0,
1 << 22,
0xFFFFFFFFFFFFFFFF,
0xFF00FF0000FF00FF,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70};
{
storage::tar::FileWriter writer(tmp.path, storage::tar::FileWriter::GenerateFingerprint);
@@ -111,7 +174,8 @@ BOOST_AUTO_TEST_CASE(continue_write_tar_file)
writer.WriteFrom("baz/bla/64bit_vector", vector_64bit.data(), 12);
writer.ContinueFrom("baz/bla/64bit_vector", vector_64bit.data() + 12, 30);
writer.ContinueFrom("baz/bla/64bit_vector", vector_64bit.data() + 42, 10);
writer.ContinueFrom("baz/bla/64bit_vector", vector_64bit.data() + 52, vector_64bit.size() - 52);
writer.ContinueFrom(
"baz/bla/64bit_vector", vector_64bit.data() + 52, vector_64bit.size() - 52);
}
storage::tar::FileReader reader(tmp.path, storage::tar::FileReader::VerifyFingerprint);
+2 -2
View File
@@ -32,8 +32,8 @@ BOOST_AUTO_TEST_CASE(io_data)
{
osrm::storage::io::FileWriter outfile(IO_TMP_FILE,
osrm::storage::io::FileWriter::GenerateFingerprint);
outfile.WriteElementCount64(data_in.size());
outfile.WriteFrom(data_in.data(), data_in.size());
outfile.WriteElementCount64(data_in.size());
outfile.WriteFrom(data_in.data(), data_in.size());
}
osrm::storage::io::FileReader infile(IO_TMP_FILE,
+5 -7
View File
@@ -86,17 +86,15 @@ BOOST_AUTO_TEST_CASE(tar_serialize_variable_indexed_data)
std::vector<std::vector<unsigned>> offset_data = {
{5, 8, 8},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
};
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}};
std::vector<std::string> char_data = {
"HalloFoo",
"ABCDEFGHIJKLMNOPQR",
"ABCDEFGHIJKLMNOP",
"HalloFoo", "ABCDEFGHIJKLMNOPQR", "ABCDEFGHIJKLMNOP",
};
for (const auto i : util::irange<std::size_t>(0, offset_data.size()))
{
TestIndexedData indexed {offset_data[i].begin(), offset_data[i].end(), char_data[i].begin()};
TestIndexedData indexed{
offset_data[i].begin(), offset_data[i].end(), char_data[i].begin()};
{
storage::tar::FileWriter writer(tmp.path,
storage::tar::FileWriter::GenerateFingerprint);
@@ -107,7 +105,7 @@ BOOST_AUTO_TEST_CASE(tar_serialize_variable_indexed_data)
storage::tar::FileReader reader(tmp.path, storage::tar::FileReader::VerifyFingerprint);
util::serialization::read(reader, "my_indexed_data", result);
for(auto j : util::irange<std::size_t>(0, offset_data[i].size() - 1))
for (auto j : util::irange<std::size_t>(0, offset_data[i].size() - 1))
{
BOOST_CHECK_EQUAL(indexed.at(j), result.at(j));
}
+1 -1
View File
@@ -7,8 +7,8 @@
#include "util/rectangle.hpp"
#include "util/typedefs.hpp"
#include "mocks/mock_datafacade.hpp"
#include "../common/temporary_file.hpp"
#include "mocks/mock_datafacade.hpp"
#include <boost/functional/hash.hpp>
#include <boost/test/auto_unit_test.hpp>