PerformanceTests.sctunit 567 B

123456789101112131415161718192021222324252627282930313233343536
  1. testclass PerformanceTests for statechart PerformanceTest {
  2. @Test
  3. operation test_100_000 () {
  4. performance(100000)
  5. } //----------------
  6. @Test
  7. operation test_1_000_000 () {
  8. performance(1000000)
  9. }
  10. @Test
  11. operation test_10_000_000 () {
  12. performance(10000000)
  13. }
  14. operation performance(perf : integer){
  15. enter
  16. assert active (PerformanceTest.mr.A)
  17. while (c < perf) {
  18. if (active (PerformanceTest.mr.A)) {
  19. raise e1
  20. } else {
  21. if (c % 2 == 0) {
  22. raise e2
  23. } else {
  24. raise e3
  25. }
  26. }
  27. proceed 1 cycle
  28. }
  29. assert a > 2
  30. }
  31. }