cleanup docs and tests (#16235)
* js module also uses runnableExamples * cleanup docs and tests
This commit is contained in:
parent
808ab7eae2
commit
e4e5a0c65a
2 changed files with 10 additions and 10 deletions
|
|
@ -253,7 +253,7 @@ proc clamp*[T](x, a, b: T): T =
|
|||
## Limits the value `x` within the interval [a, b].
|
||||
## This proc is equivalent to but fatser than `max(a, min(b, x))`.
|
||||
##
|
||||
## **Note:** `a < b` is assumed and will not be checked.
|
||||
## **Note:** `a <= b` is assumed and will not be checked.
|
||||
runnableExamples:
|
||||
assert (1.4).clamp(0.0, 1.0) == 1.0
|
||||
assert (0.5).clamp(0.0, 1.0) == 0.5
|
||||
|
|
|
|||
|
|
@ -5,42 +5,42 @@ for i in 0 .. 9:
|
|||
|
||||
doAssert res == "0123456789"
|
||||
|
||||
res = newStringOfCap(24)
|
||||
res.setLen(0)
|
||||
|
||||
for i in -9 .. 0:
|
||||
res.addInt int64(i)
|
||||
|
||||
doAssert res == "-9-8-7-6-5-4-3-2-10"
|
||||
|
||||
res = newStringOfCap(24)
|
||||
res.setLen(0)
|
||||
res.addInt high(int64)
|
||||
doAssert res == "9223372036854775807"
|
||||
|
||||
res = newStringOfCap(24)
|
||||
res.setLen(0)
|
||||
res.addInt low(int64)
|
||||
doAssert res == "-9223372036854775808"
|
||||
|
||||
res = newStringOfCap(12)
|
||||
res.setLen(0)
|
||||
res.addInt high(int32)
|
||||
doAssert res == "2147483647"
|
||||
|
||||
res = newStringOfCap(12)
|
||||
res.setLen(0)
|
||||
res.addInt low(int32)
|
||||
doAssert res == "-2147483648"
|
||||
|
||||
res = newStringOfCap(12)
|
||||
res.setLen(0)
|
||||
res.addInt high(int16)
|
||||
doAssert res == "32767"
|
||||
|
||||
res = newStringOfCap(212)
|
||||
res.setLen(0)
|
||||
res.addInt low(int16)
|
||||
doAssert res == "-32768"
|
||||
|
||||
|
||||
res = newStringOfCap(12)
|
||||
res.setLen(0)
|
||||
res.addInt high(int8)
|
||||
doAssert res == "127"
|
||||
|
||||
res = newStringOfCap(12)
|
||||
res.setLen(0)
|
||||
res.addInt low(int8)
|
||||
doAssert res == "-128"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue