Main Page
Related Pages
Modules
Namespaces
Classes
Files
Namespace List
Namespace Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Functions
test_vector Namespace Reference
Functions
def
test_vector
Function Documentation
def test_vector.test_vector
(
)
Definition at line
7
of file
larcorealg/test/GeoAlgo/test_vector.py
.
7
8
def
test_vector
():
9
10
try
:
11
debug
(
'Testing default constructor'
)
12
k=
geoalgo.Vector
(5)
13
if
not
k.size() == 5:
raise
Exception
14
15
debug
(
'Testing copy ctor'
)
16
j=
geoalgo.Vector
(k)
17
for
x
in
xrange(k.size()):
18
if
not
k[x] == j[x]:
raise
Exception
19
20
for
x
in
xrange(5):
21
k[x] = 1
22
j[x] = 1
23
debug
(
'Testing multiplication'
)
24
k *= 2
25
for
x
in
xrange(5):
26
if
not
k[x] == 2:
raise
Exception
27
28
debug
(
'Testing addition'
)
29
k += j
30
for
x
in
xrange(5):
31
if
not
k[x] == 3:
raise
Exception
32
33
debug
(
'Testing division'
)
34
k /= 3.
35
for
x
in
xrange(5):
36
if
not
k[x] == 1.:
raise
Exception
37
38
debug
(
'Testing dot product'
)
39
if
not
k * j == 5:
raise
Exception
40
41
debug
(
'Testing length'
)
42
for
x
in
xrange(5):
43
k[x] = 0
44
k[0] = 1
45
if
not
k.Length() == 1:
raise
Exception
46
47
debug
(
'Testing compatibility check'
)
48
error=
False
49
try
:
50
k.compat(j)
51
except
Exception:
52
pass
53
if
error:
raise
Exception
54
55
except
Exception:
56
error
(
'geoalgo::Vector unit test failed.'
)
57
print
traceback.format_exception(*sys.exc_info())[2]
58
return
1
59
60
info
(
'geoalgo::Vector unit test complete.'
)
61
return
0
test_msg.error
error
Definition:
larcorealg/test/GeoAlgo/test_msg.py:32
debug
debug
Definition:
icaruscode/test/fcl/testFHiCLfiles.sh:353
test_vector.test_vector
def test_vector
Definition:
larcorealg/test/GeoAlgo/test_vector.py:7
geoalgo::Vector
Definition:
larcorealg/larcorealg/GeoAlgo/GeoVector.h:33
sortDataLoggerFiles.info
tuple info
Definition:
sortDataLoggerFiles.py:393
Generated by
1.8.5