text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
#[test] fn test_borrow() { // make sure these compile -- using the Borrow trait { let mut map = BTreeMap::new(); map.insert("0".to_string(), 1); assert_eq!(map["0"], 1); } { let mut map = BTreeMap::new(); map.insert(Box::new(0), 1); assert_eq!(map[&0], 1); } { let mut map = BTreeMap::new(); map.insert(Box::new([0, 1]) as Box<[i32]>, 1); assert_eq!(map[&[0, 1][..]], 1); } { let mut map = BTreeMap::new(); map.insert(Rc::new(0), 1); assert_eq!(map[&0], 1); } }
rust_cleaned_test_functions.jsonl/49394
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 323 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 7768, 368, 341, 262, 442, 1281, 2704, 1493, 19192, 1177, 1667, 279, 77947, 17567, 198, 262, 341, 286, 1077, 5206, 2415, 284, 425, 6533, 2227, 486, 931, 543, 286, 2415, 7030, 445, 15, 3263, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_angle_x_rotate_point1() { let rotation = Rotation3::from_angle_x(Degrees(90_f64)); let point = Point3::new(0_f64, 1_f64, 0_f64); let expected = Point3::new(0_f64, 0_f64, 1_f64); let result = rotation.rotate_point(&point); assert!(relative_eq!(result, expected, epsilon = 1e-8)); }
rust_cleaned_test_functions.jsonl/70484
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 21727, 3212, 60834, 6085, 16, 368, 341, 286, 1077, 12695, 284, 47528, 18, 486, 1499, 21727, 3212, 5432, 791, 7858, 7, 24, 15, 761, 21, 19, 1106, 286, 1077, 1459, 284, 5126, 18, 486, 931,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_date_time() { let (val, remaining) = date_time() .parse("2015-08-02T18:54:42+02:30") .expect("cannot parse date"); assert_eq!(val, "2015-08-02T18:54:42+02:30"); assert_eq!(remaining, ""); assert!(date_time().parse("2015-08-02T18:54:42+02").is_err()); let (val, remaining) = date_time() .parse("2021-04-13T19:46:26.266051969+00:00") .expect("cannot parse fractional date"); assert_eq!(val, "2021-04-13T19:46:26.266051969+00:00"); assert_eq!(remaining, ""); }
rust_cleaned_test_functions.jsonl/64402
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 313 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4164, 3009, 368, 341, 286, 1077, 320, 831, 11, 9664, 8, 284, 2400, 3009, 741, 310, 659, 6400, 445, 17, 15, 16, 20, 12, 15, 23, 12, 15, 17, 51, 16, 23, 25, 20, 19, 25, 19, 17, 10, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_statns_to_nslist() { let mut listns: Vec<NsCtx> = Vec::<NsCtx>::new(); let test_nsid = 4000000000u64; let test_pid = 12345; let test_ppid = 1234; listns.push(NsCtx { nsid: test_nsid, nstype: Namespace::Mount, }); let statns = StatNs { cmdline: "/bin/bash".to_string(), stat: Stat { pid: test_pid, ppid: test_ppid, ..Default::default() }, nses: listns, }; let mut vec_statns: Vec<StatNs> = Vec::<StatNs>::new(); vec_statns.push(statns); let map_listns = statns_to_nslist(vec_statns); assert_eq!(ns_const_to_str(&map_listns[&test_nsid].nstype), "mnt"); assert_eq!(map_listns[&test_nsid].nproc, 1u32); assert_eq!(map_listns[&test_nsid].pid, test_pid); assert_eq!(map_listns[&test_nsid].ppid, test_ppid); assert_eq!(map_listns[&test_nsid].cmdline, "/bin/bash".to_string()); }
rust_cleaned_test_functions.jsonl/102375
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 620 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16271, 4412, 2346, 34728, 1607, 368, 341, 286, 1077, 5206, 1140, 4412, 25, 11312, 29198, 82, 23684, 29, 284, 11312, 27638, 47360, 23684, 6831, 931, 543, 286, 1077, 1273, 1089, 21027, 284, 220, 19,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_string_ext() { let mut s = String::new(); let t = "αβγabc"; StringExt::insert_str(&mut s, 0, t); assert_eq!(s, t); StringExt::insert_str(&mut s, 2, "x"); assert_eq!(s, "αxβγabc"); }
rust_cleaned_test_functions.jsonl/4259
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3904, 9927, 368, 341, 262, 1077, 5206, 274, 284, 923, 486, 931, 543, 262, 1077, 259, 284, 330, 18945, 51255, 59374, 13683, 876, 262, 923, 6756, 486, 4208, 2895, 2099, 6984, 274, 11, 220, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_datetime_and_duration() { let mut ctx = EvalContext::default(); let cases = vec![ // null cases (None, None, None), (None, Some("11:30:45.123456"), None), (Some("2019-01-01 01:00:00"), None, None), // normal cases ( Some("2018-01-01"), Some("11:30:45.123456"), Some("2018-01-01 11:30:45.123456"), ), ( Some("2018-02-28 23:00:00"), Some("01:30:30.123456"), Some("2018-03-01 00:30:30.123456"), ), ( Some("2016-02-28 23:00:00"), Some("01:30:30"), Some("2016-02-29 00:30:30"), ), ( Some("2018-12-31 23:00:00"), Some("01:30:30"), Some("2019-01-01 00:30:30"), ), ( Some("2018-12-31 23:00:00"), Some("1 01:30:30"), Some("2019-01-02 00:30:30"), ), ( Some("2019-01-01 01:00:00"), Some("-01:01:00"), Some("2018-12-31 23:59:00"), ), ]; for (arg1, arg2, exp) in cases { let exp = exp.map(|exp| Time::parse_datetime(&mut ctx, exp, MAX_FSP, true).unwrap()); let arg1 = arg1.map(|arg1| Time::parse_datetime(&mut ctx, arg1, MAX_FSP, true).unwrap()); let arg2 = arg2.map(|arg2| Duration::parse(&mut ctx, arg2, MAX_FSP).unwrap()); let output = RpnFnScalarEvaluator::new() .push_param(arg1) .push_param(arg2) .evaluate(ScalarFuncSig::AddDatetimeAndDuration) .unwrap(); assert_eq!(output, exp); } }
rust_cleaned_test_functions.jsonl/36244
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1169 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 28943, 8378, 25454, 368, 341, 286, 1077, 5206, 5635, 284, 58239, 1972, 486, 2258, 543, 286, 1077, 5048, 284, 7486, 90515, 310, 442, 845, 5048, 198, 310, 320, 4064, 11, 2240, 11, 2240, 1326...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_parser_errors() { let p = Commands::default().line_parser(); let (err, _) = p .parse(":map <ctrl> :tool sampler {:tool/prev") .unwrap_err(); assert_eq!(err.to_string(), "unclosed '{' delimiter".to_string()); let (err, _) = p.parse(":map <ctrl> :tool sampler :tool/prev").unwrap_err(); assert_eq!( err.to_string(), "extraneous input found: :tool/prev".to_string() ); }
rust_cleaned_test_functions.jsonl/95937
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 244 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18517, 20196, 368, 341, 286, 1077, 281, 284, 47183, 486, 2258, 1005, 1056, 18517, 1428, 286, 1077, 320, 615, 11, 27439, 284, 281, 198, 310, 659, 6400, 18893, 2186, 366, 11933, 29, 549, 14172, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_uniform_good_limits_equal_int() { let mut rng = crate::test::rng(804); let dist = Uniform::new_inclusive(10, 10); for _ in 0..20 { assert_eq!(rng.sample(dist), 10); } }
rust_cleaned_test_functions.jsonl/42154
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 125 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45066, 44781, 31820, 11478, 4042, 368, 341, 286, 1077, 5206, 28422, 284, 17717, 486, 1944, 486, 69890, 7, 23, 15, 19, 317, 286, 1077, 1582, 284, 47889, 486, 931, 1243, 8336, 7, 16, 15, 11, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_clean_dropped_unrooted_unfrozen_banks() { solana_logger::setup(); do_test_clean_dropped_unrooted_banks(FreezeBank1::No); }
rust_cleaned_test_functions.jsonl/2682
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 81 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19573, 814, 41716, 4907, 2888, 291, 4907, 69, 42240, 880, 4039, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 653, 4452, 19573, 814, 41716, 4907, 2888, 291, 880, 4039, 7832, 27633, 25828...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_ceil_int_to_int() { let cases = vec![ (1, 1), (2, 2), (666, 666), (-3, -3), (-233, -233), (i64::MAX, i64::MAX), (i64::MIN, i64::MIN), ]; for (expected, input) in cases { let expected = Some(expected); let output = RpnFnScalarEvaluator::new() .push_param(input) .evaluate::<Int>(ScalarFuncSig::CeilIntToInt) .unwrap(); assert_eq!(expected, output); } }
rust_cleaned_test_functions.jsonl/9479
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 360 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 22058, 4042, 2346, 4042, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 320, 16, 11, 220, 16, 1326, 310, 320, 17, 11, 220, 17, 1326, 310, 320, 21, 21, 21, 11, 220, 21, 21, 21, 1326,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_casting_implicit_types() { let spec = "input x: UInt8\noutput y: Float32 := cast(x)"; assert_eq!(0, num_type_errors(spec)); }
rust_cleaned_test_functions.jsonl/110713
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 81 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 287, 62, 30940, 9763, 368, 341, 286, 1077, 1398, 284, 330, 1355, 856, 25, 22275, 23, 1699, 3006, 379, 25, 13001, 18, 17, 1669, 6311, 2075, 24023, 286, 2060, 10714, 10297, 15, 11, 1629, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_find_subcmd_invalid_inpath_validation() { let rw = Recurse::Find { extension: None, find: "test".to_string(), hidden: false, inpath: PathBuf::from("path/to/bogus"), mindepth: None, maxdepth: None, symlinks: false, }; let mut output = Vec::new(); let res = FindCommand::execute(rw, &mut output); // invalid directory path should raise error assert!(res.is_err()); assert!(res .unwrap_err() .to_string() .contains("no such file or directory")); }
rust_cleaned_test_functions.jsonl/111970
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 334 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 5228, 8710, 31433, 1243, 2343, 19416, 368, 341, 286, 1077, 25991, 284, 4067, 29285, 486, 9885, 341, 310, 8894, 25, 2240, 345, 310, 1477, 25, 330, 1944, 3263, 983, 3904, 3148, 310, 8177, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_level_triggered() { let poll = Poll::new().unwrap(); let mut events = Events::with_capacity(1024); let mut timer = Timer::default(); poll.register(&timer, Token(0), Ready::readable(), PollOpt::level()) .unwrap(); timer.set_timeout(Duration::from_millis(400), "hello"); let ms = elapsed(|| { let num = poll.poll(&mut events, None).unwrap(); assert_eq!(num, 1); let event = events.iter().next().unwrap(); assert_eq!(Token(0), event.token()); assert_eq!(Ready::readable(), event.readiness()); }); assert!(is_about(400, ms), "actual={:?}", ms); let ms = elapsed(|| { let num = poll.poll(&mut events, None).unwrap(); assert_eq!(num, 1); let event = events.iter().next().unwrap(); assert_eq!(Token(0), event.token()); assert_eq!(Ready::readable(), event.readiness()); }); assert!(is_about(0, ms), "actual={:?}", ms); }
rust_cleaned_test_functions.jsonl/95275
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 409 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8274, 78678, 368, 341, 262, 1077, 7085, 284, 24385, 486, 931, 1005, 15454, 543, 262, 1077, 5206, 4357, 284, 17627, 486, 4197, 35603, 7, 16, 15, 17, 19, 317, 262, 1077, 5206, 9021, 284, 17759, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_rate_limiter_debug() { let l = RateLimiter::new(1, 2, 3, 4, 5, 6).unwrap(); assert_eq!( format!("{:?}", l), format!( "RateLimiter {{ bandwidth: {:?}, ops: {:?} }}", l.bandwidth(), l.ops() ), ); }
rust_cleaned_test_functions.jsonl/15894
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9246, 907, 17700, 15446, 368, 341, 286, 1077, 326, 284, 19775, 43, 17700, 486, 931, 7, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 568, 15454, 543, 286, 2060, 1071...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_find() { let v: &[int] = &[1, 3, 9, 27, 103, 14, 11]; assert_eq!(*v.iter().find(|x| *x & 1 == 0).unwrap(), 14); assert_eq!(*v.iter().find(|x| *x % 3 == 0).unwrap(), 3); assert!(v.iter().find(|x| *x % 12 == 0).is_none()); }
rust_cleaned_test_functions.jsonl/1015
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 153 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 368, 341, 286, 1077, 348, 25, 44590, 396, 60, 284, 44590, 16, 11, 220, 18, 11, 220, 24, 11, 220, 17, 22, 11, 220, 16, 15, 18, 11, 220, 16, 19, 11, 220, 16, 16, 935, 286, 2060, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_minimal_solution() { let sol8 = MinimalSolution::new(8); assert_eq!(8, sol8.size()); assert_eq!("MinimalSolution", sol8.name()); let sol9 = MinimalSolution::new(9); assert_eq!(9, sol9.size()); let sol23 = MinimalSolution::new(23); assert_eq!(23, sol23.size()); assert_eq!("MinimalSolution", sol23.name()); assert_eq!( "MinimalSolution: score 0, best score 0", sol23.short_description() ); let mut sol = MinimalSolution::new(42); sol.make_decision(17, true); assert_eq!(Some(true), sol.get_decision(17)); assert_eq!(None, sol.get_decision(41)); sol.put_score(42); sol.put_best_score(4242); assert_eq!(42, sol.get_score()); assert_eq!(4242, sol.get_best_score()); assert_eq!(0.0, sol.priority()); sol.set_priority(42.42); assert_eq!(42.42, sol.priority()); }
rust_cleaned_test_functions.jsonl/132691
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 484 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7260, 2861, 50274, 368, 341, 286, 1077, 2048, 23, 284, 75112, 36842, 486, 931, 7, 23, 317, 286, 2060, 10714, 10297, 23, 11, 2048, 23, 2486, 1423, 286, 2060, 10714, 17223, 88328, 36842, 497, 2048...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_init_setup() { KeysManagerTest::new(ALICE) .assert_keys(vec![(ALICE, Weight::new(1))]) .assert_deployment_threshold(1) .assert_key_management_threshold(1); }
rust_cleaned_test_functions.jsonl/96208
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6137, 21363, 368, 341, 262, 24133, 2043, 2271, 486, 931, 46232, 5487, 340, 286, 659, 2207, 12631, 25592, 0, 9697, 969, 5487, 11, 16516, 486, 931, 7, 16, 593, 2546, 286, 659, 2207, 2259, 52799, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_next_with_f64() { let mut stoch = SlowStochastic::new(3, 2).unwrap(); assert_eq!(stoch.next(10.0), 50.0); assert_eq!(stoch.next(50.0).round(), 83.0); assert_eq!(stoch.next(50.0).round(), 94.0); assert_eq!(stoch.next(30.0).round(), 31.0); assert_eq!(stoch.next(55.0).round(), 77.0); }
rust_cleaned_test_functions.jsonl/72384
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 192 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11257, 6615, 761, 21, 19, 368, 341, 286, 1077, 5206, 357, 4953, 284, 38147, 623, 65954, 486, 931, 7, 18, 11, 220, 17, 568, 15454, 543, 286, 2060, 10714, 10297, 267, 4953, 4529, 7, 16, 15, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_probe_advanced() { let (mut testkit, api) = init_testkit(); let tx = { let (pubkey, key) = crypto::gen_keypair(); TxIncrement::new(&pubkey, 6, &key) }; let other_tx = { let (pubkey, key) = crypto::gen_keypair(); TxIncrement::new(&pubkey, 10, &key) }; let admin_tx = { let (pubkey, key) = crypto::gen_keypair_from_seed(&crypto::Seed::from_slice( &crypto::hash(b"correct horse battery staple")[..], ).unwrap()); assert_eq!(pubkey, PublicKey::from_hex(ADMIN_KEY).unwrap()); TxReset::new(&pubkey, &key) }; let snapshot = testkit.probe(tx.clone()); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(6)); // Check that data is not persisted let snapshot = testkit.snapshot(); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), None); // Check dependency of the resulting snapshot on tx ordering let snapshot = testkit.probe_all(txvec![tx.clone(), admin_tx.clone()]); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(0)); let snapshot = testkit.probe_all(txvec![admin_tx.clone(), tx.clone()]); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(6)); let snapshot = testkit.snapshot(); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), None); api.send(other_tx); testkit.create_block(); let snapshot = testkit.snapshot(); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(10)); let snapshot = testkit.probe(tx.clone()); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(16)); // Check that data is not persisted let snapshot = testkit.snapshot(); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(10)); // Check dependency of the resulting snapshot on tx ordering let snapshot = testkit.probe_all(txvec![tx.clone(), admin_tx.clone()]); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(0)); let snapshot = testkit.probe_all(txvec![admin_tx.clone(), tx.clone()]); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(6)); let snapshot = testkit.snapshot(); let schema = CounterSchema::new(&snapshot); assert_eq!(schema.count(), Some(10)); }
rust_cleaned_test_functions.jsonl/86871
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 977 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49108, 83843, 368, 341, 262, 1077, 320, 6984, 1273, 8226, 11, 6330, 8, 284, 2930, 4452, 8226, 1428, 262, 1077, 9854, 284, 341, 286, 1077, 320, 9585, 792, 11, 1376, 8, 284, 19028, 486, 4370, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_a_lib_with_a_build_command() { let p = project() .file( "Cargo.toml", r#" [project] name = "foo" version = "0.5.0" authors = [] build = "build.rs" "#, ) .file( "src/lib.rs", r#" include!(concat!(env!("OUT_DIR"), "/foo.rs")); /// ``` /// foo::bar(); /// ``` pub fn bar() { assert_eq!(foo(), 1); } "#, ) .file( "build.rs", r#" use std::env; use std::io::prelude::*; use std::fs::File; use std::path::PathBuf; fn main() { let out = PathBuf::from(env::var("OUT_DIR").unwrap()); File::create(out.join("foo.rs")).unwrap().write_all(b" fn foo() -> i32 { 1 } ").unwrap(); } "#, ) .build(); p.cargo("test").run(); }
rust_cleaned_test_functions.jsonl/43478
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 706 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4306, 16142, 6615, 4306, 20801, 10811, 368, 341, 262, 1077, 281, 284, 2390, 741, 286, 659, 1192, 1006, 310, 330, 98228, 73494, 75, 756, 310, 435, 2, 698, 310, 508, 4987, 921, 310, 829, 284, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_col_iter() { let mat = m!(1, 2; 3, 4; 5, 6); let mut iter = mat.col_iter(); let col1 = iter.next(); assert_eq!(col1, Some(m![1; 3; 5])); // column format let col2 = iter.next(); assert_eq!(col2, Some(m![2; 4; 6])); assert_eq!(iter.next(), None); }
rust_cleaned_test_functions.jsonl/61505
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 178 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10211, 11723, 368, 341, 286, 1077, 5517, 284, 296, 10297, 16, 11, 220, 17, 26, 220, 18, 11, 220, 19, 26, 220, 20, 11, 220, 21, 626, 286, 1077, 5206, 5367, 284, 5517, 13414, 11723, 1428, 286,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_peerset_incoming() { let bootnode = PeerId::random(); let incoming = PeerId::random(); let incoming2 = PeerId::random(); let incoming3 = PeerId::random(); let ii = IncomingIndex(1); let ii2 = IncomingIndex(2); let ii3 = IncomingIndex(3); let ii4 = IncomingIndex(3); let config = PeersetConfig { sets: vec![SetConfig { in_peers: 2, out_peers: 1, bootnodes: vec![bootnode], reserved_nodes: Default::default(), reserved_only: false, }], }; let (mut peerset, _handle) = Peerset::from_config(config); peerset.incoming(SetId::from(0), incoming, ii); peerset.incoming(SetId::from(0), incoming, ii4); peerset.incoming(SetId::from(0), incoming2, ii2); peerset.incoming(SetId::from(0), incoming3, ii3); assert_messages( peerset, vec![ Message::Connect { set_id: SetId::from(0), peer_id: bootnode, }, Message::Accept(ii), Message::Accept(ii2), Message::Reject(ii3), ], ); }
rust_cleaned_test_functions.jsonl/50343
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 705 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36367, 44146, 1243, 4959, 368, 341, 286, 1077, 10459, 3509, 284, 45147, 764, 486, 11463, 543, 286, 1077, 19393, 284, 45147, 764, 486, 11463, 543, 286, 1077, 19393, 17, 284, 45147, 764, 486, 11463,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_job_result() { fn fn_ok(_: String, _: Vec<String>) -> Result<String, Box<Error>> { sleep(Duration::from_millis(1000)); Ok("ok".to_string()) } let queue = Queue::new("redis://localhost/", "test-result"); queue.drop().unwrap(); let uuid = queue.enqueue(vec![], 10).unwrap(); queue.work(fn_ok, Some(1), Some(5), Some(1), Some(5), Some(false), Some(false)) .unwrap(); let res = queue.result(&uuid).unwrap().unwrap(); assert!(res == "ok"); }
rust_cleaned_test_functions.jsonl/124823
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 309 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20298, 5287, 368, 341, 262, 5168, 5168, 19817, 73834, 923, 11, 58536, 11312, 3464, 9231, 1464, 5714, 3464, 11, 8261, 27, 1454, 2452, 341, 286, 6084, 64114, 486, 1499, 717, 56212, 7, 16, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_integer_literal() { fn lit( base: IntegerBase, is_unterminated: bool, has_invalid_characters: bool, has_duplicate_underscore: bool, ) -> Token { Token::IntegerLiteral { base, is_unterminated, has_invalid_characters, has_duplicate_underscore, } } use IntegerBase::{Binary as Bin, Decimal as Dec, Hexadecimal as Hex, Octal as Oct}; assert_eq!(lex("100"), (lit(Dec, false, false, false), 3)); assert_eq!(lex("001"), (lit(Dec, false, false, false), 3)); assert_eq!(lex("100_000"), (lit(Dec, false, false, false), 7)); assert_eq!(lex("0b"), (lit(Bin, true, false, false), 2)); assert_eq!(lex("0b1"), (lit(Bin, false, false, false), 3)); assert_eq!(lex("0b1_"), (lit(Bin, true, false, false), 4)); assert_eq!(lex("0b1_0"), (lit(Bin, false, false, false), 5)); assert_eq!(lex("0b12"), (lit(Bin, false, true, false), 4)); assert_eq!(lex("0o"), (lit(Oct, true, false, false), 2)); assert_eq!(lex("0x"), (lit(Hex, true, false, false), 2)); assert_eq!(lex("1_"), (lit(Dec, true, false, false), 2)); }
rust_cleaned_test_functions.jsonl/80518
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 648 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31725, 34100, 368, 341, 286, 5168, 13020, 1006, 310, 2331, 25, 4440, 3978, 345, 310, 374, 4907, 68659, 25, 1807, 345, 310, 702, 31433, 79060, 25, 1807, 345, 310, 702, 70434, 62, 53933, 25, 1807,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_const_witness() { // Test that all of the addresses that we initialize at compile time // using `new_unchecked` constructors are valid for their witness types. assert!(Ipv4::LOOPBACK_ADDRESS.0.is_specified()); assert!(Ipv6::LOOPBACK_ADDRESS.0.is_specified()); assert!(Ipv4::LIMITED_BROADCAST_ADDRESS.0.is_specified()); assert!(Ipv4::ALL_ROUTERS_MULTICAST_ADDRESS.0.is_multicast()); assert!(Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS.0.is_multicast()); assert!(Ipv6::ALL_ROUTERS_LINK_LOCAL_MULTICAST_ADDRESS.0.is_multicast()); }
rust_cleaned_test_functions.jsonl/31867
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 294 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13610, 1670, 8091, 368, 341, 286, 442, 3393, 429, 678, 315, 279, 14230, 429, 582, 9468, 518, 19192, 882, 198, 286, 442, 1667, 1565, 931, 4907, 7549, 63, 54717, 525, 2697, 369, 862, 11298, 4494, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_symbolfile_from_lf_file() { test_symbolfile_from_file( "testdata/symbols/test_app.pdb/5A9832E5287241C1838ED98914E9B7FF1/test_app.sym", ); }
rust_cleaned_test_functions.jsonl/54412
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 113 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21179, 1192, 5673, 907, 69, 2458, 368, 341, 286, 1273, 21179, 1192, 5673, 2458, 1006, 310, 330, 92425, 2687, 11786, 12697, 8191, 556, 1999, 14, 20, 32, 24, 23, 18, 17, 36, 20, 17, 23, 22, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_with_trailing_tab() { new_ucmd!() .arg("with-trailing-tab.txt") .succeeds() .stdout_contains("with tabs=> ") .stdout_does_not_contain("\t"); }
rust_cleaned_test_functions.jsonl/121786
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 111 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6615, 3547, 14277, 17344, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 858, 445, 4197, 10188, 14277, 27411, 3909, 1138, 286, 659, 82, 29264, 82, 741, 286, 659, 36358, 63598, 445, 4197, 223...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_sample_gif() { let input = vec![ 71, 73, 70, 56, 57, 97, 10, 0, 10, 0, 145, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 0, 0, 0, 33, 249, 4, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 10, 0, 10, 0, 0, 2, 22, 140, 45, 153, 135, 42, 28, 220, 51, 160, 2, 117, 236, 149, 250, 168, 222, 96, 140, 4, 145, 76, 1, 0, 59, ]; let mut reader = MockReader { data: &input, remaining: input.len(), }; let expected = vec![vec![ Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 255, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(0, 0, 255), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), Color(255, 0, 0), ] .into_boxed_slice()]; let mut parser = Parser::new(&mut reader); let result = parser.parse().unwrap(); let decoder = Decoder::new(&result); let actual = decoder.decode().unwrap(); let mut v = vec![]; for i in actual.iter() { v.push(i.colors.clone()); } assert_eq!(expected, v); }
rust_cleaned_test_functions.jsonl/98616
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2492 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17491, 1889, 333, 368, 341, 286, 1077, 1946, 284, 7486, 90515, 310, 220, 22, 16, 11, 220, 22, 18, 11, 220, 22, 15, 11, 220, 20, 21, 11, 220, 20, 22, 11, 220, 24, 22, 11, 220, 16, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_insert_phi_nodes_semi_pruned() { // Given: // block 0 // v // +-------> block 1 // | v v // | block 2 block 3 +---+ // | x = 0 | | // | v | // +------+ block 4 | // v | // block 5 <-------+ // y = x let mut cfg = { let mut cfg = ControlFlowGraph::new(); // block0 { cfg.new_block(); } // block1 { cfg.new_block(); } // block2 { let block = cfg.new_block(); block.assign(variable("x"), expr_const(0)).unwrap(); } // block3 { cfg.new_block(); } // block4 { cfg.new_block(); } // block5 { let block = cfg.new_block(); block.assign(variable("y"), variable("x").into()).unwrap(); } cfg.unconditional_edge(0, 1).unwrap(); cfg.unconditional_edge(1, 2).unwrap(); cfg.unconditional_edge(1, 3).unwrap(); cfg.unconditional_edge(2, 4).unwrap(); cfg.unconditional_edge(3, 4).unwrap(); cfg.unconditional_edge(3, 5).unwrap(); cfg.unconditional_edge(4, 1).unwrap(); cfg.unconditional_edge(4, 5).unwrap(); cfg.set_entry(0).unwrap(); cfg }; insert_phi_nodes(&mut cfg, SSAForm::SemiPruned).unwrap(); // Expected: // block 0 // v // +-------> block 1 // | v v // | block 2 block 3 +---+ // | v | // +------+ block 4 | // v | // block 5 <-------+ let block0 = cfg.block(0).unwrap(); let block1 = cfg.block(1).unwrap(); let block2 = cfg.block(2).unwrap(); let block3 = cfg.block(3).unwrap(); let block4 = cfg.block(4).unwrap(); let block5 = cfg.block(5).unwrap(); assert_eq!(block0.phi_nodes().len(), 0); assert_eq!(block1.phi_nodes().len(), 1); assert_eq!(block2.phi_nodes().len(), 0); assert_eq!(block3.phi_nodes().len(), 0); assert_eq!(block4.phi_nodes().len(), 1); assert_eq!(block5.phi_nodes().len(), 1); let phi_node_block1 = block1.phi_node(0).unwrap(); assert_eq!(phi_node_block1.out(), &variable("x")); assert_eq!( phi_node_block1.incoming_variable(4).unwrap(), &variable("x") ); assert_eq!( phi_node_block1.incoming_variable(0).unwrap(), &variable("x") ); let phi_node_block4 = block4.phi_node(0).unwrap(); assert_eq!(phi_node_block4.out(), &variable("x")); assert_eq!( phi_node_block4.incoming_variable(2).unwrap(), &variable("x") ); assert_eq!( phi_node_block4.incoming_variable(3).unwrap(), &variable("x") ); let phi_node_block5 = block5.phi_node(0).unwrap(); assert_eq!(phi_node_block5.out(), &variable("x")); assert_eq!( phi_node_block5.incoming_variable(4).unwrap(), &variable("x") ); assert_eq!( phi_node_block5.incoming_variable(3).unwrap(), &variable("x") ); }
rust_cleaned_test_functions.jsonl/13501
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2371 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17678, 42009, 14896, 3453, 8155, 5294, 48883, 368, 341, 286, 442, 16246, 510, 286, 442, 1843, 2504, 220, 15, 8945, 286, 442, 1797, 348, 198, 286, 442, 488, 16565, 405, 2504, 220, 16, 8945, 16885...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_too_few_tokens() { let err = Model::train("data/few_tokens.ffm").unwrap_err(); assert_eq!(err.to_string(), "FFM error (line: 1, node: 1, token: 3): missing token".to_string()); }
rust_cleaned_test_functions.jsonl/25229
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 102 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 78, 761, 365, 28838, 368, 341, 286, 1077, 1848, 284, 4903, 486, 10397, 445, 691, 6663, 365, 28838, 83885, 76, 1827, 15454, 9266, 543, 286, 2060, 10714, 10297, 615, 2389, 3904, 1507, 330, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_append() { let mut chain = Chain::new(); // Transactions let (t0, t0_s) = Transaction::debug_make_register(format!("SN1337BIKE")); let (t1, _) = Transaction::debug_make_register(format!("MYCOOLBIKE")); let (t2, _) = Transaction::debug_make_transfer(&t0, &t0_s); // Blocks let block_0 = Block::new(chain.get_genesis_block().calc_hash(), t0); let block_1 = Block::new(block_0.calc_hash(), t1); let block_2 = Block::new(block_1.calc_hash(), t2); chain.push(block_0, true).expect("Chain::push failure (0)"); chain.push(block_1, true).expect("Chain::push failure (1)"); chain.push(block_2, true).expect("Chain::push failure (2)"); assert_eq!( chain.block_count(), 4, "Blockchain should contain 4 blocks (+1 for genesis)" ); }
rust_cleaned_test_functions.jsonl/102216
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 419 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26041, 368, 341, 286, 1077, 5206, 8781, 284, 28525, 486, 931, 1428, 286, 442, 55285, 198, 286, 1077, 320, 83, 15, 11, 259, 15, 643, 8, 284, 17869, 486, 8349, 28230, 14000, 20698, 17223, 18966, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cli_get_config_empty_json() { let json = r#"{}"#; let mut tmpfile = NamedTempFile::new().expect("Failed to create tmp file"); writeln!(tmpfile, "{}", json).expect("Failed to write to tmp file"); // should use the default values let cli = Cli { config: tmpfile.path().to_owned(), verbose: true, }; let result = cli.get_config(); let config = result.unwrap(); let expected_config = Config::default(); assert_eq!(config, expected_config); }
rust_cleaned_test_functions.jsonl/115806
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 256 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47147, 3062, 5332, 15124, 9455, 368, 341, 286, 1077, 2951, 284, 435, 55543, 6257, 57676, 401, 286, 1077, 5206, 4174, 1192, 284, 40459, 12151, 1703, 486, 931, 1005, 17119, 445, 9408, 311, 1855, 417...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_resolve() { let mut m = PathMap::new(); let id1 = m.get_or_insert(PathBuf::from("/foo"), Root::Workspace); let id2 = m.get_or_insert(PathBuf::from("/foo/bar.rs"), Root::Workspace); assert_eq!( m.resolve(id1, &RelativePath::new("bar.rs")), Some(id2), ) }
rust_cleaned_test_functions.jsonl/113488
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 183 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 77291, 368, 341, 286, 1077, 5206, 296, 284, 7933, 2227, 486, 931, 543, 286, 1077, 877, 16, 284, 296, 670, 8734, 17678, 33030, 15064, 486, 1499, 4283, 7975, 3975, 18854, 486, 45981, 317, 286, 107...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cmd_epoch_checker() { use engine_test::kv::KvTestSnapshot; use std::sync::mpsc; fn new_admin_request(cmd_type: AdminCmdType) -> RaftCmdRequest { let mut request = RaftCmdRequest::default(); request.mut_admin_request().set_cmd_type(cmd_type); request } fn new_cb() -> (Callback<KvTestSnapshot>, mpsc::Receiver<()>) { let (tx, rx) = mpsc::channel(); (Callback::write(Box::new(move |_| tx.send(()).unwrap())), rx) } let region = metapb::Region::default(); let normal_cmd = RaftCmdRequest::default(); let split_admin = new_admin_request(AdminCmdType::BatchSplit); let prepare_merge_admin = new_admin_request(AdminCmdType::PrepareMerge); let change_peer_admin = new_admin_request(AdminCmdType::ChangePeer); let mut epoch_checker = CmdEpochChecker::<KvTestSnapshot>::default(); assert_eq!(epoch_checker.propose_check_epoch(&split_admin, 10), None); assert_eq!(epoch_checker.term, 10); epoch_checker.post_propose(AdminCmdType::BatchSplit, 5, 10); assert_eq!(epoch_checker.proposed_admin_cmd.len(), 1); // Both conflict with the split admin cmd assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 10), Some(5)); assert_eq!( epoch_checker.propose_check_epoch(&prepare_merge_admin, 10), Some(5) ); assert_eq!( epoch_checker.propose_check_epoch(&change_peer_admin, 10), None ); epoch_checker.post_propose(AdminCmdType::ChangePeer, 6, 10); assert_eq!(epoch_checker.proposed_admin_cmd.len(), 2); assert_eq!( epoch_checker.last_cmd_index(AdminCmdType::BatchSplit), Some(5) ); assert_eq!( epoch_checker.last_cmd_index(AdminCmdType::ChangePeer), Some(6) ); assert_eq!( epoch_checker.last_cmd_index(AdminCmdType::PrepareMerge), None ); // Conflict with the change peer admin cmd assert_eq!( epoch_checker.propose_check_epoch(&change_peer_admin, 10), Some(6) ); // Conflict with the split admin cmd assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 10), Some(5)); // Conflict with the change peer admin cmd assert_eq!( epoch_checker.propose_check_epoch(&prepare_merge_admin, 10), Some(6) ); epoch_checker.advance_apply(4, 10, &region); // Have no effect on `proposed_admin_cmd` assert_eq!(epoch_checker.proposed_admin_cmd.len(), 2); epoch_checker.advance_apply(5, 10, &region); // Left one change peer admin cmd assert_eq!(epoch_checker.proposed_admin_cmd.len(), 1); assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 10), None); assert_eq!(epoch_checker.propose_check_epoch(&split_admin, 10), Some(6)); // Change term to 11 assert_eq!(epoch_checker.propose_check_epoch(&split_admin, 11), None); assert_eq!(epoch_checker.term, 11); // Should be empty assert_eq!(epoch_checker.proposed_admin_cmd.len(), 0); // Test attaching multiple callbacks. epoch_checker.post_propose(AdminCmdType::BatchSplit, 7, 12); let mut rxs = vec![]; for _ in 0..3 { let conflict_idx = epoch_checker.propose_check_epoch(&normal_cmd, 12).unwrap(); let (cb, rx) = new_cb(); epoch_checker.attach_to_conflict_cmd(conflict_idx, cb); rxs.push(rx); } epoch_checker.advance_apply(7, 12, &region); for rx in rxs { rx.try_recv().unwrap(); } // Should invoke callbacks when term is increased. epoch_checker.post_propose(AdminCmdType::BatchSplit, 8, 12); let (cb, rx) = new_cb(); epoch_checker.attach_to_conflict_cmd(8, cb); assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 13), None); rx.try_recv().unwrap(); // Should invoke callbacks when it's dropped. epoch_checker.post_propose(AdminCmdType::BatchSplit, 9, 13); let (cb, rx) = new_cb(); epoch_checker.attach_to_conflict_cmd(9, cb); drop(epoch_checker); rx.try_recv().unwrap(); }
rust_cleaned_test_functions.jsonl/10523
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2123 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11684, 20682, 62715, 368, 341, 286, 990, 4712, 4452, 486, 43408, 486, 42, 85, 2271, 15009, 280, 286, 990, 1460, 486, 12996, 486, 1307, 2388, 280, 286, 5168, 501, 12207, 7893, 14160, 1819, 25, 75...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_negate() { let s = Secp256k1::new(); let (sk1, _) = s.generate_keypair(&mut thread_rng()).unwrap(); let mut sk2: SecretKey = sk1.clone(); sk2.neg_assign().unwrap(); assert!(sk2.add_assign(&sk1).is_err()); let (sk1, _) = s.generate_keypair(&mut thread_rng()).unwrap(); let mut sk2: SecretKey = sk1.clone(); sk2.neg_assign().unwrap(); sk2.neg_assign().unwrap(); assert_eq!(sk2, sk1); let (mut sk1, _) = s.generate_keypair(&mut thread_rng()).unwrap(); let mut sk2: SecretKey = sk1.clone(); sk1.neg_assign().unwrap(); let sk1_clone = sk1.clone(); sk1.add_assign(&sk1_clone).unwrap(); let sk2_clone = sk2.clone(); sk2.add_assign(&sk2_clone).unwrap(); sk2.neg_assign().unwrap(); assert_eq!(sk2, sk1); let one = SecretKey::from_slice(&[ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]).unwrap(); let (mut sk1, _) = s.generate_keypair(&mut thread_rng()).unwrap(); let mut sk2: SecretKey = one.clone(); sk2.neg_assign().unwrap(); sk2.mul_assign(&sk1).unwrap(); sk1.neg_assign().unwrap(); assert_eq!(sk2, sk1); let (mut sk1, _) = s.generate_keypair(&mut thread_rng()).unwrap(); let mut sk2: SecretKey = sk1.clone(); sk1.neg_assign().unwrap(); sk1.inv_assign().unwrap(); sk2.inv_assign().unwrap(); sk2.neg_assign().unwrap(); assert_eq!(sk2, sk1); }
rust_cleaned_test_functions.jsonl/41408
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 937 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28209, 349, 368, 341, 286, 1077, 274, 284, 4520, 79, 17, 20, 21, 74, 16, 486, 931, 1428, 286, 1077, 320, 4886, 16, 11, 27439, 284, 274, 22019, 3097, 12670, 2099, 6984, 4516, 66849, 6011, 15454...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deserialize_2() { let line = r#"{"type":"match","data":{"path":{"text":"src/handlers/submodule.rs"},"lines":{"text":" .paint(minus_commit.chars().take(7).collect::<String>()),\n"},"line_number":41,"absolute_offset":1430,"submatches":[{"match":{"text":"("},"start":30,"end":31},{"match":{"text":"("},"start":49,"end":50},{"match":{"text":")"},"start":50,"end":51},{"match":{"text":"("},"start":56,"end":57},{"match":{"text":")"},"start":58,"end":59},{"match":{"text":"("},"start":77,"end":78},{"match":{"text":")"},"start":78,"end":79},{"match":{"text":")"},"start":79,"end":80}]}}"#; let ripgrep_line: RipGrepLine = serde_json::from_str(line).unwrap(); assert_eq!( ripgrep_line, RipGrepLine { _type: grep::LineType::Match, data: RipGrepLineData { path: RipGrepLineText { text: "src/handlers/submodule.rs".into() }, lines: RipGrepLineText { text: " .paint(minus_commit.chars().take(7).collect::<String>()),\n".into(), }, line_number: Some(41), absolute_offset: 1430, submatches: vec![ RipGrepLineSubmatch { _match: RipGrepLineText { text: "(".into() }, start: 30, end: 31 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: "(".into() }, start: 49, end: 50 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: ")".into() }, start: 50, end: 51 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: "(".into() }, start: 56, end: 57 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: ")".into() }, start: 58, end: 59 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: "(".into() }, start: 77, end: 78 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: ")".into() }, start: 78, end: 79 }, RipGrepLineSubmatch { _match: RipGrepLineText { text: ")".into() }, start: 79, end: 80 }, ] } } ) }
rust_cleaned_test_functions.jsonl/70466
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2043 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15768, 9050, 62, 17, 368, 341, 286, 1077, 1555, 284, 435, 55543, 4913, 1313, 3252, 6347, 2198, 691, 22317, 2343, 22317, 1318, 3252, 3548, 7530, 437, 9254, 37885, 4352, 25638, 58640, 7969, 22317, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_partition_wise_sampling() -> Result<()> { let sc = CONTEXT.clone(); { let rdd = sc.clone().parallelize(vec![1, 2, 3, 4, 5], 6); let result = rdd.take_sample(false, 6, Some(123))?; assert!(result.len() == 5); // guaranteed with this seed: assert!(result[0] > result[1]); } { // high enough samples param to guarantee drawing >1 times w/ replacement let rdd = sc.clone().parallelize((0_i32..100).collect::<Vec<_>>(), 5); let result = rdd.take_sample(true, 80, None)?; assert!(result.len() == 80); } { let rdd = sc.parallelize((0_i32..100).collect::<Vec<_>>(), 5); let result = rdd.take_sample(false, 10, None)?; assert!(result.len() == 10); } Ok(()) }
rust_cleaned_test_functions.jsonl/27946
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 391 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43840, 1670, 1064, 77716, 368, 1464, 5714, 71698, 341, 262, 1077, 1136, 284, 87336, 15997, 543, 1066, 262, 341, 286, 1077, 435, 631, 284, 1136, 15997, 1005, 46103, 551, 25592, 20703, 16, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_default_value_int() { let msg = r#"message Sample { optional int32 x = 1 [default = 17]; }"#; let mess = parse_opt(msg, |p| p.next_message_opt()); assert_eq!("default", mess.fields[0].options[0].name); assert_eq!("17", mess.fields[0].options[0].value.format()); }
rust_cleaned_test_functions.jsonl/70459
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 162 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9993, 3142, 4042, 368, 341, 286, 1077, 3750, 284, 435, 55543, 1994, 19143, 341, 310, 10101, 526, 18, 17, 856, 284, 220, 16, 508, 2258, 284, 220, 16, 22, 935, 286, 335, 57676, 401, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_next() { let mut min = Minimum::new(3).unwrap(); assert_eq!(min.next(4.0), 4.0); assert_eq!(min.next(1.2), 1.2); assert_eq!(min.next(5.0), 1.2); assert_eq!(min.next(3.0), 1.2); assert_eq!(min.next(4.0), 3.0); assert_eq!(min.next(6.0), 3.0); assert_eq!(min.next(7.0), 4.0); assert_eq!(min.next(8.0), 6.0); assert_eq!(min.next(-9.0), -9.0); assert_eq!(min.next(0.0), -9.0); }
rust_cleaned_test_functions.jsonl/18118
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 295 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11257, 368, 341, 286, 1077, 5206, 1308, 284, 30925, 486, 931, 7, 18, 568, 15454, 1428, 286, 2060, 10714, 10297, 1065, 4529, 7, 19, 13, 15, 701, 220, 19, 13, 15, 317, 286, 2060, 10714, 10297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cifar_10_loader_rs() { let path = get_cifar_10(); let cifar_dataset = super::CifarDataset::new(path).unwrap(); let rng = &mut rand::thread_rng(); test_load_data(&cifar_dataset); test_output(&cifar_dataset, rng).unwrap(); }
rust_cleaned_test_functions.jsonl/133813
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 128 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 92927, 62, 16, 15, 22139, 47115, 368, 341, 262, 1077, 1815, 284, 633, 666, 92927, 62, 16, 15, 543, 262, 1077, 65472, 277, 18999, 284, 2256, 486, 34, 92927, 33363, 486, 931, 5581, 568, 154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_aoc11() { let sample_input = "L.LL.LL.LL\nLLLLLLL.LL\nL.L.L..L..\nLLLL.LL.LL\nL.LL.LL.LL\nL.LLLLL.LL\n..L.L.....\nLLLLLLLLLL\nL.LLLLLL.L\nL.LLLLL.LL"; let sample_res = parse_data(&sample_input).unwrap(); assert_eq!(run_a(&sample_res).ok(), Some(37)); assert_eq!(run_b(&sample_res).ok(), Some(26)); }
rust_cleaned_test_functions.jsonl/23913
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4306, 509, 16, 16, 368, 341, 10217, 6077, 5898, 284, 330, 43, 1214, 43, 1214, 43, 1214, 43, 1699, 49356, 86708, 1214, 43, 1699, 43, 1214, 1214, 496, 43, 60402, 77, 49356, 1214, 43, 1214, 43, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eval_simple() { let s = expr("1 + 2"); assert_eq!(s.to_string(), "(+ 1 2)"); let val = eval_expr(&s); match val { Value::PosNumber(x) => assert_eq!(x, 3.0), _ => panic!("Error") } }
rust_cleaned_test_functions.jsonl/99661
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 153 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 30015, 368, 341, 286, 1077, 274, 284, 15169, 445, 16, 488, 220, 17, 797, 286, 2060, 10714, 10297, 82, 2389, 3904, 1507, 11993, 10, 220, 16, 220, 17, 20996, 286, 1077, 1044, 284, 5603, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_atom_reset_id() { let mut atoms = AtomSpace::default(); let mut atom = Atom::Tx(new_tx_port(1)); atom.set_atom_id(unsafe { AtomId::new_unchecked(1) }); let _ = atoms.do_share_atom(atom); }
rust_cleaned_test_functions.jsonl/5082
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 118 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42292, 18983, 842, 368, 341, 286, 1077, 5206, 32199, 284, 39516, 9914, 486, 2258, 543, 286, 1077, 5206, 19124, 284, 39516, 486, 31584, 1755, 17805, 8716, 7, 16, 1106, 286, 19124, 980, 42292, 842, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_corrupted_slice() { let input = make_test_input(20_000); let slice_start = 5_000; let slice_len = 10_000; let (encoded, hash) = encode::encode(&input); // Slice out the middle 10_000 bytes; let mut slice = Vec::new(); let mut extractor = encode::SliceExtractor::new( Cursor::new(&encoded), slice_start as u64, slice_len as u64, ); extractor.read_to_end(&mut slice).unwrap(); // First confirm that the regular decode works. let mut output = Vec::new(); let mut reader = SliceDecoder::new(&*slice, &hash, slice_start as u64, slice_len as u64); reader.read_to_end(&mut output).unwrap(); assert_eq!(&input[slice_start..][..slice_len], &*output); // Also confirm that the outboard slice extractor gives the same slice. let (outboard, outboard_hash) = encode::outboard(&input); assert_eq!(hash, outboard_hash); let mut slice_from_outboard = Vec::new(); let mut extractor = encode::SliceExtractor::new_outboard( Cursor::new(&input), Cursor::new(&outboard), slice_start as u64, slice_len as u64, ); extractor.read_to_end(&mut slice_from_outboard).unwrap(); assert_eq!(slice, slice_from_outboard); // Now confirm that flipping bits anywhere in the slice other than the // length header will corrupt it. Tweaking the length header doesn't // final chunk. let mut i = HEADER_SIZE; while i < slice.len() { let mut slice_clone = slice.clone(); slice_clone[i] ^= 1; let mut reader = SliceDecoder::new(&*slice_clone, &hash, slice_start as u64, slice_len as u64); output.clear(); let err = reader.read_to_end(&mut output).unwrap_err(); assert_eq!(io::ErrorKind::InvalidData, err.kind()); i += 32; } }
rust_cleaned_test_functions.jsonl/118142
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 936 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14734, 85954, 26488, 368, 341, 286, 1077, 1946, 284, 1281, 4452, 5898, 7, 17, 15, 62, 15, 15, 15, 317, 286, 1077, 15983, 4906, 284, 220, 20, 62, 15, 15, 15, 280, 286, 1077, 15983, 6043, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_node_merge_catch_up_logs_empty_entries() { let mut cluster = new_node_cluster(0, 3); configure_for_merge(&mut cluster); cluster.run(); cluster.must_put(b"k1", b"v1"); cluster.must_put(b"k3", b"v3"); let pd_client = Arc::clone(&cluster.pd_client); let region = pd_client.get_region(b"k1").unwrap(); let peer_on_store1 = find_peer(&region, 1).unwrap().to_owned(); cluster.must_transfer_leader(region.get_id(), peer_on_store1); cluster.must_split(&region, b"k2"); let left = pd_client.get_region(b"k1").unwrap(); let right = pd_client.get_region(b"k2").unwrap(); // make sure the peer of left region on engine 3 has caught up logs. cluster.must_put(b"k0", b"v0"); must_get_equal(&cluster.get_engine(3), b"k0", b"v0"); // So only allowing first MsgAppend to make source peer have uncommitted entries. cluster.add_send_filter(CloneFilterFactory( RegionPacketFilter::new(left.get_id(), 3) .direction(Direction::Recv) .msg_type(MessageType::MsgAppend) .allow(1), )); // make the source peer have no way to know the uncommitted entries can be applied from heartbeat. cluster.add_send_filter(CloneFilterFactory( RegionPacketFilter::new(left.get_id(), 3) .msg_type(MessageType::MsgHeartbeat) .direction(Direction::Recv), )); // make the source peer have no way to know the uncommitted entries can be applied from target region. cluster.add_send_filter(CloneFilterFactory( RegionPacketFilter::new(right.get_id(), 3) .msg_type(MessageType::MsgAppend) .direction(Direction::Recv), )); pd_client.must_merge(left.get_id(), right.get_id()); cluster.must_region_not_exist(left.get_id(), 2); cluster.shutdown(); cluster.clear_send_filters(); // and the source peer will be destroyed. cluster.start().unwrap(); cluster.must_region_not_exist(left.get_id(), 3); }
rust_cleaned_test_functions.jsonl/27253
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 830 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5084, 20888, 666, 754, 8237, 42899, 15124, 26092, 368, 341, 262, 1077, 5206, 10652, 284, 501, 5084, 28441, 7, 15, 11, 220, 18, 317, 262, 14411, 5478, 20888, 2099, 6984, 10652, 317, 262, 10652, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_aggregatable_svc() { let rng = &mut test_rng(); let size: usize = 8; let params = key_gen::<E, _>(size, rng).unwrap(); let domain: GeneralEvaluationDomain<Fr> = EvaluationDomain::<Fr>::new(size).unwrap(); let mut values = Vec::<Fr>::new(); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); values.push(Fr::rand(rng)); let c = commit(&params.proving_key, values.clone()).unwrap(); let start = Instant::now(); let mut points = Vec::<u32>::new(); let mut point_values = Vec::<Fr>::new(); points.push(0); point_values.push(values[0]); points.push(1); point_values.push(values[1]); points.push(5); point_values.push(values[5]); let proof = prove_pos(&params.proving_key, values.clone(), points.clone()).unwrap(); let rs = verify_pos( &params.verification_key, &c, point_values, points, &proof, group_gen(&domain), ) .unwrap(); let total_setup = start.elapsed(); println!("ASVC VERIFY POSITION TIME: {:?}", total_setup); assert!(rs); let start = Instant::now(); let index: u32 = 2; let rs = verify_upk( &params.verification_key, index, &params.proving_key.update_keys[index as usize], group_gen(&domain), ) .unwrap(); let total_setup = start.elapsed(); println!("ASVC VERIFY UPK TIME: {:?}", total_setup); assert!(rs); let start = Instant::now(); let index: u32 = 3; let delta = Fr::rand(rng); let points_i = vec![index]; let point_values_i = vec![values[index as usize].add(&delta)]; let uc = update_commit( &c, delta, index, &params.proving_key.update_keys[index as usize], group_gen(&domain), size, ) .unwrap(); let proof = prove_pos(&params.proving_key, values.clone(), points_i.clone()).unwrap(); let proof = update_proof( &proof, delta, index, index, &params.proving_key.update_keys[index as usize], &params.proving_key.update_keys[index as usize], group_gen(&domain), size, ) .unwrap(); let rs = verify_pos( &params.verification_key, &uc, point_values_i, points_i, &proof, group_gen(&domain), ) .unwrap(); let total_setup = start.elapsed(); println!("ASVC UPDATE COMMIT AND PROOF TIME: {:?}", total_setup); assert!(rs); let start = Instant::now(); let index_i: u32 = 4; let points_i = vec![index_i]; let point_values_i = vec![values[index_i as usize]]; let proof = prove_pos(&params.proving_key, values.clone(), points_i.clone()).unwrap(); let proof = update_proof( &proof, delta, index_i, index, &params.proving_key.update_keys[index_i as usize], &params.proving_key.update_keys[index as usize], group_gen(&domain), size, ) .unwrap(); let rs = verify_pos( &params.verification_key, &uc, point_values_i, points_i, &proof, group_gen(&domain), ) .unwrap(); let total_setup = start.elapsed(); println!( "ASVC VERIFY UPDATE PROOF, DIFFERENT INDEX TIME: {:?}", total_setup ); assert!(rs); let start = Instant::now(); let mut points = Vec::new(); let mut point_values = Vec::new(); let mut point_proofs = Vec::new(); let point = vec![1]; points.push(1); point_values.push(values[1]); let proof = prove_pos(&params.proving_key, values.clone(), point.clone()).unwrap(); point_proofs.push(proof); let point = vec![5]; points.push(5); point_values.push(values[5]); let proof = prove_pos(&params.proving_key, values.clone(), point.clone()).unwrap(); point_proofs.push(proof); let proofs = aggregate_proofs(points.clone(), point_proofs, group_gen(&domain)).unwrap(); let rs = verify_pos( &params.verification_key, &c, point_values, points, &proofs, group_gen(&domain), ) .unwrap(); let total_setup = start.elapsed(); println!("ASVC VERIFY AGGREGATE PROOFS TIME: {:?}", total_setup); assert!(rs); }
rust_cleaned_test_functions.jsonl/131393
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2033 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20587, 7998, 15086, 78198, 368, 341, 262, 1077, 28422, 284, 609, 6984, 1273, 66849, 543, 262, 1077, 1379, 25, 22301, 284, 220, 23, 280, 262, 1077, 3628, 284, 1376, 16322, 27638, 36, 11, 716, 223...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_d() { let mut state = State8080::empty_state(); state.memory = vec![0x82]; state.a = 0x6c; state.d = 0x2e; emulate_8080_op(&mut state); assert_eq!(state.a, 0x9a); assert_eq!(state.cc.z, 0); assert_eq!(state.cc.cy, 0); assert_eq!(state.cc.p, Parity::Even); assert_eq!(state.cc.s, Sign::Negative); }
rust_cleaned_test_functions.jsonl/7779
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 236 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 814, 368, 341, 286, 1077, 5206, 1584, 284, 3234, 23, 15, 23, 15, 486, 3194, 4387, 543, 286, 1584, 36611, 284, 7486, 20703, 15, 87, 23, 17, 935, 286, 1584, 5849, 284, 220, 15, 87, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_xorps() { assert_emit!(0x0f, 0x57, 0x05, 0xf6, 0xff, 0xff, 0xff; xorps(XMM0, Mem::Base(RIP, -10))); assert_emit!(0x66, 0x0f, 0x57, 0x05, 0xf6, 0xff, 0xff, 0xff; xorpd(XMM0, Mem::Base(RIP, -10))); }
rust_cleaned_test_functions.jsonl/85509
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 186 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 76462, 1690, 368, 341, 286, 2060, 69082, 10297, 15, 87, 15, 69, 11, 220, 15, 87, 20, 22, 11, 220, 15, 87, 15, 20, 11, 220, 15, 5848, 21, 11, 220, 15, 9020, 11, 220, 15, 9020, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_compilation_of_all_default_patterns() { let mut grok = Grok::default(); let mut num_checked = 0; for &(key, _) in patterns::PATTERNS { let pattern = format!("%{{{}}}", key); grok.compile(&pattern, false).expect(&format!( "Pattern {} key {} failed to compile!", pattern, key )); num_checked += 1; } assert!(num_checked > 0); }
rust_cleaned_test_functions.jsonl/117573
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 243 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18177, 13455, 3575, 5705, 9993, 64923, 368, 341, 286, 1077, 5206, 10487, 74, 284, 17888, 74, 486, 2258, 543, 286, 1077, 5206, 1629, 56456, 284, 220, 15, 280, 286, 369, 22796, 792, 11, 27439, 304...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_namespaces() { lazy_static::initialize(&NAMESPACES); assert_eq!(NAMESPACES.len(), 7); let ns = NAMESPACES.get("user"); assert!(ns.is_some()); let ns = NAMESPACES.get("ipc"); assert!(ns.is_some()); let ns = NAMESPACES.get("pid"); assert!(ns.is_some()); let ns = NAMESPACES.get("network"); assert!(ns.is_some()); let ns = NAMESPACES.get("mount"); assert!(ns.is_some()); let ns = NAMESPACES.get("uts"); assert!(ns.is_some()); let ns = NAMESPACES.get("cgroup"); assert!(ns.is_some()); }
rust_cleaned_test_functions.jsonl/16614
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9187, 27338, 368, 341, 286, 15678, 25360, 486, 21641, 2099, 45, 15608, 47, 52081, 317, 286, 2060, 10714, 10297, 45, 15608, 47, 52081, 19406, 1507, 220, 22, 626, 286, 1077, 12268, 284, 90910, 47, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_qmp_event_macro() { use crate::socket::{Socket, SocketRWHandler}; use std::io::Read; // Pre test. Environment preparation QmpChannel::object_init(); let mut buffer = [0u8; 200]; let (listener, mut client, server) = prepare_unix_socket_environment("06"); // Use event! macro to send event msg to client let socket = Socket::from_unix_listener(listener, None); socket.bind_unix_stream(server); QmpChannel::bind_writer(SocketRWHandler::new(socket.get_stream_fd())); // 1.send no-content event event!(STOP); let length = client.read(&mut buffer).unwrap(); let qmp_event: schema::QmpEvent = serde_json::from_str(&(String::from_utf8_lossy(&buffer[..length]))).unwrap(); match qmp_event { schema::QmpEvent::STOP { data: _, timestamp: _, } => { assert!(true); } _ => assert!(false), } // 2.send with-content event let shutdown_event = schema::SHUTDOWN { guest: true, reason: "guest-shutdown".to_string(), }; event!(SHUTDOWN; shutdown_event); let length = client.read(&mut buffer).unwrap(); let qmp_event: schema::QmpEvent = serde_json::from_str(&(String::from_utf8_lossy(&buffer[..length]))).unwrap(); match qmp_event { schema::QmpEvent::SHUTDOWN { data, timestamp: _ } => { assert_eq!(data.guest, true); assert_eq!(data.reason, "guest-shutdown".to_string()); } _ => assert!(false), } // After test. Environment Recover recover_unix_socket_environment("06"); }
rust_cleaned_test_functions.jsonl/66357
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 875 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8976, 1307, 6748, 58810, 368, 341, 286, 990, 17717, 486, 9556, 22964, 10286, 11, 20954, 56368, 3050, 2440, 286, 990, 1460, 486, 815, 486, 4418, 401, 286, 442, 4968, 1273, 13, 11586, 17975, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_rotate_left_parts() { let mut v: VecDeque<_> = (1..=7).collect(); v.rotate_left(2); assert_eq!(v.as_slices(), (&[3, 4, 5, 6, 7, 1][..], &[2][..])); v.rotate_left(2); assert_eq!(v.as_slices(), (&[5, 6, 7, 1][..], &[2, 3, 4][..])); v.rotate_left(2); assert_eq!(v.as_slices(), (&[7, 1][..], &[2, 3, 4, 5, 6][..])); v.rotate_left(2); assert_eq!(v.as_slices(), (&[2, 3, 4, 5, 6, 7, 1][..], &[][..])); v.rotate_left(2); assert_eq!(v.as_slices(), (&[4, 5, 6, 7, 1, 2][..], &[3][..])); v.rotate_left(2); assert_eq!(v.as_slices(), (&[6, 7, 1, 2][..], &[3, 4, 5][..])); v.rotate_left(2); assert_eq!(v.as_slices(), (&[1, 2][..], &[3, 4, 5, 6, 7][..])); }
rust_cleaned_test_functions.jsonl/73737
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 418 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60834, 9579, 33217, 368, 341, 262, 1077, 5206, 348, 25, 11312, 73891, 32399, 29, 284, 320, 16, 496, 28, 22, 568, 17384, 543, 262, 348, 35944, 9579, 7, 17, 317, 262, 2060, 10714, 10297, 85, 535...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ord() { let mut a = TrieSet::new(); let mut b = TrieSet::new(); assert!(a <= b && a >= b); assert!(a.insert(1u)); assert!(a > b && a >= b); assert!(b < a && b <= a); assert!(b.insert(2u)); assert!(b > a && b >= a); assert!(a < b && a <= b); }
rust_cleaned_test_functions.jsonl/7313
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 189 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 67324, 368, 341, 286, 1077, 5206, 264, 284, 62783, 1649, 486, 931, 543, 286, 1077, 5206, 293, 284, 62783, 1649, 486, 931, 1428, 286, 2060, 10297, 64, 2651, 293, 1009, 264, 2604, 293, 317, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_pi_radians_exactly_180_degrees() { assert_eq!(Angle(PI).rad(), PI); assert_eq!(Angle(PI).deg(), 180.); assert_eq!(Angle::from(Deg(180.)).rad(), PI); assert_eq!(Angle::from(Deg(180.)).deg(), 180.); assert_eq!(Angle(PI / 2.).deg(), 90.); assert_eq!(Angle(PI / -2.).deg(), -90.); assert_eq!(Angle::from(Deg(-45.)).rad(), PI / -4.); }
rust_cleaned_test_functions.jsonl/18315
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 219 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47771, 1710, 20736, 2702, 32739, 62, 16, 23, 15, 46057, 7858, 368, 341, 286, 2060, 10714, 10297, 15939, 7, 1893, 568, 13281, 1507, 22578, 317, 286, 2060, 10714, 10297, 15939, 7, 1893, 568, 16508, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tokens() { sub_test("id123_OK", &[Token::Word("id123_OK")]); sub_test( "92No", &[Token::Number(Ok(Number::I32(92))), Token::Word("No")], ); sub_test( "2u3o", &[ Token::Number(Ok(Number::U32(2))), Token::Number(Ok(Number::I32(3))), Token::Word("o"), ], ); sub_test( "2.4f44po", &[ Token::Number(Ok(Number::F32(2.4))), Token::Number(Ok(Number::I32(44))), Token::Word("po"), ], ); sub_test( "Δέλτα réflexion Кызыл 𐰓𐰏𐰇 朝焼け سلام 검정 שָׁלוֹם गुलाबी փիրուզ", &[ Token::Word("Δέλτα"), Token::Word("réflexion"), Token::Word("Кызыл"), Token::Word("𐰓𐰏𐰇"), Token::Word("朝焼け"), Token::Word("سلام"), Token::Word("검정"), Token::Word("שָׁלוֹם"), Token::Word("गुलाबी"), Token::Word("փիրուզ"), ], ); sub_test("æNoø", &[Token::Word("æNoø")]); sub_test("No¾", &[Token::Word("No"), Token::Unknown('¾')]); sub_test("No好", &[Token::Word("No好")]); sub_test("_No", &[Token::Word("_No")]); sub_test( "*/*/***/*//=/*****//", &[ Token::Operation('*'), Token::AssignmentOperation('/'), Token::Operation('/'), ], ); }
rust_cleaned_test_functions.jsonl/81350
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 915 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28838, 368, 341, 262, 1186, 4452, 445, 307, 16, 17, 18, 8375, 497, 44590, 3323, 486, 10879, 445, 307, 16, 17, 18, 8375, 899, 2558, 262, 1186, 4452, 1006, 286, 330, 24, 17, 2753, 756, 286, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_normalized_newlines_stdout_is_fail() { let res = CmdResult { tmpd: None, code: None, success: true, stdout: "A\r\nB\nC".into(), stderr: "".into(), }; res.normalized_newlines_stdout_is("A\r\nB\nC\n"); }
rust_cleaned_test_functions.jsonl/74691
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 187 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 80006, 5921, 7969, 67416, 6892, 22121, 368, 341, 286, 1077, 592, 284, 40210, 2077, 341, 310, 4174, 67, 25, 2240, 345, 310, 2038, 25, 2240, 345, 310, 2393, 25, 830, 345, 310, 20075, 25, 330, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_total_risk_cycle1() { let grid: Grid<Risk> = GRAPH_STR.parse().unwrap(); let g = CaveRiskGraph::from_grid_and_cycle(&grid, 1); assert_eq!(g.total_risk(), 40); }
rust_cleaned_test_functions.jsonl/134631
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10784, 1710, 3187, 39079, 16, 368, 341, 286, 1077, 5827, 25, 10587, 23370, 3187, 29, 284, 68636, 7159, 4632, 1005, 15454, 543, 286, 1077, 342, 284, 49392, 85307, 11212, 486, 1499, 15604, 8378, 390...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_number_literal_binary() { // binary assert_parse_success!(numeric_literal, "0b1010", NumericLiteral(10f64)); assert_parse_success!(numeric_literal, "0B1010", NumericLiteral(10f64)); }
rust_cleaned_test_functions.jsonl/66452
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 96 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5500, 34100, 31761, 368, 341, 262, 442, 7868, 198, 262, 2060, 21039, 18632, 10297, 19600, 34100, 11, 330, 15, 65, 16, 15, 16, 15, 497, 50367, 17350, 7, 16, 15, 69, 21, 19, 1106, 262, 2060, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_is_simple() { let points = [[1, -1], [1, 1], [-1, 1], [-1, -1]]; assert!(is_simple(&points)); }
rust_cleaned_test_functions.jsonl/60094
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 64 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 30015, 368, 341, 262, 1077, 3501, 284, 4318, 16, 11, 481, 16, 1125, 508, 16, 11, 220, 16, 1125, 10055, 16, 11, 220, 16, 1125, 10055, 16, 11, 481, 16, 13204, 262, 2060, 10297, 285, 3001...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_strmode() { let tests = [ (0o100644, "-rw-r--r--", "file, 644"), (0o100600, "-rw-------", "file, 600"), (0o100777, "-rwxrwxrwx", "file, 777"), (0o040755, "drwxr-xr-x", "directory, 755"), (0o040711, "drwx--x--x", "directory, 711"), (0o020660, "crw-rw----", "character special, 660"), (0o060660, "brw-rw----", "block special, 660"), (0o120777, "lrwxrwxrwx", "symbolic link, 777"), (0o010600, "prw-------", "fifo, 600"), (0o140755, "srwxr-xr-x", "socket ,755"), (0o104555, "-r-sr-xr-x", "file, 755 with setuid"), (0o104644, "-rwSr--r--", "file, 644 with setuid"), (0o044755, "drwsr-xr-x", "directory, 755 with setuid"), (0o044666, "drwSrw-rw-", "directory, 666 with setuid"), (0o102755, "-rwxr-sr-x", "file, 755 with setgid"), (0o102644, "-rw-r-Sr--", "file, 644 with setgid"), (0o042755, "drwxr-sr-x", "directory, 755 with setgid"), (0o042644, "drw-r-Sr--", "directory, 644 with setgid"), (0o041755, "drwxr-xr-t", "directory, 755 with sticky"), (0o041644, "drw-r--r-T", "directory, 644 with sticky"), (0o104471, "-r-Srwx--x", "file, 471 with setuid"), (0o106471, "-r-Srws--x", "file, 471 with setuid and setgid"), (0o044471, "dr-Srwx--x", "directory, 471 with setuid"), (0o046471, "dr-Srws--x", "directory, 471 with setuid and setgid"), (0o045471, "dr-Srwx--t", "directory, 471 with setuid and sticky"), (0o047471, "dr-Srws--t", "directory, 471 with setuid, setgid, and sticky"), (0o047470, "dr-Srws--T", "directory, 470 with setuid, setgid, and sticky"), ]; for t in &tests { assert_eq!(t.1, strmode(t.0), "{}: {:o}", t.2, t.0); } }
rust_cleaned_test_functions.jsonl/74075
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 946 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 8516, 368, 341, 262, 1077, 7032, 284, 2278, 286, 320, 15, 78, 16, 15, 15, 21, 19, 19, 11, 6523, 31768, 3795, 313, 81, 313, 497, 330, 1192, 11, 220, 21, 19, 19, 4461, 286, 320, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_leb_writer() { assert_eq!(write_signed_leb_as_vector(0), [0x00]); assert_eq!(write_signed_leb_as_vector(1), [0x01]); assert_eq!(write_signed_leb_as_vector(0x80), [0x80, 0x01]); assert_eq!(write_signed_leb_as_vector(0xFF), [0xFF, 0x01]); assert_eq!(write_signed_leb_as_vector(0xFFFF), [0xFF, 0xFF, 0x03]); assert_eq!( write_signed_leb_as_vector(unsafe { std::mem::transmute(-1i64) }), [0x7F] ); assert_eq!( write_signed_leb_as_vector(unsafe { std::mem::transmute(-2i64) }), [0x7E] ); assert_eq!( write_signed_leb_as_vector(unsafe { std::mem::transmute(-256i64) }), [0x80, 0x7E] ); assert_eq!( write_signed_leb_as_vector(unsafe { std::mem::transmute(-65536i64) }), [0x80, 0x80, 0x7C] ); }
rust_cleaned_test_functions.jsonl/45665
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 448 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11751, 65, 28908, 368, 341, 262, 2060, 10714, 10297, 4934, 55617, 11751, 65, 11898, 12247, 7, 15, 701, 508, 15, 87, 15, 15, 2558, 262, 2060, 10714, 10297, 4934, 55617, 11751, 65, 11898, 12247, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stream_tx() { let conn_fc = connection_fc(4096); let conn_events = ConnectionEvents::default(); let mut s = SendStream::new(4.into(), 1024, Rc::clone(&conn_fc), conn_events); let res = s.send(&[4; 100]).unwrap(); assert_eq!(res, 100); s.mark_as_sent(0, 50, false); if let SendStreamState::Send { fc, .. } = s.state() { assert_eq!(fc.used(), 100); } else { panic!("unexpected stream state"); } // Should hit stream flow control limit before filling up send buffer let res = s.send(&[4; SEND_BUFFER_SIZE]).unwrap(); assert_eq!(res, 1024 - 100); s.set_max_stream_data(1024); let res = s.send(&[4; SEND_BUFFER_SIZE]).unwrap(); assert_eq!(res, 0); s.set_max_stream_data(1_048_576); let res = s.send(&[4; SEND_BUFFER_SIZE]).unwrap(); assert_eq!(res, 3072); // should now hit the tx buffer size conn_fc.borrow_mut().update(SEND_BUFFER_SIZE as u64); let res = s.send(&[4; SEND_BUFFER_SIZE + 100]).unwrap(); assert_eq!(res, SEND_BUFFER_SIZE - 4096); s.mark_as_acked(0, 40, false); }
rust_cleaned_test_functions.jsonl/112152
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 606 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12673, 17805, 368, 341, 286, 1077, 4534, 46506, 284, 3633, 46506, 7, 19, 15, 24, 21, 317, 286, 1077, 4534, 19691, 284, 11032, 7900, 486, 2258, 1428, 286, 1077, 5206, 274, 284, 11000, 3027, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_malformed_int() { assert!(Tuple::try_from(&[21, 0]).is_ok()); assert!(Tuple::try_from(&[22, 0]).is_err()); assert!(Tuple::try_from(&[22, 0, 0]).is_ok()); assert!(Tuple::try_from(&[19, 0]).is_ok()); assert!(Tuple::try_from(&[18, 0]).is_err()); assert!(Tuple::try_from(&[18, 0, 0]).is_ok()); }
rust_cleaned_test_functions.jsonl/127218
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 191 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 278, 10155, 4042, 368, 341, 286, 2060, 10297, 28681, 486, 1539, 5673, 2099, 58, 17, 16, 11, 220, 15, 10697, 285, 19817, 1423, 286, 2060, 10297, 28681, 486, 1539, 5673, 2099, 58, 17, 17, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reset_only_unstaged() { let (_td, repo) = repo_init().unwrap(); let root = repo.path().parent().unwrap(); let repo_path = root.as_os_str().to_str().unwrap(); let res = get_status(repo_path, StatusType::WorkingDir).unwrap(); assert_eq!(res.len(), 0); let file_path = root.join("bar.txt"); { File::create(&file_path) .unwrap() .write_all(HUNK_A.as_bytes()) .unwrap(); } debug_cmd_print(repo_path, "git status"); stage_add_file(repo_path, Path::new("bar.txt")).unwrap(); debug_cmd_print(repo_path, "git status"); // overwrite with next content { File::create(&file_path) .unwrap() .write_all(HUNK_B.as_bytes()) .unwrap(); } debug_cmd_print(repo_path, "git status"); assert_eq!(get_statuses(repo_path), (1, 1)); reset_workdir(repo_path, "bar.txt").unwrap(); debug_cmd_print(repo_path, "git status"); assert_eq!(get_statuses(repo_path), (0, 1)); }
rust_cleaned_test_functions.jsonl/82912
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 615 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18983, 18410, 4907, 267, 3279, 368, 341, 286, 1077, 5453, 1296, 11, 15867, 8, 284, 15867, 6137, 1005, 15454, 543, 286, 1077, 3704, 284, 15867, 3875, 1005, 3765, 1005, 15454, 543, 286, 1077, 15867,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eip155_decode_signed() { let expected_signed_bytes = hex::decode("f86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83").unwrap(); let expected_signed_rlp = rlp::Rlp::new(expected_signed_bytes.as_slice()); let (decoded_tx, decoded_sig) = TransactionRequest::decode_signed_rlp(&expected_signed_rlp).unwrap(); let expected_sig = Signature { v: 37, r: U256::from_dec_str( "18515461264373351373200002665853028612451056578545711640558177340181847433846", ) .unwrap(), s: U256::from_dec_str( "46948507304638947509940763649030358759909902576025900602547168820602576006531", ) .unwrap(), }; assert_eq!(expected_sig, decoded_sig); assert_eq!(decoded_tx.chain_id, Some(U64::from(1))); }
rust_cleaned_test_functions.jsonl/15450
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 567 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2204, 573, 16, 20, 20, 15227, 55617, 368, 341, 286, 1077, 3601, 55617, 12524, 284, 12371, 486, 18196, 445, 69, 23, 21, 66, 15, 24, 23, 20, 15, 19, 64, 23, 16, 22, 66, 23, 15, 15, 23, 17,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_byte_parser_mapping() { let data = "{\"a\": 1, \"b\":2}"; let parser = parser::YamlByteParser::init(data.as_bytes(), YamlUtf8Encoding); let expected = Ok(vec![ YamlStreamStartEvent(YamlUtf8Encoding), YamlDocumentStartEvent(None, vec![], true), YamlMappingStartEvent(YamlSequenceParam{anchor: None, tag: None, implicit: true, style: YamlFlowSequenceStyle}), YamlScalarEvent(YamlScalarParam{anchor: None, tag: None, value: "a".to_string(), plain_implicit: false, quoted_implicit: true, style: YamlDoubleQuotedScalarStyle}), YamlScalarEvent(YamlScalarParam{anchor: None, tag: None, value: "1".to_string(), plain_implicit: true, quoted_implicit: false, style: YamlPlainScalarStyle}), YamlScalarEvent(YamlScalarParam{anchor: None, tag: None, value: "b".to_string(), plain_implicit: false, quoted_implicit: true, style: YamlDoubleQuotedScalarStyle}), YamlScalarEvent(YamlScalarParam{anchor: None, tag: None, value: "2".to_string(), plain_implicit: true, quoted_implicit: false, style: YamlPlainScalarStyle}), YamlMappingEndEvent, YamlDocumentEndEvent(true), YamlStreamEndEvent ]); let stream: Result<Vec<YamlEventSpec>, YamlError> = parser.parse().map(|res| res.map(|evt| evt.spec)).collect(); assert_eq!(expected, stream); }
rust_cleaned_test_functions.jsonl/58258
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 615 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19737, 18517, 26930, 368, 341, 286, 1077, 821, 284, 54734, 64, 11693, 220, 16, 11, 7245, 65, 11693, 17, 26259, 286, 1077, 6729, 284, 6729, 486, 56, 9467, 7153, 6570, 486, 2327, 2592, 5357, 12524...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vote_serialize() { let mut buffer: Vec<u8> = vec![0; VoteState::size_of()]; let mut vote_state = VoteState::default(); vote_state .votes .resize(MAX_LOCKOUT_HISTORY, Lockout::default()); vote_state.root_slot = Some(1); let versioned = VoteStateVersions::new_current(vote_state); assert!(VoteState::serialize(&versioned, &mut buffer[0..4]).is_err()); VoteState::serialize(&versioned, &mut buffer).unwrap(); assert_eq!( VoteState::deserialize(&buffer).unwrap(), versioned.convert_to_current() ); }
rust_cleaned_test_functions.jsonl/6084
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 297 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54360, 88686, 368, 341, 286, 1077, 5206, 4147, 25, 11312, 34837, 23, 29, 284, 7486, 20703, 15, 26, 34034, 1397, 486, 2141, 3575, 33800, 286, 1077, 5206, 6910, 4387, 284, 34034, 1397, 486, 2258, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_write_padded() { let len = 1016; // Use a multiple of 254. let mut data = vec![255u8; len]; let buf = Vec::new(); let mut cursor = Cursor::new(buf); let padded_written = write_padded(&mut data[..].as_ref(), &mut cursor).unwrap(); let padded = cursor.into_inner(); assert_eq!(padded_written, len); assert_eq!( padded.len(), FR32_PADDING_MAP.transform_byte_offset(len, true) ); let mut unpadded = Vec::new(); let unpadded_written = write_unpadded(&padded, &mut unpadded, 0, len).unwrap(); assert_eq!(unpadded_written, len); assert_eq!(data, unpadded); assert_eq!(padded.into_boxed_slice(), bit_vec_padding(data)); }
rust_cleaned_test_functions.jsonl/33000
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 365 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 9165, 620, 16828, 368, 341, 286, 1077, 2422, 284, 220, 16, 15, 16, 21, 26, 442, 5443, 264, 5248, 315, 220, 17, 20, 19, 624, 286, 1077, 5206, 821, 284, 7486, 20703, 17, 20, 20, 84, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dynamic_spendable_outputs_local_htlc_timeout_tx() { let chanmon_cfgs = create_chanmon_cfgs(2); let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); let nodes = create_network(2, &node_cfgs, &node_chanmgrs); // Create some initial channels let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::supported(), InitFeatures::supported()); route_payment(&nodes[0], &vec!(&nodes[1])[..], 9000000).0; let local_txn = nodes[0].node.channel_state.lock().unwrap().by_id.get_mut(&chan_1.2).unwrap().channel_monitor().get_latest_local_commitment_txn(); assert_eq!(local_txn[0].input.len(), 1); check_spends!(local_txn[0], chan_1.3.clone()); // Timeout HTLC on A's chain and so it can generate a HTLC-Timeout tx let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 }; nodes[0].block_notifier.block_connected(&Block { header, txdata: vec![local_txn[0].clone()] }, 200); check_closed_broadcast!(nodes[0], false); let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap(); assert_eq!(node_txn[0].input.len(), 1); assert_eq!(node_txn[0].input[0].witness.last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT); check_spends!(node_txn[0], local_txn[0].clone()); // Verify that A is able to spend its own HTLC-Timeout tx thanks to spendable output event given back by its ChannelMonitor let spend_txn = check_spendable_outputs!(nodes[0], 1); assert_eq!(spend_txn.len(), 8); assert_eq!(spend_txn[0], spend_txn[2]); assert_eq!(spend_txn[0], spend_txn[4]); assert_eq!(spend_txn[0], spend_txn[6]); assert_eq!(spend_txn[1], spend_txn[3]); assert_eq!(spend_txn[1], spend_txn[5]); assert_eq!(spend_txn[1], spend_txn[7]); check_spends!(spend_txn[0], local_txn[0].clone()); check_spends!(spend_txn[1], node_txn[0].clone()); }
rust_cleaned_test_functions.jsonl/28319
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 801 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45992, 643, 3740, 480, 35189, 13564, 49086, 17257, 20537, 17805, 368, 341, 10217, 26023, 1645, 18343, 82, 284, 1855, 45552, 1645, 18343, 82, 7, 17, 317, 10217, 2436, 18343, 82, 284, 1855, 5084, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_atomic_accesses() { let addr = GuestAddress(0x1000); let mem = GuestMemoryMmap::from_ranges(&[(addr, 0x1000)]).unwrap(); let bad_addr = addr.unchecked_add(0x1000); crate::bytes::tests::check_atomic_accesses(mem, addr, bad_addr); }
rust_cleaned_test_functions.jsonl/112627
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 129 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51367, 12759, 288, 368, 341, 286, 1077, 10789, 284, 26215, 4286, 7, 15, 87, 16, 15, 15, 15, 317, 286, 1077, 1833, 284, 26215, 10642, 44, 2186, 486, 1499, 58748, 2099, 9697, 6214, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cast() { let length_as_i32: Length<i32, Cm> = Length::new(5); let result: Length<f32, Cm> = length_as_i32.cast(); let length_as_f32: Length<f32, Cm> = Length::new(5.0); assert_eq!(result, length_as_f32); }
rust_cleaned_test_functions.jsonl/50591
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 137 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 368, 341, 286, 1077, 3084, 11898, 5318, 18, 17, 25, 17287, 21897, 18, 17, 11, 356, 76, 29, 284, 17287, 486, 931, 7, 20, 626, 286, 1077, 1102, 25, 17287, 63895, 18, 17, 11, 356, 76, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_neg32() { test_interpreter_and_jit_asm!( " mov32 r0, 2 neg32 r0 exit", [], (), { |_vm, res: Result| { res.unwrap() == 0xfffffffe } }, 3 ); }
rust_cleaned_test_functions.jsonl/58928
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 146 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28209, 18, 17, 368, 341, 262, 1273, 15318, 28637, 8378, 5374, 275, 67529, 33673, 286, 6228, 286, 1974, 18, 17, 435, 15, 11, 220, 17, 198, 286, 4184, 18, 17, 435, 15, 198, 286, 4869, 756, 286...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_route_match_many() { let rt = Route::new("/api/v1/foo/<int:foo_id>/bar/<str:bar>/baz/<int:baz_id>", Method::Get, utils::err_404); let rm = rt.parse("/api/v1/foo/123/bar/bar/baz/456"); assert_eq!("123", rm.get("foo_id").unwrap()); assert_eq!("bar", rm.get("bar").unwrap()); assert_eq!("456", rm.get("baz_id").unwrap()); }
rust_cleaned_test_functions.jsonl/47136
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 201 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28109, 10708, 22101, 368, 341, 286, 1077, 16677, 284, 9572, 486, 931, 4283, 2068, 5457, 16, 60555, 23012, 396, 25, 7975, 842, 18105, 2257, 23012, 495, 25, 2257, 18105, 42573, 23012, 396, 25, 42573...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_no_finals() { let model = "1\n\ "; match DFAReader::new_from_string(model) { Err(DFAReaderError::MissingFinalStates) => assert!(true), _ => assert!(false, "MissingFinalStates expected."), } }
rust_cleaned_test_functions.jsonl/47828
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 154 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 20676, 82, 368, 341, 286, 1077, 1614, 4035, 310, 330, 16, 1699, 5661, 310, 7620, 286, 2432, 93631, 5062, 486, 931, 5673, 3904, 7635, 8, 341, 310, 15495, 5432, 3627, 5062, 1454, 486, 25080,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_no_full_names_no_problem() { let (font_catalog, font_pkgs, product_config) = make_font_db_args(); let font_info_loader = TestFontInfoLoader::new(btreemap! { ("AlphaSans.ttc".to_string(), 0) => FontInfo { char_set: CharSet::new(vec![0x1, 0x2]), postscript_name: Some("AlphaSans-Regular".to_string()), full_name: None, }, ("AlphaSans.ttc".to_string(), 2) => FontInfo { char_set: CharSet::new(vec![0x1, 0x2]), postscript_name: Some("AlphaSans-Bold".to_string()), full_name: None, }, ("AlphaSansCopy.ttf".to_string(), 0) => FontInfo { char_set: CharSet::new(vec![0x1, 0x2]), postscript_name: Some("AlphaSans-BoldCopy".to_string()), full_name: None, }, }); let font_dir = "foo/bar"; let font_sets = FontSets::new(btreemap! { "AlphaSans.ttc".to_string() => FontSet::Local, "AlphaSansCopy.ttf".to_string() => FontSet::Local, }); let result = generate_manifest( font_catalog, font_pkgs, font_sets, product_config, font_info_loader, font_dir, false, ); assert_matches!(result, Ok(_)); }
rust_cleaned_test_functions.jsonl/58070
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 780 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 16372, 9187, 6536, 60139, 368, 341, 286, 1077, 320, 4026, 47310, 11, 3301, 33321, 5857, 11, 1985, 5332, 8, 284, 1281, 17451, 8685, 8384, 543, 286, 1077, 3301, 3109, 22139, 284, 3393, 5447, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fft_frequencies() { let freq = fft_frequencies(22050, 2048); let larynx_fft: Array1<f64> = read_npy("tests/data/audio/larynx-fft-frequencies.npy").unwrap(); assert_relative_eq!(freq, larynx_fft); }
rust_cleaned_test_functions.jsonl/104235
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 110 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 67059, 761, 71731, 368, 341, 197, 10217, 20895, 284, 43700, 761, 71731, 7, 17, 17, 15, 20, 15, 11, 220, 17, 15, 19, 23, 317, 197, 10217, 326, 658, 23357, 67059, 25, 2910, 16, 63895, 21, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_resolve_module_3() { // unsupported schemes let test_cases = [ "ftp://localhost:4545/testdata/subdir/print_hello.ts", "blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f", ]; for &test in test_cases.iter() { let url = Url::parse(test).unwrap(); assert_eq!( SourceFileFetcher::check_if_supported_scheme(&url) .unwrap_err() .kind(), ErrorKind::UnsupportedFetchScheme ); } }
rust_cleaned_test_functions.jsonl/16765
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 248 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 77291, 10750, 62, 18, 368, 341, 262, 442, 40409, 30856, 198, 262, 1077, 1273, 41427, 284, 2278, 414, 330, 25068, 1110, 8301, 25, 19, 20, 19, 20, 12697, 691, 37885, 3741, 92221, 96724, 21288, 756...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_strong_count() { let a = Rc::new(0u32); assert!(strong_count(&a) == 1); let w = a.downgrade(); assert!(strong_count(&a) == 1); let b = w.upgrade().expect("upgrade of live rc failed"); assert!(strong_count(&b) == 2); assert!(strong_count(&a) == 2); drop(w); drop(a); assert!(strong_count(&b) == 1); let c = b.clone(); assert!(strong_count(&b) == 2); assert!(strong_count(&c) == 2); }
rust_cleaned_test_functions.jsonl/54219
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 265 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 644, 3180, 368, 341, 286, 1077, 264, 284, 81463, 486, 931, 7, 15, 84, 18, 17, 317, 286, 2060, 10297, 4519, 3180, 2099, 64, 8, 621, 220, 16, 317, 286, 1077, 289, 284, 264, 18148, 6937, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_containing_polygon() { let la = Point::new(-118.2437, 34.0522); let poly = Polygon::new( vec![ [-119.53125, 33.75], [-118.125, 33.75], [-118.125, 35.15625], [-119.53125, 35.15625], [-119.53125, 33.75], ] .into(), vec![], ); let polyg = Geometry::Polygon(poly); println!("{}", polyg.to_wkt().items.pop().unwrap()); match distance(&la, &polyg) { Some(d) => assert_eq!(d.round(), 0.), None => assert!(false, "Should get distance"), } }
rust_cleaned_test_functions.jsonl/93758
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 390 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10260, 2056, 73542, 368, 341, 286, 1077, 1187, 284, 5126, 486, 931, 4080, 16, 16, 23, 13, 17, 19, 18, 22, 11, 220, 18, 19, 13, 15, 20, 17, 17, 317, 286, 1077, 9861, 284, 48159, 486, 931, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_mint() { let mut service = TestService::new(); let ctx = mock_context(TestService::caller()); let asset = create_asset!(service, ctx.clone(), 10000, 10); let recipient = Address::from_hex("0x666cdba6ae4f479f7164792b318b2a06c759833b").unwrap(); let asset_to_mint = MintAssetPayload { asset_id: asset.id.clone(), to: recipient.clone(), amount: 100, proof: Hex::from_string("0x1122".to_owned()).unwrap(), memo: "".to_owned(), }; let ctx_admin = mock_context(TestService::admin()); let minted = service.mint(ctx, asset_to_mint.clone()); assert!(minted.is_error(), "mint require admin permission"); service_call!(service, mint, ctx_admin.clone(), asset_to_mint); assert_eq!(ctx_admin.get_events().len(), 1); let event: MintAssetEvent = serde_json::from_str(&ctx_admin.get_events()[0].data).expect("event"); assert_eq!(event.asset_id, asset.id); assert_eq!(event.to, recipient); assert_eq!(event.amount, 100); let recipient_balance = service_call!(service, get_balance, ctx_admin.clone(), GetBalancePayload { asset_id: asset.id.clone(), user: recipient, }); assert_eq!(recipient_balance.balance, 100); let asset_ret = service_call!(service, get_asset, ctx_admin, GetAssetPayload { id: asset.id, }); assert_eq!(asset_ret.supply, 10100) }
rust_cleaned_test_functions.jsonl/32946
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 625 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 396, 368, 341, 262, 1077, 5206, 2473, 284, 3393, 1860, 486, 931, 543, 262, 1077, 5635, 284, 7860, 8467, 31159, 1860, 486, 56126, 1423, 262, 1077, 9329, 284, 1855, 42299, 10297, 7936, 11, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_create_connection_agency_failure() { let _setup = SetupIndyMocks::init(); let handle = create_connection("invalid").unwrap(); let rc = connect(handle, None); assert_eq!(rc.unwrap_err().kind(), VcxErrorKind::PostMessageFailed); }
rust_cleaned_test_functions.jsonl/20871
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 15866, 20587, 2251, 43618, 368, 341, 286, 1077, 716, 15188, 284, 18626, 1425, 88, 72577, 486, 2327, 1428, 286, 1077, 3705, 284, 1855, 15866, 445, 11808, 1827, 15454, 543, 286, 1077, 10192, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deserialize_signed_tx_parity() { // taken from RPC docs. let tx_str = r#"{ "raw": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675", "tx": { "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "nonce": "0x0", "blockHash": "0xbeab0aa2411b7ab17f30a99d3cb9c6ef2fc5426d6ad6fd9e2a26a6aed1d1055b", "blockNumber": "0x15df", "transactionIndex": "0x1", "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1", "to": "0x853f43d8a49eeb85d32cf465507dd71d507100c1", "value": "0x7f110", "gas": "0x7f110", "gasPrice": "0x09184e72a000", "input": "0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360", "s": "0x777" } }"#; let _tx: RawTransaction = serde_json::from_str(tx_str).unwrap(); }
rust_cleaned_test_functions.jsonl/68220
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 569 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15768, 9050, 55617, 17805, 620, 10748, 368, 341, 286, 442, 4429, 504, 34008, 26340, 624, 286, 1077, 9854, 2895, 284, 435, 55543, 515, 286, 330, 1041, 788, 330, 15, 9703, 19, 21, 68, 23, 631, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_intersect_regions_new_ranges_within_existing() { let actual = intersect_regions( vec![UnchangedRange { base_range: 20..70, offsets: vec![3], }], &[(25..30, 35..40), (40..50, 40..50)], ); let expected = vec![ UnchangedRange { base_range: 25..30, offsets: vec![3, 10], }, UnchangedRange { base_range: 40..50, offsets: vec![3, 0], }, ]; assert_eq!(actual, expected); }
rust_cleaned_test_functions.jsonl/89253
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 369 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 72747, 58035, 5921, 58748, 72385, 62630, 368, 341, 286, 1077, 5042, 284, 31796, 58035, 1006, 310, 7486, 20703, 1806, 17353, 6046, 341, 394, 2331, 9698, 25, 220, 17, 15, 496, 22, 15, 345, 394, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_quality_scores_with_sequence_and_no_quality_scores() -> io::Result<()> { let data = [0xff, 0xff, 0xff, 0xff]; let mut buf = &data[..]; let mut quality_scores = sam::record::QualityScores::default(); get_quality_scores(&mut buf, &mut quality_scores, 4)?; assert!(quality_scores.is_empty()); Ok(()) }
rust_cleaned_test_functions.jsonl/75437
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 55074, 27198, 6615, 23735, 8378, 6536, 55074, 27198, 368, 1464, 6399, 486, 2077, 71698, 341, 286, 1077, 821, 284, 508, 15, 9020, 11, 220, 15, 9020, 11, 220, 15, 9020, 11, 220, 15, 9020, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_update_clock_timestamp() { let leader_pubkey = solana_sdk::pubkey::new_rand(); let GenesisConfigInfo { genesis_config, voting_keypair, .. } = create_genesis_config_with_leader(5, &leader_pubkey, 3); let mut bank = Bank::new(&genesis_config); bank = new_from_parent(&Arc::new(bank)); bank = new_from_parent(&Arc::new(bank)); assert_eq!( bank.clock().unix_timestamp, bank.unix_timestamp_from_genesis() ); bank.update_clock(None); assert_eq!( bank.clock().unix_timestamp, bank.unix_timestamp_from_genesis() ); update_vote_account_timestamp( BlockTimestamp { slot: bank.slot(), timestamp: bank.unix_timestamp_from_genesis() - 1, }, &bank, &voting_keypair.pubkey(), ); bank.update_clock(None); assert_eq!( bank.clock().unix_timestamp, bank.unix_timestamp_from_genesis() ); update_vote_account_timestamp( BlockTimestamp { slot: bank.slot(), timestamp: bank.unix_timestamp_from_genesis(), }, &bank, &voting_keypair.pubkey(), ); bank.update_clock(None); assert_eq!( bank.clock().unix_timestamp, bank.unix_timestamp_from_genesis() ); update_vote_account_timestamp( BlockTimestamp { slot: bank.slot(), timestamp: bank.unix_timestamp_from_genesis() + 1, }, &bank, &voting_keypair.pubkey(), ); bank.update_clock(None); assert_eq!( bank.clock().unix_timestamp, bank.unix_timestamp_from_genesis() + 1 ); // Timestamp cannot go backward from ancestor Bank to child bank = new_from_parent(&Arc::new(bank)); update_vote_account_timestamp( BlockTimestamp { slot: bank.slot(), timestamp: bank.unix_timestamp_from_genesis() - 1, }, &bank, &voting_keypair.pubkey(), ); bank.update_clock(None); assert_eq!( bank.clock().unix_timestamp, bank.unix_timestamp_from_genesis() ); }
rust_cleaned_test_functions.jsonl/2660
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1344 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 23062, 23073, 368, 341, 286, 1077, 7653, 34014, 792, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 40788, 2648, 1731, 341, 310, 59366, 5332, 345, 310, 15668, 3097,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_naive_time() -> Result<()> { let mut db = checked_memory_handle()?; let time = NaiveTime::from_hms_micro(23, 56, 4, 12_345); db.execute("INSERT INTO foo (tt) VALUES (?)", [time])?; let s: String = db.query_row("SELECT tt FROM foo", [], |r| r.get(0))?; assert_eq!("23:56:04.012345", s); let t: NaiveTime = db.query_row("SELECT tt FROM foo", [], |r| r.get(0))?; assert_eq!(time, t); Ok(()) }
rust_cleaned_test_functions.jsonl/76835
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58631, 533, 3009, 368, 1464, 5714, 71698, 341, 286, 1077, 5206, 2927, 284, 10067, 19195, 10630, 94136, 286, 1077, 882, 284, 12812, 533, 1462, 486, 1499, 1523, 1011, 73003, 7, 17, 18, 11, 220, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_manage_and_reward_node_providers() { let p: PathBuf = ["tests", "neurons.csv"].iter().collect(); let mut builder = GovernanceCanisterInitPayloadBuilder::new(); let init_neurons = &mut builder.add_all_neurons_from_csv_file(&p).proto.neurons; let voter_pid = *init_neurons[&42].controller.as_ref().unwrap(); let voter_neuron = init_neurons[&42].id.as_ref().unwrap().clone(); init_neurons.get_mut(&42).unwrap().dissolve_state = Some(DissolveState::DissolveDelaySeconds( MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS, )); let np_pid = PrincipalId::new_self_authenticating(&[14]); let (driver, mut gov) = governance_with_neurons(&init_neurons.values().cloned().collect::<Vec<Neuron>>()); println!( "Ledger {:?}\n", driver.state.as_ref().try_lock().unwrap().accounts, ); // Submit a proposal to reward a node provider which doesn't exist. // The submitter neuron votes automatically and that should be enough // to have it accepted. let pid = match gov .manage_neuron( &voter_pid, &ManageNeuron { id: Some(voter_neuron.clone()), command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal { summary: "Reward this NP...".to_string(), url: "".to_string(), action: Some(proposal::Action::RewardNodeProvider(RewardNodeProvider { create_neuron: None, node_provider: Some(NodeProvider { id: Some(np_pid) }), amount_e8s: 10 * 100_000_000, })), }))), }, ) .now_or_never() .unwrap() .expect("Couldn't submit proposal.") .command .unwrap() { manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(), _ => panic!("Invalid response"), }; // The proposal should have failed as the node provider doesn't exist. assert_eq!( gov.get_proposal_data(pid).unwrap().status(), ProposalStatus::Failed ); // Now make a proposal to add the node provider. let pid = match gov .manage_neuron( &voter_pid, &ManageNeuron { id: Some(voter_neuron.clone()), command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal { summary: "Just want to add this NP.".to_string(), url: "".to_string(), action: Some(proposal::Action::AddOrRemoveNodeProvider( AddOrRemoveNodeProvider { change: Some(Change::ToAdd(NodeProvider { id: Some(np_pid) })), }, )), }))), }, ) .now_or_never() .unwrap() .expect("Couldn't submit proposal.") .command .unwrap() { manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(), _ => panic!("Invalid response"), }; // The proposal should have been executed assert_eq!( gov.get_proposal_data(pid).unwrap().status(), ProposalStatus::Executed ); assert_eq!(gov.get_node_providers().len(), 1); assert_eq!( gov.get_node_providers()[0], NodeProvider { id: Some(np_pid) } ); // Adding the same node provider again should fail. let pid = match gov .manage_neuron( &voter_pid, &ManageNeuron { id: Some(voter_neuron.clone()), command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal { summary: "Just want to add this NP.".to_string(), url: "".to_string(), action: Some(proposal::Action::AddOrRemoveNodeProvider( AddOrRemoveNodeProvider { change: Some(Change::ToAdd(NodeProvider { id: Some(np_pid) })), }, )), }))), }, ) .now_or_never() .unwrap() .expect("Couldn't submit proposal.") .command .unwrap() { manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(), _ => panic!("Invalid response"), }; assert_eq!( gov.get_proposal_data(pid).unwrap().status(), ProposalStatus::Failed ); // Rewarding the node provider should now work. let pid = match gov .manage_neuron( &voter_pid, &ManageNeuron { id: Some(voter_neuron.clone()), command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal { summary: "Reward this NP...".to_string(), url: "".to_string(), action: Some(proposal::Action::RewardNodeProvider(RewardNodeProvider { create_neuron: None, node_provider: Some(NodeProvider { id: Some(np_pid) }), amount_e8s: 10 * 100_000_000, })), }))), }, ) .now_or_never() .unwrap() .expect("Couldn't submit proposal.") .command .unwrap() { manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(), _ => panic!("Invalid response"), }; // The proposal should have been executed assert_eq!( gov.get_proposal_data(pid).unwrap().status(), ProposalStatus::Executed ); // Now reward the node provider with a neuron instead of liquid ICP. let pid = match gov .manage_neuron( &voter_pid, &ManageNeuron { id: Some(voter_neuron.clone()), command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal { summary: "Reward this NP...".to_string(), url: "".to_string(), action: Some(proposal::Action::RewardNodeProvider(RewardNodeProvider { create_neuron: Some(reward_node_provider::CreateNeuron { dissolve_delay_seconds: 10, }), node_provider: Some(NodeProvider { id: Some(np_pid) }), amount_e8s: 99_999_999, })), }))), }, ) .now_or_never() .unwrap() .expect("Couldn't submit proposal.") .command .unwrap() { manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(), _ => panic!("Invalid response"), }; // The proposal should have been executed assert_eq!( gov.get_proposal_data(pid).unwrap().status(), ProposalStatus::Executed ); let (_, neuron) = gov .proto .neurons .iter() .find(|(_, x)| x.controller == Some(np_pid) && x.transfer.is_some()) .unwrap(); assert_eq!(neuron.stake_e8s(), 99_999_999); driver.assert_account_contains( &AccountIdentifier::new( GOVERNANCE_CANISTER_ID.get(), Some(Subaccount::try_from(&neuron.account[..]).unwrap()), ), 99_999_999, ); // Now make a proposal to remove the NodeProvider let pid = match gov .manage_neuron( &voter_pid, &ManageNeuron { id: Some(voter_neuron), command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal { summary: "Just want to remove this NP.".to_string(), url: "".to_string(), action: Some(proposal::Action::AddOrRemoveNodeProvider( AddOrRemoveNodeProvider { change: Some(Change::ToRemove(NodeProvider { id: Some(np_pid) })), }, )), }))), }, ) .now_or_never() .unwrap() .expect("Couldn't submit proposal.") .command .unwrap() { manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(), _ => panic!("Invalid response"), }; // The proposal should have been executed assert_eq!( gov.get_proposal_data(pid).unwrap().status(), ProposalStatus::Executed ); // There should no longer be a noder provider. assert_eq!(gov.get_node_providers().len(), 0); }
rust_cleaned_test_functions.jsonl/42512
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4451 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 56473, 8378, 38260, 5084, 2540, 17761, 368, 341, 262, 1077, 281, 25, 7933, 15064, 284, 4383, 23841, 497, 330, 811, 53669, 11219, 5521, 2015, 1005, 17384, 543, 262, 1077, 5206, 7363, 284, 80589, 67...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
#[test] fn test_log() { let path_to_current_dir = file_system::get_current_dir() .ok() .expect("Failed read current directory."); let target_dir = Path::new(&path_to_current_dir) .join("target") .join("debug"); let target_dir = file_system::path_to_str(target_dir.as_path()); assert_eq!("", get_log_directory()); init_log(&target_dir, Some(&String::from("trace"))); let log_dir = Path::new(&target_dir).join("log"); let log_dir = file_system::path_to_str(log_dir.as_path()); assert_eq!(log_dir, get_log_directory()); error!("text"); trace!("text"); debug!("text"); warn!("text"); info!("text"); let files_in_target_dir = file_system::files_in_dir(&target_dir); let path_to_log_dir = files_in_target_dir.get(&String::from("log")); assert!(path_to_log_dir.is_some()); let files_in_log_dir = file_system::files_in_dir(&path_to_log_dir.unwrap()); let path_to_main_log = files_in_log_dir.get(&String::from("main.log")); assert!(path_to_main_log.is_some()); let log_text = match file_system::read_file(path_to_main_log.unwrap()) { Err(e) => panic!("{}", e), Ok(v) => String::from_utf8(v).unwrap(), }; assert!(has_text(r"(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}),(\d{3}) - ERROR - text", &log_text)); assert!(has_text(r"(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}),(\d{3}) - TRACE - text", &log_text)); assert!(has_text(r"(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}),(\d{3}) - DEBUG - text", &log_text)); assert!(has_text(r"(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}),(\d{3}) - WARN - text", &log_text)); assert!(has_text(r"(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}),(\d{3}) - INFO - text", &log_text)); }
rust_cleaned_test_functions.jsonl/89801
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1125 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5224, 368, 1476, 286, 1077, 1815, 2346, 11080, 4334, 284, 1034, 17687, 486, 455, 11080, 4334, 741, 8333, 659, 562, 741, 8333, 659, 17119, 445, 9408, 1349, 1482, 6220, 7320, 286, 1077, 2169, 4334, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_copy_expand_with_type_params() { let expanded = expand_builtin_derive( r#" #[derive(Copy)] struct Foo<A, B>; "#, known::Copy, ); assert_eq!( expanded, "impl<T0:core::marker::Copy,T1:core::marker::Copy>core::marker::CopyforFoo<T0,T1>{}" ); }
rust_cleaned_test_functions.jsonl/86380
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 214 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16096, 67875, 6615, 1819, 6745, 368, 341, 286, 1077, 17183, 284, 9225, 73829, 35345, 533, 1006, 310, 435, 2, 698, 286, 11506, 27098, 3025, 1266, 5563, 286, 2036, 33428, 30192, 11, 425, 10133, 5767...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_operators() { type F = f32; type V = Vector0XYZ<F>; { let v123 = V::from_xyz(1.,2.,3.); let v123neg= V::from_xyz(-1.,-2.,-3.); let v246 = V::from_xyz(2.,4.,6.); assert!((v123 + v123neg).is_zero()); assert!((v123 + v123 - v246).is_zero()); assert!((v123 * 2. - v246).is_zero()); } }
rust_cleaned_test_functions.jsonl/33004
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25634, 2973, 368, 341, 262, 943, 434, 284, 282, 18, 17, 280, 262, 943, 647, 284, 4196, 15, 32196, 30499, 19421, 262, 341, 286, 1077, 348, 16, 17, 18, 284, 647, 486, 1499, 64974, 7, 16, 2572,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tail_empty() { let dir = tempdir().unwrap(); let repo = LogRepository::new(dir.path()); let paths = repo.tail(5).unwrap(); assert_eq!(paths.len(), 0); }
rust_cleaned_test_functions.jsonl/101106
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 102 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35471, 15124, 368, 341, 286, 1077, 5419, 284, 2730, 3741, 1005, 15454, 543, 286, 1077, 15867, 284, 2835, 4624, 486, 931, 14161, 3875, 1423, 286, 1077, 12716, 284, 15867, 38711, 7, 20, 568, 15454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_list_neurons_determinism() { local_test_on_sns_subnet(|runtime| async move { let users = vec![ Sender::from_keypair(&TEST_USER1_KEYPAIR), Sender::from_keypair(&TEST_USER2_KEYPAIR), Sender::from_keypair(&TEST_USER3_KEYPAIR), Sender::from_keypair(&TEST_USER4_KEYPAIR), ]; let account_identifiers = users .iter() .map(|user| AccountIdentifier::from(user.get_principal_id())) .collect(); let alloc = Tokens::from_tokens(1000).unwrap(); let sns_init_payload = SnsInitPayloadsBuilder::new() .with_ledger_accounts(account_identifiers, alloc) .build(); let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await; for user in &users { sns_canisters.stake_and_claim_neuron(user, None).await; } let list_neuron_response: ListNeuronsResponse = sns_canisters .governance .query_from_sender( "list_neurons", candid_one, ListNeurons { limit: 100, start_page_at: None, of_principal: None, }, &users[0], ) .await .expect("Error calling the list_neurons api"); let expected = list_neuron_response.neurons; let actual = paginate_neurons(&sns_canisters.governance, &users[0], 1_usize).await; assert_eq!(expected, actual); Ok(()) }); }
rust_cleaned_test_functions.jsonl/107244
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 853 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 96156, 814, 16483, 2142, 368, 341, 262, 2205, 4452, 4470, 643, 4412, 95681, 22428, 22255, 91, 3312, 3271, 341, 286, 1077, 3847, 284, 7486, 90515, 310, 54610, 486, 1499, 3097, 12670, 2099, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_module_defined_types_limit() { let limits = ModuleLimits { types: 0, ..Default::default() }; let mut module = Module::default(); assert!(limits.validate(&module).is_ok()); module .types .push(ModuleType::Function(SignatureIndex::new(0))); assert_eq!( limits.validate(&module).map_err(|e| e.to_string()), Err("defined types count of 1 exceeds the limit of 0".into()) ); }
rust_cleaned_test_functions.jsonl/48863
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10750, 52870, 9763, 14763, 368, 341, 286, 1077, 13388, 284, 13711, 94588, 341, 310, 4494, 25, 220, 15, 345, 310, 5241, 3675, 486, 2258, 741, 286, 3634, 286, 1077, 5206, 4688, 284, 13711, 486, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_try_panic_message_owned_str() { match thread::spawn(move|| { panic!("owned string".to_string()); }).join() { Err(e) => { type T = String; assert!(e.is::<T>()); assert_eq!(*e.downcast::<T>().unwrap(), "owned string".to_string()); } Ok(()) => panic!() } }
rust_cleaned_test_functions.jsonl/8569
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 229 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 620, 31270, 6462, 51973, 2895, 368, 341, 286, 2432, 4516, 486, 46087, 34081, 8484, 341, 310, 21975, 17223, 18332, 914, 3263, 983, 3904, 1423, 286, 8533, 5987, 368, 341, 310, 15495, 2026, 8,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_raw_text() { let (sql, params) = Postgres::build(Select::default().value("foo".raw())).unwrap(); assert_eq!("SELECT 'foo'", sql); assert!(params.is_empty()); }
rust_cleaned_test_functions.jsonl/6458
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 95 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 4326, 368, 341, 286, 1077, 320, 3544, 11, 3628, 8, 284, 3877, 17818, 486, 5834, 7, 3379, 486, 2258, 1005, 957, 445, 7975, 3263, 1041, 34670, 15454, 543, 286, 2060, 10714, 17223, 4858, 364...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_listen_timeout() { let mut s = socket_listen(); s.set_timeout(Some(Duration::from_millis(100))); assert_eq!(s.poll_at(), None); }
rust_cleaned_test_functions.jsonl/1777
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79286, 20537, 368, 341, 286, 1077, 5206, 274, 284, 7575, 79286, 543, 286, 274, 980, 20537, 65405, 64114, 486, 1499, 717, 56212, 7, 16, 15, 15, 4945, 286, 2060, 10714, 10297, 82, 41477, 3752, 150...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_part1() { assert_eq!(part1(&parse("R2, L3")), 5); assert_eq!(part1(&parse("R2, R2, R2")), 2); assert_eq!(part1(&parse("R5, L5, R5, R3")), 12); }
rust_cleaned_test_functions.jsonl/52823
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 113 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10495, 16, 368, 341, 286, 2060, 10714, 10297, 4480, 16, 2099, 6400, 445, 49, 17, 11, 444, 18, 35674, 220, 20, 317, 286, 2060, 10714, 10297, 4480, 16, 2099, 6400, 445, 49, 17, 11, 431, 17, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_try_from_record_for_reference_sequence_with_invalid_length( ) -> Result<(), record::value::TryFromIteratorError> { let record = Record::new( record::Kind::ReferenceSequence, record::Value::try_from_iter(vec![("LN", "thirteen")])?, ); assert!(matches!( ReferenceSequence::try_from(record), Err(TryFromRecordError::InvalidLength) )); let record = Record::new( record::Kind::ReferenceSequence, record::Value::try_from_iter(vec![("SN", "sq0"), ("LN", "0")])?, ); assert!(matches!( ReferenceSequence::try_from(record), Err(TryFromRecordError::InvalidLength) )); Ok(()) }
rust_cleaned_test_functions.jsonl/23401
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 368 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 5673, 14192, 5478, 25433, 23735, 6615, 31433, 5118, 1006, 262, 873, 1464, 5714, 68843, 3255, 486, 957, 486, 21453, 3830, 11951, 1454, 29, 341, 286, 1077, 3255, 284, 13583, 486, 931, 1006, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_fmt_debug() { let tree = RTree::bulk_load(vec![[0, 1], [0, 1]]); let debug: String = format!("{:?}", tree); assert_eq!(debug, "RTree { size: 2, items: {[0, 1], [0, 1]} }"); }
rust_cleaned_test_functions.jsonl/71303
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 118 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38128, 15446, 368, 341, 286, 1077, 4916, 284, 431, 6533, 486, 67142, 12411, 25592, 0, 15505, 15, 11, 220, 16, 1125, 508, 15, 11, 220, 16, 49854, 286, 1077, 7390, 25, 923, 284, 3561, 88928, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_matched() { let mut ps = ParseStream { content: "Hello World".to_string(), cursor: 2, }; let val = ps.matched("[a-z]+").unwrap(); assert_eq!(ps.cursor, 5); assert_eq!(val, "llo".to_string()); }
rust_cleaned_test_functions.jsonl/41146
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 151 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 93900, 368, 341, 286, 1077, 5206, 4726, 284, 14775, 3027, 341, 310, 2213, 25, 330, 9707, 4337, 3263, 983, 3904, 3148, 310, 8128, 25, 220, 17, 345, 286, 3634, 286, 1077, 1044, 284, 4726, 11072, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1