diff --git a/day-15/go.mod b/day-15/go.mod index 228e1e8..6bcf2ed 100644 --- a/day-15/go.mod +++ b/day-15/go.mod @@ -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 +) diff --git a/day-15/go.sum b/day-15/go.sum index 70c7aac..49660a1 100644 --- a/day-15/go.sum +++ b/day-15/go.sum @@ -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= diff --git a/day-15/hasher_test.go b/day-15/hasher_test.go new file mode 100644 index 0000000..fdca86f --- /dev/null +++ b/day-15/hasher_test.go @@ -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")) + }) +}