Point_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 check_point(p, x, y, z):
11  assert pytest.approx(p.getX()) == pytest.approx(x);
12  assert pytest.approx(p.getY()) == pytest.approx(y);
13  assert pytest.approx(p.getZ()) == pytest.approx(z);
14 
16  p1 = f2c.Point(1.1, 2.2, 3.3);
17  p2 = f2c.Point(-0.5, 0.6, 1);
18  p3 = p2 - p1;
19  check_point(p1, 1.1, 2.2, 3.3);
20  check_point(p2, -0.5, 0.6, 1);
21  check_point(p3, -1.6, -1.6, -2.3);
22  p4 = p2 - p1;
23  check_point(p1, 1.1, 2.2, 3.3);
24  check_point(p2, -0.5, 0.6, 1);
25  check_point(p4, -1.6, -1.6, -2.3);
26 
27 
29  p1 = f2c.Point(1.1, 2.2, 3.3);
30  p2 = f2c.Point(-0.5, 0.6, 1);
31  p3 = p2 + p1;
32  check_point(p1, 1.1, 2.2, 3.3);
33  check_point(p2, -0.5, 0.6, 1);
34  check_point(p3, 0.6, 2.8, 4.3);
35 
37  p1 = f2c.Point(1.1, 2.2, 3.3);
38  p1 *= 1.5;
39  check_point(p1, 1.65, 3.3, 4.95);
40 
42  p1 = f2c.Point(1.1, 2.2, 3.3);
43  p2 = p1 * 1.5;
44  check_point(p1, 1.1, 2.2, 3.3);
45  check_point(p2, 1.65, 3.3, 4.95);
46 
47 
48 
Point_test.test_fields2cover_types_point_plus
def test_fields2cover_types_point_plus()
Definition: Point_test.py:28
Point_test.test_fields2cover_types_point_mult_equal
def test_fields2cover_types_point_mult_equal()
Definition: Point_test.py:36
Point_test.test_fields2cover_types_point_multiply
def test_fields2cover_types_point_multiply()
Definition: Point_test.py:41
Point_test.test_fields2cover_types_point_minus
def test_fields2cover_types_point_minus()
Definition: Point_test.py:15
Point_test.check_point
def check_point(p, x, y, z)
Definition: Point_test.py:10


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31