Skip to content

Commit

Permalink
chore: rename vectorTest to testVector
Browse files Browse the repository at this point in the history
  • Loading branch information
MorettiGeorgiev committed Oct 24, 2024
1 parent a17c7f9 commit 68cf901
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions zk/tests/zk_counters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type vector struct {
} `json:"txs"`
}

type vectorTest struct {
type testVector struct {
idx int
fileName string
vector vector
Expand All @@ -99,25 +99,25 @@ func Test_RunTestVectors(t *testing.T) {
m := mock.Mock(t)
blockReader, _ := m.BlocksIO()

vectorTests, err := vectorTests()
testVectors, err := testVectors()
if err != nil {
t.Fatalf("could not get vector tests: %v", err)
}

for idx, test := range vectorTests {
for idx, test := range testVectors {
t.Run(test.fileName, func(t *testing.T) {
runTest(t, blockReader, vectorTests[idx])
runTest(t, blockReader, testVectors[idx])
})
}
}

func vectorTests() ([]vectorTest, error) {
func testVectors() ([]testVector, error) {
files, err := os.ReadDir(root)
if err != nil {
return nil, fmt.Errorf("could not read directory %s: %v", root, err)
}

var tests []vectorTest
var tests []testVector
for _, file := range files {
var vectors []vector
contents, err := os.ReadFile(fmt.Sprintf("%s/%s", root, file.Name()))
Expand All @@ -129,7 +129,7 @@ func vectorTests() ([]vectorTest, error) {
return nil, fmt.Errorf("could not unmarshal file %s: %v", file.Name(), err)
}
for i := len(vectors) - 1; i >= 0; i-- {
tests = append(tests, vectorTest{
tests = append(tests, testVector{
idx: i,
fileName: file.Name(),
vector: vectors[i],
Expand All @@ -140,7 +140,7 @@ func vectorTests() ([]vectorTest, error) {
return tests, nil
}

func runTest(t *testing.T, blockReader services.FullBlockReader, test vectorTest) {
func runTest(t *testing.T, blockReader services.FullBlockReader, test testVector) {
// arrange
decodedBlocks, err := decodeBlocks(test.vector, test.fileName)
if err != nil {
Expand Down

0 comments on commit 68cf901

Please sign in to comment.