-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
20,050 additions
and
628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package ssz | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"strconv" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestBitlist(t *testing.T) { | ||
res := []string{} | ||
err := filepath.Walk("./spectests/fixtures/bitlist", func(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if !info.IsDir() { | ||
res = append(res, path) | ||
} | ||
return nil | ||
}) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
for _, i := range res { | ||
t.Run(i, func(t *testing.T) { | ||
serialized, err := ioutil.ReadFile(i) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
var maxSize uint64 | ||
|
||
testName := strings.Split(i, "/")[3] | ||
if strings.Contains(testName, "_no_") { | ||
maxSize = 1000 | ||
} else { | ||
// decode maxSize from name | ||
num, err := strconv.Atoi(strings.Split(testName, "_")[1]) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
maxSize = uint64(num) | ||
} | ||
|
||
if err := ValidateBitlist(serialized, maxSize); err == nil { | ||
t.Fatal("bad") | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,9 @@ | ||
module github.com/ferranbt/fastssz | ||
|
||
go 1.12 | ||
go 1.14 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.0 | ||
github.com/dgraph-io/ristretto v0.0.1 // indirect | ||
github.com/ghodss/yaml v1.0.0 | ||
github.com/gogo/protobuf v1.3.1 // indirect | ||
github.com/golang/protobuf v1.3.4 | ||
github.com/google/go-cmp v0.4.0 | ||
github.com/google/gofuzz v1.1.0 | ||
github.com/grpc-ecosystem/grpc-gateway v1.13.0 | ||
github.com/minio/highwayhash v1.0.0 // indirect | ||
github.com/minio/sha256-simd v0.1.1 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/protolambda/zssz v0.1.3 | ||
github.com/prysmaticlabs/go-bitfield v0.0.0-20191017011753-53b773adde52 | ||
github.com/prysmaticlabs/go-ssz v0.0.0-20200101200214-e24db4d9e963 | ||
github.com/stretchr/testify v1.5.1 | ||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383 | ||
google.golang.org/grpc v1.27.1 | ||
gopkg.in/yaml.v2 v2.2.3 | ||
gotest.tools v2.2.0+incompatible | ||
github.com/minio/sha256-simd v0.1.1 | ||
github.com/mitchellh/mapstructure v1.3.2 | ||
gopkg.in/yaml.v2 v2.3.0 | ||
) |
Oops, something went wrong.