summary refs log tree commit diff stats
path: root/tests/objects
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-01-13 02:10:03 +0100
committerAraq <rumpf_a@web.de>2014-01-13 02:10:03 +0100
commit20b5f31c03fb556ec0aa2428a40adbac004d8987 (patch)
tree58086941e7d6bb8f480ca1173a95722ada9435b2 /tests/objects
parent51ee524109cf7e3e86c676bc1676063a01bfd979 (diff)
downloadNim-20b5f31c03fb556ec0aa2428a40adbac004d8987.tar.gz
new tester; all tests categorized
Diffstat (limited to 'tests/objects')
-rw-r--r--tests/objects/tobjects.nim52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/objects/tobjects.nim b/tests/objects/tobjects.nim
new file mode 100644
index 000000000..06fa15583
--- /dev/null
+++ b/tests/objects/tobjects.nim
@@ -0,0 +1,52 @@
+type
+  TBase = object of TObject
+    x, y: int
+
+  TSubclassKind = enum ka, kb, kc, kd, ke, kf
+  TSubclass = object of TBase
+    case c: TSubclassKind
+    of ka, kb, kc, kd:
+      a, b: int
+    of ke:
+      d, e, f: char
+    else: nil
+    n: bool
+
+type
+  TMyObject = object of TObject
+    case disp: range[0..4]
+      of 0: arg: char
+      of 1: s: string
+      else: wtf: bool
+      
+var
+  x: TMyObject
+
+var
+  global: int
+
+var
+  s: string
+  r: float = 0.0
+  i: int = 500 + 400
+
+case i
+of 500..999: write(stdout, "ha!\n")
+of 1000..3000, 12: write(stdout, "ganz schön groß\n")
+of 1, 2, 3: write(stdout, "1 2 oder 3\n")
+else: write(stdout, "sollte nicht passieren\n")
+
+case readLine(stdin)
+of "Rumpf": write(stdout, "Hallo Meister!\n")
+of "Andreas": write(stdout, "Hallo Meister!\n")
+else: write(stdout, "Nicht mein Meister!\n")
+
+global = global + 1
+write(stdout, "Hallo wie heißt du? \n")
+s = readLine(stdin)
+i = 0
+while i < len(s):
+  if s[i] == 'c': write(stdout, "'c' in deinem Namen gefunden\n")
+  i = i + 1
+
+write(stdout, "Du heißt " & s)