tests
python
types
LineString_test.py
Go to the documentation of this file.
1
#==============================================================================
2
# Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3
# Author: Gonzalo Mier
4
# BSD-3 License
5
#==============================================================================
6
7
import
pytest
8
import
fields2cover
as
f2c
9
10
def
near
(a, b):
11
assert
pytest.approx(a) == pytest.approx(b)
12
13
14
def
test_fields2cover_types_linestring_init
():
15
line1 = f2c.LineString();
16
line1.addPoint(1,1);
17
line1.addPoint(2,1);
18
near
(line1.size(), 2);
19
line2 = f2c.LineString(f2c.VectorPoint([f2c.Point(1,2), f2c.Point(3,2), f2c.Point(1,3)]));
20
near
(line2.size(), 3);
21
near
(line2.getX(0), 1);
22
near
(line2.getX(1), 3);
23
24
def
test_fields2cover_types_linestring_add
():
25
p1 = f2c.Point(1,2,3)
26
p2 = f2c.Point(2,1,3)
27
p3 = f2c.Point(0,0,0)
28
line = f2c.LineString()
29
line.addPoint(p2)
30
line.addPoint(p3)
31
line2 = line + p1
32
near
(line2.size(), 2);
33
near
(line2.getX(0), 3);
34
near
(line2.getX(1), 1);
35
near
(line2.getY(0), 3);
36
near
(line2.getY(1), 2);
37
near
(line2.getZ(0), 6);
38
near
(line2.getZ(1), 3);
39
40
41
42
43
44
LineString_test.near
def near(a, b)
Definition:
LineString_test.py:10
LineString_test.test_fields2cover_types_linestring_add
def test_fields2cover_types_linestring_add()
Definition:
LineString_test.py:24
LineString_test.test_fields2cover_types_linestring_init
def test_fields2cover_types_linestring_init()
Definition:
LineString_test.py:14
fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31