mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-27 01:34:02 +00:00
resolved system.nim conflicts
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
# Simplest Nimrod program
|
||||
|
||||
echo "Hallo, World!"
|
||||
echo "Hello, World!"
|
||||
|
||||
@@ -36,7 +36,7 @@ macrotest(stdout)
|
||||
#GC_disable()
|
||||
|
||||
echo("This was compiled by Nimrod version " & system.nimrodVersion)
|
||||
writeln(stdout, "Hallo", " World", "!")
|
||||
writeln(stdout, "Hello", " World", "!")
|
||||
|
||||
echo(["a", "b", "c", "d"].len)
|
||||
for x in items(["What's", "your", "name", "?", ]):
|
||||
@@ -51,7 +51,7 @@ var testseq: seq[string] = @[
|
||||
]
|
||||
echo(repr(testseq))
|
||||
|
||||
var dummy = "hallo"
|
||||
var dummy = "hello"
|
||||
echo(copy(dummy, 2, 3))
|
||||
|
||||
echo($meC)
|
||||
@@ -60,11 +60,11 @@ echo($meC)
|
||||
for x, y in items([(1, 2), (3, 4), (6, 1), (5, 2)]):
|
||||
echo x
|
||||
echo y
|
||||
|
||||
|
||||
proc simpleConst(): int = return 34
|
||||
|
||||
# test constant evaluation:
|
||||
const
|
||||
|
||||
# test constant evaluation:
|
||||
const
|
||||
constEval3 = simpleConst()
|
||||
constEval = "abc".contains('b')
|
||||
constEval2 = fac(7)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# test the file-IO
|
||||
|
||||
proc main() =
|
||||
for line in lines("thallo.nim"):
|
||||
for line in lines("thello.nim"):
|
||||
writeln(stdout, line)
|
||||
|
||||
main()
|
||||
|
||||
@@ -57,7 +57,7 @@ proc Foo(n: int): int =
|
||||
while b:
|
||||
a = a + 3
|
||||
a = a + 5
|
||||
write(stdout, "Hallo!")
|
||||
write(stdout, "Hello!")
|
||||
|
||||
|
||||
# We should come till here :-)
|
||||
|
||||
@@ -2,6 +2,6 @@ import streams
|
||||
|
||||
var outp = newFileStream(stdout)
|
||||
var inp = newFileStream(stdin)
|
||||
write(outp, "Hallo! What is your name?")
|
||||
write(outp, "Hello! What is your name?")
|
||||
var line = readLine(inp)
|
||||
write(outp, "nice name: " & line)
|
||||
write(outp, "Nice name: " & line)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# Test the new initialization for modules
|
||||
write(stdout, "Hallo from module! ")
|
||||
write(stdout, "Hello from module! ")
|
||||
|
||||
@@ -4,7 +4,7 @@ import tbintree
|
||||
|
||||
var
|
||||
root: PBinaryTree[string]
|
||||
x = newNode("hallo")
|
||||
x = newNode("hello")
|
||||
add(root, x)
|
||||
add(root, "world")
|
||||
if find(root, "world"):
|
||||
@@ -21,5 +21,5 @@ add(r2, 99)
|
||||
for y in items(r2):
|
||||
stdout.write(y)
|
||||
|
||||
#OUT halloworld99110223
|
||||
#OUT helloworld99110223
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ proc add*[Ty](root: var PBinaryTree[Ty], data: Ty) =
|
||||
# convenience proc:
|
||||
add(root, newNode(data))
|
||||
|
||||
proc find*[Ty2](b: PBinaryTree[Ty2], data: Ty2): bool =
|
||||
proc find*[Ty2](b: PBinaryTree[Ty2], data: Ty2): bool =
|
||||
# for testing this needs to be recursive, so that the
|
||||
# instantiated type is checked for proper tyGenericInst envelopes
|
||||
if b == nil:
|
||||
if b == nil:
|
||||
result = false
|
||||
else:
|
||||
else:
|
||||
var c = cmp(data, b.data)
|
||||
if c < 0: result = find(b.le, data)
|
||||
elif c > 0: result = find(b.ri, data)
|
||||
@@ -66,7 +66,7 @@ iterator items*[T](root: PBinaryTree[T]): T =
|
||||
while n != nil:
|
||||
add(stack, n)
|
||||
n = n.le
|
||||
if stack.len > 0:
|
||||
if stack.len > 0:
|
||||
n = stack.pop()
|
||||
yield n.data
|
||||
n = n.ri
|
||||
@@ -81,7 +81,7 @@ proc debug[T](a: PBinaryTree[T]) =
|
||||
when isMainModule:
|
||||
var
|
||||
root: PBinaryTree[string]
|
||||
x = newNode("hallo")
|
||||
x = newNode("hello")
|
||||
add(root, x)
|
||||
add(root, "world")
|
||||
if find(root, "world"):
|
||||
@@ -89,7 +89,7 @@ when isMainModule:
|
||||
stdout.write(str)
|
||||
else:
|
||||
stdout.writeln("BUG")
|
||||
|
||||
|
||||
var
|
||||
r2: PBinaryTree[int]
|
||||
add(r2, newNode(110))
|
||||
@@ -98,4 +98,4 @@ when isMainModule:
|
||||
for y in items(r2):
|
||||
stdout.write(y)
|
||||
|
||||
#OUT halloworld99110223
|
||||
#OUT helloworld99110223
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
import minit
|
||||
|
||||
write(stdout, "Hallo from main module!\n")
|
||||
#OUT Hallo from module! Hallo from main module!
|
||||
write(stdout, "Hello from main module!\n")
|
||||
#OUT Hello from module! Hello from main module!
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
proc write(t: TFile, s: string) =
|
||||
nil # a nop
|
||||
|
||||
system.write(stdout, "hallo")
|
||||
#OUT hallo
|
||||
system.write(stdout, "hello")
|
||||
#OUT hello
|
||||
|
||||
@@ -23,7 +23,7 @@ proc mypos(sub, s: string, start: int = 0): int =
|
||||
else:
|
||||
result = -1
|
||||
|
||||
var sub = "hallo"
|
||||
var s = "world hallo"
|
||||
var sub = "hello"
|
||||
var s = "world hello"
|
||||
write(stdout, mypos(sub, s))
|
||||
#OUT 6
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import strutils
|
||||
|
||||
var x = "hallo world!".toLower.toUpper
|
||||
var x = "hello world!".toLower.toUpper
|
||||
x.echo()
|
||||
#OUT HALLO WORLD!
|
||||
#OUT HELLO WORLD!
|
||||
|
||||
|
||||
10
tests/tenuminh.nim
Normal file
10
tests/tenuminh.nim
Normal file
@@ -0,0 +1,10 @@
|
||||
type
|
||||
TCardPts = enum
|
||||
North, West, South, East
|
||||
|
||||
TCardPts2 = enum of TCardPts
|
||||
N, W, S, E
|
||||
|
||||
# If I do:
|
||||
var y = W
|
||||
echo($y & "=" & $ord(y)) #OUT W=5
|
||||
Reference in New Issue
Block a user