tests: unify testdata directory

This commit is contained in:
George Tankersley 2018-12-14 19:17:27 -05:00
parent 313adc8432
commit abca4335ec
14 changed files with 15 additions and 57 deletions

View File

@ -55,7 +55,7 @@ func TestParseNBits(t *testing.T) {
}
func TestBlockHeader(t *testing.T) {
testBlocks, err := os.Open("testdata/blocks")
testBlocks, err := os.Open("../testdata/blocks")
if err != nil {
t.Fatal(err)
}

View File

@ -15,7 +15,7 @@ import (
)
func TestBlockParser(t *testing.T) {
testBlocks, err := os.Open("testdata/blocks")
testBlocks, err := os.Open("../testdata/blocks")
if err != nil {
t.Fatal(err)
}
@ -54,7 +54,7 @@ func TestCompactBlocks(t *testing.T) {
}
var compactTests []compactTest
blockJSON, err := ioutil.ReadFile("testdata/compact_blocks.json")
blockJSON, err := ioutil.ReadFile("../testdata/compact_blocks.json")
if err != nil {
t.Fatal(err)
}

View File

@ -152,7 +152,7 @@ func TestSproutTransactionParser(t *testing.T) {
// order as the test table above. If you update the test table without
// adding a line to the raw file, this test will panic due to index
// misalignment.
testData, err := os.Open("testdata/zip143_raw_tx")
testData, err := os.Open("../testdata/zip143_raw_tx")
if err != nil {
t.Fatal(err)
}
@ -658,7 +658,7 @@ var zip243tests = []txTestVector{
}
func TestSaplingTransactionParser(t *testing.T) {
testData, err := os.Open("testdata/zip243_raw_tx")
testData, err := os.Open("../testdata/zip243_raw_tx")
if err != nil {
t.Fatal(err)
}

View File

@ -17,16 +17,17 @@ import (
"github.com/gtank/ctxd/rpc"
)
func TestSqliteStorage(t *testing.T) {
type compactTest struct {
BlockHeight int `json:"block"`
BlockHash string `json:"hash"`
Full string `json:"full"`
Compact string `json:"compact"`
}
var compactTests []compactTest
type compactTest struct {
BlockHeight int `json:"block"`
BlockHash string `json:"hash"`
Full string `json:"full"`
Compact string `json:"compact"`
}
blockJSON, err := ioutil.ReadFile("testdata/compact_blocks.json")
var compactTests []compactTest
func TestSqliteStorage(t *testing.T) {
blockJSON, err := ioutil.ReadFile("../testdata/compact_blocks.json")
if err != nil {
t.Fatal(err)
}
@ -35,11 +36,6 @@ func TestSqliteStorage(t *testing.T) {
if err != nil {
t.Fatal(err)
}
conn, err := sql.Open("sqlite3", ":memory:")
if err != nil {
t.Fatal(err)
}
defer conn.Close()
err = CreateTables(conn)

File diff suppressed because one or more lines are too long

BIN
testdata/test.db vendored Normal file

Binary file not shown.