Hi Stewart, You can use `capnp eval` to accomplish that. Define a file input.capnp:
``` @0xda7d72d8f4b3c0c1; using Vm = import "vm.capnp"; const myVmInput: Vm.VMInput = (code=[.Vm.stop, .Vm.stop], data=[.Vm.stop, .Vm.stop]); ``` then encode it with `capnp eval -b input.capnp myVmInput`. - David On Tue, Apr 4, 2017 at 5:04 AM, stewart mackenzie <[email protected]> wrote: > Greetings > > I want to define a schema for a virtual machine input > > @0xb8d0e016e09e5605; > > const stop :Data = 0x"00"; > > struct VMInput { > code @1 :List(Data); > data @2 :List(Data); > } > > Next I want to create a set of files testing different scenarios of the > virtual machine > > message.txt contains > (code=[.stop, .stop], data=[.stop, .stop]) > > lets encode it > > $ capnp encode input.capnp VMInput < message.txt > message.bin > <stdin>:1:8-13: error: External constants not allowed in encode input. > <stdin>:1:15-20: error: External constants not allowed in encode input. > <stdin>:1:29-34: error: External constants not allowed in encode input. > <stdin>:1:36-41: error: External constants not allowed in encode input. > > okay, that's bad > > I want to define the vm bytecode as consts, this way I can have nice human > readable bytecode for my test cases. > > The objective is to make the tests super simple to spin up and reason > about in a text editor. > > Assistance greatly appreciated > > kr/sjm > > > -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > Visit this group at https://groups.google.com/group/capnproto. > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/capnproto.
