testTestUtils.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
  2. # McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from testutils import *
  16. class TestTestUtils(unittest.TestCase):
  17. def test_testutils_equalStateVectors(self):
  18. state1 = [1, 2, 3]
  19. state2 = [1, 4, 3]
  20. state3 = [1, 2, 4]
  21. state4 = [1, 4, 3]
  22. state5 = [2, 2, 4]
  23. a = []
  24. b = [state1]
  25. self.assertFalse(equalStateVectors(a, b))
  26. a = [state2]
  27. self.assertFalse(equalStateVectors(a, b))
  28. a = [state1, state2]
  29. self.assertFalse(equalStateVectors(a, b))
  30. b = [state2, state1]
  31. self.assertFalse(equalStateVectors(a, b))
  32. # Third field doesn't matter
  33. a = [state1]
  34. b = [state3]
  35. self.assertTrue(equalStateVectors(a, b))
  36. a = [state3, state1]
  37. b = [state1, state3]
  38. self.assertTrue(equalStateVectors(a, b))
  39. # Even though it doesn't matter, length must be equal
  40. a = [state1, state3]
  41. b = [state1, state1, state1]
  42. self.assertFalse(equalStateVectors(a, b))
  43. a = [state1]
  44. b = [state5]
  45. self.assertFalse(equalStateVectors(a, b))