aboutsummaryrefslogtreecommitdiff
path: root/object/object_test.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-04-10 20:42:41 +0000
committerBobby <[email protected]>2024-04-10 20:42:41 +0000
commitca46690f9166681e4b32af90e28fb215c12f76c0 (patch)
tree1b8ac7bf26616bcc0bdc3038221997d30d66d751 /object/object_test.go
parente7b7baba5e6485ae6e241eee4c3f30557afa0fa8 (diff)
downloadmana-ca46690f9166681e4b32af90e28fb215c12f76c0.tar.xz
mana-ca46690f9166681e4b32af90e28fb215c12f76c0.zip
hashes
Diffstat (limited to 'object/object_test.go')
-rw-r--r--object/object_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/object/object_test.go b/object/object_test.go
new file mode 100644
index 0000000..3d08c8b
--- /dev/null
+++ b/object/object_test.go
@@ -0,0 +1,22 @@
+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("strings with same content have different hash keys")
+ }
+
+ if diff1.HashKey() != diff2.HashKey() {
+ t.Errorf("strings with same content have different hash keys")
+ }
+
+ if hello1.HashKey() == diff1.HashKey() {
+ t.Errorf("strings with different content have same hash keys")
+ }
+} \ No newline at end of file