You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "github.com/tendermint/abci/types"
  6. )
  7. var abciType string
  8. func init() {
  9. abciType = os.Getenv("ABCI")
  10. if abciType == "" {
  11. abciType = "socket"
  12. }
  13. }
  14. func main() {
  15. testCounter()
  16. }
  17. func testCounter() {
  18. abciApp := os.Getenv("ABCI_APP")
  19. if abciApp == "" {
  20. panic("No ABCI_APP specified")
  21. }
  22. fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
  23. appProc := startApp(abciApp)
  24. defer appProc.StopProcess(true)
  25. client := startClient(abciType)
  26. defer client.Stop()
  27. setOption(client, "serial", "on")
  28. commit(client, nil)
  29. deliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil)
  30. commit(client, nil)
  31. deliverTx(client, []byte{0x00}, types.CodeType_OK, nil)
  32. commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1})
  33. deliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil)
  34. deliverTx(client, []byte{0x01}, types.CodeType_OK, nil)
  35. deliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil)
  36. deliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil)
  37. deliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil)
  38. deliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil)
  39. commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})
  40. }