Robot_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 
14  robot = f2c.Robot(3, 6);
15  near(robot.getWidth(), 3);
16  near(robot.getCovWidth(), 6);
17 
18  r1 = robot;
19  near(r1.getWidth(), 3);
20  near(r1.getCovWidth(), 6);
21 
22  r2 = f2c.Robot(1, 2);
23  near(r2.getWidth(), 1);
24  near(r2.getCovWidth(), 2);
25 
26  r3 = f2c.Robot();
27  near(r3.getWidth(), 0);
28  near(r3.getCovWidth(), 0);
29 
30  r4 = f2c.Robot();
31  r4.setMinTurningRadius(20.0);
32  r4.setMaxDiffCurv(0.2);
33  near(r4.getMaxCurv(), 1/20.0);
34  near(r4.getMaxDiffCurv(), 0.2);
35 
36  with pytest.raises(Exception) as e_info:
37  f2c.Robot(0, 0);
38  with pytest.raises(Exception) as e_info:
39  f2c.Robot(-3, 3);
40  with pytest.raises(Exception) as e_info:
41  f2c.Robot(3, -3);
42 
43 
Robot_test.test_fields2cover_types_robot_init
def test_fields2cover_types_robot_init()
Definition: Robot_test.py:13
Robot_test.near
def near(a, b)
Definition: Robot_test.py:10


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