PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/test/kilim/test/ex/ExYieldConstants.java

http://github.com/kilim/kilim
Java | 77 lines | 69 code | 7 blank | 1 comment | 3 complexity | ff81eee035a014706c408df5ebca9d23 MD5 | raw file
 1package kilim.test.ex;
 2
 3import kilim.Pausable;
 4import kilim.Task;
 5
 6public class ExYieldConstants extends ExYieldBase {
 7    public ExYieldConstants(int test) {
 8        testCase = test;
 9    }
10    
11    public void execute() throws Pausable {
12        doPause = false;
13        testConstants();
14        doPause = true;
15        testConstants();
16    }
17
18    void testConstants() throws Pausable {
19    	double d0 = 0;
20    	double d1 = 1;
21    	double d = 10.0;
22    	int i0 = 0;
23    	long l0 = 0;
24    	long l1 = 1;
25    	long l = 10;
26    	int i1 = 1;
27    	int i2 = 2;
28    	int i3 = 3;
29    	int i4 = 4;
30    	int i5 = 5;
31    	float f0 = 0;
32    	float f1 = 1;
33    	int i = 10;
34    	String s = "10";
35        if (doPause) { 
36            Task.sleep(50);
37        }
38        pausable_st(d, s, l, doPause);
39        new ExYieldConstants(testCase).pausable_v(d, s, l);
40        verify(d);
41        verify(l);
42        verify(s);
43        verify(i);
44        // constants with built-in opcode support
45        verify(f0, 0.0f);
46        verify(f1, 1.0f);
47        verify(d0, 0.0d);
48        verify(d1, 1.0d);
49        verify(i0, 0);
50        verify(i1, 1);
51        verify(i2, 2);
52        verify(i3, 3);
53        verify(i4, 4);
54        verify(i5, 5);
55        verify(l0, 0);
56        verify(l1, 1);
57    }
58
59    static void pausable_st(double d, String s, long l, boolean doPause) throws Pausable {
60        if (doPause) {
61            Task.sleep(50);
62        }
63        verify(l);
64        verify(s);
65        verify(d);
66    }
67
68    void pausable_v(double d, String s, long l) throws Pausable {
69        if (doPause) {
70            Task.sleep(50);
71        }
72        verify(l);
73        verify(s);
74        verify(d);
75    }
76
77}