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_to_webp() {
let plot = create_test_plot();
let dst = PathBuf::from("example.webp");
plot.to_webp(&dst, 1024, 680);
assert!(dst.exists());
std::fs::remove_file(&dst);
assert!(!dst.exists());
} | rust_cleaned_test_functions.jsonl/121957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
25960,
79,
368,
341,
286,
1077,
7089,
284,
1855,
4452,
24351,
543,
286,
1077,
10648,
284,
7933,
15064,
486,
1499,
445,
8687,
6411,
79,
797,
286,
7089,
2389,
25960,
79,
2099,
15658,
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_matches() {
assert!("test".match_level(&Level::normal("test")));
assert!("$SYS".match_level(&Level::metadata("$SYS")));
let t: Topic = "sport/tennis/player1/#".parse().unwrap();
assert!(t.matches_str("sport/tennis/player1"));
assert!(t.matches_str("sport/tennis/player1/ranking"));
assert!(t.matches_str("sport/tennis/player1/score/wimbledon"));
assert!(Topic::from_str("sport/#").unwrap().matches_str("sport"));
let t: Topic = "sport/tennis/+".parse().unwrap();
assert!(t.matches_str("sport/tennis/player1"));
assert!(t.matches_str("sport/tennis/player2"));
assert!(!t.matches_str("sport/tennis/player1/ranking"));
let t: Topic = "sport/+".parse().unwrap();
assert!(!t.matches_str("sport"));
assert!(t.matches_str("sport/"));
assert!(Topic::from_str("+/+").unwrap().matches_str("/finance"));
assert!(Topic::from_str("/+").unwrap().matches_str("/finance"));
assert!(!Topic::from_str("+").unwrap().matches_str("/finance"));
assert!(!Topic::from_str("#").unwrap().matches_str("$SYS"));
assert!(!Topic::from_str("+/monitor/Clients")
.unwrap()
.matches_str("$SYS/monitor/Clients"));
assert!(Topic::from_str(&"$SYS/#").unwrap().matches_str("$SYS/"));
assert!(Topic::from_str("$SYS/monitor/+").unwrap().matches_str("$SYS/monitor/Clients"));
} | rust_cleaned_test_functions.jsonl/77013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38344,
368,
341,
286,
2060,
17223,
1944,
3263,
6347,
8274,
2099,
4449,
486,
8252,
445,
1944,
17621,
286,
2060,
17223,
3,
37931,
3263,
6347,
8274,
2099,
4449,
486,
17637,
20912,
37931,
74385,
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_primitive_array_sum() {
let a = Int32Array::from(vec![1, 2, 3, 4, 5]);
assert_eq!(15, sum(&a).unwrap());
} | rust_cleaned_test_functions.jsonl/27857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
10160,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
2558,
286,
2060,
10714,
10297,
16,
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 |
#[test]
fn test_exact_full() {
let needle = b"ACGACTAGTTATAAAAATTCNACTCCANTTAGCTCCCTACTTTCCGAGAG";
let haystack = b"ACGACTAGTTATAAAAATTCNACTCCANTTAGCTCCCTACTTTCCGAGAG";
check_test(needle, haystack, 0);
} | rust_cleaned_test_functions.jsonl/83256 | {
"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,
71084,
16372,
368,
341,
286,
1077,
30309,
284,
293,
1,
1706,
38,
6823,
1890,
14903,
4485,
50107,
828,
7749,
45,
6823,
3706,
2821,
32144,
1162,
3706,
1162,
6823,
14903,
3706,
38,
1890,
1890,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parent_dir_if_missing() {
let root_path = TempDir::new("test_create_parent_dir_if_missing").unwrap();
let path = root_path.path().join("not_exist_dir");
let mut tikv_cfg = TiKvConfig::default();
tikv_cfg.storage.data_dir = path.as_path().to_str().unwrap().to_owned();
assert!(check_and_persist_critical_config(&tikv_cfg).is_ok());
} | rust_cleaned_test_functions.jsonl/29168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
15960,
4334,
11119,
40447,
368,
341,
286,
1077,
3704,
2638,
284,
19944,
6184,
486,
931,
445,
1944,
8657,
15960,
4334,
11119,
40447,
1827,
15454,
543,
286,
1077,
1815,
284,
3704,
2638,
3875,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ty_with_complex_type() {
check(
r#"
macro_rules! m {
($t:ty) => ( fn bar() -> $ t {} )
}
m! { &'a Baz<u8> }
m! { extern "Rust" fn() -> Ret }
"#,
expect![[r#"
macro_rules! m {
($t:ty) => ( fn bar() -> $ t {} )
}
fn bar() -> & 'a Baz<u8> {}
fn bar() -> extern "Rust"fn() -> Ret {}
"#]],
);
} | rust_cleaned_test_functions.jsonl/85228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53171,
6615,
41522,
1819,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
83,
25,
1881,
8,
589,
320,
5168,
3619,
368,
1464,
400,
259,
4687,
1727,
630,
76,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new() {
let b = Box3D::new(point3(-1.0, -1.0, -1.0), point3(1.0, 1.0, 1.0));
assert!(b.min.x == -1.0);
assert!(b.min.y == -1.0);
assert!(b.min.z == -1.0);
assert!(b.max.x == 1.0);
assert!(b.max.y == 1.0);
assert!(b.max.z == 1.0);
} | rust_cleaned_test_functions.jsonl/7473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
293,
284,
8261,
18,
35,
486,
931,
20235,
18,
4080,
16,
13,
15,
11,
481,
16,
13,
15,
11,
481,
16,
13,
15,
701,
1459,
18,
7,
16,
13,
15,
11,
220,
16,
13,
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_association_ko() {
with_rewards_default(|_, accounts| {
assert_ok!(CrowdloanRewards::initialize(Origin::root()));
for (picasso_account, remote_account) in accounts.into_iter() {
assert_noop!(remote_account.claim(picasso_account), Error::<Test>::NotAssociated);
}
});
} | rust_cleaned_test_functions.jsonl/41094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58665,
367,
4698,
78,
368,
341,
46948,
77997,
9993,
22428,
6878,
9618,
91,
341,
197,
6948,
19817,
10297,
93926,
67,
38329,
58465,
2347,
486,
21641,
7,
13298,
486,
2888,
7392,
197,
2023,
320,
15587... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_diff() {
let conf1 = r#"
tab_size = 42
translate_tabs_to_spaces = true
"#;
let conf1 = table_from_toml_str(conf1).unwrap();
let conf2 = r#"
tab_size = 6
translate_tabs_to_spaces = true
"#;
let conf2 = table_from_toml_str(conf2).unwrap();
let stack1 = TableStack(vec![Arc::new(conf1)]);
let stack2 = TableStack(vec![Arc::new(conf2)]);
let diff = stack1.diff(&stack2).unwrap();
assert!(diff.len() == 1);
assert_eq!(diff.get("tab_size"), Some(&42.into()));
} | rust_cleaned_test_functions.jsonl/40018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
368,
341,
286,
1077,
2335,
16,
284,
435,
2,
698,
6192,
2368,
284,
220,
19,
17,
198,
14045,
57953,
2346,
67883,
284,
830,
198,
57676,
280,
286,
1077,
2335,
16,
284,
1965,
5673,
528,
316,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_url() {
let id = Identity::mock_default();
let input = UpdateInput {
allow_downgrade: false,
enabled: true,
strategy: "fleet_lock".to_string(),
fleet_lock: FleetLockInput {
base_url: String::new(),
},
};
let res = StrategyFleetLock::new(input, &id);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/14605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
2903,
368,
341,
286,
1077,
877,
284,
26540,
486,
16712,
9993,
543,
286,
1077,
1946,
284,
5549,
2505,
341,
310,
2138,
13998,
6937,
25,
895,
345,
310,
8970,
25,
830,
345,
310,
8282,
25,
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... | 1 |
#[test]
fn test_invalid_try_from_core_invalid_capability_delegation_ref() {
let invalid_ref: DID = "did:invalid:HGE4tecHWL2YiZv5qAGtH7gaeQcaz2Z1CR15GWmMjY1M"
.parse()
.unwrap();
let doc = IotaDocument::try_from_core(
CoreDocument::builder(valid_properties())
.id(valid_did())
.authentication(core_verification_method(&valid_did(), "#auth-key"))
// INVALID
.capability_delegation(MethodRef::Refer(invalid_ref))
.build()
.unwrap(),
);
assert!(doc.is_err());
} | rust_cleaned_test_functions.jsonl/84327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
53283,
5673,
15467,
31433,
89686,
2259,
87566,
7793,
368,
341,
262,
1077,
8318,
7793,
25,
59119,
284,
330,
22920,
25,
11808,
94192,
10777,
19,
54200,
38252,
43,
17,
56,
72,
57,
85,
20,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_set_buffer_authority() {
let test_commands = app("test", "desc", "version");
let default_keypair = Keypair::new();
let keypair_file = make_tmp_path("keypair_file");
write_keypair_file(&default_keypair, &keypair_file).unwrap();
let default_signer = DefaultSigner {
path: keypair_file.clone(),
arg_name: "".to_string(),
};
let buffer_pubkey = Pubkey::new_unique();
let new_authority_pubkey = Pubkey::new_unique();
let test_deploy = test_commands.clone().get_matches_from(vec![
"test",
"program",
"set-buffer-authority",
&buffer_pubkey.to_string(),
"--new-buffer-authority",
&new_authority_pubkey.to_string(),
]);
assert_eq!(
parse_command(&test_deploy, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::SetBufferAuthority {
buffer_pubkey,
buffer_authority_index: Some(0),
new_buffer_authority: new_authority_pubkey,
}),
signers: vec![read_keypair_file(&keypair_file).unwrap().into()],
}
);
let buffer_pubkey = Pubkey::new_unique();
let new_authority_pubkey = Keypair::new();
let new_authority_pubkey_file = make_tmp_path("authority_keypair_file");
write_keypair_file(&new_authority_pubkey, &new_authority_pubkey_file).unwrap();
let test_deploy = test_commands.clone().get_matches_from(vec![
"test",
"program",
"set-buffer-authority",
&buffer_pubkey.to_string(),
"--new-buffer-authority",
&new_authority_pubkey_file,
]);
assert_eq!(
parse_command(&test_deploy, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::SetBufferAuthority {
buffer_pubkey,
buffer_authority_index: Some(0),
new_buffer_authority: new_authority_pubkey.pubkey(),
}),
signers: vec![read_keypair_file(&keypair_file).unwrap().into()],
}
);
} | rust_cleaned_test_functions.jsonl/89296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
21039,
2602,
7776,
22938,
487,
368,
341,
286,
1077,
1273,
44151,
284,
906,
445,
1944,
497,
330,
8614,
497,
330,
4366,
3071,
286,
1077,
1638,
3097,
12670,
284,
6569,
1082,
1310,
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_not_in_valid_nested() {
let mut test = Map::new();
test.assign("in", Value::String("1".to_owned())).ok();
let mut params = Map::new();
params.assign("test", Value::Map(test)).ok();
let mut rules = BTreeMap::new();
rules.insert("test.in",
vec![Rule::NotIn(vec![Value::String("2".into()), Value::U64(1)])]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["test", "in"]).unwrap(),
&Value::String("1".to_owned()));
} | rust_cleaned_test_functions.jsonl/104862 | {
"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,
7913,
1243,
8337,
66279,
368,
341,
262,
1077,
5206,
1273,
284,
5027,
486,
931,
543,
262,
1273,
17870,
445,
258,
497,
5162,
486,
703,
445,
16,
3263,
983,
51973,
34670,
562,
543,
262,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rotate_vector1() {
let vector = 3_f64 * Vector2::unit_x();
let angle = Degrees(90_f64);
let rotation = Rotation2::from_angle(angle);
let expected = 3_f64 * Vector2::unit_y();
let result = rotation.rotate_vector(&vector);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
12247,
16,
368,
341,
286,
1077,
4621,
284,
220,
18,
761,
21,
19,
353,
4196,
17,
486,
3843,
3212,
543,
286,
1077,
9210,
284,
92901,
7,
24,
15,
761,
21,
19,
317,
286,
1077,
12695,
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... | 1 |
#[test]
fn test_checksum() {
let data = vec![8, 0, 0, 0, 0x12, 0x34, 0x00, 0x01];
assert_eq!(finish_netsum(partial_netsum(0, &data)), 0xE5CA);
} | rust_cleaned_test_functions.jsonl/3283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64038,
368,
341,
262,
1077,
821,
284,
7486,
20703,
23,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
87,
16,
17,
11,
220,
15,
87,
18,
19,
11,
220,
15,
87,
15,
15,
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_classed_html_generator_prefixed() {
let current_code = "x + y".to_string();
let syntax_set = SyntaxSet::load_defaults_newlines();
let syntax = syntax_set.find_syntax_by_name("R").unwrap();
let mut html_generator = ClassedHTMLGenerator::new_with_class_style(&syntax, &syntax_set, ClassStyle::SpacedPrefixed { prefix: "foo-" });
for line in current_code.lines() {
html_generator.parse_html_for_line(&line);
}
let html = html_generator.finalize();
assert_eq!(html, "<span class=\"foo-source foo-r\">x <span class=\"foo-keyword foo-operator foo-arithmetic foo-r\">+</span> y\n</span>");
} | rust_cleaned_test_functions.jsonl/67243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
291,
9564,
25813,
43331,
3286,
368,
341,
286,
1077,
1482,
4136,
284,
330,
87,
488,
379,
3263,
983,
3904,
543,
286,
1077,
19482,
2602,
284,
32117,
1649,
486,
1078,
42290,
5921,
7969,
543,
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_item() {
let w = Wrapper::new(&DriverType::Postgres).having("id");
assert_eq!(w.sql, "having id");
let mut m = BTreeMap::new();
m.insert("id",2);
m.insert("name",1);
let w = Wrapper::new(&DriverType::Postgres).all_eq(m);
assert_eq!(w.sql, "(id = $1 and name = $2)");
let w = Wrapper::new(&DriverType::Postgres).eq("id",1);
assert_eq!(w.sql, "id = $1");
let w = Wrapper::new(&DriverType::Postgres).ne("id",1);
assert_eq!(w.sql, "id <> $1");
let w = Wrapper::new(&DriverType::Postgres).order_by(true,&["id"]);
assert_eq!(w.sql, " order by id asc ");
let w = Wrapper::new(&DriverType::Postgres).group_by(&["id"]);
assert_eq!(w.sql, " group by id ");
let w = Wrapper::new(&DriverType::Postgres).gt("id",1);
assert_eq!(w.sql, "id > $1");
let w = Wrapper::new(&DriverType::Postgres).ge("id",1);
assert_eq!(w.sql, "id >= $1");
let w = Wrapper::new(&DriverType::Postgres).lt("id",1);
assert_eq!(w.sql, "id < $1");
let w = Wrapper::new(&DriverType::Postgres).le("id",1);
assert_eq!(w.sql, "id <= $1");
let w = Wrapper::new(&DriverType::Postgres).between("id", 1, 2);
assert_eq!(w.sql, "id between $1 and $2");
let w = Wrapper::new(&DriverType::Postgres).not_between("id", 1, 2);
assert_eq!(w.sql, "id not between $1 and $2");
let w = Wrapper::new(&DriverType::Postgres).like("id", 1);
assert_eq!(w.sql, "id like $1");
let w = Wrapper::new(&DriverType::Postgres).like_left("id", 1);
assert_eq!(w.sql, "id like $1");
let w = Wrapper::new(&DriverType::Postgres).like_right("id", 1);
assert_eq!(w.sql, "id like $1");
let w = Wrapper::new(&DriverType::Postgres).not_like("id", 1);
assert_eq!(w.sql, "id not like $1");
let w = Wrapper::new(&DriverType::Postgres).is_null("id");
assert_eq!(w.sql, "id is NULL");
let w = Wrapper::new(&DriverType::Postgres).is_not_null("id");
assert_eq!(w.sql, "id is not NULL");
let w = Wrapper::new(&DriverType::Postgres).in_array("id",&[1]);
assert_eq!(w.sql, "id in ( $1 )");
let w = Wrapper::new(&DriverType::Postgres).not_in("id",&[1]);
assert_eq!(w.sql, "id not in ( $1 )");
let w = Wrapper::new(&DriverType::Postgres).insert_into("table","c","v");
assert_eq!(w.sql, "insert into table (c) values v");
let w = Wrapper::new(&DriverType::Postgres).limit(1);
assert_eq!(w.sql, " limit 1 ");
} | rust_cleaned_test_functions.jsonl/34377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5634,
368,
341,
286,
1077,
289,
284,
35488,
486,
931,
2099,
11349,
929,
486,
4133,
17818,
568,
68566,
445,
307,
797,
286,
2060,
10714,
10297,
86,
10045,
11,
330,
68566,
877,
797,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_index_expr() {
test_walk(
"a[b]",
vec![
"File",
"ExprStmt",
"IndexExpr",
"IdentifierExpr",
"IdentifierExpr",
],
)
} | rust_cleaned_test_functions.jsonl/3322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
21915,
368,
341,
310,
1273,
56131,
1006,
394,
330,
64,
18483,
45016,
394,
7486,
90515,
503,
330,
1703,
756,
503,
330,
16041,
31063,
756,
503,
330,
1552,
16041,
756,
503,
330,
8714,
16041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_authorize_checked() {
let vote_pubkey = Pubkey::new_unique();
let authorized_pubkey = Pubkey::new_unique();
let new_authorized_pubkey = Pubkey::new_unique();
// Test with vanilla authorize accounts
let mut instruction = authorize_checked(
&vote_pubkey,
&authorized_pubkey,
&new_authorized_pubkey,
VoteAuthorize::Voter,
);
instruction.accounts = instruction.accounts[0..2].to_vec();
assert_eq!(
process_instruction(&instruction),
Err(InstructionError::NotEnoughAccountKeys),
);
let mut instruction = authorize_checked(
&vote_pubkey,
&authorized_pubkey,
&new_authorized_pubkey,
VoteAuthorize::Withdrawer,
);
instruction.accounts = instruction.accounts[0..2].to_vec();
assert_eq!(
process_instruction(&instruction),
Err(InstructionError::NotEnoughAccountKeys),
);
// Test with non-signing new_authorized_pubkey
let mut instruction = authorize_checked(
&vote_pubkey,
&authorized_pubkey,
&new_authorized_pubkey,
VoteAuthorize::Voter,
);
instruction.accounts[3] = AccountMeta::new_readonly(new_authorized_pubkey, false);
assert_eq!(
process_instruction(&instruction),
Err(InstructionError::MissingRequiredSignature),
);
let mut instruction = authorize_checked(
&vote_pubkey,
&authorized_pubkey,
&new_authorized_pubkey,
VoteAuthorize::Withdrawer,
);
instruction.accounts[3] = AccountMeta::new_readonly(new_authorized_pubkey, false);
assert_eq!(
process_instruction(&instruction),
Err(InstructionError::MissingRequiredSignature),
);
// Test with new_authorized_pubkey signer
let vote_account = AccountSharedData::new_ref(100, VoteState::size_of(), &id());
let clock_address = sysvar::clock::id();
let clock_account = RefCell::new(account::create_account_shared_data_for_test(
&Clock::default(),
));
let default_authorized_pubkey = Pubkey::default();
let authorized_account = create_default_account();
let new_authorized_account = create_default_account();
let keyed_accounts = vec![
KeyedAccount::new(&vote_pubkey, false, &vote_account),
KeyedAccount::new(&clock_address, false, &clock_account),
KeyedAccount::new(&default_authorized_pubkey, true, &authorized_account),
KeyedAccount::new(&new_authorized_pubkey, true, &new_authorized_account),
];
assert_eq!(
super::process_instruction(
&Pubkey::default(),
&serialize(&VoteInstruction::AuthorizeChecked(VoteAuthorize::Voter)).unwrap(),
&mut MockInvokeContext::new(keyed_accounts)
),
Ok(())
);
let keyed_accounts = vec![
KeyedAccount::new(&vote_pubkey, false, &vote_account),
KeyedAccount::new(&clock_address, false, &clock_account),
KeyedAccount::new(&default_authorized_pubkey, true, &authorized_account),
KeyedAccount::new(&new_authorized_pubkey, true, &new_authorized_account),
];
assert_eq!(
super::process_instruction(
&Pubkey::default(),
&serialize(&VoteInstruction::AuthorizeChecked(
VoteAuthorize::Withdrawer
))
.unwrap(),
&mut MockInvokeContext::new(keyed_accounts)
),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/97475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
22938,
551,
56456,
368,
341,
286,
1077,
6910,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
18630,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
501,
62,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut h = Histogram::new();
h.increment(1).unwrap();
assert_eq!(h.get(1), Some(1));
h.increment(1).unwrap();
assert_eq!(h.get(1), Some(2));
h.increment(2).unwrap();
assert_eq!(h.get(2), Some(1));
assert_eq!(h.get(3), Some(0));
} | rust_cleaned_test_functions.jsonl/82150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
286,
1077,
5206,
305,
284,
82138,
486,
931,
1428,
286,
305,
56936,
7,
16,
568,
15454,
543,
286,
2060,
10714,
10297,
71,
670,
7,
16,
701,
4329,
7,
16,
3237,
286,
305,
56936,
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_multiple_leaves() {
let mut batch1 = create_leaves(600..608);
let mock_store = MockAccumulatorStore::new();
let accumulator = MerkleAccumulator::new(
*ACCUMULATOR_PLACEHOLDER_HASH,
vec![],
0,
0,
Arc::new(mock_store),
);
let root_hash1 = accumulator.append(&batch1).unwrap();
proof_verify(&accumulator, root_hash1, &batch1, 0);
let batch2 = create_leaves(609..613);
let root_hash2 = accumulator.append(&batch2).unwrap();
batch1.extend_from_slice(&batch2);
proof_verify(&accumulator, root_hash2, &batch1, 0);
} | rust_cleaned_test_functions.jsonl/51492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
11751,
4693,
368,
341,
262,
1077,
5206,
7162,
16,
284,
1855,
11751,
4693,
7,
21,
15,
15,
496,
21,
15,
23,
317,
262,
1077,
7860,
14809,
284,
14563,
14603,
372,
10511,
6093,
486,
931,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_component_recovery() -> () {
let system = KompactConfig::default().build().expect("KompactSystem");
let (sender, receiver) = std::sync::mpsc::channel::<Arc<Component<RecvComponent>>>();
// limit scope
let cc = system.create(|| CrasherComponent::new(false));
cc.set_recovery_function(move |fault| {
fault.recover_with(move |_ctx, system, log| {
info!(log, "Recovering into RecvComponent");
let rcd = system.create(RecvComponent::new);
system.start(&rcd);
sender.send(rcd).expect("sent component");
})
});
let ccref = cc.actor_ref();
let f = system.start_notify(&cc);
let res = f.wait_timeout(Duration::from_millis(1000));
assert!(res.is_ok(), "Component should not crash on start");
ccref.tell(Box::new(()) as Box<dyn Any + Send>);
let rcd = receiver
.recv_timeout(Duration::from_millis(1000))
.expect("receive component");
assert!(cc.is_faulty(), "Component should have crashed.");
let rcd_ref = rcd.actor_ref();
rcd_ref.tell("MsgTest");
thread::sleep(Duration::from_millis(10));
rcd.on_definition(|c| {
assert_eq!(c.last_string, String::from("MsgTest"));
});
system
.shutdown()
.expect("Kompact didn't shut down properly");
} | rust_cleaned_test_functions.jsonl/36833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 685
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23406,
91475,
368,
1464,
1719,
341,
286,
1077,
1849,
284,
730,
14435,
531,
2648,
486,
2258,
1005,
5834,
1005,
17119,
445,
42,
14435,
531,
2320,
3071,
286,
1077,
320,
11644,
11,
13964,
8,
284,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_scalar_is_odd() {
assert!(bool::from(Scalar::from(0).is_even()));
assert!(bool::from(Scalar::from(1).is_odd()));
assert!(bool::from(Scalar::from(324834872).is_even()));
assert!(bool::from(Scalar::from(324834873).is_odd()));
} | rust_cleaned_test_functions.jsonl/54664 | {
"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,
41652,
6892,
74668,
368,
341,
286,
2060,
10297,
2641,
486,
1499,
7,
20639,
486,
1499,
7,
15,
568,
285,
68347,
7392,
286,
2060,
10297,
2641,
486,
1499,
7,
20639,
486,
1499,
7,
16,
568,
285,
746... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialize() {
use std::io::Cursor;
use crate::serialize::{json, Decodable, Encodable};
macro_rules! round_trip (
($var:ident) => ({
let start = $var;
let mut encoded = String::new();
{
let mut encoder = json::Encoder::new(&mut encoded);
start.encode(&mut encoder).unwrap();
}
let json = json::Json::from_reader(&mut Cursor::new(encoded.as_bytes())).unwrap();
let mut decoder = json::Decoder::new(json);
let decoded = Decodable::decode(&mut decoder);
assert_eq!(Ok(Some(start)), decoded);
})
);
let s = Secp256k1::new();
for _ in 0..500 {
let (sk, pk) = s.generate_keypair(&mut thread_rng()).unwrap();
round_trip!(sk);
round_trip!(pk);
}
} | rust_cleaned_test_functions.jsonl/41397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
341,
286,
990,
1460,
486,
815,
486,
14543,
280,
286,
990,
17717,
486,
24166,
22964,
2236,
11,
3714,
69129,
11,
10751,
69129,
2315,
286,
18072,
21407,
0,
4778,
63883,
2399,
310,
1711,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_grep_no_match() {
let fake_parent_grep_command =
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this";
let _args = FakeParentArgs::for_scope(fake_parent_grep_command);
assert_eq!(
parse_grep_line("src/co-7-fig.rs-xxx"),
Some(GrepLine {
path: "src/co-7-fig.rs".into(),
line_number: None,
line_type: LineType::Context,
code: "xxx".into(),
submatches: None,
})
);
assert_eq!(
parse_grep_line("src/config.rs- pub available_terminal_width: usize,"),
Some(GrepLine {
path: "src/config.rs".into(),
line_number: None,
line_type: LineType::Context,
code: " pub available_terminal_width: usize,".into(),
submatches: None,
})
);
assert_eq!(
parse_grep_line("src/con-fig.rs-use crate::minusplus::MinusPlus;"),
Some(GrepLine {
path: "src/con-fig.rs".into(),
line_number: None,
line_type: LineType::Context,
code: "use crate::minusplus::MinusPlus;".into(),
submatches: None,
})
);
assert_eq!(
parse_grep_line("de-lta.rs- if self.source == Source::Unknown {"),
Some(GrepLine {
path: "de-lta.rs".into(),
line_number: None,
line_type: LineType::Context,
code: " if self.source == Source::Unknown {".into(),
submatches: None,
})
);
assert_eq!(
parse_grep_line(r#"aaa/bbb.scala- s"xxx.yyy.zzz: $ccc ddd""#),
Some(GrepLine {
path: "aaa/bbb.scala".into(),
line_number: None,
line_type: LineType::Context,
code: r#" s"xxx.yyy.zzz: $ccc ddd""#.into(),
submatches: None,
})
);
assert_eq!(
parse_grep_line(r#"aaa/bbb.scala- val atRegex = Regex.compile("(@.*)|(-shdw@.*)""#),
Some(GrepLine {
path: "aaa/bbb.scala".into(),
line_number: None,
line_type: LineType::Context,
code: r#" val atRegex = Regex.compile("(@.*)|(-shdw@.*)""#.into(),
submatches: None,
})
);
} | rust_cleaned_test_functions.jsonl/43042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1889,
9995,
6536,
10708,
368,
341,
286,
1077,
12418,
15960,
1889,
9995,
10811,
4035,
310,
3521,
7063,
22270,
8749,
60590,
1177,
27057,
406,
1448,
1650,
20675,
1177,
44707,
60191,
6329,
24868,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mark_read_existing_post() {
let readlist = readlist_from(vec![
("feed1", vec!["post1", "post2"]),
("feed2", vec!["post3", "post4", "post5"]),
]);
let output = _mark_read(readlist, "post4");
let expected = readlist_from(vec![
("feed1", vec!["post1", "post2"]),
("feed2", vec!["post3", "post5"]),
]);
assert_eq!(expected, output);
} | rust_cleaned_test_functions.jsonl/56104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
6443,
62630,
6333,
368,
341,
286,
1077,
1349,
1607,
284,
1349,
1607,
5673,
25592,
90515,
310,
3489,
11184,
16,
497,
7486,
0,
1183,
2203,
16,
497,
330,
2203,
17,
46442,
310,
3489,
11184,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_adc_reg_w() {
assert_eq!(
decode_32(0xeb50500e),
Instruction::ADC_reg {
params: Reg3ShiftParams {
rd: Reg::R0,
rn: Reg::R0,
rm: Reg::LR,
setflags: SetFlags::True,
shift_t: SRType::LSL,
shift_n: 20,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
64840,
4920,
1670,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
54468,
20,
15,
20,
15,
15,
68,
1326,
286,
29051,
486,
31956,
4920,
341,
310,
3628,
25,
3184,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zero_length_accesses() {
#[derive(Default, Clone, Copy)]
#[repr(C)]
struct ZeroSizedStruct {
dummy: [u32; 0],
}
unsafe impl ByteValued for ZeroSizedStruct {}
let addr = GuestAddress(0x1000);
let mem = GuestMemoryMmap::from_ranges(&[(addr, 0x1000)]).unwrap();
let obj = ZeroSizedStruct::default();
let mut image = make_image(0x80);
assert_eq!(mem.write(&[], addr).unwrap(), 0);
assert_eq!(mem.read(&mut [], addr).unwrap(), 0);
assert!(mem.write_slice(&[], addr).is_ok());
assert!(mem.read_slice(&mut [], addr).is_ok());
assert!(mem.write_obj(obj, addr).is_ok());
assert!(mem.read_obj::<ZeroSizedStruct>(addr).is_ok());
assert_eq!(mem.read_from(addr, &mut Cursor::new(&image), 0).unwrap(), 0);
assert!(mem
.read_exact_from(addr, &mut Cursor::new(&image), 0)
.is_ok());
assert_eq!(
mem.write_to(addr, &mut Cursor::new(&mut image), 0).unwrap(),
0
);
assert!(mem
.write_all_to(addr, &mut Cursor::new(&mut image), 0)
.is_ok());
} | rust_cleaned_test_functions.jsonl/46438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
5118,
12759,
288,
368,
341,
286,
11506,
27098,
87874,
11,
27913,
11,
14540,
5563,
286,
11506,
30837,
3025,
5563,
286,
2036,
18306,
50,
1506,
9422,
341,
310,
17292,
25,
508,
84,
18,
17,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_osc() {
test(b"\x1b]", "\n");
test(b"\x1b]\x07hello\x1b]\x07world\x1b]\x07", "helloworld\n");
test(
b"\x1b]message\x07hello\x1b]message\x07world\x1b]message\x07",
"helloworld\n",
);
test(
b"\x1b]mes\ns\tage\x07hello\x1b]mes\ns\tage\x07world\x1b]mes\ns\tage\x07",
"helloworld\n",
);
} | rust_cleaned_test_functions.jsonl/36868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23469,
368,
341,
262,
1273,
1883,
11934,
87,
16,
65,
19076,
2917,
77,
797,
262,
1273,
1883,
11934,
87,
16,
65,
17960,
87,
15,
22,
14990,
3462,
16,
65,
17960,
87,
15,
22,
14615,
3462,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_circular_index_occupied() {
// Empty.
assert_eq!(occupied(0, 0, 10), (0..0, None));
// Empty with position in the middle.
assert_eq!(occupied(5, 0, 10), (5..5, None));
// Fully occupied.
assert_eq!(occupied(0, 10, 10), (0..10, None));
// Occupied only in the left half.
assert_eq!(occupied(0, 5, 10), (0..5, None));
// Occupied only in the right half.
assert_eq!(occupied(5, 5, 10), (5..10, None));
// Occupied only in the middle.
assert_eq!(occupied(1, 8, 10), (1..9, None));
// Fully occupied overflowing the end.
assert_eq!(occupied(5, 10, 10), (5..10, Some(0..5)));
} | rust_cleaned_test_functions.jsonl/86389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
21472,
3560,
62,
40356,
368,
341,
262,
442,
22228,
624,
262,
2060,
10714,
10297,
40356,
7,
15,
11,
220,
15,
11,
220,
16,
15,
701,
320,
15,
496,
15,
11,
2240,
3237,
262,
442,
22228,
448,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sign_verify_random() {
let mut rng = ThreadRng256 {};
for _ in 0..ITERATIONS {
let msg = rng.gen_uniform_u8x32();
let sk = SecKey::gensk(&mut rng);
let pk = sk.genpk();
let sign = sk.sign_rng::<Sha256, _>(&msg, &mut rng);
assert!(pk.verify_vartime::<Sha256>(&msg, &sign));
}
} | rust_cleaned_test_functions.jsonl/81728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
35638,
22644,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
20375,
286,
369,
716,
304,
220,
15,
496,
24733,
21792,
341,
310,
1077,
3750,
284,
28422,
22822,
45066,
7300... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_benchmarks() {
let (mut t, _, _) = ExternalityBuilder::build();
t.execute_with(|| {
assert_ok!(test_benchmark_store_public_key::<TestRuntime>());
assert_ok!(test_benchmark_store_public_key_share::<TestRuntime>());
assert_ok!(test_benchmark_combine_public_key_shares::<TestRuntime>());
assert_ok!(test_benchmark_store_question::<TestRuntime>());
assert_ok!(test_benchmark_create_vote::<TestRuntime>());
assert_ok!(test_benchmark_cast_ballot::<TestRuntime>());
});
} | rust_cleaned_test_functions.jsonl/24791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
15544,
368,
341,
286,
1077,
320,
6984,
259,
11,
8358,
27439,
284,
1374,
4160,
2719,
3297,
486,
5834,
543,
286,
259,
7769,
6615,
79453,
341,
310,
2060,
19817,
10297,
1944,
880,
39381,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_cmd_line() {
let p = std::process::Command::new("timeout")
.arg("/t")
.arg("3")
.spawn()
.unwrap();
let mut s = sysinfo::System::new();
assert!(s.get_processes().len() == 0);
s.refresh_processes();
assert!(s.get_processes().len() > 0);
if let Some(process) = s.get_process(p.id() as sysinfo::Pid) {
assert_eq!(process.cmd(), &["timeout", "/t", "3"]);
} else {
unix_like_cmd();
}
} | rust_cleaned_test_functions.jsonl/79805 | {
"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,
3062,
11684,
6528,
368,
341,
262,
1077,
281,
284,
1460,
486,
4630,
486,
4062,
486,
931,
445,
14150,
1138,
286,
659,
858,
4283,
83,
1138,
286,
659,
858,
445,
18,
1138,
286,
659,
46087,
741,
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... | 2 |
#[test]
fn test_ex9e_skip_if_pressed() {
let mut machine = Machine::new(TestContext::new());
machine.register_set(0xB, 0xC);
machine.key.key_down(0xC);
machine.test_opcode(0xEB9E);
// Should skip next instruction
assert_eq!(machine.pc, PC_BEGIN + 4);
// Should not skip if there is no press
machine.reset();
machine.register_set(0xB, 0xD);
machine.key.key_down(0xC);
machine.test_opcode(0xEB9E);
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
24,
68,
44830,
11119,
46178,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
9929,
2602,
7,
15,
14377,
11,
220,
15,
12125,
317,
262,
5662,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_kex_rng_pubkey_round_trip() {
run_with_several_seeds(|mut rng| {
let test_val = KexRngPubkey::sample(&mut rng);
round_trip_message::<KexRngPubkey, kex_rng::KexRngPubkey>(&test_val);
});
} | rust_cleaned_test_functions.jsonl/52323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
327,
66849,
34014,
792,
29896,
63883,
368,
341,
262,
1598,
6615,
3453,
17539,
3453,
6767,
22428,
6984,
28422,
91,
341,
286,
1077,
1273,
6189,
284,
730,
327,
49,
968,
29162,
792,
486,
13611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pair() {
assert_eq!(_0, Ratio::from((0, 1)));
assert_eq!(_1, Ratio::from((1, 1)));
assert_eq!(_NEG2, Ratio::from((-2, 1)));
assert_eq!(_1_NEG2, Ratio::from((1, -2)));
} | rust_cleaned_test_functions.jsonl/844 | {
"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,
5673,
14445,
368,
341,
286,
2060,
10714,
0,
2490,
15,
11,
50748,
486,
1499,
1188,
15,
11,
220,
16,
4945,
286,
2060,
10714,
0,
2490,
16,
11,
50748,
486,
1499,
1188,
16,
11,
220,
16,
4945,
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_timespec_eq_ord() {
let a = &Timespec::new(-2, 1);
let b = &Timespec::new(-1, 2);
let c = &Timespec::new(1, 2);
let d = &Timespec::new(2, 1);
let e = &Timespec::new(2, 1);
assert!(d.eq(e));
assert!(c.ne(e));
assert!(a.lt(b));
assert!(b.lt(c));
assert!(c.lt(d));
assert!(a.le(b));
assert!(b.le(c));
assert!(c.le(d));
assert!(d.le(e));
assert!(e.le(d));
assert!(b.ge(a));
assert!(c.ge(b));
assert!(d.ge(c));
assert!(e.ge(d));
assert!(d.ge(e));
assert!(b.gt(a));
assert!(c.gt(b));
assert!(d.gt(c));
} | rust_cleaned_test_functions.jsonl/7345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22353,
992,
10714,
67324,
368,
341,
286,
1077,
264,
284,
609,
18889,
992,
486,
931,
4080,
17,
11,
220,
16,
317,
286,
1077,
293,
284,
609,
18889,
992,
486,
931,
4080,
16,
11,
220,
17,
317,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_after_variable() {
test_statement(b"select $$ $$; extra;", 13);
test_statement(b"select $a$ $a$; extra;", 15);
test_statement(b"select $a;", 10);
test_statement(b"select $a{ x; };", 16);
} | rust_cleaned_test_functions.jsonl/44564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19844,
14635,
368,
341,
262,
1273,
37404,
1883,
1,
1742,
26107,
26107,
26,
4960,
32503,
220,
16,
18,
317,
262,
1273,
37404,
1883,
1,
1742,
400,
64,
3,
400,
64,
3,
26,
4960,
32503,
220,
16,
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_quotes() {
let mut vm = build_def_vm();
let mut reader_state = ReaderState::new();
let tokens = tokenize(&mut vm, &mut reader_state, "'(1 2 3)", None);
assert!(tokens.len() == 8);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:quote");
assert!(tokens[2] == "(");
assert!(tokens[3] == "Int:1");
assert!(tokens[4] == "Int:2");
assert!(tokens[5] == "Int:3");
assert!(tokens[6] == ")");
assert!(tokens[7] == ")");
tokenize_err(&mut vm, &mut reader_state, "'(1 2 ,3)", None);
tokenize_err(&mut vm, &mut reader_state, "'(1 2 ,@3)", None);
let tokens = tokenize(&mut vm, &mut reader_state, "`(1 2 ,3)", None);
assert!(tokens.len() == 11);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:back-quote");
assert!(tokens[2] == "(");
assert!(tokens[3] == "Int:1");
assert!(tokens[4] == "Int:2");
assert!(tokens[5] == "(");
assert!(tokens[6] == "Symbol:unquote");
assert!(tokens[7] == "Int:3");
assert!(tokens[8] == ")");
assert!(tokens[9] == ")");
assert!(tokens[10] == ")");
let tokens = tokenize(&mut vm, &mut reader_state, "`(1 2 ,@3)", None);
assert!(tokens.len() == 11);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:back-quote");
assert!(tokens[2] == "(");
assert!(tokens[3] == "Int:1");
assert!(tokens[4] == "Int:2");
assert!(tokens[5] == "(");
assert!(tokens[6] == "Symbol:unquote-splice");
assert!(tokens[7] == "Int:3");
assert!(tokens[8] == ")");
assert!(tokens[9] == ")");
assert!(tokens[10] == ")");
let tokens = tokenize(&mut vm, &mut reader_state, "`(1 2 ,.3)", None);
assert!(tokens.len() == 11);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:back-quote");
assert!(tokens[2] == "(");
assert!(tokens[3] == "Int:1");
assert!(tokens[4] == "Int:2");
assert!(tokens[5] == "(");
assert!(tokens[6] == "Symbol:unquote-splice!");
assert!(tokens[7] == "Int:3");
assert!(tokens[8] == ")");
assert!(tokens[9] == ")");
assert!(tokens[10] == ")");
let tokens = tokenize(&mut vm, &mut reader_state, "`(1 `2 ,@3)", None);
assert!(tokens.len() == 14);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:back-quote");
assert!(tokens[2] == "(");
assert!(tokens[3] == "Int:1");
assert!(tokens[4] == "(");
assert!(tokens[5] == "Symbol:back-quote");
assert!(tokens[6] == "Int:2");
assert!(tokens[7] == ")");
assert!(tokens[8] == "(");
assert!(tokens[9] == "Symbol:unquote-splice");
assert!(tokens[10] == "Int:3");
assert!(tokens[11] == ")");
assert!(tokens[12] == ")");
assert!(tokens[13] == ")");
let tokens = tokenize(&mut vm, &mut reader_state, "`(1 `(2 ,x) ,@3)", None);
assert!(tokens.len() == 20);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:back-quote");
assert!(tokens[2] == "(");
assert!(tokens[3] == "Int:1");
assert!(tokens[4] == "(");
assert!(tokens[5] == "Symbol:back-quote");
assert!(tokens[6] == "(");
assert!(tokens[7] == "Int:2");
assert!(tokens[8] == "(");
assert!(tokens[9] == "Symbol:unquote");
assert!(tokens[10] == "Symbol:x");
assert!(tokens[11] == ")");
assert!(tokens[12] == ")");
assert!(tokens[13] == ")");
assert!(tokens[14] == "(");
assert!(tokens[15] == "Symbol:unquote-splice");
assert!(tokens[16] == "Int:3");
assert!(tokens[17] == ")");
assert!(tokens[18] == ")");
assert!(tokens[19] == ")");
} | rust_cleaned_test_functions.jsonl/101093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75637,
368,
341,
286,
1077,
5206,
10995,
284,
1936,
7844,
39008,
543,
286,
1077,
5206,
6604,
4387,
284,
25166,
1397,
486,
931,
543,
286,
1077,
11211,
284,
77651,
2099,
6984,
10995,
11,
609,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_u16_index() {
const N: usize = 4096;
let mut vec: ArrayVec<[_; N]> = ArrayVec::new();
for _ in 0..N {
assert!(vec.try_push(1u8).is_ok());
}
assert!(vec.try_push(0).is_err());
assert_eq!(vec.len(), N);
} | rust_cleaned_test_functions.jsonl/36762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
16,
21,
3560,
368,
341,
262,
733,
451,
25,
22301,
284,
220,
19,
15,
24,
21,
280,
262,
1077,
5206,
7486,
25,
2910,
10050,
27,
13496,
26,
451,
25669,
284,
2910,
10050,
486,
931,
543,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_app_configuration() -> Result<()> {
assert_eq!(
"Microsoft.AppConfiguration/configurationStores".to_camel_case_id(),
"MicrosoftAppConfigurationConfigurationStores"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/2021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8191,
35726,
368,
1464,
5714,
71698,
341,
286,
2060,
10714,
33673,
310,
330,
12778,
5105,
7688,
89442,
69026,
3263,
983,
666,
35562,
19096,
842,
3148,
310,
330,
12778,
2164,
7688,
7688,
69026,
698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_map_def() {
assert!(matches!(
parse_map_def("foo", &[]),
Err(ParseError::InvalidMapDefinition { .. })
));
assert_eq!(
parse_map_def(
"foo",
bytes_of(&bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
..Default::default()
})
)
.unwrap(),
bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
..Default::default()
}
);
assert_eq!(
parse_map_def(
"foo",
&bytes_of(&bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
..Default::default()
})[..(mem::size_of::<u32>() * 5)]
)
.unwrap(),
bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
..Default::default()
}
);
let map = parse_map_def(
"foo",
&bytes_of(&bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
..Default::default()
})[..(mem::size_of::<u32>() * 5)],
)
.unwrap();
assert!(map.id == 0 && map.pinning == 0)
} | rust_cleaned_test_functions.jsonl/132921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5376,
7844,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
4715,
5376,
7844,
445,
7975,
497,
609,
1294,
1326,
310,
15495,
71812,
1454,
486,
7928,
2227,
10398,
314,
5241,
2751,
286,
33351,
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_receive_gratuitous_arp_response() {
let mut ctx = DummyContext::default();
send_arp_packet(
&mut ctx,
ArpOp::Response,
TEST_REMOTE_IPV4,
TEST_REMOTE_IPV4,
TEST_REMOTE_MAC,
TEST_REMOTE_MAC,
);
// We should have cached the sender's address information.
assert_eq!(
ctx.get_ref().arp_state.table.lookup(TEST_REMOTE_IPV4).unwrap(),
&TEST_REMOTE_MAC
);
// Gratuitous ARPs should not send a response.
assert_eq!(ctx.frames().len(), 0);
} | rust_cleaned_test_functions.jsonl/16989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38557,
15682,
266,
3083,
782,
62,
7876,
9655,
368,
341,
1789,
23459,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
543,
286,
3624,
62,
7876,
21078,
1006,
310,
609,
6984,
5635,
345,
310,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sanitized_message() {
let s = "<b>bold</b>";
assert_eq!(s, sanitize_message(s));
let s = "<i>italic</i>";
assert_eq!(s, sanitize_message(s));
let s = "<u>underline</u>";
assert_eq!(s, sanitize_message(s));
let s = "<font color=\"#000000\">font</font>";
assert_eq!(s, sanitize_message(s));
let s = "<a href=\"https://badssl.com/\">link</a>";
assert_eq!(
"<a href=\"https://badssl.com/\" rel=\"noopener noreferrer\">link</a>",
sanitize_message(s)
);
let s = "<script>alert('XSS');</script>";
assert_eq!("", sanitize_message(s));
} | rust_cleaned_test_functions.jsonl/92486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87866,
83443,
6462,
368,
341,
286,
1077,
274,
284,
4055,
65,
29,
14824,
522,
65,
6734,
286,
2060,
10714,
10297,
82,
11,
45183,
6462,
1141,
3237,
286,
1077,
274,
284,
4055,
72,
29,
34406,
522,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_temporary_views() -> Result<(), Box<dyn Error>> {
mz_ore::test::init_logging();
let server = util::start_server(util::Config::default())?;
let mut client_a = server.connect(postgres::NoTls)?;
let mut client_b = server.connect(postgres::NoTls)?;
client_a
.batch_execute("CREATE VIEW v AS VALUES (1, 'foo'), (2, 'bar'), (3, 'foo'), (1, 'bar')")?;
client_a.batch_execute("CREATE TEMPORARY VIEW temp_v AS SELECT * FROM v")?;
let query_v = "SELECT count(*) FROM v;";
let query_temp_v = "SELECT count(*) FROM temp_v;";
// Ensure that client_a can query v and temp_v.
let count: i64 = client_b.query_one(query_v, &[])?.get("count");
assert_eq!(4, count);
let count: i64 = client_a.query_one(query_temp_v, &[])?.get("count");
assert_eq!(4, count);
let count: i64 = client_b.query_one(query_v, &[])?.get("count");
assert_eq!(4, count);
let err = client_b.query_one(query_temp_v, &[]).unwrap_db_error();
assert_eq!(err.message(), "unknown catalog item \'temp_v\'");
Ok(())
} | rust_cleaned_test_functions.jsonl/8398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11771,
7592,
39498,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
262,
95392,
62,
460,
486,
1944,
486,
2327,
59982,
1428,
262,
1077,
3538,
284,
4094,
486,
2468,
12015,
67811,
486,
2648,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_parans() {
let scanner = Scanner::new();
assert_eq!(
Ok(vec![
Token {
t: TokenType::LeftParen,
line: 1,
lexeme: "(".to_owned(),
literal: None,
},
Token {
t: TokenType::RightParen,
line: 1,
lexeme: ")".to_owned(),
literal: None,
},
Token {
t: TokenType::Eof,
line: 1,
lexeme: String::new(),
literal: None,
}
]),
scanner.scan_tokens("()".to_owned())
);
} | rust_cleaned_test_functions.jsonl/92085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22654,
596,
368,
341,
286,
1077,
20775,
284,
17170,
486,
931,
543,
286,
2060,
10714,
33673,
310,
7622,
25592,
90515,
394,
9660,
341,
503,
259,
25,
56582,
486,
5415,
83997,
345,
503,
1555,
25,
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_option() {
let regex = r"^(?P<foo>\d*),(?P<bar>-?\d*)$";
let input = "1,-2";
let output: Test3 = from_str(input, regex).unwrap();
assert_eq!(output, Test3 { foo: Some(1), bar: Some(-2) });
} | rust_cleaned_test_functions.jsonl/133420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
368,
341,
286,
1077,
20180,
284,
435,
1,
13268,
30,
47,
27,
7975,
8449,
67,
9,
23547,
30,
47,
27,
2257,
38643,
32620,
67,
3764,
3,
876,
286,
1077,
1946,
284,
330,
16,
4999,
17,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_segment() {
let (segment, s) = Segment::parse("argument").unwrap();
assert_eq!(segment, Segment::Argument);
assert_eq!(s, "");
let (segment, s) = Segment::parse("pointer 1 //foo").unwrap();
assert_eq!(segment, Segment::Pointer);
assert_eq!(s, " 1 //foo");
} | rust_cleaned_test_functions.jsonl/132600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28061,
368,
341,
286,
1077,
320,
23169,
11,
274,
8,
284,
37103,
486,
6400,
445,
14479,
1827,
15454,
543,
286,
2060,
10714,
10297,
23169,
11,
37103,
486,
9171,
317,
286,
2060,
10714,
10297,
82,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_twiddle_incr() {
let mut to_test = [0, 1, 2, 3, 4, 5, 6, 7];
twiddle(&mut to_test);
assert_eq!(to_test, [34, 43, 7, 158, 28, 133, 208, 242]);
} | rust_cleaned_test_functions.jsonl/54024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54178,
3310,
1243,
5082,
368,
341,
286,
1077,
5206,
311,
4452,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
935,
286,
4384,
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_acpi_event_serialize() {
let mut acpi_event_serialized = Cursor::new(Vec::new());
acpi_event_serialized
.write(&vec![
65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
])
.unwrap();
acpi_event_serialized
.write(&vec![65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
.unwrap();
acpi_event_serialized.write_u32::<NativeEndian>(5).unwrap();
acpi_event_serialized.write_u32::<NativeEndian>(7).unwrap();
let acpi_event = AcpiEvent {
device_class: DeviceClass("AAAAAA".to_string()),
bus_id: BusId("AAAAA".to_string()),
event_type: 5,
event_data: 7,
};
let state = serialize(&acpi_event, false).unwrap();
assert_eq!(state.as_slice(), acpi_event_serialized.get_ref().as_slice());
} | rust_cleaned_test_functions.jsonl/76945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14718,
2493,
6748,
88686,
368,
341,
286,
1077,
5206,
1613,
2493,
6748,
25602,
1506,
284,
28067,
486,
931,
49923,
486,
931,
1423,
286,
1613,
2493,
6748,
25602,
1506,
198,
310,
659,
4934,
2099,
4083... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_environment_source_no_prefix() {
env::set_var("my_awesome_key", "my_awesome_value");
env::set_var("notmy_awesome_key", "notmy_awesome_value");
let mut builder = ConfigurationBuilder::default();
builder.add_provider(EnvironmentProvider::new());
let configuration = builder.build().unwrap();
assert_eq!(
Some("my_awesome_value"),
configuration.get("my_awesome_key")
);
assert_eq!(
Some("notmy_awesome_value"),
configuration.get("notmy_awesome_key")
);
} | rust_cleaned_test_functions.jsonl/114128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51774,
10347,
6536,
13974,
368,
341,
262,
6105,
486,
746,
4612,
445,
2408,
62,
16875,
3097,
497,
330,
2408,
62,
16875,
3142,
797,
262,
6105,
486,
746,
4612,
445,
1921,
2408,
62,
16875,
3097,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_finish_function_name() {
assert_eq!(
"g_file_copy_finish",
&finish_function_name("g_file_copy_async")
);
assert_eq!("g_bus_get_finish", &finish_function_name("g_bus_get"));
} | rust_cleaned_test_functions.jsonl/16662 | {
"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,
42980,
9174,
1269,
368,
341,
286,
2060,
10714,
33673,
310,
330,
70,
2458,
16096,
42980,
756,
310,
609,
30150,
9174,
1269,
445,
70,
2458,
16096,
28346,
1138,
286,
1439,
286,
2060,
10714,
17223,
70,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_logging_duration() {
let mut runner = Runner::new();
// will be waiting on its timer.
let mut query = runner.proxy.start_logging(100, 1_000);
assert_matches!(runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Ok(()))));
// Check default values before first temperature poll.
assert_inspect_tree!(
runner.inspector,
root: {
TemperatureLogger: {
"cpu (°C)": f64::MIN,
"gpu (°C)": f64::MIN,
"elapsed time (ms)": std::i64::MIN
}
}
);
// for i in 0..9 {
runner.cpu_temperature.set(30.0 + i as f32);
runner.gpu_temperature.set(40.0 + i as f32);
runner.iterate_logging_task();
assert_inspect_tree!(
runner.inspector,
root: {
TemperatureLogger: {
"cpu (°C)": runner.cpu_temperature.get() as f64,
"gpu (°C)": runner.gpu_temperature.get() as f64,
"elapsed time (ms)": 100 * (1 + i as i64)
}
}
);
} | rust_cleaned_test_functions.jsonl/91282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59982,
25454,
368,
341,
286,
1077,
5206,
22259,
284,
44946,
486,
931,
1428,
1789,
286,
442,
686,
387,
8580,
389,
1181,
9021,
624,
286,
1077,
5206,
3239,
284,
22259,
41103,
4962,
59982,
7,
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 |
#[test]
fn test_double_ended_filter_map() {
let xs = [1, 2, 3, 4, 5, 6];
let mut it = xs.iter().filter_map(|&x| if x & 1 == 0 { Some(x * 2) } else { None });
assert_eq!(it.next_back().unwrap(), 12);
assert_eq!(it.next_back().unwrap(), 8);
assert_eq!(it.next().unwrap(), 4);
assert_eq!(it.next_back(), None);
} | rust_cleaned_test_functions.jsonl/1025 | {
"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,
24598,
62,
2883,
8727,
5376,
368,
341,
286,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
286,
1077,
5206,
432,
284,
11943,
19471,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rle_specific_sequences() {
let mut expected_buffer = Vec::new();
let mut values = Vec::new();
for _ in 0..50 {
values.push(0);
}
for _ in 0..50 {
values.push(1);
}
expected_buffer.push(50 << 1);
expected_buffer.push(0);
expected_buffer.push(50 << 1);
expected_buffer.push(1);
for width in 1..9 {
validate_rle(&values[..], width, Some(&expected_buffer[..]), 4);
}
for width in 9..MAX_WIDTH + 1 {
validate_rle(
&values[..],
width as u8,
None,
2 * (1 + bit_util::ceil(width as i64, 8) as i32),
);
}
// Test 100 0's and 1's alternating
values.clear();
expected_buffer.clear();
for i in 0..101 {
values.push(i % 2);
}
let num_groups = bit_util::ceil(100, 8) as u8;
expected_buffer.push(((num_groups << 1) as u8) | 1);
for _ in 1..(100 / 8) + 1 {
expected_buffer.push(0b10101010);
}
expected_buffer.push(0b00001010);
validate_rle(
&values,
1,
Some(&expected_buffer[..]),
1 + num_groups as i32,
);
for width in 2..MAX_WIDTH + 1 {
let num_values = bit_util::ceil(100, 8) * 8;
validate_rle(
&values,
width as u8,
None,
1 + bit_util::ceil(width as i64 * num_values, 8) as i32,
);
}
} | rust_cleaned_test_functions.jsonl/72790 | {
"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,
1710,
273,
56592,
58732,
368,
341,
286,
1077,
5206,
3601,
7776,
284,
11312,
486,
931,
543,
286,
1077,
5206,
2750,
284,
11312,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,
20,
15,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_op_parse_uleb() {
// Doesn't matter for this test.
let encoding = encoding4();
let values = [
0,
1,
0x100,
(!0u16).into(),
0x1eee_eeee,
0x7fff_ffff_ffff_ffff,
!0u64,
];
for value in values.iter() {
let mut inputs = vec![
(
constants::DW_OP_constu,
Operation::UnsignedConstant { value: *value },
),
(
constants::DW_OP_plus_uconst,
Operation::PlusConstant { value: *value },
),
];
if *value <= (!0u16).into() {
inputs.push((
constants::DW_OP_regx,
Operation::Register {
register: Register::from_u64(*value).unwrap(),
},
));
}
if *value <= (!0u32).into() {
inputs.extend(&[
(
constants::DW_OP_addrx,
Operation::AddressIndex {
index: DebugAddrIndex(*value as usize),
},
),
(
constants::DW_OP_constx,
Operation::ConstantIndex {
index: DebugAddrIndex(*value as usize),
},
),
]);
}
// FIXME
if *value < !0u64 / 8 {
inputs.push((
constants::DW_OP_piece,
Operation::Piece {
size_in_bits: 8 * value,
bit_offset: None,
},
));
}
for item in inputs.iter() {
let (op, ref expect) = *item;
let input = Section::with_endian(Endian::Little)
.D8(op.0)
.uleb(*value)
.get_contents()
.unwrap();
check_op_parse_simple(&input, expect, encoding);
}
}
} | rust_cleaned_test_functions.jsonl/45752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
21039,
62,
1111,
65,
368,
341,
286,
442,
48832,
944,
4925,
369,
419,
1273,
624,
286,
1077,
11170,
284,
11170,
19,
1428,
286,
1077,
2750,
284,
2278,
310,
220,
15,
345,
310,
220,
16,
345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_abbreviate_options() {
#[rustfmt::skip]
let oup = exec_target(
TARGET_EXE_PATH,
&[ "--deb", "--verb", "--verb", "--sp", "123", "--col",
"never", "--con", "dir/file.conf", "inp", "oup", ],
);
assert_eq!(oup.status.success(), true);
assert_eq!(
oup.stdout,
concat!(
"CmdOptConf {",
" flag_debug: false,",
" cnt_verbose: 0,",
" opt_speed: 42.0,",
" opt_color: Auto,",
" opt_config: None,",
" arg_input: \"\",",
" arg_output: None",
" }\n"
)
);
assert_eq!(oup.stderr, "");
} | rust_cleaned_test_functions.jsonl/79979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
44272,
6493,
8743,
368,
341,
262,
11506,
35788,
12501,
486,
20599,
921,
262,
1077,
5908,
79,
284,
3883,
11123,
1006,
286,
41033,
4966,
36,
7944,
345,
286,
44590,
14482,
37935,
497,
14482,
2232... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_protoset_contains() {
let protoset: ProtoSet = ProtoSet::from_slice(&[(0, 5), (7, 9), (13, 14)]).unwrap();
for x in 0..6 { assert!(protoset.contains(&x), format!("should contain {}", x)); }
for x in 7..10 { assert!(protoset.contains(&x), format!("should contain {}", x)); }
for x in 13..15 { assert!(protoset.contains(&x), format!("should contain {}", x)); }
for x in [6, 10, 11, 12, 15, 42, 43, 44, 45, 1234584].iter() {
assert!(!protoset.contains(&x), format!("should not contain {}", x));
}
} | rust_cleaned_test_functions.jsonl/105774 | {
"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,
22357,
436,
295,
63598,
368,
341,
286,
1077,
1724,
436,
295,
25,
57677,
1649,
284,
57677,
1649,
486,
1499,
26488,
2099,
9697,
15,
11,
220,
20,
701,
320,
22,
11,
220,
24,
701,
320,
16,
18,
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... | 5 |
#[test]
fn test_ok() {
let handler = SetUIHandler::new();
let string_mutation =
StringMutation { operation: StringOperation::Update, value: "Hi".to_string() };
let result = handler.mutate(
SettingType::Unknown,
fidl_fuchsia_setui::Mutation::StringMutationValue(string_mutation),
);
assert_eq!(result, MutationResponse { return_code: ReturnCode::Ok });
} | rust_cleaned_test_functions.jsonl/21400 | {
"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,
19817,
368,
341,
286,
1077,
7013,
284,
2573,
2275,
3050,
486,
931,
543,
286,
1077,
914,
717,
22705,
4035,
310,
923,
53998,
314,
5666,
25,
923,
8432,
486,
4289,
11,
897,
25,
330,
13048,
3263,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_queue_guard_object() {
let m = &GuestMemoryMmap::<()>::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = MockSplitQueue::new(m, 0x100);
let mut q = vq.create_queue(m);
let mut g = q.lock_with_memory();
// g is currently valid.
assert!(g.is_valid());
assert!(g.ready());
assert_eq!(g.max_size(), 0x100);
g.set_size(16);
for i in 0..7 {
let flags = match i {
1 | 4 | 6 => 0,
_ => VIRTQ_DESC_F_NEXT,
};
let desc = Descriptor::new((0x1000 * (i + 1)) as u64, 0x1000, flags, i + 1);
vq.desc_table().store(i, desc);
}
vq.avail().ring().ref_at(0).store(u16::to_le(0));
vq.avail().ring().ref_at(1).store(u16::to_le(2));
vq.avail().ring().ref_at(2).store(u16::to_le(5));
// Let the device know it can consume chains with the index < 2.
vq.avail().idx().store(u16::to_le(3));
// No descriptor chains are consumed at this point.
assert_eq!(g.next_avail(), 0);
assert_eq!(g.next_used(), 0);
loop {
g.disable_notification().unwrap();
while let Some(chain) = g.iter().unwrap().next() {
// used ring.
let head_index = chain.head_index();
let mut desc_len = 0;
chain.for_each(|d| {
if d.flags() & VIRTQ_DESC_F_WRITE == VIRTQ_DESC_F_WRITE {
desc_len += d.len();
}
});
g.add_used(head_index, desc_len).unwrap();
}
if !g.enable_notification().unwrap() {
break;
}
}
// The next chain that can be consumed should have index 3.
assert_eq!(g.next_avail(), 3);
assert_eq!(g.avail_idx(Ordering::Acquire).unwrap(), Wrapping(3));
assert_eq!(g.next_used(), 3);
assert_eq!(g.used_idx(Ordering::Acquire).unwrap(), Wrapping(3));
assert!(g.ready());
// test that we don't panic in case the driver decrements it.
vq.avail().idx().store(1);
loop {
g.disable_notification().unwrap();
while let Some(_chain) = g.iter().unwrap().next() {
}
if !g.enable_notification().unwrap() {
break;
}
}
} | rust_cleaned_test_functions.jsonl/108598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10841,
36796,
5314,
368,
341,
286,
1077,
296,
284,
609,
37804,
10642,
44,
2186,
27638,
368,
6831,
1499,
58748,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
7252,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_ufo_outpath_default() {
let op = get_ufo_outpath(&Path::new("one/two/three.ufo"), &None, &None);
assert_eq!(op, PathBuf::from("one/two/three.ufo"));
} | rust_cleaned_test_functions.jsonl/21541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7300,
824,
6068,
2343,
9993,
368,
341,
286,
1077,
1179,
284,
633,
7300,
824,
6068,
2343,
2099,
1820,
486,
931,
445,
603,
5523,
1126,
20439,
765,
11634,
824,
3975,
609,
4064,
11,
609,
4064,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_debug() {
let resp = ClientResponse::new(ClientMessage::default());
resp.as_mut()
.headers
.insert(header::COOKIE, HeaderValue::from_static("cookie1=value1"));
resp.as_mut()
.headers
.insert(header::COOKIE, HeaderValue::from_static("cookie2=value2"));
let dbg = format!("{:?}", resp);
assert!(dbg.contains("ClientResponse"));
} | rust_cleaned_test_functions.jsonl/2773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
9039,
284,
8423,
2582,
486,
931,
46851,
2052,
486,
2258,
1423,
286,
9039,
5357,
29523,
741,
310,
659,
7713,
198,
310,
659,
4208,
25534,
486,
44796,
11,
12104,
1130,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_success() {
let tmpdir = std::env::temp_dir();
let exe = std::env::current_exe().unwrap();
let cwd = std::env::current_dir().unwrap();
let mut alt_cwd;
if let Some(fname) = cwd.file_name() {
alt_cwd = OsString::from("../");
alt_cwd.push(fname);
} else {
alt_cwd = cwd.clone().into();
}
for &path in [
"/",
".",
"..",
"../..",
"..//..//../",
"/bin",
"///usr/./bin/.",
"src",
"/etc/passwd",
tmpdir.to_str().unwrap(),
exe.to_str().unwrap(),
cwd.to_str().unwrap(),
alt_cwd.to_str().unwrap(),
#[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "")))]
&"./".repeat(libc::PATH_MAX as usize),
]
.iter()
{
assert_eq!(
realpath(path, RealpathFlags::empty()).unwrap().as_os_str(),
fs::canonicalize(path).unwrap().as_os_str()
);
realpath(path, RealpathFlags::IGNORE_SYMLINKS).unwrap();
}
} | rust_cleaned_test_functions.jsonl/130549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18632,
368,
341,
262,
1077,
4174,
3741,
284,
1460,
486,
3160,
486,
3888,
4334,
543,
262,
1077,
47193,
284,
1460,
486,
3160,
486,
3231,
76074,
1005,
15454,
543,
262,
1077,
46938,
284,
1460,
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... | 3 |
#[test]
fn test_typedef_to_ptr_is_marked_unsafe() {
let hdr = indoc! {"
struct _xlocalefoo; /* forward reference */
typedef struct _xlocalefoo * locale_tfoo;
extern \"C\" {
locale_tfoo duplocalefoo(locale_tfoo);
}
"};
let rs = quote! {};
run_test("", hdr, rs, &["duplocalefoo"], &[]);
} | rust_cleaned_test_functions.jsonl/9879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42111,
4219,
2346,
4348,
6892,
18924,
291,
4907,
18675,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
2036,
716,
87,
14484,
7975,
26,
1391,
4637,
5785,
735,
262,
13501,
2036,
716... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_remove_complex() {
let mut root =
tree!(30 => [3, (15 => [2, 5, 20]), (70 => [3, (50 => [2, 35, (60 => [2, 55, 65])]), (85 => [2, 80, 90])])]);
println!("Input: `{:?}`", root);
let removed = root.remove(&5);
let expected =
tree!(50 => [3, (30 => [2, (15 => [1, Nil, 20]), 35]), (70 => [3, (60 => [2, 55, 65]), (85 => [2, 80, 90])])]);
assert_eq!(removed, Some(5));
assert_eq!(root, expected);
} | rust_cleaned_test_functions.jsonl/9216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
41522,
368,
341,
2394,
197,
10217,
5206,
3704,
4035,
298,
51968,
10297,
18,
15,
589,
508,
18,
11,
320,
16,
20,
589,
508,
17,
11,
220,
20,
11,
220,
17,
15,
9719,
320,
22,
15,
589,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_books_not_about_alice() -> Result<()> {
let sql = SqlBuilder::select_from("books")
.field("title")
.and_where_not_like_any("title", "Alice's")
.sql()?;
assert_eq!(
"SELECT title FROM books WHERE title NOT LIKE '%Alice''s%';",
&sql
);
Ok(())
} | rust_cleaned_test_functions.jsonl/12598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
73084,
7913,
57975,
8418,
558,
368,
1464,
5714,
71698,
341,
286,
1077,
5704,
284,
7224,
3297,
486,
1742,
5673,
445,
12110,
1138,
310,
659,
2566,
445,
2102,
1138,
310,
659,
437,
36814,
7913,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_release_works() {
new_test_ext().execute_with(|| {
let creator_initial_balance = 100;
let payment_amount = 40;
let expected_incentive_amount = payment_amount / INCENTIVE_PERCENTAGE as u128;
// should be able to create a payment with available balance
assert_ok!(Payment::pay(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT,
CURRENCY_ID,
payment_amount,
None
));
assert_eq!(
PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT),
Some(PaymentDetail {
asset: CURRENCY_ID,
amount: payment_amount,
incentive_amount: expected_incentive_amount,
state: PaymentState::Created,
resolver_account: RESOLVER_ACCOUNT,
fee_detail: Some((FEE_RECIPIENT_ACCOUNT, 0)),
})
);
// the payment amount should be reserved
assert_eq!(
Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR),
creator_initial_balance - payment_amount - expected_incentive_amount
);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), 0);
// should succeed for valid payment
assert_ok!(Payment::release(Origin::signed(PAYMENT_CREATOR), PAYMENT_RECIPENT));
assert_eq!(
last_event(),
crate::Event::<Test>::PaymentReleased {
from: PAYMENT_CREATOR,
to: PAYMENT_RECIPENT
}
.into()
);
// the payment amount should be transferred
assert_eq!(
Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR),
creator_initial_balance - payment_amount
);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), payment_amount);
// should be deleted from storage
assert_eq!(PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT), None);
// should be able to create another payment since previous is released
assert_ok!(Payment::pay(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT,
CURRENCY_ID,
payment_amount,
None
));
// the payment amount should be reserved
assert_eq!(
Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR),
creator_initial_balance - (payment_amount * 2) - expected_incentive_amount
);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), payment_amount);
});
} | rust_cleaned_test_functions.jsonl/111984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 849
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24577,
11498,
82,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
19919,
15809,
29396,
284,
220,
16,
15,
15,
280,
197,
10217,
8160,
13471,
284,
220,
19,
15,
280,
197,
1021... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_os() {
let config_path = String::from(DEFAULT_CONFIG_DIR);
assert!(
config_path.ends_with("/Adobe/OperatingConfigs"),
"This module can only be compiled on Mac or Win"
);
let app_support_path = config_path.trim_end_matches("/Adobe/OperatingConfigs");
assert!(
FileInfo::from_path(app_support_path).is_ok(),
"Application Support path is not present"
);
} | rust_cleaned_test_functions.jsonl/45328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29387,
368,
341,
286,
1077,
2193,
2638,
284,
923,
486,
1499,
43175,
12568,
8291,
317,
286,
2060,
33673,
310,
2193,
2638,
25932,
6615,
4283,
81605,
14,
58147,
84905,
4461,
310,
330,
1986,
4688,
646... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_install_basic() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "test_install_target_dir_dir_a";
let file1 = "test_install_target_dir_file_a1";
let file2 = "test_install_target_dir_file_a2";
at.touch(file1);
at.touch(file2);
at.mkdir(dir);
ucmd.arg(file1).arg(file2).arg(dir).succeeds().no_stderr();
assert!(at.file_exists(file1));
assert!(at.file_exists(file2));
assert!(at.file_exists(&format!("{}/{}", dir, file1)));
assert!(at.file_exists(&format!("{}/{}", dir, file2)));
} | rust_cleaned_test_functions.jsonl/124404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
34729,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
5419,
284,
330,
1944,
34245,
11123,
4334,
4334,
4306,
876,
262,
1077,
1034,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_create() {
bad_create_case(f64::NAN, f64::NAN);
bad_create_case(0.0, f64::NAN);
bad_create_case(-1.0, f64::NAN);
bad_create_case(-10.0, f64::NAN);
bad_create_case(f64::NAN, 0.0);
bad_create_case(0.0, 0.0);
bad_create_case(-1.0, 0.0);
bad_create_case(-10.0, 0.0);
bad_create_case(f64::NAN, -1.0);
bad_create_case(0.0, -1.0);
bad_create_case(-1.0, -1.0);
bad_create_case(-10.0, -1.0);
bad_create_case(f64::NAN, -10.0);
bad_create_case(0.0, -10.0);
bad_create_case(-1.0, -10.0);
bad_create_case(-10.0, -10.0);
bad_create_case(f64::INFINITY, 0.1);
bad_create_case(0.1, f64::INFINITY);
bad_create_case(f64::INFINITY, f64::INFINITY);
} | rust_cleaned_test_functions.jsonl/42679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
8657,
368,
341,
286,
3873,
8657,
19096,
955,
21,
19,
486,
45,
1093,
11,
282,
21,
19,
486,
45,
1093,
317,
286,
3873,
8657,
19096,
7,
15,
13,
15,
11,
282,
21,
19,
486,
45,
1093,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_neq_same_length() {
// Given:
let a = Counter::from(vec![1, 2, 4]);
let b = Counter::from(vec![1, 2, 3]);
// Then:
assert!(a != b);
} | rust_cleaned_test_functions.jsonl/79516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
80,
33574,
5118,
368,
341,
310,
442,
16246,
510,
310,
1077,
264,
284,
19735,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
19,
2558,
310,
1077,
293,
284,
19735,
486,
1499,
25592,
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_get_earliest_reward_era() {
new_test_ext().execute_with(|| {
advance_session();
assert_eq!(OracleFinance::get_earliest_reward_era(), None);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 0);
assert_eq!(OracleFinance::get_earliest_reward_era(), None);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 1);
assert_eq!(OracleFinance::get_earliest_reward_era(), None);
advance_session();
assert_eq!(OracleFinance::get_earliest_reward_era(), None);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 2);
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(0));
advance_session();
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(0));
advance_session();
assert_eq!(OracleFinance::current_era_num(), 3);
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(1), " 3 - 2 ");
advance_session();
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(1));
advance_session();
assert_eq!(OracleFinance::current_era_num(), 4);
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(2));
advance_session();
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(2));
advance_session();
assert_eq!(OracleFinance::current_era_num(), 5);
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(3));
advance_session();
assert_eq!(OracleFinance::get_earliest_reward_era(), Some(3));
});
} | rust_cleaned_test_functions.jsonl/35131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 570
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
62,
682,
23138,
38260,
62,
2416,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
1476,
197,
197,
59320,
12316,
543,
197,
6948,
10714,
10297,
48663,
78088,
486,
455,
62,
682,
23138,
382... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_set() -> Result<(), Box<EvalAltResult>> {
#[derive(Clone)]
struct TestStruct {
x: INT,
y: INT,
array: Vec<INT>,
}
impl TestStruct {
fn get_x(&mut self) -> INT {
self.x
}
fn set_x(&mut self, new_x: INT) {
self.x = new_x;
}
fn get_y(&mut self) -> INT {
self.y
}
fn new() -> Self {
Self {
x: 1,
y: 0,
array: vec![1, 2, 3, 4, 5],
}
}
}
let mut engine = Engine::new();
engine.register_type::<TestStruct>();
engine.register_get_set("x", TestStruct::get_x, TestStruct::set_x);
engine.register_get("y", TestStruct::get_y);
engine.register_fn("add", |value: &mut INT| *value += 41);
engine.register_fn("new_ts", TestStruct::new);
assert_eq!(engine.eval::<INT>("let a = new_ts(); a.x = 500; a.x")?, 500);
assert_eq!(engine.eval::<INT>("let a = new_ts(); a.x.add(); a.x")?, 42);
assert_eq!(engine.eval::<INT>("let a = new_ts(); a.y.add(); a.y")?, 0);
#[cfg(not(feature = "no_index"))]
{
engine.register_indexer_get_set(
|value: &mut TestStruct, index: ImmutableString| value.array[index.len()],
|value: &mut TestStruct, index: ImmutableString, new_val: INT| {
value.array[index.len()] = new_val
},
);
assert_eq!(engine.eval::<INT>(r#"let a = new_ts(); a["abc"]"#)?, 4);
assert_eq!(
engine.eval::<INT>(r#"let a = new_ts(); a["abc"] = 42; a["abc"]"#)?,
42
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/10534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 887
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2602,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
65297,
5563,
262,
2036,
3393,
9422,
341,
286,
856,
25,
9221,
345,
286,
379,
25,
9221,
345,
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... | 1 |
#[test]
fn test_destroy_output_stream_after_unplugging_a_default_output_device() {
test_unplug_a_device_on_an_active_stream(StreamType::OUTPUT, Scope::Output, true, 0);
} | rust_cleaned_test_functions.jsonl/23855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18066,
7645,
12673,
19844,
4907,
500,
35268,
4306,
9993,
7645,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
30301,
11,
34920,
486,
5097,
11,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_exponential_f64() {
assert!((Exp.transform(0.0) - 1.0).abs() < 1e-7);
assert!((Exp.transform(1.0) - E).abs() < 1e-7);
assert!((Exp.transform(2.0) - E * E).abs() < 1e-7);
assert!((Exp.transform(0.0) - Exp.grad(0.0)).abs() < 1e-7);
assert!((Exp.transform(1.0) - Exp.grad(1.0)).abs() < 1e-7);
assert!((Exp.transform(2.0) - Exp.grad(2.0)).abs() < 1e-7);
} | rust_cleaned_test_functions.jsonl/78491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
59825,
761,
21,
19,
368,
341,
286,
2060,
0,
1188,
8033,
8134,
7,
15,
13,
15,
8,
481,
220,
16,
13,
15,
568,
3435,
368,
366,
220,
16,
68,
12,
22,
317,
286,
2060,
0,
1188,
8033,
8134,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_queue_processing() {
let m = &GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = VirtQueue::new(GuestAddress(0), m, 16);
let mut q = vq.create_queue();
q.ready = true;
// Let's create two simple descriptor chains.
for j in 0..5 {
vq.dtable[j].set(
0x1000 * (j + 1) as u64,
0x1000,
VIRTQ_DESC_F_NEXT,
(j + 1) as u16,
);
}
vq.dtable[1].flags.set(0);
vq.dtable[4].flags.set(0);
vq.avail.ring[0].set(0);
vq.avail.ring[1].set(2);
vq.avail.idx.set(2);
// We've just set up two chains.
assert_eq!(q.len(m), 2);
// The first chain should hold exactly two descriptors.
let d = q.pop(m).unwrap().next_descriptor().unwrap();
assert!(!d.has_next());
assert!(d.next_descriptor().is_none());
assert_eq!(q.len(m), 1);
// The next chain holds three descriptors.
let d = q
.pop(m)
.unwrap()
.next_descriptor()
.unwrap()
.next_descriptor()
.unwrap();
assert!(!d.has_next());
assert!(d.next_descriptor().is_none());
assert!(q.is_empty(m));
assert!(q.pop(m).is_none());
// Undoing the last pop should let us walk the last chain again.
q.undo_pop();
assert_eq!(q.len(m), 1);
let d = q
.pop(m)
.unwrap()
.next_descriptor()
.unwrap()
.next_descriptor()
.unwrap();
assert!(!d.has_next());
assert!(d.next_descriptor().is_none());
} | rust_cleaned_test_functions.jsonl/3577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1018
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10841,
58209,
368,
341,
286,
1077,
296,
284,
609,
37804,
10642,
44,
2186,
486,
1499,
58748,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
7252,
568,
15454,
543,
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... | 2 |
#[test]
fn test_number() {
assert_eq!(number("0"), done_result!(0));
assert_eq!(number("1"), done_result!(1));
assert_eq!(number("01"), Done("1", 0));
} | rust_cleaned_test_functions.jsonl/29990 | {
"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,
5500,
368,
341,
286,
2060,
10714,
10297,
4082,
445,
15,
3975,
2814,
5287,
10297,
15,
1106,
286,
2060,
10714,
10297,
4082,
445,
16,
3975,
2814,
5287,
10297,
16,
3237,
1789,
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 |
#[test]
fn test_read_file_header_block_with_invalid_content_type() {
let block = Block::builder()
.set_content_type(ContentType::ExternalData)
.build();
assert!(matches!(
read_file_header_block(&block),
Err(ref e) if e.kind() == io::ErrorKind::InvalidData
));
} | rust_cleaned_test_functions.jsonl/29934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2458,
8757,
7113,
6615,
31433,
7495,
1819,
368,
341,
286,
1077,
2504,
284,
8362,
486,
17850,
741,
310,
659,
746,
7495,
1819,
7,
29504,
486,
25913,
1043,
340,
310,
659,
5834,
1428,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_as_ref() {
let p = POINT3;
{
let p: &[i32; 3] = p.as_ref();
assert_eq!(p, &[1, 2, 3]);
}
{
let p: &(i32, i32, i32) = p.as_ref();
assert_eq!(p, &(1, 2, 3));
}
} | rust_cleaned_test_functions.jsonl/45382 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
7793,
368,
341,
310,
1077,
281,
284,
46595,
18,
280,
310,
341,
394,
1077,
281,
25,
44590,
72,
18,
17,
26,
220,
18,
60,
284,
281,
5357,
7793,
543,
394,
2060,
10714,
10297,
79,
11,
4459... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_print_batches_with_sep() {
let batches = vec![];
assert_eq!("", print_batches_with_sep(&batches, b',').unwrap());
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Int32, false),
Field::new("c", DataType::Int32, false),
]));
let batch = RecordBatch::try_new(
schema,
vec![
Arc::new(Int32Array::from_slice(&[1, 2, 3])),
Arc::new(Int32Array::from_slice(&[4, 5, 6])),
Arc::new(Int32Array::from_slice(&[7, 8, 9])),
],
)
.unwrap();
let batches = vec![batch];
let r = print_batches_with_sep(&batches, b',').unwrap();
assert_eq!("a,b,c\n1,4,7\n2,5,8\n3,6,9\n", r);
} | rust_cleaned_test_functions.jsonl/13597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
57755,
6615,
54775,
368,
341,
286,
1077,
44792,
284,
7486,
0,
15078,
286,
2060,
10714,
17223,
497,
1173,
57755,
6615,
54775,
2099,
65,
9118,
11,
293,
516,
1823,
15454,
5231,
286,
1077,
1080... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterator_clone() {
let s = "ศไทย中华Việt Nam";
let mut it = s.chars();
it.next();
assert!(it.clone().zip(it).all(|(x,y)| x == y));
} | rust_cleaned_test_functions.jsonl/11127 | {
"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,
13491,
54742,
368,
341,
262,
1077,
274,
284,
330,
123863,
125451,
100849,
35544,
124382,
29974,
876,
262,
1077,
5206,
432,
284,
274,
85062,
543,
262,
432,
4529,
543,
262,
2060,
10297,
275,
15997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_intersection() {
let sc = CONTEXT.clone();
let col1 = vec![1, 2, 3, 4, 5, 10, 12, 13, 19, 0];
let col2 = vec![3, 4, 5, 6, 7, 8, 11, 13];
let first = sc.parallelize(col1, 2);
let second = sc.parallelize(col2, 4);
let mut res = first.intersection(Arc::new(second)).collect().unwrap();
res.sort();
let expected = vec![3, 4, 5, 13];
assert_eq!(res, expected);
} | rust_cleaned_test_functions.jsonl/27953 | {
"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,
82558,
368,
341,
262,
1077,
1136,
284,
87336,
15997,
1428,
262,
1077,
1375,
16,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
16,
15,
11,
220,
16,
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_used_in_for_expr() {
check_assist(
inline_local_variable,
r"
fn foo() {
let a$0 = vec![10, 20];
for i in a {}
}",
r"
fn foo() {
for i in vec![10, 20] {}
}",
);
} | rust_cleaned_test_functions.jsonl/3241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
1243,
5478,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
435,
698,
8822,
15229,
368,
341,
262,
1077,
264,
3,
15,
284,
7486,
20703,
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,
1... | 1 |
#[test]
fn test_map_without_alpha_rgba() {
let rgba = Rgba([0, 0, 0, 0]).map_without_alpha(|s| s + 1);
assert_eq!(rgba, Rgba([1, 1, 1, 0]));
} | rust_cleaned_test_functions.jsonl/46644 | {
"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,
5376,
39904,
26633,
95229,
368,
341,
286,
1077,
23524,
284,
431,
56380,
2561,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
10697,
2186,
39904,
26633,
22428,
82,
91,
274,
488,
220,
16,
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... | 1 |
#[test]
fn test_invoke_script() {
solana_logger::setup();
let code = "main() { return; }";
let sender_address = AccountAddress::default();
let script = LibraAccount::create_script(&sender_address, code, vec![]);
let genesis = LibraAccount::create_genesis(1_000_000_000);
let keyed_accounts = vec![KeyedAccount::new(&script.key, true, &script.account)];
MoveProcessor::do_finalize(&keyed_accounts).unwrap();
let keyed_accounts = vec![
KeyedAccount::new(&script.key, true, &script.account),
KeyedAccount::new(&genesis.key, false, &genesis.account),
];
MoveProcessor::do_invoke_main(&keyed_accounts, sender_address, "main".to_string(), vec![])
.unwrap();
} | rust_cleaned_test_functions.jsonl/71384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
14660,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
2038,
284,
330,
3817,
368,
314,
470,
26,
335,
876,
286,
1077,
4646,
6744,
284,
8615,
4286,
486,
2258,
543,
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_multislice() {
defmac!(test_multislice mut arr, s1, s2 => {
{
let copy = arr.clone();
assert_eq!(
multislice!(arr, mut s1, mut s2,),
(copy.clone().slice_mut(s1), copy.clone().slice_mut(s2))
);
}
{
let copy = arr.clone();
assert_eq!(
multislice!(arr, mut s1, s2,),
(copy.clone().slice_mut(s1), copy.clone().slice(s2))
);
}
{
let copy = arr.clone();
assert_eq!(
multislice!(arr, s1, mut s2),
(copy.clone().slice(s1), copy.clone().slice_mut(s2))
);
}
{
let copy = arr.clone();
assert_eq!(
multislice!(arr, s1, s2),
(copy.clone().slice(s1), copy.clone().slice(s2))
);
}
});
let mut arr = Array1::from_iter(0..48).into_shape((8, 6)).unwrap();
assert_eq!((arr.clone().view(),), multislice!(arr, [.., ..]));
test_multislice!(&mut arr, s![0, ..], s![1, ..]);
test_multislice!(&mut arr, s![0, ..], s![-1, ..]);
test_multislice!(&mut arr, s![0, ..], s![1.., ..]);
test_multislice!(&mut arr, s![1, ..], s![..;2, ..]);
test_multislice!(&mut arr, s![..2, ..], s![2.., ..]);
test_multislice!(&mut arr, s![1..;2, ..], s![..;2, ..]);
test_multislice!(&mut arr, s![..;-2, ..], s![..;2, ..]);
test_multislice!(&mut arr, s![..;12, ..], s![3..;3, ..]);
} | rust_cleaned_test_functions.jsonl/103430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 891
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
285,
4754,
368,
341,
262,
707,
11948,
10297,
1944,
26290,
285,
4754,
5206,
2890,
11,
274,
16,
11,
274,
17,
589,
341,
286,
341,
310,
1077,
2975,
284,
2890,
15997,
543,
310,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error_from_code() {
use super::Error::*;
assert_eq!(Ok(()), Error::from_code(ERROR_SUCCESS as i32));
assert_eq!(
Err(InsufficientMemory),
Error::from_code(ERROR_INSUFFICIENT_MEMORY as i32)
);
assert_eq!(
Err(ScanTimeout),
Error::from_code(ERROR_SCAN_TIMEOUT as i32)
);
} | rust_cleaned_test_functions.jsonl/115372 | {
"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,
4096,
5673,
4136,
368,
341,
286,
990,
2256,
486,
1454,
79304,
286,
2060,
10714,
10297,
11578,
5065,
701,
4600,
486,
1499,
4136,
32268,
8827,
438,
600,
18,
17,
1106,
286,
2060,
10714,
33673,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_last_kv_in_cf() {
let cfs = [String::from("1")];
let db = Database::open_with_cfs("test", &cfs);
cfs.iter().for_each(|cf| {
db.put_cf(cf, "a", "b").unwrap();
db.put_cf(cf, "e", "f").unwrap();
db.put_cf(cf, "x", "y").unwrap();
let (_, value) = db.last_kv_in_cf(cf).unwrap();
let value: String = utils::deserialize_from_bytes(value.to_vec())
.unwrap()
.unwrap();
assert_eq!("y".to_string(), value);
});
drop(db);
DB::destroy(&Options::default(), "test").unwrap();
} | rust_cleaned_test_functions.jsonl/125265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
97066,
1243,
71143,
368,
341,
286,
1077,
272,
3848,
284,
508,
703,
486,
1499,
445,
16,
899,
935,
286,
1077,
2927,
284,
9994,
486,
2508,
6615,
666,
3848,
445,
1944,
497,
609,
66,
3848,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inc_dec_mem() {
let code = vec![0xE6, 0x02, 0xC6, 0x02];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.next(&mut memory).unwrap();
assert_eq!(1, memory.get(0x02 as usize));
nes.next(&mut memory).unwrap();
assert_eq!(0, memory.get(0x02 as usize));
} | rust_cleaned_test_functions.jsonl/38728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31285,
13783,
12976,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
12606,
21,
11,
220,
15,
87,
15,
17,
11,
220,
15,
12125,
21,
11,
220,
15,
87,
15,
17,
935,
286,
1077,
5206,
308,
288,
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_wait_packet_sent() {
let mut rfm = setup_rfm(Vec::new(), vec![0b0000_0_000, 0]);
rfm.wait_packet_sent().err().unwrap();
assert_eq!(rfm.spi.rx_buffer[0], Registers::IrqFlags2.read());
rfm.spi.tx_buffer[0] = 0b0000_1_000;
rfm.spi.rx_buffer.clear();
rfm.wait_packet_sent().ok().unwrap();
assert_eq!(rfm.spi.rx_buffer[0], Registers::IrqFlags2.read());
} | rust_cleaned_test_functions.jsonl/3703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
21078,
24115,
368,
341,
262,
1077,
5206,
435,
21112,
284,
6505,
1710,
21112,
49923,
486,
931,
1507,
7486,
20703,
15,
65,
15,
15,
15,
15,
62,
15,
62,
15,
15,
15,
11,
220,
15,
2558,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
use ast::TypeName;
use ast::TypeSpecifier::Int;
use env::Env;
use parser::expression;
let env = &mut Env::new();
assert_eq!(
expression("(int) 1", env),
Ok(CastExpression {
type_name: TypeName {
specifiers: vec![Int.into()],
declarator: None,
}
.into(),
expression: int::dec("1"),
}
.into())
);
assert!(expression("(foo) 1", env).is_err());
} | rust_cleaned_test_functions.jsonl/107547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
368,
341,
262,
990,
11763,
486,
39429,
280,
262,
990,
11763,
486,
929,
87297,
486,
1072,
280,
262,
990,
6105,
486,
14359,
280,
262,
990,
6729,
486,
28099,
401,
262,
1077,
6105,
284,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_puzzle_input() {
let clay_areas = parse_input("input.txt");
assert_eq!(solve(&clay_areas), (31471, 24169));
} | rust_cleaned_test_functions.jsonl/102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
14945,
5898,
368,
341,
286,
1077,
36048,
78572,
284,
4715,
5898,
445,
1355,
3909,
797,
286,
2060,
10714,
10297,
59419,
2099,
564,
352,
78572,
701,
320,
18,
16,
19,
22,
16,
11,
220,
17,
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 |
#[test]
fn test_cycle_nonpod_with_str_by_ref() {
let cxx = indoc! {"
uint32_t take_bob(const Bob& a) {
return a.a;
}
std::unique_ptr<Bob> make_bob() {
auto a = std::make_unique<Bob>();
a->a = 32;
a->b = \"hello\";
return a;
}
"};
let hdr = indoc! {"
#include <cstdint>
#include <string>
#include <memory>
struct Bob {
uint32_t a;
std::string b;
};
uint32_t take_bob(const Bob& a);
std::unique_ptr<Bob> make_bob();
"};
let rs = quote! {
let a = ffi::make_bob();
assert_eq!(ffi::take_bob(a.as_ref().unwrap()), 32);
};
run_test(cxx, hdr, rs, &["take_bob", "Bob", "make_bob"], &[]);
} | rust_cleaned_test_functions.jsonl/9750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39079,
21637,
39073,
6615,
2895,
3710,
7793,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
1896,
880,
674,
2741,
14261,
5,
264,
8,
341,
310,
470,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_emit_movb_memq_reg() {
assert_emit!(0x8a, 0x45, 1; emit_movb_memq_reg(RBP, 1, RAX));
assert_emit!(0x8a, 0x44, 0x24, 1; emit_movb_memq_reg(RSP, 1, RAX));
assert_emit!(0x8a, 0x44, 0x24, 0xff; emit_movb_memq_reg(RSP, -1, RAX));
assert_emit!(0x8a, 0x5d, 1; emit_movb_memq_reg(RBP, 1, RBX));
assert_emit!(0x8a, 0x4d, 1; emit_movb_memq_reg(RBP, 1, RCX));
assert_emit!(0x8a, 0x55, 1; emit_movb_memq_reg(RBP, 1, RDX));
assert_emit!(0x44, 0x8a, 0x7d, 1; emit_movb_memq_reg(RBP, 1, R15));
assert_emit!(0x40, 0x8a, 0x75, 1; emit_movb_memq_reg(RBP, 1, RSI));
assert_emit!(0x40, 0x8a, 0x7d, 1; emit_movb_memq_reg(RBP, 1, RDI));
} | rust_cleaned_test_functions.jsonl/85439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
55798,
65,
12976,
80,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
23,
64,
11,
220,
15,
87,
19,
20,
11,
220,
16,
26,
16691,
55798,
65,
12976,
80,
4920,
2785,
26095,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_function_declaration_valid() {
let correct = FunctionDef(
String::from("foo"),
Rc::new(CompoundCommand {
kind: Brace(vec![cmd_args("echo", &["body"])]),
io: vec![],
}),
);
assert_eq!(
correct,
make_parser("function foo() { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo () { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo ( ) { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo( ) { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo() { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo () { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo ( ) { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo( ) { echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo() \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo () \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo ( )\n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo( ) \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("function foo \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo() \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo () \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo ( ) \n{ echo body; }")
.function_declaration()
.unwrap()
);
assert_eq!(
correct,
make_parser("foo( ) \n{ echo body; }")
.function_declaration()
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/69862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
77926,
8337,
368,
341,
262,
1077,
4396,
284,
5712,
2620,
1006,
286,
923,
486,
1499,
445,
7975,
4461,
286,
81463,
486,
931,
7,
43134,
4062,
341,
310,
3093,
25,
69206,
25592,
20703,
8710,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_priority_update_push_on_control_stream() {
test_wrong_frame_on_control_stream(&[0x80, 0x0f, 0x07, 0x01, 0x01, 0x03]);
} | rust_cleaned_test_functions.jsonl/101885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38161,
8882,
14218,
4470,
13436,
12673,
368,
341,
286,
1273,
75198,
8929,
4470,
13436,
12673,
2099,
58,
15,
87,
23,
15,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
15,
22,
11,
220,
15,
87,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_schema_no_fees_with_pool() {
let _setup = SetupLibraryWalletPoolZeroFees::init();
let handle = create_schema_real();
let _source_id = get_source_id(handle).unwrap();
let _schema_id = get_schema_id(handle).unwrap();
let _schema_json = to_string(handle).unwrap();
// No Payment performed
let _payment = get_payment_txn(handle).unwrap_err();
} | rust_cleaned_test_functions.jsonl/33235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25371,
6536,
761,
5516,
6615,
15709,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16915,
38259,
10551,
17999,
37,
5516,
486,
2327,
1428,
286,
1077,
3705,
284,
1855,
25371,
15266,
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_lift() {
type H = Hlist![(), usize, f64, (), bool];
// Ensure type inference works as expected first:
let x: H = 1337.lift_into();
assert_eq!(x, hlist![(), 1337, 0.0, (), false]);
let x = H::lift_from(42.0);
assert_eq!(x, hlist![(), 0, 42.0, (), false]);
let x: H = lift_from(true);
assert_eq!(x, hlist![(), 0, 0.0, (), true]);
// Sublists:
let x: H = hlist![(), true].lift_into();
assert_eq!(x, hlist![(), 0, 0.0, (), true]);
let x: H = hlist![3.0, ()].lift_into();
assert_eq!(x, hlist![(), 0, 3.0, (), false]);
let x: H = hlist![(), 1337].lift_into();
assert_eq!(x, hlist![(), 1337, 0.0, (), false]);
let x: H = hlist![(), 1337, 42.0, (), true].lift_into();
assert_eq!(x, hlist![(), 1337, 42.0, (), true]);
} | rust_cleaned_test_functions.jsonl/24770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87004,
368,
341,
286,
943,
472,
284,
472,
1607,
20703,
1507,
22301,
11,
282,
21,
19,
11,
38104,
1807,
4821,
286,
442,
29279,
943,
44378,
4278,
438,
3601,
1156,
510,
286,
1077,
856,
25,
472,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lexicographical_partition_points_empty() {
let input = vec![];
assert!(
lexicographical_partition_points(&input).is_err(),
"lexicographical_partition_points should reject columns with empty rows"
);
} | rust_cleaned_test_functions.jsonl/119211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
292,
31177,
43840,
12928,
15124,
368,
341,
286,
1077,
1946,
284,
7486,
0,
15078,
286,
2060,
33673,
310,
512,
14331,
31177,
43840,
12928,
2099,
1355,
568,
285,
9266,
3148,
310,
330,
2571,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_count_matches() {
{
let items = vec![
vec!["phone".to_string(), "blue".to_string(), "pixel".to_string()],
vec![
"computer".to_string(),
"silver".to_string(),
"lenovo".to_string(),
],
vec![
"phone".to_string(),
"gold".to_string(),
"iphone".to_string(),
],
];
assert_eq!(
count_matches(items, "color".to_string(), "silver".to_string()),
1
);
}
{
let items = vec![
vec!["phone".to_string(), "blue".to_string(), "pixel".to_string()],
vec![
"computer".to_string(),
"silver".to_string(),
"phone".to_string(),
],
vec![
"phone".to_string(),
"gold".to_string(),
"iphone".to_string(),
],
];
assert_eq!(
count_matches(items, "type".to_string(), "phone".to_string()),
2
);
}
} | rust_cleaned_test_functions.jsonl/78720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 689
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
38344,
368,
341,
262,
341,
286,
1077,
3589,
284,
7486,
90515,
310,
7486,
0,
1183,
4844,
3263,
983,
3904,
1507,
330,
12203,
3263,
983,
3904,
1507,
330,
29684,
3263,
983,
3904,
73845,
310,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.