rename ranges/stackarray to stackarrays for consitency
This commit is contained in:
parent
0fb54a8a9d
commit
51121411a0
|
@ -40,9 +40,10 @@ iterator mpairs*(a: var StackArray): (int, var a.T) =
|
|||
|
||||
template allocStackArray*(T: typedesc, size: int): auto =
|
||||
if size < 0: raise newException(RangeError, "allocation with a negative size")
|
||||
# XXX: is it possible to perform a stack size check before
|
||||
# calling `alloca`? Nim has a stackBottom pointer in the
|
||||
# system module.
|
||||
# XXX: is it possible to perform a stack size check before calling `alloca`?
|
||||
# On thread init, Nim may record the base address and the capacity of the stack,
|
||||
# so in theory we can verify that we still have enough room for the allocation.
|
||||
# Research this.
|
||||
var
|
||||
bufferSize = size * sizeof(T)
|
||||
totalSize = sizeof(int) + bufferSize
|
|
@ -1,6 +1,6 @@
|
|||
import
|
||||
unittest, math,
|
||||
../ranges/stackarray
|
||||
../ranges/stackarrays
|
||||
|
||||
suite "Stack arrays":
|
||||
test "Basic operations work as expected":
|
||||
|
@ -8,7 +8,7 @@ suite "Stack arrays":
|
|||
check:
|
||||
type(arr[0]) is int
|
||||
arr.len == 10
|
||||
|
||||
|
||||
# all items should be initially zero
|
||||
for i in arr: check i == 0
|
||||
for i in 0 .. arr.high: check arr[i] == 0
|
||||
|
|
Loading…
Reference in New Issue