fix concurrent_test Error

This commit is contained in:
226Charles
2023-04-25 00:09:36 +08:00
committed by korverwang
parent 5c4e85c45a
commit 7c8eee4b2d

View File

@@ -230,6 +230,7 @@ func TestConcurrentRemove(t *testing.T) {
} }
} }
//change t.Error remove->forEach
func TestConcurrentForEach(t *testing.T) { func TestConcurrentForEach(t *testing.T) {
d := MakeConcurrent(0) d := MakeConcurrent(0)
size := 100 size := 100
@@ -243,13 +244,13 @@ func TestConcurrentForEach(t *testing.T) {
intVal, _ := value.(int) intVal, _ := value.(int)
expectedKey := "k" + strconv.Itoa(intVal) expectedKey := "k" + strconv.Itoa(intVal)
if key != expectedKey { if key != expectedKey {
t.Error("remove test failed: expected " + expectedKey + ", actual: " + key) t.Error("forEach test failed: expected " + expectedKey + ", actual: " + key)
} }
i++ i++
return true return true
}) })
if i != size { if i != size {
t.Error("remove test failed: expected " + strconv.Itoa(size) + ", actual: " + strconv.Itoa(i)) t.Error("forEach test failed: expected " + strconv.Itoa(size) + ", actual: " + strconv.Itoa(i))
} }
} }