mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 09:01:48 +00:00
* Bfbs Nim Generator * Remove commented out tests * add missing line to idl.h * Commit python reflection changes * Commit python reflection changes and move tests * Remove default string addition * Move tests to python file * Fix element size check when element is table * remove whitespace changes * add element_type docs and commit further to namer and remove kkeep * Bfbs Nim Generator * Remove commented out tests * add missing line to idl.h * Commit python reflection changes * Commit python reflection changes and move tests * Remove default string addition * Move tests to python file * Fix element size check when element is table * remove whitespace changes * add element_type docs and commit further to namer and remove kkeep * remove unused variables * added tests to ci * added tests to ci * fixes * Added reflection type Field, Variable to namer * Moved reflection namer impl to bfbsnamer * Remove whitespace at end of line * Added nim to generated code * Revert whitespace removal Co-authored-by: Derek Bailey <derekbailey@google.com>
30 lines
712 B
Nim
30 lines
712 B
Nim
discard """
|
|
action: "run"
|
|
exitcode: 0
|
|
timeout: 60.0
|
|
"""
|
|
import std/unittest
|
|
import std/options
|
|
import flatbuffers
|
|
import ../../../optional_scalars/ScalarStuff
|
|
|
|
|
|
suite "TestOptionalScalars":
|
|
|
|
test "OptionalScalars":
|
|
var builder = newBuilder(1024)
|
|
builder.ScalarStuffStart()
|
|
let root = builder.ScalarStuffEnd()
|
|
builder.Finish(root)
|
|
|
|
var optionals: ScalarStuff
|
|
optionals.GetRootAs(builder.FinishedBytes(), 0)
|
|
|
|
# Creates a flatbuffer with optional values.
|
|
check(optionals.justI8 == 0)
|
|
check(optionals.maybeF32.isNone)
|
|
check(optionals.defaultBool == true)
|
|
check(optionals.justU16 == 0)
|
|
check(optionals.maybeEnum.isNone)
|
|
check(optionals.defaultU64 == 42)
|