File: multi_line_string.cpp

package info (click to toggle)
mapbox-geometry 2.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 304 kB
  • sloc: cpp: 1,563; sh: 150; makefile: 37
file content (61 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
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
#include <catch.hpp>
#include <mapbox/geometry/multi_line_string.hpp>

using mapbox::geometry::line_string;
using mapbox::geometry::multi_line_string;
using mapbox::geometry::point;

TEST_CASE("test multi line string - double")
{
    multi_line_string<double> mls1;
    CHECK(mls1.empty());

    line_string<double> ls1;
    point<double> p1(1.5, 1.6);
    point<double> p2(2.4, 1.9);
    ls1.push_back(p1);
    ls1.push_back(p2);
    mls1.push_back(ls1);
    CHECK(mls1.size() == 1);

    mls1.emplace_back();
    CHECK(mls1.size() == 2);

    multi_line_string<double> mls2(std::size_t(10));
    CHECK(mls2.size() == 10);

    CHECK(mls1 == mls1);
    CHECK(!(mls1 != mls1));
    CHECK(mls1 != mls2);
}

TEST_CASE("test multi line string - int64_t")
{
    multi_line_string<int64_t> mls1;
    CHECK(mls1.empty());

    line_string<int64_t> ls1;
    point<int64_t> p1(1, 2);
    point<int64_t> p2(3, 4);
    ls1.push_back(p1);
    ls1.push_back(p2);
    mls1.push_back(ls1);
    CHECK(mls1.size() == 1);

    mls1.emplace_back();
    auto& ls2 = mls1.back();
    ls2.emplace_back(10, 5);
    ls2.emplace_back(9, 8);
    ls2.emplace_back(-4, 5);
    CHECK(mls1.size() == 2);

    multi_line_string<int64_t> mls2(std::size_t(10));
    CHECK(mls2.size() == 10);

    CHECK(mls1 == mls1);
    CHECK(!(mls1 != mls1));
    CHECK(mls1 != mls2);

    multi_line_string<int64_t> mls3 = {{{1, 2}, {3, 4}}, {{10, 5}, {9, 8}, {-4, 5}}};
    CHECK(mls1 == mls3);
}