diff options
author | Adam Strzelecki <ono@java.pl> | 2015-09-04 23:04:32 +0200 |
---|---|---|
committer | Adam Strzelecki <ono@java.pl> | 2015-09-04 23:04:32 +0200 |
commit | e80465dacf50f260abec30ae57d37b298c93fd83 (patch) | |
tree | 393394f8353a4adb49f95e6f13da1fd41681b7b3 /tests/range | |
parent | ac9c1cd6b980d4f00eeb52d1109d8e2c8cd21213 (diff) | |
download | Nim-e80465dacf50f260abec30ae57d37b298c93fd83.tar.gz |
tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
Diffstat (limited to 'tests/range')
-rw-r--r-- | tests/range/tbug499771.nim | 4 | ||||
-rw-r--r-- | tests/range/tcolors.nim | 28 | ||||
-rw-r--r-- | tests/range/tmatrix3.nim | 8 | ||||
-rw-r--r-- | tests/range/tsubrange.nim | 6 | ||||
-rw-r--r-- | tests/range/tsubrange2.nim | 6 | ||||
-rw-r--r-- | tests/range/tsubrange3.nim | 4 |
6 files changed, 28 insertions, 28 deletions
diff --git a/tests/range/tbug499771.nim b/tests/range/tbug499771.nim index 682148422..1504a2ad7 100644 --- a/tests/range/tbug499771.nim +++ b/tests/range/tbug499771.nim @@ -3,11 +3,11 @@ discard """ output: '''TSubRange: 5 from 1 to 10 true true true''' """ -type +type TSubRange = range[1 .. 10] TEnum = enum A, B, C var sr: TSubRange = 5 -echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " & +echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " & $high(TSubRange)) const cset = {A} + {B} diff --git a/tests/range/tcolors.nim b/tests/range/tcolors.nim index 9d1034405..ab5b3e199 100644 --- a/tests/range/tcolors.nim +++ b/tests/range/tcolors.nim @@ -3,7 +3,7 @@ import strutils type TColor = distinct int32 -proc rgb(r, g, b: range[0..255]): TColor = +proc rgb(r, g, b: range[0..255]): TColor = result = TColor(r or g shl 8 or b shl 16) proc `$`(c: TColor): string = @@ -15,25 +15,25 @@ when false: type TColor = distinct int32 TColorComponent = distinct int8 - - proc red(a: TColor): TColorComponent = + + proc red(a: TColor): TColorComponent = result = TColorComponent(int32(a) and 0xff'i32) - - proc green(a: TColor): TColorComponent = + + proc green(a: TColor): TColorComponent = result = TColorComponent(int32(a) shr 8'i32 and 0xff'i32) - - proc blue(a: TColor): TColorComponent = + + proc blue(a: TColor): TColorComponent = result = TColorComponent(int32(a) shr 16'i32 and 0xff'i32) - - proc rgb(r, g, b: range[0..255]): TColor = + + proc rgb(r, g, b: range[0..255]): TColor = result = TColor(r or g shl 8 or b shl 8) - - proc `+!` (a, b: TColorComponent): TColorComponent = + + proc `+!` (a, b: TColorComponent): TColorComponent = ## saturated arithmetic: result = TColorComponent(min(ze(int8(a)) + ze(int8(b)), 255)) - - proc `+` (a, b: TColor): TColor = + + proc `+` (a, b: TColor): TColor = ## saturated arithmetic for colors makes sense, I think: return rgb(red(a) +! red(b), green(a) +! green(b), blue(a) +! blue(b)) - + rgb(34, 55, 255) diff --git a/tests/range/tmatrix3.nim b/tests/range/tmatrix3.nim index 80d38d63d..fe666b0d8 100644 --- a/tests/range/tmatrix3.nim +++ b/tests/range/tmatrix3.nim @@ -10,11 +10,11 @@ discard """ include compilehelpers type - Matrix*[M, N, T] = object + Matrix*[M, N, T] = object aij*: array[M, array[N, T]] - + Matrix2*[T] = Matrix[range[0..1], range[0..1], T] - + Matrix3*[T] = Matrix[range[0..2], range[0..2], T] proc mn(x: Matrix): Matrix.T = x.aij[0][0] @@ -23,7 +23,7 @@ proc m2(x: Matrix2): Matrix2.T = x.aij[0][0] proc m3(x: Matrix3): auto = x.aij[0][0] -var +var matn: Matrix[range[0..3], range[0..2], int] mat2: Matrix2[int] mat3: Matrix3[float] diff --git a/tests/range/tsubrange.nim b/tests/range/tsubrange.nim index b4a333bf3..6f88c5a22 100644 --- a/tests/range/tsubrange.nim +++ b/tests/range/tsubrange.nim @@ -5,10 +5,10 @@ discard """ type TRange = range[0..40] - + proc p(r: TRange) = nil - + var r: TRange y = 50 @@ -18,4 +18,4 @@ p y const myConst: TRange = 60 - + diff --git a/tests/range/tsubrange2.nim b/tests/range/tsubrange2.nim index 759d16b9c..7097faed2 100644 --- a/tests/range/tsubrange2.nim +++ b/tests/range/tsubrange2.nim @@ -6,12 +6,12 @@ discard """ type TRange = range[0..40] - + proc p(r: TRange) = discard - + var r: TRange y = 50 p y - + diff --git a/tests/range/tsubrange3.nim b/tests/range/tsubrange3.nim index 600161cfd..f5bb2f161 100644 --- a/tests/range/tsubrange3.nim +++ b/tests/range/tsubrange3.nim @@ -6,10 +6,10 @@ discard """ type TRange = range[0..40] - + proc p(r: TRange) = discard - + var r: TRange y = 50 |