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