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

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