Commits

German Larrain committed 0143e55

tests: renamed files 'utilities_x.py' to 'utils_x.py'

  • Participants
  • Parent commits 0743fbd

Comments (0)

Files changed (8)

File tests/utilities_containers.py

-
-# Created on 2012.05.03
-#
-# @author: german
-
-import ars.utils.containers as cont
-
-def test_Queue():
-	q = cont.Queue()
-	print(q.is_empty())
-	print(q.count())
-
-	q.put('first element')
-	q.put('second')
-	q.put(('third', {'key 1': 1, 'another key': []}))
-	print(q.count())
-
-	print(q.pull())
-	print(q.pull())
-
-	print(q.count())
-	q.put('after some pulls')
-	print(q.count())
-
-	print(q.pull())
-	print(q.pull())
-	print(q.count())
-
-if __name__ == "__main__":
-	test_Queue()

File tests/utilities_generic.py

-
-# Created on 2012.05.03
-#
-# @author: german
-
-import ars.utils.generic as gen
-
-def test_get_current_epoch_time():
-	print(repr(gen.get_current_epoch_time()))
-	print(repr(gen.get_current_epoch_time()))
-
-if __name__ == "__main__":
-	test_get_current_epoch_time()

File tests/utilities_geometry.py

-
-# TODO: create a test for calc_rotation_matrix
-
-import numpy as np
-
-import ars.utils.geometry as gemut
-import ars.utils.mathematical as mut
-
-
-def _test_Transform():
-
-	pos = (10,20,30)
-	rot = (0,0,1,1,0,0,0,1,0)
-	t = gemut.Transform(pos, rot)
-
-	print(pos)
-	print(rot)
-	print(t)
-	print(t.get_long_tuple())
-
-def _test_rot_matrix_to_hom_transform():
-
-	rot1 = np.mat([[1,2,3],[4,5,6],[7,8,9]])
-	rot2 = ((1,2,3),(4,5,6),(7,8,9))
-	rot3 = (1,2,3,4,5,6,7,8,9)
-	ht1 = gemut.rot_matrix_to_hom_transform(rot1)
-	ht2 = gemut.rot_matrix_to_hom_transform(rot2)
-	ht3 = gemut.rot_matrix_to_hom_transform(rot3)
-
-	#print(rot1)
-	#print(rot2)
-	print(ht1)
-	print(ht2)
-	print(ht3)
-
-def test_calc_inclination(axis, angle, correct):
-	#axis = mut.upAxis
-	#angle = mut.pi/4
-	rot_matrix = gemut.calc_rotation_matrix(axis, angle)
-	res = gemut.calc_inclination(rot_matrix, mut.upAxis)
-	print('angle: %f' % angle)
-	print('tilt: %f' % res)
-	print('error: %f' % (correct - res))
-	print('')
-
-if __name__ == "__main__":
-
-	_test_rot_matrix_to_hom_transform()
-
-	_test_Transform()
-
-	# rotation around axii perpendicular to the ground does not affect
-	# the inclination
-	test_calc_inclination(mut.upAxis, mut.pi/4, 0)
-	test_calc_inclination(mut.upAxis, 3*mut.pi/9, 0)
-	test_calc_inclination(mut.upAxis, -mut.pi/8, 0)
-	test_calc_inclination(mut.downAxis, mut.pi/4, 0)
-	test_calc_inclination(mut.downAxis, 3*mut.pi/9, 0)
-	test_calc_inclination(mut.downAxis, -mut.pi/8, 0)
-
-	test_calc_inclination(mut.rightAxis, mut.pi/6, mut.pi/6)
-	test_calc_inclination(mut.rightAxis, 3*mut.pi/9, 3*mut.pi/9)
-	test_calc_inclination(mut.rightAxis, -mut.pi/8, -mut.pi/8)

File tests/utilities_mathematical.py

-
-# Created on 2011.12.01
-#
-# @author: german
-
-import ars.utils.mathematical as mut
-
-def test_matrix_multiply():
-	print (mut.matrix3_multiply(((2,0,0),(0,1,0),(0,0,1)), ((1,0,0),(0,2,0),(0,0,1))))
-
-if __name__ == "__main__":
-	#import sys;sys.argv = ['', 'Test.testName']
-	test_matrix_multiply()

File tests/utils_containers.py

+
+# Created on 2012.05.03
+#
+# @author: german
+
+import ars.utils.containers as cont
+
+def test_Queue():
+	q = cont.Queue()
+	print(q.is_empty())
+	print(q.count())
+
+	q.put('first element')
+	q.put('second')
+	q.put(('third', {'key 1': 1, 'another key': []}))
+	print(q.count())
+
+	print(q.pull())
+	print(q.pull())
+
+	print(q.count())
+	q.put('after some pulls')
+	print(q.count())
+
+	print(q.pull())
+	print(q.pull())
+	print(q.count())
+
+if __name__ == "__main__":
+	test_Queue()

File tests/utils_generic.py

+
+# Created on 2012.05.03
+#
+# @author: german
+
+import ars.utils.generic as gen
+
+def test_get_current_epoch_time():
+	print(repr(gen.get_current_epoch_time()))
+	print(repr(gen.get_current_epoch_time()))
+
+if __name__ == "__main__":
+	test_get_current_epoch_time()

File tests/utils_geometry.py

+
+# TODO: create a test for calc_rotation_matrix
+
+import numpy as np
+
+import ars.utils.geometry as gemut
+import ars.utils.mathematical as mut
+
+
+def _test_Transform():
+
+	pos = (10,20,30)
+	rot = (0,0,1,1,0,0,0,1,0)
+	t = gemut.Transform(pos, rot)
+
+	print(pos)
+	print(rot)
+	print(t)
+	print(t.get_long_tuple())
+
+def _test_rot_matrix_to_hom_transform():
+
+	rot1 = np.mat([[1,2,3],[4,5,6],[7,8,9]])
+	rot2 = ((1,2,3),(4,5,6),(7,8,9))
+	rot3 = (1,2,3,4,5,6,7,8,9)
+	ht1 = gemut.rot_matrix_to_hom_transform(rot1)
+	ht2 = gemut.rot_matrix_to_hom_transform(rot2)
+	ht3 = gemut.rot_matrix_to_hom_transform(rot3)
+
+	#print(rot1)
+	#print(rot2)
+	print(ht1)
+	print(ht2)
+	print(ht3)
+
+def test_calc_inclination(axis, angle, correct):
+	#axis = mut.upAxis
+	#angle = mut.pi/4
+	rot_matrix = gemut.calc_rotation_matrix(axis, angle)
+	res = gemut.calc_inclination(rot_matrix, mut.upAxis)
+	print('angle: %f' % angle)
+	print('tilt: %f' % res)
+	print('error: %f' % (correct - res))
+	print('')
+
+if __name__ == "__main__":
+
+	_test_rot_matrix_to_hom_transform()
+
+	_test_Transform()
+
+	# rotation around axii perpendicular to the ground does not affect
+	# the inclination
+	test_calc_inclination(mut.upAxis, mut.pi/4, 0)
+	test_calc_inclination(mut.upAxis, 3*mut.pi/9, 0)
+	test_calc_inclination(mut.upAxis, -mut.pi/8, 0)
+	test_calc_inclination(mut.downAxis, mut.pi/4, 0)
+	test_calc_inclination(mut.downAxis, 3*mut.pi/9, 0)
+	test_calc_inclination(mut.downAxis, -mut.pi/8, 0)
+
+	test_calc_inclination(mut.rightAxis, mut.pi/6, mut.pi/6)
+	test_calc_inclination(mut.rightAxis, 3*mut.pi/9, 3*mut.pi/9)
+	test_calc_inclination(mut.rightAxis, -mut.pi/8, -mut.pi/8)

File tests/utils_mathematical.py

+
+# Created on 2011.12.01
+#
+# @author: german
+
+import ars.utils.mathematical as mut
+
+def test_matrix_multiply():
+	print (mut.matrix3_multiply(((2,0,0),(0,1,0),(0,0,1)), ((1,0,0),(0,2,0),(0,0,1))))
+
+if __name__ == "__main__":
+	#import sys;sys.argv = ['', 'Test.testName']
+	test_matrix_multiply()