From 3fef4167b90d8340f53f89cfc12f270fab865aac Mon Sep 17 00:00:00 2001 From: Meng-Ying Yang Date: Sat, 23 Feb 2019 10:52:14 +0800 Subject: core: vm: sqlvm: add op testcases with template We reduce code of funtion call and nested struct initialization by generating testcases with go template system. Run `go run cmd/gen-op-test/main.go` first before testing instructions, and commit generated code for fully testing on CI. --- core/vm/sqlvm/cmd/gen-op-test/main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 core/vm/sqlvm/cmd/gen-op-test/main.go (limited to 'core/vm/sqlvm/cmd') diff --git a/core/vm/sqlvm/cmd/gen-op-test/main.go b/core/vm/sqlvm/cmd/gen-op-test/main.go new file mode 100644 index 000000000..60387dddf --- /dev/null +++ b/core/vm/sqlvm/cmd/gen-op-test/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "flag" + + "github.com/dexon-foundation/dexon/core/vm/sqlvm/runtime" +) + +func main() { + var output string + flag.StringVar( + &output, "o", "./runtime/instructions_op_test.go", + "the output path of generated testcases", + ) + flag.Parse() + + err := runtime.RenderOpTest(output) + if err != nil { + panic(err) + } +} -- cgit v1.2.3