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
|
|
@ -2,34 +2,34 @@ discard """
|
|||
file: "tpos.nim"
|
||||
output: "6"
|
||||
"""
|
||||
# test this particular function
|
||||
|
||||
proc mypos(sub, s: string, start: int = 0): int =
|
||||
var
|
||||
i, j, M, N: int
|
||||
M = sub.len
|
||||
N = s.len
|
||||
i = start
|
||||
j = 0
|
||||
if i >= N:
|
||||
result = -1
|
||||
else:
|
||||
while true:
|
||||
if s[i] == sub[j]:
|
||||
inc(i)
|
||||
inc(j)
|
||||
else:
|
||||
i = i - j + 1
|
||||
j = 0
|
||||
if (j >= M) or (i >= N): break
|
||||
if j >= M:
|
||||
result = i - M
|
||||
else:
|
||||
result = -1
|
||||
|
||||
var sub = "hello"
|
||||
var s = "world hello"
|
||||
write(stdout, mypos(sub, s))
|
||||
#OUT 6
|
||||
# test this particular function
|
||||
|
||||
proc mypos(sub, s: string, start: int = 0): int =
|
||||
var
|
||||
i, j, M, N: int
|
||||
M = sub.len
|
||||
N = s.len
|
||||
i = start
|
||||
j = 0
|
||||
if i >= N:
|
||||
result = -1
|
||||
else:
|
||||
while true:
|
||||
if s[i] == sub[j]:
|
||||
inc(i)
|
||||
inc(j)
|
||||
else:
|
||||
i = i - j + 1
|
||||
j = 0
|
||||
if (j >= M) or (i >= N): break
|
||||
if j >= M:
|
||||
result = i - M
|
||||
else:
|
||||
result = -1
|
||||
|
||||
var sub = "hello"
|
||||
var s = "world hello"
|
||||
write(stdout, mypos(sub, s))
|
||||
#OUT 6
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue