runme.py 584 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import random
  4. import my_add
  5. import my_sub
  6. # These can be changed, but make sure not to overflow `int`
  7. a = random.randint(1, 1024)
  8. b = random.randint(1, 1024)
  9. if my_add.add(a, b) == a + b:
  10. print ("Test 1 Passed for SWIG custom source file extension")
  11. else:
  12. print ("Test 1 FAILED for SWIG custom source file extension")
  13. exit(1)
  14. if my_sub.sub(a, b) == a - b:
  15. print ("Test 2 Passed for SWIG custom source file extension")
  16. else:
  17. print ("Test 2 FAILED for SWIG custom source file extension")
  18. exit(1)