Files
monkey/internal/object/object_test.go
csmith 99f7553d67
Some checks failed
Publish Image / publish (push) Waiting to run
Test / build (push) Waiting to run
Build / build (push) Has been cancelled
refactor objects
2024-04-01 17:34:10 -04:00

23 lines
557 B
Go

package object
import "testing"
func TestStringHashKey(t *testing.T) {
hello1 := String{Value: "Hello World"}
hello2 := String{Value: "Hello World"}
diff1 := String{Value: "My name is johnny"}
diff2 := String{Value: "My name is johnny"}
if hello1.Hash() != hello2.Hash() {
t.Errorf("string with same content have different hash keys")
}
if diff1.Hash() != diff2.Hash() {
t.Errorf("string with same content have different hash keys")
}
if hello1.Hash() == diff1.Hash() {
t.Errorf("string with different content have same hash keys")
}
}