name lookup for sockets module

This commit is contained in:
Andreas Rumpf 2010-01-14 22:06:36 +01:00
commit 0bcdab8395
5 changed files with 129 additions and 35 deletions

3
tests/tparsefloat.nim Executable file
View file

@ -0,0 +1,3 @@
import strutils
echo ParseFloat("5000") / ParseFloat("10")

24
tests/tquicksort.nim Executable file
View file

@ -0,0 +1,24 @@
proc QuickSort(list: seq[int]): seq[int] =
if len(list) == 0:
return @[]
var pivot = list[0]
var left: seq[int] = @[]
var right: seq[int] = @[]
for i in low(list)..high(list):
if list[i] < pivot:
left.add(list[i])
elif list[i] > pivot:
right.add(list[i])
result = QuickSort(left) & pivot & QuickSort(right)
proc echoSeq(a: seq[int]) =
for i in low(a)..high(a):
echo(a[i])
var
list: seq[int]
list = QuickSort(@[89,23,15,23,56,123,356,12,7,1,6,2,9,4,3])
echoSeq(list)

11
tests/tsockets.nim Executable file
View file

@ -0,0 +1,11 @@
import sockets
var s: TSocket
s = socket()
s.connect("www.google.com", TPort(80))
var recvData: string = ""
echo(s.recvLine(recvData))
echo(recvData)