1# Test decoder callback support inside oneofs. 2 3Import('env') 4 5env.NanopbProto('oneof') 6 7enc = env.Program(['encode_oneof.c', 8 'oneof.pb.c', 9 '$COMMON/pb_encode.o', 10 '$COMMON/pb_common.o']) 11 12dec = env.Program(['decode_oneof.c', 13 'oneof.pb.c', 14 '$COMMON/pb_decode.o', 15 '$COMMON/pb_common.o']) 16 17for i in range(1,7): 18 # Encode message, then decode with protoc and test program and compare. 19 e = env.RunTest("message%d.pb" % i, enc, ARGS = [str(i)]) 20 d1 = env.Decode([e, "oneof.proto"], MESSAGE = "OneOfMessage") 21 d2 = env.RunTest("message%d.txt" % i, [dec, e]) 22 env.Compare([d1, d2]) 23