/test/kilim/test/TestYieldJSR.java
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 7package kilim.test; 8 9import junit.framework.TestCase; 10 11public class TestYieldJSR extends TestCase { 12 13 /* 14 * Ordinary jsr call. No inlining should happen 15 */ 16 public void testNonPausableJSR() throws Exception { 17 TestYield.runTask("kilim.test.ex.ExYieldSub", 0); 18 } 19 20 /* 21 * Single jsr call to a subroutine that calls Task.sleep. 22 */ 23 public void testSinglePausableJSR() throws Exception { 24 TestYield.runTask("kilim.test.ex.ExYieldSub", 1); 25 } 26 27 /* 28 * jsr sub1, jsr sub2 , jsr sub1 in sequence. Tests inlining 29 * (because sub1 is called twice), and tests whether stack 30 * and locals are preserved. 31 */ 32 public void testMultiplePausableJSRs() throws Exception { 33 TestYield.runTask("kilim.test.ex.ExYieldSub", 2); 34 } 35 36 /* jsr sub1, jsr sub2, jsr sub1, jsr sub2, where sub2 is pausable 37 * and sub1 is not. Only calls to sub2 should be inlined. We have 38 * no automated way of checking this, but the behavior can certainly 39 * be tested. 40 */ 41 public void testMixedJSRs() throws Exception { 42 TestYield.runTask("kilim.test.ex.ExYieldSub", 3); 43 } 44 45}