/test/kilim/test/TestYieldJSR.java

http://github.com/kilim/kilim · Java · 45 lines · 16 code · 8 blank · 21 comment · 0 complexity · 1095d1dd581fcdb4aa6d9b14b1154662 MD5 · raw file

  1. /* Copyright (c) 2006, Sriram Srinivasan
  2. *
  3. * You may distribute this software under the terms of the license
  4. * specified in the file "License"
  5. */
  6. package kilim.test;
  7. import junit.framework.TestCase;
  8. public class TestYieldJSR extends TestCase {
  9. /*
  10. * Ordinary jsr call. No inlining should happen
  11. */
  12. public void testNonPausableJSR() throws Exception {
  13. TestYield.runTask("kilim.test.ex.ExYieldSub", 0);
  14. }
  15. /*
  16. * Single jsr call to a subroutine that calls Task.sleep.
  17. */
  18. public void testSinglePausableJSR() throws Exception {
  19. TestYield.runTask("kilim.test.ex.ExYieldSub", 1);
  20. }
  21. /*
  22. * jsr sub1, jsr sub2 , jsr sub1 in sequence. Tests inlining
  23. * (because sub1 is called twice), and tests whether stack
  24. * and locals are preserved.
  25. */
  26. public void testMultiplePausableJSRs() throws Exception {
  27. TestYield.runTask("kilim.test.ex.ExYieldSub", 2);
  28. }
  29. /* jsr sub1, jsr sub2, jsr sub1, jsr sub2, where sub2 is pausable
  30. * and sub1 is not. Only calls to sub2 should be inlined. We have
  31. * no automated way of checking this, but the behavior can certainly
  32. * be tested.
  33. */
  34. public void testMixedJSRs() throws Exception {
  35. TestYield.runTask("kilim.test.ex.ExYieldSub", 3);
  36. }
  37. }