Require a first argument of test type

This commit is contained in:
Taylor Gerring 2015-06-08 16:03:21 -04:00
parent e4f9ec886b
commit 6415ed0730

View File

@ -225,9 +225,29 @@ func main() {
helper.Logger.SetLogLevel(5) helper.Logger.SetLogLevel(5)
vm.Debug = true vm.Debug = true
if len(os.Args) > 1 { if len(os.Args) < 2 {
os.Exit(RunVmTest(strings.NewReader(os.Args[1]))) glog.Exit("Must specify test type")
} else {
os.Exit(RunVmTest(os.Stdin))
} }
test := os.Args[1]
var code int
switch test {
case "vm", "VMTests":
glog.Exit("VMTests not yet implemented")
case "state", "StateTest":
if len(os.Args) > 2 {
code = RunVmTest(strings.NewReader(os.Args[2]))
} else {
code = RunVmTest(os.Stdin)
}
case "tx", "TransactionTests":
glog.Exit("TransactionTests not yet implemented")
case "bc", "BlockChainTest":
glog.Exit("BlockChainTest not yet implemented")
default:
glog.Exit("Invalid test type specified")
}
os.Exit(code)
} }