File tree 5 files changed +22
-20
lines changed
5 files changed +22
-20
lines changed Original file line number Diff line number Diff line change 1
1
#include < benchmark/benchmark.h>
2
2
#include < string>
3
3
#include < delaunator.hpp>
4
- #include " ../test/test_utils .hpp"
4
+ #include " ../examples/utils .hpp"
5
5
6
- static void BM_simple (benchmark::State& state) // NOLINT google-runtime-references
7
- {
8
- std::string points_str = test_utils::read_file (" ./test/test-files/osm-nodes-45331-epsg-3857.geojson" );
9
- std::vector<double > coords = test_utils::get_geo_json_points (points_str);
10
-
11
- while (state.KeepRunning ())
6
+ namespace {
7
+ void BM_simple (benchmark::State& state)
12
8
{
13
- delaunator::Delaunator delaunator (coords);
9
+ std::string points_str = utils::read_file (" ./test/test-files/osm-nodes-45331-epsg-3857.geojson" );
10
+ std::vector<double > coords = utils::get_geo_json_points (points_str);
11
+
12
+ while (state.KeepRunning ())
13
+ {
14
+ delaunator::Delaunator delaunator (coords);
15
+ }
14
16
}
15
17
}
16
18
17
19
int main (int argc, char * argv[])
18
20
{
19
- benchmark::RegisterBenchmark (" BM_simple" , BM_simple); // NOLINT clang-analyzer-cplusplus.NewDeleteLeaks
21
+ benchmark::RegisterBenchmark (" BM_simple" , BM_simple);
20
22
benchmark::Initialize (&argc, argv);
21
23
benchmark::RunSpecifiedBenchmarks ();
22
24
Original file line number Diff line number Diff line change 1
1
#include " rapidjson/document.h"
2
2
#include " rapidjson/prettywriter.h"
3
3
#include < delaunator.hpp>
4
- #include " ../../test/test_utils .hpp"
4
+ #include " ../utils .hpp"
5
5
#include < cstdio>
6
6
#include < fstream>
7
7
#include < vector>
@@ -62,8 +62,8 @@ std::string serialize_to_json(delaunator::Delaunator const& delaunator) {
62
62
int main (int , char * argv[]) {
63
63
const char * filename = argv[1 ];
64
64
const char * output = argv[2 ];
65
- std::string json = test_utils ::read_file (filename);
66
- std::vector<double > coords = test_utils ::get_geo_json_points (json);
65
+ std::string json = utils ::read_file (filename);
66
+ std::vector<double > coords = utils ::get_geo_json_points (json);
67
67
delaunator::Delaunator delaunator (coords);
68
68
const char * out_json = serialize_to_json (delaunator).c_str ();
69
69
Original file line number Diff line number Diff line change 2
2
#include < stdexcept>
3
3
#include " rapidjson/document.h"
4
4
5
- namespace test_utils {
5
+ namespace utils {
6
6
7
7
std::string read_file (const char * filename) {
8
8
std::ifstream input_file (filename);
@@ -53,4 +53,4 @@ std::vector<double> get_array_points(std::string const& json) {
53
53
54
54
}
55
55
56
- } // end ns test_utils
56
+ } // end ns utils
Original file line number Diff line number Diff line change 1
1
#include < delaunator.hpp>
2
2
#include < catch.hpp>
3
- #include " test_utils .hpp"
3
+ #include " ../examples/utils .hpp"
4
4
5
5
namespace {
6
6
void validate (const std::vector<double > &coords) {
@@ -19,18 +19,18 @@ namespace {
19
19
}
20
20
21
21
TEST_CASE (" triangles match JS version ouput" , " [Delaunator]" ) {
22
- std::string points_str = test_utils ::read_file (" ./test/test-files/playgrounds-1356-epsg-3857.geojson" );
23
- std::string triangles_str = test_utils ::read_file (" ./test/test-files/playgrounds-1356-triangles.json" );
24
- std::vector<double > coords = test_utils ::get_geo_json_points (points_str);
25
- std::vector<double > triangles = test_utils ::get_array_points (triangles_str);
22
+ std::string points_str = utils ::read_file (" ./test/test-files/playgrounds-1356-epsg-3857.geojson" );
23
+ std::string triangles_str = utils ::read_file (" ./test/test-files/playgrounds-1356-triangles.json" );
24
+ std::vector<double > coords = utils ::get_geo_json_points (points_str);
25
+ std::vector<double > triangles = utils ::get_array_points (triangles_str);
26
26
delaunator::Delaunator delaunator (coords);
27
27
28
28
SECTION (" length of triangles is the same" ) {
29
29
REQUIRE (delaunator.triangles .size () == triangles.size ());
30
30
}
31
31
32
32
SECTION (" values are the same" ) {
33
- for (size_t i = 0 ; i < triangles.size (); i++)
33
+ for (std:: size_t i = 0 ; i < triangles.size (); i++)
34
34
{
35
35
REQUIRE (delaunator.triangles [i] == Approx (triangles[i]));
36
36
}
File renamed without changes.
You can’t perform that action at this time.
0 commit comments