tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
This commit is contained in:
parent
ac9c1cd6b9
commit
e80465dacf
372 changed files with 4486 additions and 4486 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ discard """
|
|||
|
||||
type
|
||||
TRange = range[0..40]
|
||||
|
||||
|
||||
proc p(r: TRange) =
|
||||
discard
|
||||
|
||||
|
||||
var
|
||||
r: TRange
|
||||
y = 50
|
||||
p y
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ discard """
|
|||
|
||||
type
|
||||
TRange = range[0..40]
|
||||
|
||||
|
||||
proc p(r: TRange) =
|
||||
discard
|
||||
|
||||
|
||||
var
|
||||
r: TRange
|
||||
y = 50
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue