1111 If a test passes for correspondent component, a 1 is returned.
1212 If no test was executed on that component, 0 is preserved.
1313"""
14+ import logging
1415from coderbot import CoderBot
1516
1617# Single components tests
@@ -20,70 +21,70 @@ def __test_encoder():
2021 try :
2122 c = CoderBot .get_instance ()
2223 # moving both wheels at speed 100 clockwise
23- print ("moving both wheels at speed 100 clockwise" )
24+ logging . info ("moving both wheels at speed 100 clockwise" )
2425 assert (c .speed () == 0 )
2526 c .move (speed = 100 , elapse = 2 )
2627 assert (c .distance () != 0 )
2728 assert (c .speed () == 0 )
2829
2930 # moving both wheels at speed 40 clockwise
30- print ("moving both wheels at speed 40 clockwise" )
31+ logging . info ("moving both wheels at speed 40 clockwise" )
3132 assert (c .speed () == 0 )
3233 c .move (speed = 40 , elapse = 2 )
3334 assert (c .distance () != 0 )
3435 assert (c .speed () == 0 )
3536
3637 # moving both wheels at speed 100 counter-clockwise
37- print ("moving both wheels at speed 100 counter-clockwise" )
38+ logging . info ("moving both wheels at speed 100 counter-clockwise" )
3839 assert (c .speed () == 0 )
3940 c .move (speed = - 100 , elapse = 2 )
4041 assert (c .distance () != 0 )
4142 assert (c .speed () == 0 )
4243
4344 # moving both wheels at speed 40 counter-clockwise
44- print ("moving both wheels at speed 40 counter-clockwise" )
45+ logging . info ("moving both wheels at speed 40 counter-clockwise" )
4546 assert (c .speed () == 0 )
4647 c .move (speed = - 40 , elapse = 2 )
4748 assert (c .distance () != 0 )
4849 assert (c .speed () == 0 )
4950
5051 # moving forward
51- print ("moving forward" )
52+ logging . info ("moving forward" )
5253 assert (c .speed () == 0 )
5354 c .forward (speed = 100 , elapse = 2 )
5455 assert (c .distance () != 0 )
5556 assert (c .speed () == 0 )
5657
5758 # moving backwards
58- print ("moving backwards" )
59+ logging . info ("moving backwards" )
5960 assert (c .speed () == 0 )
6061 c .backward (speed = 100 , elapse = 2 )
6162 assert (c .distance () != 0 )
6263 assert (c .speed () == 0 )
6364
6465 # moving forward for 1 meter
65- print ("moving forward for 1 meter" )
66+ logging . info ("moving forward for 1 meter" )
6667 assert (c .speed () == 0 )
6768 c .forward (speed = 100 , distance = 1000 )
6869 assert (c .distance () != 0 )
6970 assert (c .speed () == 0 )
7071
7172 # moving backwards for 1 meter
72- print ("moving backwards for 1 meter" )
73+ logging . info ("moving backwards for 1 meter" )
7374 assert (c .speed () == 0 )
7475 c .backward (speed = 100 , distance = 1000 )
7576 assert (c .distance () != 0 )
7677 assert (c .speed () == 0 )
7778
7879 # turning left
79- print ("turning left" )
80+ logging . info ("turning left" )
8081 assert (c .speed () == 0 )
8182 c .left (speed = 100 , elapse = 2 )
8283 assert (c .distance () != 0 )
8384 assert (c .speed () == 0 )
8485
8586 # turning right
86- print ("turning right" )
87+ logging . info ("turning right" )
8788 assert (c .speed () == 0 )
8889 c .right (speed = 100 , elapse = 2 )
8990 assert (c .distance () != 0 )
0 commit comments