tstrtabs.nim 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. discard """
  2. sortoutput: true
  3. output: '''
  4. key1: value1
  5. key2: value2
  6. key_0: value0
  7. key_10: value10
  8. key_11: value11
  9. key_12: value12
  10. key_13: value13
  11. key_14: value14
  12. key_15: value15
  13. key_16: value16
  14. key_17: value17
  15. key_18: value18
  16. key_19: value19
  17. key_20: value20
  18. key_21: value21
  19. key_22: value22
  20. key_23: value23
  21. key_24: value24
  22. key_25: value25
  23. key_26: value26
  24. key_27: value27
  25. key_28: value28
  26. key_29: value29
  27. key_30: value30
  28. key_31: value31
  29. key_32: value32
  30. key_33: value33
  31. key_34: value34
  32. key_35: value35
  33. key_36: value36
  34. key_37: value37
  35. key_38: value38
  36. key_39: value39
  37. key_3: value3
  38. key_40: value40
  39. key_41: value41
  40. key_42: value42
  41. key_43: value43
  42. key_44: value44
  43. key_45: value45
  44. key_46: value46
  45. key_47: value47
  46. key_48: value48
  47. key_49: value49
  48. key_4: value4
  49. key_50: value50
  50. key_51: value51
  51. key_52: value52
  52. key_53: value53
  53. key_54: value54
  54. key_55: value55
  55. key_56: value56
  56. key_57: value57
  57. key_58: value58
  58. key_59: value59
  59. key_5: value5
  60. key_60: value60
  61. key_61: value61
  62. key_62: value62
  63. key_63: value63
  64. key_64: value64
  65. key_65: value65
  66. key_66: value66
  67. key_67: value67
  68. key_68: value68
  69. key_69: value69
  70. key_6: value6
  71. key_70: value70
  72. key_71: value71
  73. key_72: value72
  74. key_73: value73
  75. key_74: value74
  76. key_75: value75
  77. key_76: value76
  78. key_77: value77
  79. key_78: value78
  80. key_79: value79
  81. key_7: value7
  82. key_80: value80
  83. key_8: value8
  84. key_9: value9
  85. length of table 0
  86. length of table 81
  87. value1 = value2
  88. '''
  89. """
  90. import strtabs
  91. var tab = newStringTable({"key1": "val1", "key2": "val2"},
  92. modeStyleInsensitive)
  93. for i in 0..80:
  94. tab["key_" & $i] = "value" & $i
  95. for key, val in pairs(tab):
  96. writeLine(stdout, key, ": ", val)
  97. writeLine(stdout, "length of table ", $tab.len)
  98. writeLine(stdout, `%`("$key1 = $key2", tab, {useEnvironment}))
  99. tab.clear
  100. writeLine(stdout, "length of table ", $tab.len)