/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

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