1# Test the AllTypes encoding & decoding using callbacks for all fields. 2 3Import("env", "malloc_env") 4 5c = Copy("$TARGET", "$SOURCE") 6env.Command("alltypes.proto", "#alltypes_proto3/alltypes.proto", c) 7 8env.NanopbProto(["alltypes", "alltypes.options"]) 9enc = env.Program(["encode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_encode.o", "$COMMON/pb_common.o"]) 10dec = env.Program(["decode_alltypes_callback.c", "alltypes.pb.c", "$COMMON/pb_decode.o", "$COMMON/pb_common.o"]) 11 12refdec = "$BUILD/alltypes_proto3/decode_alltypes$PROGSUFFIX" 13 14# Encode and compare results 15env.RunTest(enc) 16env.RunTest("decode_alltypes.output", [refdec, "encode_alltypes_callback.output"]) 17env.RunTest("decode_alltypes_callback.output", [dec, "encode_alltypes_callback.output"]) 18 19# Do the same thing with the optional fields present 20env.RunTest("optionals.output", enc, ARGS = ['1']) 21env.RunTest("optionals.refdecout", [refdec, "optionals.output"], ARGS = ['1']) 22env.RunTest("optionals.decout", [dec, "optionals.output"], ARGS = ['1']) 23 24