Exemplo n.º 1
0
   def testDistance(self):
      # first some basic test of vector difference function
      assert(motion01.vectorDiff((0, 0), (0, 0)) == [0, 0])
      assert(motion01.vectorDiff((1, 2), (1, 2)) == [0, 0])
      assert(motion01.vectorDiff((1, 3), (1, 2)) == [0, 1])
      assert(motion01.vectorDiff((1, 2), (1, 3)) == [0, -1])

      # test whether vectors are the same
      assert(motion01.sameVector((0, 0), (1.0e-20, 0)))
      assert(not(motion01.sameVector((0, 0), (1, 0))))

      # now test the actual distance function
      assert(motion01.distance((0, 0), (0, 0)) == 0)
      assert(motion01.sameVector((1, 1), (1.0, 1.0 + 1.0e-20)))
Exemplo n.º 2
0
 def testReadCVSLine(self):
    assert(motion01.sameVector(motion01.parseLine("0"), [0]))
    assert(motion01.sameVector(motion01.parseLine("0,0"), [0, 0]))
    assert(motion01.sameVector(motion01.parseLine("0,0,0"), [0, 0, 0]))
    assert(motion01.sameVector(motion01.parseLine("1.0, 2.0, 3.0"), [1, 2, 3]))