Browse Source

test_app: unexport internal function.

This reverts commit 24c9b2761d.
pull/1780/head
Tzu-Jung Lee 8 years ago
parent
commit
af2a66b226
2 changed files with 22 additions and 24 deletions
  1. +7
    -9
      tests/test_app/app.go
  2. +15
    -15
      tests/test_app/main.go

+ 7
- 9
tests/test_app/app.go View File

@ -2,18 +2,16 @@ package main
import (
"bytes"
"fmt"
"os"
"time"
"github.com/tendermint/abci/client"
"github.com/tendermint/abci/types"
common "github.com/tendermint/go-common"
"github.com/tendermint/go-process"
)
//----------------------------------------
func StartApp(abciApp string) *process.Process {
func startApp(abciApp string) *process.Process {
// Start the app
//outBuf := NewBufferCloser(nil)
proc, err := process.StartProcess("abci_app",
@ -33,7 +31,7 @@ func StartApp(abciApp string) *process.Process {
return proc
}
func StartClient(abciType string) abcicli.Client {
func startClient(abciType string) abcicli.Client {
// Start client
client, err := abcicli.NewClient("tcp://127.0.0.1:46658", abciType, true)
if err != nil {
@ -42,7 +40,7 @@ func StartClient(abciType string) abcicli.Client {
return client
}
func SetOption(client abcicli.Client, key, value string) {
func setOption(client abcicli.Client, key, value string) {
res := client.SetOptionSync(key, value)
_, _, log := res.Code, res.Data, res.Log
if res.IsErr() {
@ -50,7 +48,7 @@ func SetOption(client abcicli.Client, key, value string) {
}
}
func Commit(client abcicli.Client, hashExp []byte) {
func commit(client abcicli.Client, hashExp []byte) {
res := client.CommitSync()
_, data, log := res.Code, res.Data, res.Log
if res.IsErr() {
@ -62,7 +60,7 @@ func Commit(client abcicli.Client, hashExp []byte) {
}
}
func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
func deliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
res := client.DeliverTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log
if code != codeExp {
@ -75,7 +73,7 @@ func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, da
}
}
func CheckTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
func checkTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
res := client.CheckTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log
if res.IsErr() {


+ 15
- 15
tests/test_app/main.go View File

@ -27,22 +27,22 @@ func testCounter() {
}
fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
appProc := StartApp(abciApp)
appProc := startApp(abciApp)
defer appProc.StopProcess(true)
client := StartClient(abciType)
client := startClient(abciType)
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})
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})
}

Loading…
Cancel
Save