1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
import tables
type
MyEnum = enum
meOne,
meTwo,
meThree,
meFour,
MyOtherEnum = enum
moOne,
moTwo,
moThree,
moFoure,
MyObj = object
a*: int
b*: string
var counter = 0
proc myDebug[T](arg: T): void =
counter += 1
proc testProc(): void =
var myEnum = meTwo
myDebug(myEnum) #1
# create a string, but don't allocate it
var myString: string
myDebug(myString) #2
# create a string object but also make the NTI for MyEnum is generated
myString = $myEnum
myDebug(myString) #3
var mySet = {meOne,meThree}
myDebug(mySet) #4
# for MyOtherEnum there is no NTI. This tests the fallback for the pretty printer.
var moEnum = moTwo
myDebug(moEnum) #5
var moSet = {moOne,moThree}
myDebug(moSet) #6
let myArray = [1,2,3,4,5]
myDebug(myArray) #7
# implicitly initialized seq test
var mySeq: seq[string]
myDebug(mySeq) #8
# len not equal to capacity
let myOtherSeq = newSeqOfCap[string](10)
myDebug(myOtherSeq) #9
let myOtherArray = ["one","two"]
myDebug(myOtherArray) #10
# numeric sec
var mySeq3 = @[1,2,3]
myDebug(mySeq3) #11
# seq had to grow
var mySeq4 = @["one","two","three"]
myDebug(mySeq4) #12
var myTable = initTable[int, string]()
myTable[4] = "four"
myTable[5] = "five"
myTable[6] = "six"
myDebug(myTable) #13
var myOtherTable = {"one": 1, "two": 2, "three": 3}.toTable
myDebug(myOtherTable) #14
var obj = MyObj(a: 1, b: "some string")
myDebug(obj) #15
var tup = ("hello", 42)
myDebug(tup) # 16
assert counter == 16
testProc()
|