Browse Source

tests: unify testdata directory

wip_broken_chromebook
George Tankersley 5 years ago
parent
commit
abca4335ec
  1. 2
      parser/block_header_test.go
  2. 4
      parser/block_test.go
  3. 4
      parser/transaction_test.go
  4. 24
      storage/sqlite3_test.go
  5. 38
      storage/testdata/compact_blocks.json
  6. 0
      testdata/blocks
  7. 0
      testdata/compact_blocks.json
  8. 0
      testdata/corpus/block0
  9. 0
      testdata/corpus/block1
  10. 0
      testdata/corpus/block2
  11. 0
      testdata/corpus/block3
  12. BIN
      testdata/test.db
  13. 0
      testdata/zip143_raw_tx
  14. 0
      testdata/zip243_raw_tx

2
parser/block_header_test.go

@ -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)
}

4
parser/block_test.go

@ -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)
}

4
parser/transaction_test.go

@ -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)
}

24
storage/sqlite3_test.go

@ -17,26 +17,22 @@ 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")
if err != nil {
t.Fatal(err)
}
var compactTests []compactTest
err = json.Unmarshal(blockJSON, &compactTests)
func TestSqliteStorage(t *testing.T) {
blockJSON, err := ioutil.ReadFile("../testdata/compact_blocks.json")
if err != nil {
t.Fatal(err)
}
conn, err := sql.Open("sqlite3", ":memory:")
err = json.Unmarshal(blockJSON, &compactTests)
if err != nil {
t.Fatal(err)
}

38
storage/testdata/compact_blocks.json

File diff suppressed because one or more lines are too long

0
parser/testdata/blocks → testdata/blocks

0
parser/testdata/compact_blocks.json → testdata/compact_blocks.json

0
parser/testdata/corpus/block0 → testdata/corpus/block0

0
parser/testdata/corpus/block1 → testdata/corpus/block1

0
parser/testdata/corpus/block2 → testdata/corpus/block2

0
parser/testdata/corpus/block3 → testdata/corpus/block3

BIN
testdata/test.db

Binary file not shown.

0
parser/testdata/zip143_raw_tx → testdata/zip143_raw_tx

0
parser/testdata/zip243_raw_tx → testdata/zip243_raw_tx

Loading…
Cancel
Save