tendermint/tests/test_app/main.go

49 lines
1.2 KiB
Go
Raw Normal View History

2016-07-23 15:54:58 -07:00
package main
import (
"fmt"
"os"
2017-01-12 12:47:55 -08:00
"github.com/tendermint/abci/types"
2016-07-23 15:54:58 -07:00
)
2017-01-12 12:47:55 -08:00
var abciType string
2016-07-23 15:54:58 -07:00
func init() {
2017-01-12 12:47:55 -08:00
abciType = os.Getenv("ABCI")
if abciType == "" {
abciType = "socket"
2016-07-23 15:54:58 -07:00
}
}
func main() {
testCounter()
}
func testCounter() {
2017-01-12 12:47:55 -08:00
abciApp := os.Getenv("ABCI_APP")
if abciApp == "" {
panic("No ABCI_APP specified")
2016-07-23 15:54:58 -07:00
}
2017-01-12 12:47:55 -08:00
fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
appProc := startApp(abciApp)
2016-07-23 15:54:58 -07:00
defer appProc.StopProcess(true)
client := startClient(abciType)
2016-07-23 15:54:58 -07:00
defer client.Stop()
setOption(client, "serial", "on")
commit(client, nil)
deliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil)
commit(client, nil)
deliverTx(client, []byte{0x00}, types.CodeType_OK, nil)
commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1})
deliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil)
deliverTx(client, []byte{0x01}, types.CodeType_OK, nil)
deliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil)
deliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil)
deliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil)
deliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil)
commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})
2016-07-23 15:54:58 -07:00
}