Newer
Older
zweic / tests / 3 / eyer.zwei
@glproj03 glproj03 on 8 Dec 2005 1 KB some more tests for 3
  1. //a class without extends
  2. class TestSystematic {
  3.  
  4. //test member definition
  5. Int member;
  6.  
  7. //Test function without parameter
  8. Null functionNoPar() {
  9. }
  10.  
  11. //Test functions with one parameter
  12. Null functionOne(Int x) {
  13. }
  14.  
  15. //Test functions with two parameters
  16. Null functionTwo(Int x, Int y) {
  17. }
  18.  
  19. //Test statements
  20. Null testStat() {
  21. while (a == b) {
  22. a;
  23. b;
  24. c;
  25. }
  26.  
  27. type name = init;
  28. name = init;
  29. a == b;
  30. printInt(1);
  31. printChar(1);
  32. }
  33.  
  34. Null testIf() {
  35. if (a) b;
  36. if (a) b else d;
  37. }
  38.  
  39. //Test the factors
  40. Null testFactors() {
  41. ident;
  42. 123;
  43. "hello";
  44. true;
  45. false;
  46. this;
  47. null;
  48. readInt;
  49. readChar;
  50. (a);
  51. {
  52. a;
  53. };
  54. {
  55. a;
  56. return b
  57. };
  58. new Test();
  59. new Test(a, b, c);
  60. factor.ident;
  61. factor.ident();
  62. factor.ident(a, b, c);
  63. }
  64.  
  65. //test syntactic sugar
  66. Null syntaxSugar() {
  67. true;
  68. false;
  69. a || b;
  70. if (a) b;
  71. {};
  72. "abcd";
  73. }
  74.  
  75. //test operator precedence
  76. Null operatorPrec() {
  77. a + b * c;
  78. a + b * -c;
  79. (a+b) * c;
  80. -(a+b) * c;
  81. a == b + c * d && e;
  82. }
  83.  
  84.  
  85.  
  86.  
  87. }
  88.  
  89. //a class with extends
  90. class Systematic2 extends Systematic {
  91.  
  92. }
  93.  
  94. foobar.main()