Files
monkey/internal/object/object_test.go
Charles Smith aebbe43999
Some checks failed
Build / build (push) Successful in 10m25s
Publish Image / publish (push) Failing after 39s
Test / build (push) Successful in 11m19s
Fix VM memory allocation optimizations by reducing what we allocate on the heap
2024-03-31 20:44:50 -04:00

23 lines
575 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.HashKey() != hello2.HashKey() {
t.Errorf("string with same content have different hash keys")
}
if diff1.HashKey() != diff2.HashKey() {
t.Errorf("string with same content have different hash keys")
}
if hello1.HashKey() == diff1.HashKey() {
t.Errorf("string with different content have same hash keys")
}
}