tmarkerproc_regression.nim 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. discard """
  2. output: "done markerproc regression"
  3. """
  4. type
  5. Version* = distinct string
  6. Special* = distinct string
  7. VersionRangeEnum* = enum
  8. verLater, # > V
  9. verEarlier, # < V
  10. verEqLater, # >= V -- Equal or later
  11. verEqEarlier, # <= V -- Equal or earlier
  12. verIntersect, # > V & < V
  13. verEq, # V
  14. verAny, # *
  15. verSpecial # #head
  16. VersionRange* = ref VersionRangeObj
  17. VersionRangeObj = object
  18. case kind*: VersionRangeEnum
  19. of verLater, verEarlier, verEqLater, verEqEarlier, verEq:
  20. ver*: Version
  21. of verSpecial:
  22. spe*: Special
  23. of verIntersect:
  24. verILeft, verIRight: VersionRange
  25. of verAny:
  26. nil
  27. proc foo(x: string): VersionRange =
  28. new(result)
  29. result.kind = verEq
  30. result.ver = Version(x)
  31. proc main =
  32. var a: array[500, VersionRange]
  33. for i in 0 ..< 500:
  34. a[i] = foo($i & "some longer text here " & $i)
  35. GC_fullcollect()
  36. for i in 0 ..< 500:
  37. let expected = $i & "some longer text here " & $i
  38. if a[i].ver.string != expected:
  39. quit "bug!"
  40. echo "done markerproc regression"
  41. main()