| 1 |
// Copyright (c) 2025, Maxime Soulé |
| 2 |
// All rights reserved. |
| 3 |
// |
| 4 |
// This source code is licensed under the BSD-style license found in the |
| 5 |
// LICENSE file in the root directory of this source tree. |
| 6 |
|
| 7 |
//go:build go1.21 |
| 8 |
// +build go1.21 |
| 9 |
|
| 10 |
package sort_test |
| 11 |
|
| 12 |
import ( |
| 13 |
"reflect" |
| 14 |
"slices" |
| 15 |
"testing" |
| 16 |
|
| 17 |
"github.com/maxatome/go-testdeep/internal/sort" |
| 18 |
) |
| 19 |
|
| 20 |
func TestFunc(t *testing.T) { |
| 21 |
s := []reflect.Value{ |
| 22 |
reflect.ValueOf(4), |
| 23 |
reflect.ValueOf(3), |
| 24 |
reflect.ValueOf(1), |
| 25 |
} |
| 26 |
slices.SortFunc(s, sort.Func()) |
| 27 |
if s[0].Int() != 1 || s[1].Int() != 3 || s[2].Int() != 4 { |
| 28 |
t.Errorf("sort error: [ %v, %v, %v ]", s[0].Int(), s[1].Int(), s[2].Int()) |
| 29 |
} |
| 30 |
} |