diff --git a/grow/defs/add_one.yaml b/grow/defs/add_one.yaml index 2936eca..f155a13 100644 --- a/grow/defs/add_one.yaml +++ b/grow/defs/add_one.yaml @@ -2,15 +2,11 @@ global_memory_size: 1 function_memory_size: 1 instruction_limit: 2 samples: -- global_memory_inputs: - 0: 0 - global_memory_outputs: - 0: 1 -- global_memory_inputs: - 0: 1 - global_memory_outputs: - 0: 2 -- global_memory_inputs: - 0: 100 - global_memory_outputs: - 0: 101 +- in: [0] + out: [1] + +- in: [1] + out: [2] + +- in: [100] + out: [101] diff --git a/grow/defs/mul_five.yaml b/grow/defs/mul_five.yaml index e824f7d..bb97b0d 100644 --- a/grow/defs/mul_five.yaml +++ b/grow/defs/mul_five.yaml @@ -2,19 +2,14 @@ global_memory_size: 1 function_memory_size: 1 instruction_limit: 2 samples: -- global_memory_inputs: - 0: 0 - global_memory_outputs: - 0: 0 -- global_memory_inputs: - 0: 1 - global_memory_outputs: - 0: 5 -- global_memory_inputs: - 0: 2 - global_memory_outputs: - 0: 10 -- global_memory_inputs: - 0: 100 - global_memory_outputs: - 0: 500 +- in: [0] + out: [0] + +- in: [1] + out: [5] + +- in: [2] + out: [10] + +- in: [100] + out: [500] diff --git a/grow/defs/mul_four.yaml b/grow/defs/mul_four.yaml index 75794c0..b3c048e 100644 --- a/grow/defs/mul_four.yaml +++ b/grow/defs/mul_four.yaml @@ -2,19 +2,14 @@ global_memory_size: 1 function_memory_size: 1 instruction_limit: 2 samples: -- global_memory_inputs: - 0: 0 - global_memory_outputs: - 0: 0 -- global_memory_inputs: - 0: 1 - global_memory_outputs: - 0: 4 -- global_memory_inputs: - 0: 2 - global_memory_outputs: - 0: 8 -- global_memory_inputs: - 0: 100 - global_memory_outputs: - 0: 400 +- in: [0] + out: [0] + +- in: [1] + out: [4] + +- in: [2] + out: [8] + +- in: [100] + out: [400] diff --git a/grow/defs/mul_two.yaml b/grow/defs/mul_two.yaml index f6d39cf..4d97be7 100644 --- a/grow/defs/mul_two.yaml +++ b/grow/defs/mul_two.yaml @@ -2,19 +2,14 @@ global_memory_size: 1 function_memory_size: 1 instruction_limit: 2 samples: -- global_memory_inputs: - 0: 0 - global_memory_outputs: - 0: 0 -- global_memory_inputs: - 0: 1 - global_memory_outputs: - 0: 2 -- global_memory_inputs: - 0: 2 - global_memory_outputs: - 0: 4 -- global_memory_inputs: - 0: 100 - global_memory_outputs: - 0: 200 +- in: [0] + out: [0] + +- in: [1] + out: [2] + +- in: [2] + out: [4] + +- in: [100] + out: [200] diff --git a/grow/sample.go b/grow/sample.go index cf51e47..7aec5b9 100644 --- a/grow/sample.go +++ b/grow/sample.go @@ -3,19 +3,19 @@ package grow import "github.com/firestuff/subcoding/vm" type Sample struct { - GlobalMemoryInputs map[uint64]uint64 `yaml:"global_memory_inputs"` - GlobalMemoryOutputs map[uint64]uint64 `yaml:"global_memory_outputs"` + In []uint64 `yaml:"in,flow"` + Out []uint64 `yaml:"out,flow"` } func (s *Sample) SetInputs(state *vm.State) { - for i, val := range s.GlobalMemoryInputs { - state.GlobalMemory().WriteUnsigned(i, val) + for i, val := range s.In { + state.GlobalMemory().WriteUnsigned(uint64(i), val) } } func (s *Sample) OutputsMatch(state *vm.State) bool { - for i, val := range s.GlobalMemoryOutputs { - if state.GlobalMemory().MustReadUnsigned(i) != val { + for i, val := range s.Out { + if state.GlobalMemory().MustReadUnsigned(uint64(i)) != val { return false } }