summary refs log tree commit diff stats
path: root/tests/run/tmatrix.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/tmatrix.nim')
-rwxr-xr-xtests/run/tmatrix.nim48
1 files changed, 0 insertions, 48 deletions
diff --git a/tests/run/tmatrix.nim b/tests/run/tmatrix.nim
deleted file mode 100755
index 90dfde959..000000000
--- a/tests/run/tmatrix.nim
+++ /dev/null
@@ -1,48 +0,0 @@
-discard """
-  file: "tmatrix.nim"
-  output: "111"
-"""
-# Test overloading of [] with multiple indices
-
-type
-  TMatrix* = object
-    data: seq[float]
-    fWidth, fHeight: int
-
-template `|`(x, y: int): expr = y * m.fWidth + x
-
-proc createMatrix*(width, height: int): TMatrix = 
-  result.fWidth = width
-  result.fHeight = height
-  newSeq(result.data, width*height)
-
-proc width*(m: TMatrix): int {.inline.} = return m.fWidth
-proc height*(m: TMatrix): int {.inline.} = return m.fHeight
-
-proc `[]`*(m: TMatrix, x, y: int): float {.inline.} =
-  result = m.data[x|y]
-
-proc `[]=`*(m: var TMatrix, x, y: int, val: float) {.inline.} =
-  m.data[x|y] = val
-  
-proc `-|`*(m: TMatrix): TMatrix =
-  ## transposes a matrix
-  result = createMatrix(m.height, m.width)
-  for x in 0..m.width-1:
-    for y in 0..m.height-1: result[y,x] = m[x,y]
-
-#m.row(0, 2) # select row
-#m.col(0, 89) # select column
-
-const
-  w = 3
-  h = 20
-
-var m = createMatrix(w, h)
-for i in 0..w-1:
-  m[i, i] = 1.0
-
-for i in 0..w-1:
-  stdout.write(m[i,i]) #OUT 111
-
-