nim-stew/tests/test_sequtils2.nim
Jacek Sieka d8d914332d
random helpers (#64)
* random helpers

* arrayops as a home for small array/openArray utilities
* assign2 - a replacement for genericAssign and assignment operators in
general which in nim are very slow
* use assign2 in a few places to speed things up

* fixes

* fixes
2020-12-10 12:05:22 +01:00

40 lines
895 B
Nim

# byteutils
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
std/unittest,
../stew/sequtils2
suite "sequtils2":
test "write":
block:
var a: seq[int]
a.write([0, 1, 2, 3])
check:
a == @[0, 1, 2, 3]
a.write([])
a.write([4])
check:
a == @[0, 1, 2, 3, 4]
block:
var a: seq[byte]
a.write([byte 0, 1, 2, 3])
check:
a == [byte 0, 1, 2, 3]
a.write([])
a.write([byte 4])
check:
a == [byte 0, 1, 2, 3, 4]