1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

fix: fix slice_test.go ,We should not assume the order of the slice when using multithreads,sort them before compare

This commit is contained in:
jialulu
2025-02-09 22:23:35 +08:00
parent d4b425e39c
commit fc43138a0e

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"math"
"reflect"
"sort"
"strconv"
"strings"
"sync"
@@ -1794,6 +1795,8 @@ func TestFilterConcurrent(t *testing.T) {
nums := []int{1, 2, 3, 4, 5, 6}
expected := []int{4, 5, 6}
actual := FilterConcurrent(nums, func(_, n int) bool { return n > 3 }, 4)
sort.Ints(actual)
sort.Ints(expected)
assert.Equal(expected, actual)
})
}