Skip to content

Commit ce9623c

Browse files
author
wudeyu
committed
fix the test case
1 parent 084b5ca commit ce9623c

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

tests/test_rdd.rs

+33-3
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,41 @@ fn test_intersection() {
462462
#[test]
463463
fn test_sort_by() {
464464
let sc = CONTEXT.clone();
465-
let col = vec![1, 3, 2, 4, 4, 10, 9, 13, 19, 0];
465+
let col = vec![
466+
"1".to_string(),
467+
"3".to_string(),
468+
"2".to_string(),
469+
"4".to_string(),
470+
"4".to_string(),
471+
"10".to_string(),
472+
"9".to_string(),
473+
"13".to_string(),
474+
"19".to_string(),
475+
"0".to_string(),
476+
];
466477

467478
let rdd = sc.parallelize(col, 2);
468-
let res = rdd.sort_by(true, 5, Fn!(|x| { x })).collect().unwrap();
479+
let res = rdd
480+
.sort_by(
481+
true,
482+
5,
483+
Fn!(|x: &String| -> u8 { x.parse::<u8>().unwrap() }),
484+
)
485+
.collect()
486+
.unwrap();
487+
488+
let expected = vec![
489+
"0".to_string(),
490+
"1".to_string(),
491+
"2".to_string(),
492+
"3".to_string(),
493+
"4".to_string(),
494+
"4".to_string(),
495+
"9".to_string(),
496+
"10".to_string(),
497+
"13".to_string(),
498+
"19".to_string(),
499+
];
469500

470-
let expected = vec![0, 1, 2, 3, 4, 4, 9, 10, 13, 19];
471501
assert_eq!(res, expected);
472502
}

0 commit comments

Comments
 (0)