example.bmx 706 B

123456789101112131415161718192021222324252627282930
  1. Import BRL.MaxUnit
  2. New TTestSuite.run() ' <-- run all the tests!
  3. Type MyTest Extends TTest ' <-- extend from TTest
  4. Field value1:Int
  5. Field value2:Int
  6. Method setup() { before } ' <-- {before} is run once per test method. Optional.
  7. value1 = 2
  8. value2 = 3
  9. End Method
  10. Method testAdd() { test } ' <-- {test} defines a single test to run.
  11. Local result:Int = value1 + value2
  12. assertTrue(result = 5)
  13. End Method
  14. Method testMultiply() { test }
  15. Local result:Int = value1 * value2
  16. assertEqualsI(6, result)
  17. End Method
  18. Method testOops() { test }
  19. Local result:Int = value1 + value2
  20. assertEqualsI(2, result, "Just here to show a failed test...")
  21. End Method
  22. End Type