test_framework.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. print ('Testing framework Python bindings')
  7. import azlmbr.entity as entity
  8. import azlmbr.framework as framework
  9. import azlmbr.math as math
  10. def test_entity_api():
  11. entityId = entity.EntityId()
  12. if (entityId.IsValid is None):
  13. print('entityId.IsValid is None')
  14. framework.Terminate(1)
  15. if (entityId.IsValid() is True):
  16. print('entityId.IsValid() is True')
  17. framework.Terminate(2)
  18. def test_math_api():
  19. if (math.Math_IsEven(3)):
  20. framework.Terminate(1)
  21. if (math.Math_IsClose(1.0,2.0)):
  22. framework.Terminate(2)
  23. if (math.Math_IsClose(2.0, math.Math_Sqrt(4.0)) is False):
  24. framework.Terminate(3)
  25. def main():
  26. import sys
  27. print("Starting framework test")
  28. if (sys.argv[1] == 'entity'):
  29. test_entity_api()
  30. elif (sys.argv[1] == 'math'):
  31. test_math_api()
  32. else:
  33. print('Unknown arg {}'.format(sys.argv[0]))
  34. framework.Terminate(4)
  35. if __name__ == "__main__":
  36. main()