mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-21 18:00:47 +00:00
add hasher tests
This commit is contained in:
parent
e5a75872fe
commit
6dc1631eb3
@ -5,6 +5,12 @@ go 1.21.5
|
||||
require (
|
||||
github.com/elliotchance/orderedmap/v2 v2.2.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/stretchr/testify v1.7.1
|
||||
)
|
||||
|
||||
require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
|
||||
)
|
||||
|
@ -13,6 +13,7 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
29
day-15/hasher_test.go
Normal file
29
day-15/hasher_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHasher(t *testing.T) {
|
||||
//t.Skip("skipping test")
|
||||
|
||||
hash := newHasher()
|
||||
|
||||
t.Run("Should produce a hash value 30", func(t *testing.T) {
|
||||
assert.Equal(t, 30, hash.run("rn=1"))
|
||||
})
|
||||
|
||||
t.Run("Should produce a hash value 253", func(t *testing.T) {
|
||||
assert.Equal(t, 253, hash.run("cm-"))
|
||||
})
|
||||
|
||||
t.Run("Should produce a hash value 0", func(t *testing.T) {
|
||||
assert.Equal(t, 0, hash.run("rn"))
|
||||
})
|
||||
|
||||
t.Run("Should produce a hash value 3", func(t *testing.T) {
|
||||
assert.Equal(t, 3, hash.run("pc"))
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user