Remove deprecated stuff from stdlib (#14699)

* update to the latest Jester

* remove deprecated procs from some stdlib modules

* 'criterion' is not maintained anymore and relies on obsolete stuff
This commit is contained in:
Miran 2020-06-17 15:25:02 +02:00 • committed by GitHub
commit e7f280bd26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 155 additions and 519 deletions

View file

@ -196,17 +196,6 @@ proc nextPowerOfTwo*(x: int): int {.noSideEffect.} =
result = result or (result shr 1)
result += 1 + ord(x <= 0)
proc countBits32*(n: int32): int {.noSideEffect, deprecated:
"Deprecated since v0.20.0; use 'bitops.countSetBits' instead".} =
runnableExamples:
doAssert countBits32(7) == 3
doAssert countBits32(8) == 1
doAssert countBits32(15) == 4
doAssert countBits32(16) == 1
doAssert countBits32(17) == 2
bitops.countSetBits(n)
proc sum*[T](x: openArray[T]): T {.noSideEffect.} =
## Computes the sum of the elements in ``x``.
##
@ -611,13 +600,6 @@ when not defined(js): # C
## echo gamma(4.0) # 6.0
## echo gamma(11.0) # 3628800.0
## echo gamma(-1.0) # nan
proc tgamma*(x: float32): float32
{.deprecated: "Deprecated since v0.19.0; use 'gamma' instead",
importc: "tgammaf", header: "<math.h>".}
proc tgamma*(x: float64): float64
{.deprecated: "Deprecated since v0.19.0; use 'gamma' instead",
importc: "tgamma", header: "<math.h>".}
## The gamma function
proc lgamma*(x: float32): float32 {.importc: "lgammaf", header: "<math.h>".}
proc lgamma*(x: float64): float64 {.importc: "lgamma", header: "<math.h>".}
## Computes the natural log of the gamma function for ``x``.
@ -750,12 +732,6 @@ when not defined(js): # C
## echo trunc(PI) # 3.0
## echo trunc(-1.85) # -1.0
proc fmod*(x, y: float32): float32 {.deprecated: "Deprecated since v0.19.0; use 'mod' instead",
importc: "fmodf", header: "<math.h>".}
proc fmod*(x, y: float64): float64 {.deprecated: "Deprecated since v0.19.0; use 'mod' instead",
importc: "fmod", header: "<math.h>".}
## Computes the remainder of ``x`` divided by ``y``.
proc `mod`*(x, y: float32): float32 {.importc: "fmodf", header: "<math.h>".}
proc `mod`*(x, y: float64): float64 {.importc: "fmod", header: "<math.h>".}
## Computes the modulo operation for float values (the remainder of ``x`` divided by ``y``).
@ -1111,7 +1087,6 @@ when isMainModule and not defined(js) and not windowsCC89:
# check gamma function
assert(gamma(5.0) == 24.0) # 4!
assert($tgamma(5.0) == $24.0) # 4!
assert(lgamma(1.0) == 0.0) # ln(1.0) == 0.0
assert(erf(6.0) > erf(5.0))
assert(erfc(6.0) < erfc(5.0))
@ -1133,20 +1108,6 @@ when isMainModule:
doAssert round(-54.652) ==~ -55.0
doAssert round(-54.352) ==~ -54.0
doAssert round(0.0) ==~ 0.0
# Round to positive decimal places
doAssert round(-547.652, 1) ==~ -547.7
doAssert round(547.652, 1) ==~ 547.7
doAssert round(-547.652, 2) ==~ -547.65
doAssert round(547.652, 2) ==~ 547.65
# Round to negative decimal places
doAssert round(547.652, -1) ==~ 550.0
doAssert round(547.652, -2) ==~ 500.0
doAssert round(547.652, -3) ==~ 1000.0
doAssert round(547.652, -4) ==~ 0.0
doAssert round(-547.652, -1) ==~ -550.0
doAssert round(-547.652, -2) ==~ -500.0
doAssert round(-547.652, -3) ==~ -1000.0
doAssert round(-547.652, -4) ==~ 0.0
block: # splitDecimal() tests
doAssert splitDecimal(54.674).intpart ==~ 54.0