nim-json-serialization/fuzzer/fuzz_lexer.nim

24 lines
655 B
Nim
Raw Permalink Normal View History

2023-12-26 02:38:34 +00:00
# json-serialization
# Copyright (c) 2023 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.
import
testutils/fuzzing,
faststreams,
../json_serialization/lexer
template prepareLexer(T: type, payload: untyped) =
var stream = unsafeMemoryInput(payload)
var lex = init(JsonLexer, stream)
var value: JsonValueRef[T]
lex.scanValue(value)
test:
prepareLexer(string, payload)
prepareLexer(uint64, payload)