Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
test_specific_cases.py
1
35
36
from
pytest
import
approx
37
from
visp.core
import
Math, ImagePoint, ColVector, ThetaUVector, Point
38
def
test_tuple_return_basic_values_only_output
():
39
'''
40
Test that a function that was with signature
41
double lineFitting(const std::vector<...>& imPts, double& a, double& b, double& c)
42
is now (with custom configuration) with a signature lineFitting(imPts) -> tuple[double * 4]
43
44
all the reference parameters are used as outputs but not as inputs
45
46
'''
47
a = 45.0
48
b = 52.0
49
points = [
50
ImagePoint(a*i+b, i)
for
i
in
range(3)
51
]
52
res = Math.lineFitting(points)
53
print(res)
54
values = (res[0], -res[1] / res[2], res[3] / res[2])
55
expected = (0, a, b)
56
for
i, (val, exp)
in
enumerate(zip(values, expected)):
57
print(i)
58
assert
val == approx(exp, 0.0001)
59
60
def
test_tuple_return_basic_values_only_output_2
():
61
theta = 3.14
62
vec = [0.0, 0.0, 1.0]
63
thetau = ThetaUVector(*[v * theta
for
v
in
vec])
64
theta_out, vec_out = thetau.extract()
65
assert
theta_out == theta
66
assert
vec_out == ColVector(vec)
67
68
def
test_pass_by_ref
():
69
values = [0, 1, 2]
70
p = Point(values)
71
vec_ref = ColVector()
72
p.getWorldCoordinates(vec_ref)
73
assert
vec_ref == p.getWorldCoordinates()
74
75
def
test_tuple_return_basic_values_mixed
():
76
pass
test_specific_cases.test_tuple_return_basic_values_only_output_2
test_tuple_return_basic_values_only_output_2()
Definition
test_specific_cases.py:60
test_specific_cases.test_tuple_return_basic_values_mixed
test_tuple_return_basic_values_mixed()
Definition
test_specific_cases.py:75
test_specific_cases.test_pass_by_ref
test_pass_by_ref()
Definition
test_specific_cases.py:68
test_specific_cases.test_tuple_return_basic_values_only_output
test_tuple_return_basic_values_only_output()
Definition
test_specific_cases.py:38
modules
python
test
test_specific_cases.py
Generated by
1.17.0