MCPcopy Create free account
hub / github.com/aceld/zinx / TestMGet

Function TestMGet

zutils/shard_lock_map_test.go:586–609  ·  view source on GitHub ↗

TestMGet tests the MGet method

(t *testing.T)

Source from the content-addressed store, hash-verified

584
585// TestMGet tests the MGet method
586func TestMGet(t *testing.T) {
587 slm := NewShardLockMaps()
588 slm.Set("key1", "value1")
589 slm.Set("key2", "value2")
590 slm.Set("key3", "value3")
591
592 // Test getting multiple existing keys
593 values := slm.MGet("key1", "key2", "key3")
594 if len(values) != 3 {
595 t.Error("Expected 3 values")
596 }
597 if values["key1"] != "value1" || values["key2"] != "value2" || values["key3"] != "value3" {
598 t.Error("Expected correct values")
599 }
600
601 // Test getting mix of existing and non-existing keys
602 values = slm.MGet("key1", "nonexistent", "key2")
603 if len(values) != 2 {
604 t.Error("Expected 2 values for mix of existing and non-existing keys")
605 }
606 if values["key1"] != "value1" || values["key2"] != "value2" {
607 t.Error("Expected correct values for existing keys")
608 }
609}
610
611// TestGetAll tests the GetAll method
612func TestGetAll(t *testing.T) {

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
MGetMethod · 0.95
NewShardLockMapsFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected