TestMGet tests the MGet method
(t *testing.T)
| 584 | |
| 585 | // TestMGet tests the MGet method |
| 586 | func 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 |
| 612 | func TestGetAll(t *testing.T) { |
nothing calls this directly
no test coverage detected