summaryrefslogtreecommitdiffstats
path: root/tests/field_size_16/SConscript
blob: 48d08e84311c3e765268c3f2cf878e06e436d367 ( @media only all and (prefers-color-scheme: dark) { .highlight .hll { background-color: #49483e } .highlight .c { color: #75715e } /* Comment */ .highlight .err { color: #960050; background-color: #1e0010 } /* Error */ .highlight .k { color: #66d9ef } /* Keyword */ .highlight .l { color: #ae81ff } /* Literal */ .highlight .n { color: #f8f8f2 } /* Name */ .highlight .o { color: #f92672 } /* Operator */ .highlight .p { color: #f8f8f2 } /* Punctuation */ .highlight .ch { color: #75715e } /* Comment.Hashbang */ .highlight .cm { color: #75715e } /* Comment.Multiline */ .highlight .cp { color: #75715e } /* Comment.Preproc */ .highlight .cpf { color: #75715e } /* Comment.PreprocFile */ .highlight .c1 { color: #75715e } /* Comment.Single */ .highlight .cs { color: #75715e } /* Comment.Special */ .highlight .gd { color: #f92672 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gi { color: #a6e22e } /* Generic.Inserted */ .
# Run the alltypes test case, but compile with PB_FIELD_16BIT=1.
# Also the .proto file has been modified to have high indexes.

Import("env")

# Take copy of the files for custom build.
c = Copy("$TARGET", "$SOURCE")
env.Command("pb_encode.c", "#../pb_encode.c", c)
env.Command("pb_decode.c", "#../pb_decode.c", c)
env.Command("encode_alltypes.c", "#alltypes/encode_alltypes.c", c)
env.Command("decode_alltypes.c", "#alltypes/decode_alltypes.c", c)

env.NanopbProto("alltypes")

# Define the compilation options
opts = env.Clone()
opts.Append(CPPDEFINES = {'PB_FIELD_16BIT': 1})

# Now build and run the test normally.
enc = opts.Program(["encode_alltypes.c", "alltypes.pb.c", "pb_encode.c"])
dec = opts.Program(["decode_alltypes.c", "alltypes.pb.c", "pb_decode.c"])

env.RunTest(enc)
env.RunTest([dec, "encode_alltypes.output"])