()
| 3693 | |
| 3694 | #[test] |
| 3695 | fn argsort_permutation_default() { |
| 3696 | // Test with a slice of string literals. |
| 3697 | let fruits = ["banana", "apple", "cherry"]; |
| 3698 | let mut order = [0; 3]; // output buffer must be at least fruits.len() |
| 3699 | sz::argsort_permutation(&fruits, &mut order).expect("argsort_permutation failed"); |
| 3700 | |
| 3701 | // Reconstruct sorted order using the returned indices. |
| 3702 | let sorted_from_api: Vec<_> = order.iter().map(|&i| fruits[i]).collect(); |
| 3703 | |
| 3704 | // Compute expected order using the standard sort. |
| 3705 | let mut expected = fruits.to_vec(); |
| 3706 | expected.sort(); |
| 3707 | |
| 3708 | assert_eq!(sorted_from_api, expected); |
| 3709 | } |
| 3710 | |
| 3711 | #[test] |
| 3712 | fn argsort_permutation_by_custom() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…