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_flags_from_vec_29() {
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"--seed",
"250",
"--v8-flags=--expose-gc",
"run",
"script.ts"
]);
assert_eq!(
flags,
DenoFlags {
seed: Some(250 as u64),
v8_flags: Some(svec!["deno", "--expose-gc", "--random-seed=250"]),
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"]);
} | rust_cleaned_test_functions.jsonl/112858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
17,
24,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
284,
8042,
5673,
13251,
1141,
4083,
90515,
414,
330,
5183,
78,
756,
414,
14482,
22602,
756,
414,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_permissions_request_read() {
let guard = PERMISSION_PROMPT_GUARD.lock().unwrap();
let whitelist = vec![PathBuf::from("/foo/bar")];
let mut perms0 = DenoPermissions::from_flags(&Flags {
read_whitelist: whitelist.clone(),
..Default::default()
});
set_prompt_result(false);
// regardless of prompt result
assert_eq!(
perms0.request_read(&Some(Path::new("/foo/bar"))),
PermissionState::Allow
);
let mut perms1 = DenoPermissions::from_flags(&Flags {
read_whitelist: whitelist.clone(),
..Default::default()
});
set_prompt_result(true);
assert_eq!(
perms1.request_read(&Some(Path::new("/foo/baz"))),
PermissionState::Allow
);
let mut perms2 = DenoPermissions::from_flags(&Flags {
read_whitelist: whitelist,
..Default::default()
});
set_prompt_result(false);
assert_eq!(
perms2.request_read(&Some(Path::new("/foo/baz"))),
PermissionState::Deny
);
drop(guard);
} | rust_cleaned_test_functions.jsonl/78059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44767,
7893,
6443,
368,
341,
262,
1077,
7616,
284,
96540,
71346,
2828,
84513,
7376,
21003,
1005,
15454,
543,
262,
1077,
67727,
284,
7486,
20703,
1820,
15064,
486,
1499,
4283,
7975,
49513,
899,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_index_trait_range_panic_wrong_order() {
Python::with_gil(|py| {
let list = PyList::new(py, &[2, 3, 5]);
#[allow(clippy::reversed_empty_ranges)]
list[2..1].extract::<Vec<i32>>().unwrap();
})
} | rust_cleaned_test_functions.jsonl/108643 | {
"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,
2019,
3560,
78491,
9698,
620,
31270,
75198,
7869,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wait_for_max_stake() {
solana_logger::setup();
let mut validator_config = ValidatorConfig::default();
validator_config.rpc_config.enable_validator_exit = true;
let config = ClusterConfig {
cluster_lamports: 10_000,
node_stakes: vec![100; 4],
validator_configs: vec![validator_config; 4],
..ClusterConfig::default()
};
let cluster = LocalCluster::new(&config);
let client = RpcClient::new_socket(cluster.entry_point_info.rpc);
assert!(client
.wait_for_max_stake(CommitmentConfig::default(), 33.0f32)
.is_ok());
assert!(client.get_slot().unwrap() > 10);
} | rust_cleaned_test_functions.jsonl/36004 | {
"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,
18760,
5478,
6345,
1261,
726,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
1077,
5206,
22935,
5332,
284,
32566,
2648,
486,
2258,
543,
262,
22935,
5332,
55177,
5332,
28697,
64959,
16880,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_close_wait_ack() {
let mut s = socket_close_wait();
s.send_slice(b"abcdef").unwrap();
recv!(s, [TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1 + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
}]);
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1 + 1,
ack_number: Some(LOCAL_SEQ + 1 + 6),
..SEND_TEMPL
});
} | rust_cleaned_test_functions.jsonl/1748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12704,
18760,
48447,
368,
341,
286,
1077,
5206,
274,
284,
7575,
12704,
18760,
543,
286,
274,
5219,
26488,
1883,
1,
41202,
1827,
15454,
543,
286,
27006,
10297,
82,
11,
508,
77536,
693,
649,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_message_unique_program_ids_order_preserved() {
let program_id0 = Pubkey::new_unique();
let program_id1 = Pubkey::default(); // Key less than program_id0
let program_ids = get_program_ids(&[
Instruction::new_with_bincode(program_id0, &0, vec![]),
Instruction::new_with_bincode(program_id1, &0, vec![]),
Instruction::new_with_bincode(program_id0, &0, vec![]),
]);
assert_eq!(program_ids, vec![program_id0, program_id1]);
} | rust_cleaned_test_functions.jsonl/55516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
21218,
25096,
8077,
7869,
32116,
2771,
368,
341,
286,
1077,
2025,
842,
15,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2025,
842,
16,
284,
22611,
792,
486,
2258,
2129,
442,
5309,
268... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add() {
let vals = vec![
("12.34", "1.234", "13.574"),
("12.34", "-1.234", "11.106"),
("1234e6", "1234e-6", "1234000000.001234"),
("1234e-6", "1234e6", "1234000000.001234"),
("18446744073709551616.0", "1", "18446744073709551617"),
("184467440737e3380", "0", "184467440737e3380"),
];
for &(x, y, z) in vals.iter() {
let mut a = BigDecimal::from_str(x).unwrap();
let b = BigDecimal::from_str(y).unwrap();
let c = BigDecimal::from_str(z).unwrap();
let s = a.clone() + b.clone();
assert_eq!(s, c);
a += b;
assert_eq!(a, c);
}
} | rust_cleaned_test_functions.jsonl/75811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
1077,
28356,
284,
7486,
90515,
310,
3489,
16,
17,
13,
18,
19,
497,
330,
16,
13,
17,
18,
19,
497,
330,
16,
18,
13,
20,
22,
19,
4461,
310,
3489,
16,
17,
13,
18,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_playback_status_to_fidl() {
let status = PlaybackStatus::Playing;
let status: fidl::PlaybackStatus = status.into();
let expected = fidl::PlaybackStatus::Playing;
assert_eq!(expected, status);
} | rust_cleaned_test_functions.jsonl/15962 | {
"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,
22144,
1419,
4773,
2346,
761,
55464,
368,
341,
286,
1077,
2639,
284,
95301,
2522,
486,
27471,
280,
286,
1077,
2639,
25,
32104,
75,
486,
87125,
2522,
284,
2639,
39860,
543,
286,
1077,
3601,
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 |
#[test]
fn test_file_type() {
assert_eq!("block special file", pretty_filetype(S_IFBLK, 0));
assert_eq!("character special file", pretty_filetype(S_IFCHR, 0));
assert_eq!("regular file", pretty_filetype(S_IFREG, 1));
assert_eq!("regular empty file", pretty_filetype(S_IFREG, 0));
assert_eq!("weird file", pretty_filetype(0, 0));
} | rust_cleaned_test_functions.jsonl/36729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
1819,
368,
341,
286,
2060,
10714,
17223,
4574,
3281,
1034,
497,
5020,
2458,
1313,
3759,
19035,
9389,
42,
11,
220,
15,
1106,
286,
2060,
10714,
17223,
19190,
3281,
1034,
497,
5020,
2458,
1313,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_f64() {
let cases = vec![
("12345", 12345f64),
("123.45", 123.45),
("-123.45", -123.45),
("0.00012345000098765", 0.00012345000098765),
("1234500009876.5", 1234500009876.5),
("3.141592653589793", 3.141592653589793),
("3", 3f64),
("1234567890123456", 1234567890123456f64),
("1234567890123456000", 1234567890123456000f64),
("1234.567890123456", 1234.567890123456),
("0.1234567890123456", 0.1234567890123456),
("0", 0f64),
("0.111111111111111", 0.1111111111111110),
("0.1111111111111111", 0.1111111111111111),
("0.1111111111111119", 0.1111111111111119),
("0.000000000000000001", 0.000000000000000001),
("0.000000000000000002", 0.000000000000000002),
("0.000000000000000003", 0.000000000000000003),
("0.000000000000000005", 0.000000000000000005),
("0.000000000000000008", 0.000000000000000008),
("0.1000000000000001", 0.1000000000000001),
("0.1000000000000002", 0.1000000000000002),
("0.1000000000000003", 0.1000000000000003),
("0.1000000000000005", 0.1000000000000005),
("0.1000000000000008", 0.1000000000000008),
];
let mut ctx = EvalContext::default();
for (dec_str, exp) in cases {
let dec = dec_str.parse::<Decimal>().unwrap();
let res = format!("{}", dec);
assert_eq!(res, dec_str);
let f: f64 = dec.convert(&mut ctx).unwrap();
assert!((exp - f).abs() < EPSILON, "expect: {}, got: {}", exp, f);
}
} | rust_cleaned_test_functions.jsonl/40306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 911
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
761,
21,
19,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
16,
17,
18,
19,
20,
497,
220,
16,
17,
18,
19,
20,
69,
21,
19,
1326,
310,
3489,
16,
17,
18,
13,
19,
20,
497,
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_timer() {
let mut timer = Timer::new(10);
timer.add_task(Duration::from_millis(20), Task::A);
timer.add_task(Duration::from_millis(150), Task::C);
timer.add_task(Duration::from_millis(100), Task::B);
assert_eq!(timer.pending.len(), 3);
let tick_time = timer.next_timeout().unwrap();
assert_eq!(timer.pop_task_before(tick_time).unwrap(), Task::A);
assert_eq!(timer.pop_task_before(tick_time), None);
let tick_time = timer.next_timeout().unwrap();
assert_eq!(timer.pop_task_before(tick_time).unwrap(), Task::B);
assert_eq!(timer.pop_task_before(tick_time), None);
let tick_time = timer.next_timeout().unwrap();
assert_eq!(timer.pop_task_before(tick_time).unwrap(), Task::C);
assert_eq!(timer.pop_task_before(tick_time), None);
} | rust_cleaned_test_functions.jsonl/1908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16255,
368,
341,
286,
1077,
5206,
9021,
284,
17759,
486,
931,
7,
16,
15,
317,
286,
9021,
1364,
12184,
64114,
486,
1499,
717,
56212,
7,
17,
15,
701,
5430,
486,
32,
317,
286,
9021,
1364,
12184,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_s3_list_multipart_uploads() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"s3-list-multipart-uploads.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = S3Client::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListMultipartUploadsRequest::default();
let result = client.list_multipart_uploads(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/29201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
643,
18,
2019,
717,
18204,
62,
19374,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
82,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_array() {
let mut builder = PrimitiveArrayBuilder::<i64>::with_capacity(16);
let data_array: DFInt64Array = builder.finish();
// verify empty data array and data type
assert!(data_array.is_empty());
assert_eq!(&DataType::Int64, data_array.data_type());
} | rust_cleaned_test_functions.jsonl/102160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
3858,
368,
341,
262,
1077,
5206,
7363,
284,
51460,
1857,
3297,
27638,
72,
21,
19,
6831,
4197,
35603,
7,
16,
21,
317,
262,
1077,
821,
3858,
25,
43376,
1072,
21,
19,
1857,
284,
7363,
4008... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_flatten_grammar_with_final_precedence() {
let result = flatten_variable(Variable {
name: "test".to_string(),
kind: VariableType::Named,
rule: Rule::prec_left(
Precedence::Integer(101),
Rule::seq(vec![Rule::non_terminal(1), Rule::non_terminal(2)]),
),
})
.unwrap();
assert_eq!(
result.productions,
vec![Production {
dynamic_precedence: 0,
steps: vec![
ProductionStep::new(Symbol::non_terminal(1))
.with_prec(Precedence::Integer(101), Some(Associativity::Left)),
ProductionStep::new(Symbol::non_terminal(2))
.with_prec(Precedence::Integer(101), Some(Associativity::Left)),
]
}]
);
let result = flatten_variable(Variable {
name: "test".to_string(),
kind: VariableType::Named,
rule: Rule::prec_left(
Precedence::Integer(101),
Rule::seq(vec![Rule::non_terminal(1)]),
),
})
.unwrap();
assert_eq!(
result.productions,
vec![Production {
dynamic_precedence: 0,
steps: vec![ProductionStep::new(Symbol::non_terminal(1))
.with_prec(Precedence::Integer(101), Some(Associativity::Left)),]
}]
);
} | rust_cleaned_test_functions.jsonl/122535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
14456,
62,
41094,
6615,
20676,
10442,
1998,
763,
368,
341,
286,
1077,
1102,
284,
45343,
14635,
7,
7827,
341,
310,
829,
25,
330,
1944,
3263,
983,
3904,
3148,
310,
3093,
25,
12407,
929,
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... | 1 |
#[test]
fn test_delta() {
let mut rng = rand::thread_rng();
let y = Scalar::random(&mut rng);
let z = Scalar::random(&mut rng);
// Choose n = 256 to ensure we overflow the group order during
let n = 256;
// code copied from previous implementation
let z2 = z * z;
let z3 = z2 * z;
let mut power_g = Scalar::zero();
let mut exp_y = Scalar::one(); // start at y^0 = 1
let mut exp_2 = Scalar::one(); // start at 2^0 = 1
for _ in 0..n {
power_g += (z - z2) * exp_y - z3 * exp_2;
exp_y = exp_y * y;
exp_2 = exp_2 + exp_2;
}
assert_eq!(power_g, delta(n, 1, &y, &z),);
} | rust_cleaned_test_functions.jsonl/17372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26710,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
379,
284,
35176,
486,
11463,
2099,
6984,
28422,
317,
286,
1077,
1147,
284,
35176,
486,
11463,
2099,
6984,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_resolve_module_5() {
let (_temp_dir, deno_dir) = test_setup();
let module_specifier = "http://localhost:4545/tests/subdir/mod2.ts";
let containing_file = add_root!("/deno/tests/006_url_imports.ts");
let expected_module_name = "http://localhost:4545/tests/subdir/mod2.ts";
let expected_filename = deno_fs::normalize_path(
deno_dir
.deps
.join("localhost_PORT4545/tests/subdir/mod2.ts")
.as_ref(),
);
let (module_name, filename) = deno_dir
.resolve_module(module_specifier, containing_file)
.unwrap();
assert_eq!(module_name, expected_module_name);
assert_eq!(filename, expected_filename);
} | rust_cleaned_test_functions.jsonl/42048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10750,
62,
20,
368,
341,
220,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
220,
1077,
4688,
13594,
3049,
284,
330,
1254,
1110,
8301,
25,
19,
20,
19,
20,
62468,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_human_formatted() {
assert_eq!(dur(10, 4), parse_dur("10m 4s").unwrap());
assert_eq!(dur(19, 3), parse_dur("19m3s").unwrap());
assert_eq!(dur(0, 10), parse_dur(" 10 ").unwrap());
assert_eq!(dur(0, 9), parse_dur("6s 3s").unwrap()); // Units are added
assert!(parse_dur("s").is_err());
assert!(parse_dur("10s m").is_err());
assert!(parse_dur("10sm").is_err());
} | rust_cleaned_test_functions.jsonl/51536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86247,
86610,
368,
341,
286,
2060,
10714,
10297,
70692,
7,
16,
15,
11,
220,
19,
701,
4715,
82289,
445,
16,
15,
76,
220,
19,
82,
1827,
15454,
1423,
286,
2060,
10714,
10297,
70692,
7,
16,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_basic_timeout() {
let (mut pm, mut timeout_rx) = make_pacemaker();
// jump start the pacemaker
pm.process_certificates(Some(0), None, None);
for _ in 0..2 {
let round = block_on(timeout_rx.next()).unwrap();
// round for timeout is not changed as no timeout certificate was gathered at this point
assert_eq!(1, round);
pm.process_local_timeout(round);
}
} | rust_cleaned_test_functions.jsonl/9072 | {
"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,
34729,
20537,
368,
341,
262,
1077,
320,
6984,
8836,
11,
5206,
9632,
24330,
8,
284,
1281,
620,
580,
58675,
1428,
262,
442,
7784,
1191,
279,
22894,
58675,
198,
262,
8836,
16988,
37097,
24405,
65405,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_process_unknown_command() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
// This command does not exist.
let reset_reponse = ctap_state.process_command(&[0xDF], DUMMY_CHANNEL_ID);
let expected_response = vec![Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND as u8];
assert_eq!(reset_reponse, expected_response);
} | rust_cleaned_test_functions.jsonl/35319 | {
"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,
11305,
57507,
10811,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
17895,
43187,
36976,
284,
66091,
7622,
7,
1423,
286,
1077,
5206,
20251,
391,
4387,
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_parse_invalid_framing() {
let input = "--BEGIN data-----
-----END data-----";
assert_eq!(parse(&input), Err(PemError::MalformedFraming));
} | rust_cleaned_test_functions.jsonl/61389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
761,
2396,
287,
368,
341,
286,
1077,
1946,
284,
14482,
37588,
821,
34764,
286,
34703,
4689,
821,
15081,
876,
286,
2060,
10714,
10297,
6400,
2099,
1355,
701,
15495,
5304,
336,
1454,
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 |
#[test]
fn test_trim_end_matches() {
let tests: Vec<(_, _, _)> = vec![
("/a/b/cde/", "/", "/a/b/cde"),
("\nhello\nworld\n", "\n", "\nhello\nworld"),
(", hello, world, ", ", ", ", hello, world"),
];
for (input, pat, expected) in tests {
let mut args = HashMap::new();
args.insert("pat".to_string(), to_value(pat).unwrap());
let result = trim_end_matches(&to_value(input).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(expected).unwrap());
}
} | rust_cleaned_test_functions.jsonl/119640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
6213,
38344,
368,
341,
286,
1077,
7032,
25,
11312,
27,
41117,
8358,
716,
16018,
284,
7486,
90515,
310,
88889,
64,
3470,
2899,
450,
28105,
64657,
3521,
64,
3470,
2899,
450,
4461,
310,
51658,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fq_repr_is_zero() {
assert!(BigInteger256::from(0).is_zero());
assert!(!BigInteger256::from(1).is_zero());
assert!(!BigInteger256([0, 0, 1, 0]).is_zero());
} | rust_cleaned_test_functions.jsonl/3540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
68535,
6892,
19359,
368,
341,
262,
2060,
10297,
53219,
17,
20,
21,
486,
1499,
7,
15,
568,
285,
19359,
1423,
262,
2060,
0,
3471,
53219,
17,
20,
21,
486,
1499,
7,
16,
568,
285,
19359,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encoder_send() {
fn check_send<S: Send>(_: &S) {}
let enc = EncoderBuilder::new().build(Vec::new());
check_send(&enc);
} | rust_cleaned_test_functions.jsonl/118878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39068,
13565,
368,
341,
286,
5168,
1779,
13565,
18858,
25,
11000,
2235,
23211,
609,
50,
8,
5613,
286,
1077,
3209,
284,
55115,
3297,
486,
931,
1005,
5834,
49923,
486,
931,
1423,
286,
1779,
13565,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simpleslicedeserializer_impl() {
let data: [u8; 4] = [0; 4];
let mut v = SimpleSliceDeserializer::new(&data);
for i in 0..4 {
v.offset = i;
assert_eq!(v.offset(), i);
assert_eq!(v.avaliable(), 4 - i);
for r in 0..v.avaliable() {
v.can_read(r).unwrap();
}
assert!(matches!(
v.can_read(v.avaliable() + 1),
Err(ErrorKind::UnableToRead)
));
}
} | rust_cleaned_test_functions.jsonl/90004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6664,
642,
415,
58526,
41939,
21007,
368,
341,
262,
1077,
821,
25,
508,
84,
23,
26,
220,
19,
60,
284,
508,
15,
26,
220,
19,
935,
262,
1077,
5206,
348,
284,
8993,
33236,
80097,
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... | 3 |
#[test]
fn test_parse_int() {
assert_eq!(parse_int::<u16>(b"0"), Some(0));
assert_eq!(parse_int::<u8>(b"12"), Some(12));
assert_eq!(parse_int::<u16>(b"2018"), Some(2018));
assert_eq!(parse_int::<u32>(b"2018"), Some(2018));
assert_eq!(parse_int::<u32>(b"01d8"), None);
assert_eq!(parse_int::<u32>(b"-018"), None);
assert_eq!(parse_int::<i16>(b"0"), Some(0));
assert_eq!(parse_int::<i16>(b"-12"), Some(-12));
assert_eq!(parse_int::<i16>(b"2018"), Some(2018));
assert_eq!(parse_int::<i32>(b"-018"), Some(-18));
assert_eq!(parse_int::<i32>(b"-0d18"), None);
} | rust_cleaned_test_functions.jsonl/100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4042,
368,
341,
286,
2060,
10714,
10297,
6400,
4042,
27638,
84,
16,
21,
2235,
65,
1,
15,
3975,
4329,
7,
15,
1106,
286,
2060,
10714,
10297,
6400,
4042,
27638,
84,
23,
2235,
65,
1,
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_guide_library_rejects_mixed_length() {
let g1 = Guide::new(0, "foo-1", "ACGTCAGCATGCATGACGTT", "FOO", GuideType::Other);
let g2 = Guide::new(1, "foo-2", "GCTAGACTGGACTCTAATGCC", "FOO", GuideType::Other);
let result = GuideLibrary::new(vec![g1, g2]);
assert!(result.err().unwrap().to_string().contains("More than one guide length found"));
} | rust_cleaned_test_functions.jsonl/48768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80407,
39461,
1288,
583,
82,
717,
3286,
5118,
368,
341,
286,
1077,
342,
16,
284,
12712,
486,
931,
7,
15,
11,
330,
7975,
12,
16,
497,
330,
1706,
38,
7749,
1890,
28196,
22863,
828,
38,
1706,
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_primitive_array_gt_eq_scalar() {
cmp_i64_scalar!(
gt_eq_scalar,
vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
8,
vec![false, false, true, true, true, false, false, true, true, true]
);
} | rust_cleaned_test_functions.jsonl/36031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
37479,
10714,
41652,
368,
341,
286,
26089,
5318,
21,
19,
41652,
33673,
310,
25161,
10714,
41652,
345,
310,
7486,
20703,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
11,
220,
16,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_schema_with_currently_parsing_schema() {
let schema = Schema::parse_str(
r#"
{
"type": "record",
"name": "test",
"fields": [{
"name": "recordField",
"type": {
"type": "record",
"name": "Node",
"fields": [
{"name": "label", "type": "string"},
{"name": "children", "type": {"type": "array", "items": "Node"}}
]
}
}]
}
"#,
)
.unwrap();
let mut lookup = HashMap::new();
lookup.insert("recordField".to_owned(), 0);
let mut node_lookup = HashMap::new();
node_lookup.insert("children".to_owned(), 1);
node_lookup.insert("label".to_owned(), 0);
let expected = Schema::Record {
name: Name::new("test"),
doc: None,
fields: vec![RecordField {
name: "recordField".to_string(),
doc: None,
default: None,
schema: Schema::Record {
name: Name::new("Node"),
doc: None,
fields: vec![
RecordField {
name: "label".to_string(),
doc: None,
default: None,
schema: Schema::String,
order: RecordFieldOrder::Ascending,
position: 0,
},
RecordField {
name: "children".to_string(),
doc: None,
default: None,
schema: Schema::Array(Box::new(Schema::Ref {
name: Name::new("Node"),
})),
order: RecordFieldOrder::Ascending,
position: 1,
},
],
lookup: node_lookup,
},
order: RecordFieldOrder::Ascending,
position: 0,
}],
lookup,
};
assert_eq!(schema, expected);
let canonical_form = &schema.canonical_form();
let expected = r#"{"name":"test","type":"record","fields":[{"name":"recordField","type":{"name":"Node","type":"record","fields":[{"name":"label","type":"string"},{"name":"children","type":{"type":"array","items":"Node"}}]}}]}"#;
assert_eq!(canonical_form, &expected);
} | rust_cleaned_test_functions.jsonl/108436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
25371,
6615,
11080,
398,
620,
28598,
25371,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
2,
698,
310,
341,
394,
330,
1313,
788,
330,
8548,
756,
394,
330,
606,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_move_iter() {
let v = SmallVector::zero();
let v: Vec<int> = v.move_iter().collect();
assert_eq!(Vec::new(), v);
let v = SmallVector::one(1);
assert_eq!(vec!(1), v.move_iter().collect());
let v = SmallVector::many(vec!(1, 2, 3));
assert_eq!(vec!(1, 2, 3), v.move_iter().collect());
} | rust_cleaned_test_functions.jsonl/86520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
11723,
368,
341,
286,
1077,
348,
284,
14994,
3781,
486,
14154,
543,
286,
1077,
348,
25,
11312,
4159,
29,
284,
348,
13635,
11723,
1005,
17384,
543,
286,
2060,
10714,
10297,
10050,
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_physical_memory_map_from_u32_gets_valid_segment() {
let address: u32 = 0x1000_0000;
let expected_map: PhysicalMap = PhysicalMap::CartridgeDomain1_2;
let result_map: PhysicalMap = PhysicalMap::from_u32(address);
assert_eq!(expected_map, result_map);
} | rust_cleaned_test_functions.jsonl/77138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84980,
19195,
5376,
5673,
7300,
18,
17,
3062,
82,
8337,
28061,
368,
341,
220,
1077,
2621,
25,
575,
18,
17,
284,
220,
15,
87,
16,
15,
15,
15,
62,
15,
15,
15,
15,
280,
220,
1077,
3601,
5376,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hash_as_u64() {
let arr: Vec<u8> = (0..HASH_BYTES).map(|i| i as u8 + 1).collect();
let hash = Hash::new(&arr);
assert_eq!(CrdsFilter::hash_as_u64(&hash), 0x807060504030201);
} | rust_cleaned_test_functions.jsonl/82264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
11898,
7300,
21,
19,
368,
341,
286,
1077,
2890,
25,
11312,
34837,
23,
29,
284,
320,
15,
496,
70707,
40705,
568,
2186,
22428,
72,
91,
600,
438,
575,
23,
488,
220,
16,
568,
17384,
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... | 1 |
#[test]
fn test_export_to_json() {
let descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/0/*)";
let change_descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/1/*)";
let wallet = Wallet::new_offline(
descriptor,
Some(change_descriptor),
Network::Bitcoin,
get_test_db(),
)
.unwrap();
let export = WalletExport::export_wallet(&wallet, "Test Label", true).unwrap();
assert_eq!(export.to_string(), "{\"descriptor\":\"wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44\'/0\'/0\'/0/*)\",\"blockheight\":5000,\"label\":\"Test Label\"}");
} | rust_cleaned_test_functions.jsonl/21477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27114,
2346,
9455,
368,
341,
286,
1077,
16414,
284,
330,
8421,
30664,
2075,
649,
85,
24,
82,
17,
16,
57,
81,
48,
39,
16,
19,
18,
42,
19,
1162,
65,
21,
18,
36,
64,
44,
87,
5580,
16,
56,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_persist_app() {
block_on(async {
let config = config_generator();
let storage = Rc::new(Mutex::new(MemStorage::new()));
let app_set = make_test_app_set();
StateMachineBuilder::new(
StubPolicyEngine,
StubHttpRequest,
StubInstaller::default(),
StubTimer,
StubMetricsReporter,
Rc::clone(&storage),
config,
app_set.clone(),
)
.oneshot_check(CheckOptions::default())
.await
.map(|_| ())
.collect::<()>()
.await;
let storage = storage.lock().await;
let apps = app_set.to_vec().await;
storage.get_string(&apps[0].id).await.unwrap();
assert!(storage.committed());
});
} | rust_cleaned_test_functions.jsonl/126411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4975,
8191,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5819,
284,
81463,
486,
931,
3189,
9371,
486,
931,
3189,
336,
5793,
486,
931,
7392,
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_decode_tokens() -> Result<(), io::Error> {
// Given
let mut vocab_file = tempfile::NamedTempFile::new()?;
write!(vocab_file, "{{\"hello\": 1,\n \"world\": 0,\n \"<unk>\": 2,\n \"!\": 3\n}}")?;
let path = vocab_file.into_temp_path();
let openai_gpt_vocab = OpenAiGptVocab::from_file(path.to_path_buf().to_str().unwrap());
assert_eq!(openai_gpt_vocab.id_to_token(&(1 as i64)), "hello");
assert_eq!(openai_gpt_vocab.id_to_token(&(0 as i64)), "world");
assert_eq!(openai_gpt_vocab.id_to_token(&(3 as i64)), "!");
assert_eq!(openai_gpt_vocab.id_to_token(&(2 as i64)), "<unk>");
drop(path);
Ok(())
} | rust_cleaned_test_functions.jsonl/25062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
28838,
368,
1464,
5714,
68843,
6399,
486,
1454,
29,
341,
322,
286,
16246,
198,
286,
1077,
5206,
23820,
2458,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
94136,
286,
3270,
10297,
86847,
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... | 3 |
#[test]
fn test_parallel_vs_sequential() {
let prod_ctor = || (0u32..100);
let xform_ctor = || do_some_work;
let result_xform = |acc: u32, x| acc.wrapping_add(x);
let prod = prod_ctor();
let par_r =
ParallelIterator::new(prod_ctor, xform_ctor).fold(0, &result_xform);
let seq_r = prod.map(do_some_work).fold(0, &result_xform);
assert_eq!(par_r, seq_r);
} | rust_cleaned_test_functions.jsonl/57636 | {
"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,
60625,
42434,
3453,
15838,
368,
341,
286,
1077,
14475,
54185,
284,
1369,
320,
15,
84,
18,
17,
496,
16,
15,
15,
317,
286,
1077,
856,
627,
54185,
284,
1369,
653,
61855,
11498,
280,
286,
1077,
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... | 3 |
#[test]
fn test_no_maturity_increase_if_no_proposal() {
// Single neuron
assert_eq!(compute_maturities(vec![1], Vec::<&str>::new()), vec![0]);
// Two neurons
assert_eq!(
compute_maturities(vec![1, 5], Vec::<&str>::new()),
vec![0, 0]
);
} | rust_cleaned_test_functions.jsonl/1132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
717,
37854,
73807,
11119,
6536,
21663,
32556,
368,
341,
262,
442,
11327,
48284,
198,
262,
2060,
10714,
10297,
27706,
717,
2628,
1361,
25592,
20703,
16,
1125,
11312,
27638,
5,
495,
6831,
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_neuron_action_is_not_authorized() {
local_test_on_sns_subnet(|runtime| async move {
let neuron_owner = Sender::from_keypair(&TEST_USER1_KEYPAIR);
let unauthorized_caller = Sender::from_keypair(&TEST_USER2_KEYPAIR);
let neuron_owner_account_identifier =
AccountIdentifier::from(neuron_owner.get_principal_id());
let alloc = Tokens::from_tokens(1000).unwrap();
let system_params = NervousSystemParameters {
neuron_claimer_permissions: Some(NeuronPermissionList {
permissions: NeuronPermissionType::all(),
}),
..NervousSystemParameters::with_default_values()
};
let sns_init_payload = SnsInitPayloadsBuilder::new()
.with_ledger_account(neuron_owner_account_identifier, alloc)
.with_nervous_system_parameters(system_params)
.build();
let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await;
// Stake and claim a neuron capable of making a proposal
let neuron_owner_nid = sns_canisters
.stake_and_claim_neuron(&neuron_owner, Some(ONE_YEAR_SECONDS as u32))
.await;
// Get that neuron's subaccount
let neuron_owner_subaccount = neuron_owner_nid
.subaccount()
.expect("Error creating the subaccount");
let proposal_payload = Proposal {
title: "Motion to delete this SNS".into(),
action: Some(Action::Motion(Motion {
motion_text: "I'm a bad actor and this should not be tolerated".into(),
})),
..Default::default()
};
let manage_neuron_response: ManageNeuronResponse = sns_canisters
.governance
.update_from_sender(
"manage_neuron",
candid_one,
ManageNeuron {
subaccount: neuron_owner_subaccount.to_vec(),
command: Some(Command::MakeProposal(proposal_payload)),
},
&unauthorized_caller,
)
.await
.expect("Error calling manage_neuron");
match manage_neuron_response.command.unwrap() {
CommandResponse::Error(e) => assert_eq!(e.error_type, ErrorType::NotAuthorized as i32),
response => panic!("Unexpected response, {:?}", response),
}
Ok(())
});
} | rust_cleaned_test_functions.jsonl/107250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
36090,
7931,
6892,
7913,
62,
19084,
368,
341,
262,
2205,
4452,
4470,
643,
4412,
95681,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
48284,
29027,
284,
54610,
486,
1499,
3097,
12670,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_message_unique_program_ids() {
let program_id0 = Pubkey::default();
let program_ids = get_program_ids(&[
Instruction::new_with_bincode(program_id0, &0, vec![]),
Instruction::new_with_bincode(program_id0, &0, vec![]),
]);
assert_eq!(program_ids, vec![program_id0]);
} | rust_cleaned_test_functions.jsonl/55512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
21218,
25096,
8077,
368,
341,
286,
1077,
2025,
842,
15,
284,
22611,
792,
486,
2258,
543,
286,
1077,
2025,
8077,
284,
633,
25096,
8077,
2099,
9640,
310,
29051,
486,
931,
6615,
21816,
1851,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lograte_env() {
assert_ne!(DEFAULT_LOG_RATE, 0);
let _writelock = get_env_lock().write();
static mut COUNTER: Counter = create_counter!("test_lograte_env", 0, 1);
env::set_var("SOLANA_DEFAULT_LOG_RATE", "50");
inc_counter!(COUNTER, Level::Error, 2);
unsafe {
assert_eq!(COUNTER.lograte.load(Ordering::Relaxed), 50);
}
static mut COUNTER2: Counter = create_counter!("test_lograte_env", 0, 1);
env::set_var("SOLANA_DEFAULT_LOG_RATE", "0");
inc_counter!(COUNTER2, Level::Error, 2);
unsafe {
assert_eq!(COUNTER2.lograte.load(Ordering::Relaxed), DEFAULT_LOG_RATE);
}
} | rust_cleaned_test_functions.jsonl/92061 | {
"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,
5224,
7698,
15879,
368,
341,
286,
2060,
13925,
10297,
17285,
8419,
29108,
11,
220,
15,
317,
286,
1077,
716,
86,
58962,
1176,
284,
633,
15879,
9818,
1005,
4934,
543,
286,
1099,
5206,
356,
35019,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_containing() {
let mut map = HashMap::new();
map.insert("hey", 1);
let tests = vec![
(to_value("hello world").unwrap(), to_value("hel").unwrap(), true),
(to_value("hello world").unwrap(), to_value("hol").unwrap(), false),
(to_value(vec![1, 2, 3]).unwrap(), to_value(3).unwrap(), true),
(to_value(vec![1, 2, 3]).unwrap(), to_value(4).unwrap(), false),
(to_value(map.clone()).unwrap(), to_value("hey").unwrap(), true),
(to_value(map.clone()).unwrap(), to_value("ho").unwrap(), false),
];
for (container, needle, expected) in tests {
assert_eq!(containing(Some(&container), &[needle]).unwrap(), expected);
}
} | rust_cleaned_test_functions.jsonl/125455 | {
"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,
10260,
2056,
368,
341,
286,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
286,
2415,
7030,
445,
35561,
497,
220,
16,
626,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
983,
3142,
445,
14990,
1879,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_slice_serialize_deserialize() {
let config = ReadConfig {
error_on_trailing_bytes: true,
};
let test = Test {
slice: b"Hello there",
};
let mut slice = [0u8; 1024];
let length = binver::write_to_slice(&mut slice, &test).unwrap();
assert_eq!(slice[6..10], (test.slice.len() as u32).to_be_bytes());
assert_eq!(&slice[..length][10..], test.slice);
let result: Test = binver::deserialize_slice_with_config(&slice[..length], config).unwrap();
assert_eq!(result.slice, b"Hello there");
} | rust_cleaned_test_functions.jsonl/103509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
88686,
15768,
9050,
368,
341,
262,
1077,
2193,
284,
4457,
2648,
341,
286,
1465,
4470,
3547,
14277,
12524,
25,
830,
345,
262,
3634,
262,
1077,
1273,
284,
3393,
341,
286,
15983,
25,
293,
1,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_algo_with_prefix_to_url() {
let mock_client = mock_client();
let algorithm = mock_client.algo("algo://anowell/Pinky/0.1");
assert_eq!(
algorithm.to_url().unwrap().path(),
"/v1/algo/anowell/Pinky/0.1"
);
} | rust_cleaned_test_functions.jsonl/692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76993,
6615,
13974,
2346,
2903,
368,
341,
286,
1077,
7860,
8179,
284,
7860,
8179,
543,
286,
1077,
12111,
284,
7860,
8179,
12168,
3346,
445,
72464,
1110,
276,
79499,
16341,
38034,
14,
15,
13,
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_get_dependencies() {
fn do_check(toml: &str, expected: Vec<Dependency>) {
let cargo_toml = CargoToml::new(toml).unwrap();
assert_eq!(cargo_toml.dependencies(), expected);
}
do_check(r#"
[dependencies]
foo = "1.0"
bar = { git = "https://example.com" }
[dependencies.baz]
version = "2.0"
git = "https://example.com"
branch = "dev"
"#, vec![
Dependency {
name: "bar".to_string(),
optional: false,
source: DependencySource::Git {
url: "https://example.com".to_string(),
version: None,
branch: None,
},
},
Dependency {
name: "baz".to_string(),
optional: false,
source: DependencySource::Git {
url: "https://example.com".to_string(),
version: Some("2.0".to_string()),
branch: Some("dev".to_string()),
},
},
Dependency {
name: "foo".to_string(),
optional: false,
source: DependencySource::Version("1.0".to_string()),
},
]);
do_check(r#"
dependencies = { foo = "1.0", bar = { git = "https://example.com" } }
"#, vec![
Dependency {
name: "bar".to_string(),
optional: false,
source: DependencySource::Git {
url: "https://example.com".to_string(),
version: None,
branch: None,
},
},
Dependency {
name: "foo".to_string(),
optional: false,
source: DependencySource::Version("1.0".to_string()),
},
]);
do_check(r#"
dependencies.foo = "1.0"
dependencies.bar.git = "https://example.com"
dependencies.bar.version = "2.0"
dependencies.baz = { version = "9.2" }
"#, vec![
Dependency {
name: "bar".to_string(),
optional: false,
source: DependencySource::Git {
url: "https://example.com".to_string(),
version: Some("2.0".to_string()),
branch: None,
},
},
Dependency {
name: "baz".to_string(),
optional: false,
source: DependencySource::Version("9.2".to_string()),
},
Dependency {
name: "foo".to_string(),
optional: false,
source: DependencySource::Version("1.0".to_string()),
},
]);
do_check(r#"
[dependencies]
bar.git = "https://example.com"
bar.version = "2.0"
"#, vec![Dependency {
name: "bar".to_string(),
optional: false,
source: DependencySource::Git {
url: "https://example.com".to_string(),
version: Some("2.0".to_string()),
branch: None,
},
}]);
} | rust_cleaned_test_functions.jsonl/99638 | {
"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,
3062,
71841,
368,
341,
262,
5168,
653,
7200,
1155,
316,
75,
25,
609,
495,
11,
3601,
25,
11312,
27,
36387,
9231,
341,
286,
1077,
25652,
528,
316,
75,
284,
61288,
24732,
75,
486,
931,
1155,
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_main_thread_task() {
let myself = Process::myself().unwrap();
let task = myself.task_main_thread().unwrap();
check_unwrap(&myself, task.stat());
} | rust_cleaned_test_functions.jsonl/17534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11027,
10814,
12184,
368,
341,
262,
1077,
7037,
284,
8603,
486,
2408,
721,
1005,
15454,
543,
262,
1077,
3383,
284,
7037,
15034,
11027,
10814,
1005,
15454,
543,
262,
1779,
4907,
10097,
2099,
2408,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_json_block() {
let n = Block {
base: BaseNode::default(),
body: vec![Statement::Expr(ExprStmt {
base: BaseNode::default(),
expression: Expression::StringLit(StringLit {
base: Default::default(),
value: "hello".to_string(),
}),
})],
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"Block","body":[{"type":"ExpressionStatement","expression":{"type":"StringLiteral","value":"hello"}}]}"#
);
let deserialized: Block = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
7113,
368,
341,
262,
1077,
308,
284,
8362,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
2487,
25,
7486,
20703,
8636,
486,
16041,
7,
16041,
31063,
341,
310,
2331,
25,
5351,
1955,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_auto_import_split_common_target_longer() {
check_assist(
add_import,
"
use std::fmt::Debug;
impl std::fmt::nested::Display<|> for Foo {
}
",
"
use std::fmt::{ nested::Display, Debug};
impl Display<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/39957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
18434,
17052,
21107,
11123,
17799,
261,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
18434,
345,
310,
6228,
810,
1460,
486,
12501,
486,
7939,
401,
6383,
1460,
486,
12501,
486,
59271,
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... | 1 |
#[test]
fn test_disk_backing_file_helper() {
let num_sectors = 2;
let f = TempFile::new().unwrap();
let size = SECTOR_SIZE * num_sectors;
f.as_file().set_len(size).unwrap();
let disk_properties =
DiskProperties::new(String::from(f.as_path().to_str().unwrap()), true).unwrap();
assert_eq!(size, SECTOR_SIZE * num_sectors);
assert_eq!(disk_properties.nsectors, num_sectors);
let cfg = disk_properties.virtio_block_config_space();
assert_eq!(cfg.len(), CONFIG_SPACE_SIZE);
for (i, byte) in cfg.iter().enumerate() {
assert_eq!(*byte, (num_sectors >> (8 * i)) as u8);
}
assert!(DiskProperties::new("invalid-disk-path".to_string(), true).is_err());
} | rust_cleaned_test_functions.jsonl/73913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41687,
3895,
287,
2458,
10418,
368,
341,
286,
1077,
1629,
3453,
12532,
284,
220,
17,
280,
286,
1077,
282,
284,
19944,
1703,
486,
931,
1005,
15454,
543,
286,
1077,
1379,
284,
5052,
26275,
4098,
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... | 2 |
#[test]
fn test_vcx_schema_get_attrs_with_pool() {
let _setup = SetupLibraryWalletPoolZeroFees::init();
let (schema_id, _) = libindy::utils::anoncreds::tests::create_and_write_test_schema(utils::constants::DEFAULT_SCHEMA_ATTRS);
let cb = return_types_u32::Return_U32_U32_STR::new().unwrap();
assert_eq!(vcx_schema_get_attributes(cb.command_handle,
CString::new("Test Source ID").unwrap().into_raw(),
CString::new(schema_id).unwrap().into_raw(),
Some(cb.get_callback())), error::SUCCESS.code_num);
let (_err, attrs) = cb.receive(TimeoutUtils::some_short()).unwrap();
let mut result_vec = vec!(attrs.clone().unwrap());
let mut expected_vec = vec!(DEFAULT_SCHEMA_ATTRS);
assert_eq!(result_vec.sort(), expected_vec.sort());
} | rust_cleaned_test_functions.jsonl/118201 | {
"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,
2273,
25844,
25371,
3062,
39578,
6615,
15709,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16915,
38259,
10551,
17999,
37,
5516,
486,
2327,
1428,
286,
1077,
320,
17349,
842,
11,
27439,
284,
3051,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_maximum_too_low() {
let array = [0u8; 2048];
FastCDC::new(&array, 64, 256, 1023);
} | rust_cleaned_test_functions.jsonl/32055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93581,
2346,
78,
23767,
368,
341,
286,
1077,
1334,
284,
508,
15,
84,
23,
26,
220,
17,
15,
19,
23,
935,
286,
17288,
73458,
486,
931,
2099,
1653,
11,
220,
21,
19,
11,
220,
17,
20,
21,
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 |
#[test]
fn test_verify_root_mismatch() {
let (root, proof, _) = test_generate_proof::<NoExtensionLayout>(
test_entries(),
vec![b"bravo"],
);
let items = vec![
(b"bravo", Some("incorrect")),
];
match verify_proof::<NoExtensionLayout, _, _, _>(&root, &proof, items.iter()) {
Err(VerifyError::RootMismatch(_)) => {}
result => panic!("expected VerifyError::RootMismatch, got {:?}", result),
}
} | rust_cleaned_test_functions.jsonl/56662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
12993,
717,
24976,
368,
341,
10217,
320,
2888,
11,
11064,
11,
27439,
284,
1273,
48851,
86757,
27638,
2753,
12049,
2175,
17055,
197,
18185,
26092,
3148,
197,
40213,
20703,
65,
1,
1323,
27217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_less_than() {
assert_expression!(
"A < B",
Expression::BinaryExpression(
Operator::Less,
Box::new("A".as_var_expr(1, 7)),
Box::new("B".as_var_expr(1, 11)),
ExpressionType::Unresolved
)
);
} | rust_cleaned_test_functions.jsonl/102631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50747,
51613,
368,
341,
286,
2060,
28068,
33673,
310,
330,
32,
366,
425,
756,
310,
16378,
486,
21338,
9595,
1006,
394,
28498,
486,
27451,
345,
394,
8261,
486,
931,
445,
32,
3263,
300,
4612,
2191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encode_bytes_compare() {
let pairs: Vec<(&[u8], &[u8], _)> = vec![
(b"", b"\x00", Ordering::Less),
(b"\x00", b"\x00", Ordering::Equal),
(b"\xFF", b"\x00", Ordering::Greater),
(b"\xFF", b"\xFF\x00", Ordering::Less),
(b"a", b"b", Ordering::Less),
(b"a", b"\x00", Ordering::Greater),
(b"\x00", b"\x01", Ordering::Less),
(b"\x00\x01", b"\x00\x00", Ordering::Greater),
(b"\x00\x00\x00", b"\x00\x00", Ordering::Greater),
(b"\x00\x00\x00", b"\x00\x00", Ordering::Greater),
(
b"\x00\x00\x00\x00\x00\x00\x00\x00",
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00",
Ordering::Less,
),
(b"\x01\x02\x03\x00", b"\x01\x02\x03", Ordering::Greater),
(b"\x01\x03\x03\x04", b"\x01\x03\x03\x05", Ordering::Less),
(
b"\x01\x02\x03\x04\x05\x06\x07",
b"\x01\x02\x03\x04\x05\x06\x07\x08",
Ordering::Less,
),
(
b"\x01\x02\x03\x04\x05\x06\x07\x08\x09",
b"\x01\x02\x03\x04\x05\x06\x07\x08",
Ordering::Greater,
),
(
b"\x01\x02\x03\x04\x05\x06\x07\x08\x00",
b"\x01\x02\x03\x04\x05\x06\x07\x08",
Ordering::Greater,
),
];
for (x, y, ord) in pairs {
assert_eq!(encode_bytes(x).cmp(&encode_bytes(y)), ord);
assert_eq!(
encode_bytes_desc(x).cmp(&encode_bytes_desc(y)),
ord.reverse()
);
}
} | rust_cleaned_test_functions.jsonl/55211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
12524,
32235,
368,
341,
286,
1077,
13530,
25,
11312,
27,
2099,
58,
84,
23,
1125,
44590,
84,
23,
1125,
716,
16018,
284,
7486,
90515,
310,
320,
65,
56323,
293,
11934,
87,
15,
15,
497,
686... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_config_defaults_with_serialization() {
let _ = env_logger::builder().is_test(true).try_init();
if serde_json::from_str::<ConfigurationSpec>(r#"{}"#).is_ok() {
panic!("discovery handler is required");
}
serde_json::from_str::<ConfigurationSpec>(
r#"{"discoveryHandler":{"name":"random", "discoveryDetails":"serialized details"}}"#,
)
.unwrap();
if serde_json::from_str::<ConfigurationSpec>(r#"{"discoveryHandler":{"name":"random"}}"#)
.is_err()
{
panic!("discovery details are not required");
}
if serde_json::from_str::<ConfigurationSpec>(r#"{"discoveryHandler":{}}"#).is_ok() {
panic!("discovery handler name is required");
}
let json = r#"{"discoveryHandler":{"name":"onvif", "discoveryDetails":"{\"onvif\":{}}"}}"#;
let deserialized: ConfigurationSpec = serde_json::from_str(json).unwrap();
assert_eq!(default_capacity(), deserialized.capacity);
assert_eq!(None, deserialized.broker_pod_spec);
assert_eq!(None, deserialized.instance_service_spec);
assert_eq!(None, deserialized.configuration_service_spec);
assert_eq!(0, deserialized.broker_properties.len());
} | rust_cleaned_test_functions.jsonl/34768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
42290,
6615,
25602,
2022,
368,
341,
286,
1077,
716,
284,
6105,
27413,
486,
17850,
1005,
285,
4452,
3715,
568,
1539,
6137,
1428,
286,
421,
61570,
9455,
486,
1499,
2895,
27638,
7688,
8327,
223... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_update_epoch_slots_new_root() {
let mut current_root = 0;
let mut completed_slots = BTreeSet::new();
let node_info = Node::new_localhost_with_address(&BvmAddr::default());
let node_group_info = RwLock::new(NodeGroupInfo::new_with_invalid_keypair(
node_info.info.clone(),
));
let my_address = BvmAddr::new_rand();
let (completed_slots_sender, completed_slots_receiver) = channel();
// Send a new slot before the root is updated
let newly_completed_slot = 63;
completed_slots_sender
.send(vec![newly_completed_slot])
.unwrap();
FixService::update_epoch_slots(
my_address.clone(),
current_root,
&mut current_root.clone(),
&mut completed_slots,
&node_group_info,
&completed_slots_receiver,
);
// We should see epoch state update
let (my_epoch_slots_in_gossip, updated_ts) = {
let r_node_group_info = node_group_info.read().unwrap();
let (my_epoch_slots_in_gossip, updated_ts) = r_node_group_info
.get_epoch_state_for_node(&my_address, None)
.clone()
.unwrap();
(my_epoch_slots_in_gossip.clone(), updated_ts)
};
assert_eq!(my_epoch_slots_in_gossip.root, 0);
assert_eq!(current_root, 0);
assert_eq!(my_epoch_slots_in_gossip.slots.len(), 1);
assert!(my_epoch_slots_in_gossip
.slots
.contains(&newly_completed_slot));
// Calling update again with no updates to either the roots or set of completed slots
// should not update gossip
FixService::update_epoch_slots(
my_address.clone(),
current_root,
&mut current_root,
&mut completed_slots,
&node_group_info,
&completed_slots_receiver,
);
assert!(node_group_info
.read()
.unwrap()
.get_epoch_state_for_node(&my_address, Some(updated_ts))
.is_none());
sleep(Duration::from_millis(10));
// Updating just the root again should update gossip (simulates replay phase updating root
// after a slot has been signaled as completed)
FixService::update_epoch_slots(
my_address.clone(),
current_root + 1,
&mut current_root,
&mut completed_slots,
&node_group_info,
&completed_slots_receiver,
);
let r_node_group_info = node_group_info.read().unwrap();
let (my_epoch_slots_in_gossip, _) = r_node_group_info
.get_epoch_state_for_node(&my_address, Some(updated_ts))
.clone()
.unwrap();
// Check the root was updated correctly
assert_eq!(my_epoch_slots_in_gossip.root, 1);
assert_eq!(current_root, 1);
assert_eq!(my_epoch_slots_in_gossip.slots.len(), 1);
assert!(my_epoch_slots_in_gossip
.slots
.contains(&newly_completed_slot));
} | rust_cleaned_test_functions.jsonl/20953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
20682,
54161,
5921,
12993,
368,
341,
286,
1077,
5206,
1482,
12993,
284,
220,
15,
401,
286,
1077,
5206,
8145,
54161,
284,
425,
6533,
1649,
486,
931,
543,
286,
1077,
2436,
3109,
284,
6018,
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_list_in_out() {
#[api_v2_schema]
#[derive(Serialize, Deserialize)]
enum Sort {
Asc,
Desc,
}
#[api_v2_schema]
#[derive(Serialize, Deserialize)]
struct Params {
sort: Option<Sort>,
limit: Option<u16>,
}
#[api_v2_operation]
fn get_pets(_q: web::Query<Params>) -> web::Json<Vec<Pet>> {
unimplemented!();
}
run_and_check_app(
|| {
App::new()
.wrap_api()
.with_json_spec_at("/api/spec")
.service(web::resource("/pets").route(web::get().to(get_pets)))
.build()
},
|addr| {
let mut resp = CLIENT
.get(&format!("http://{}/api/spec", addr))
.send()
.expect("request failed?");
check_json(
&mut resp,
json!({
"definitions": {
"Pet": {
"properties": {
"class": {
"enum": ["Dog", "Cat", "EverythingElse"],
"type": "string"
},
"id": {
"format": "int64",
"type": "integer"
},
"name": {
"type": "string"
},
"updated": {
"format": "date-time",
"type": "string"
},
"uid": {
"format": "uuid",
"type": "string"
}
},
"required":["class", "name", "updated"]
}
},
"paths": {
"/pets": {
"get": {
"responses": {
"200": {
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
}
}
},
"parameters": [{
"format": "int32",
"in": "query",
"name": "limit",
"type": "integer"
}, {
"enum": ["Asc", "Desc"],
"in": "query",
"name": "sort",
"type": "string"
}],
}
},
"swagger": "2.0"
}),
);
},
);
} | rust_cleaned_test_functions.jsonl/95584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
1243,
6068,
368,
341,
262,
11506,
2068,
2273,
17,
25371,
921,
262,
11506,
27098,
3759,
9050,
11,
48440,
5563,
262,
7618,
15967,
341,
286,
39560,
345,
286,
31185,
345,
262,
555,
262,
11506,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_internal_fn_big() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(
engine.eval::<INT>(
"
fn math_me(a, b, c, d, e, f) {
a - b * c + d * e - f
}
math_me(100, 5, 2, 9, 6, 32)
",
)?,
112
);
Ok(())
} | rust_cleaned_test_functions.jsonl/131007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23472,
15246,
36386,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
33673,
286,
4712,
31710,
27638,
3221,
17055,
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... | 2 |
#[test]
fn test_send_generic_message_fails_with_invalid_connection() {
init!("true");
let handle = ::connection::tests::build_test_connection();
match send_generic_message(handle, "this is the message", "type", "title") {
Ok(x) => panic!("test shoudl fail: {}", x),
Err(x) => assert_eq!(x, error::NOT_READY.code_num),
};
} | rust_cleaned_test_functions.jsonl/75280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
41232,
6462,
761,
6209,
6615,
31433,
15866,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
3504,
7742,
486,
23841,
486,
5834,
4452,
15866,
1428,
286,
2432,
3624,
41232,
6462,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_or_as_filename() {
new_ucmd!()
.args(&["x", "-a", "-z", "-o"])
.run()
.status_code(1);
} | rust_cleaned_test_functions.jsonl/11035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
11898,
13323,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
87,
497,
6523,
64,
497,
6523,
89,
497,
6523,
78,
14108,
286,
659,
6108,
741,
286,
659,
2829,
4136,
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 |
#[test]
fn test_direct_read_write() {
let path = tempdir_with_prefix("_rust_rocksdb_direct_read_write");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
opts.set_use_direct_reads(true);
opts.set_use_direct_io_for_flush_and_compaction(true);
DB::open(opts, path.path().to_str().unwrap()).unwrap();
} | rust_cleaned_test_functions.jsonl/34112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32871,
6443,
9165,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
32871,
6443,
9165,
797,
262,
1077,
5206,
12185,
284,
5952,
3798,
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,
1... | 1 |
#[test]
fn test_from_angle_x() {
let angle: Radians<f64> = Radians::full_turn_div_4();
let unit_y = Vector3::unit_y();
let unit_z = Vector3::unit_z();
let matrix = Matrix4x4::from_affine_angle_x(angle);
let expected = unit_z.extend(0.0);
let result = matrix * unit_y.extend(0.0);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/129124 | {
"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,
5673,
21727,
3212,
368,
341,
286,
1077,
9210,
25,
431,
20736,
63895,
21,
19,
29,
284,
431,
20736,
486,
8878,
37274,
16237,
62,
19,
543,
286,
1077,
4982,
4178,
284,
4196,
18,
486,
3843,
4178,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_drop_panic() {
let (array, receiver) = default_drop();
assert_eq!(receiver.try_recv().ok(), None);
let result = thread::spawn(move || {
array.set(DroppableElement::new(1, None));
})
.join();
assert!(result.is_err());
let indices = receiver.iter().collect::<Vec<_>>();
assert_eq!(indices.len(), 1);
assert_eq!(indices[0], 0);
} | rust_cleaned_test_functions.jsonl/13511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
620,
31270,
368,
341,
286,
1077,
320,
1653,
11,
13964,
8,
284,
1638,
29584,
1428,
286,
2060,
10714,
10297,
37553,
48779,
36118,
1005,
562,
1507,
2240,
626,
286,
1077,
1102,
284,
4516,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_valid_password() {
assert_eq!(is_valid_password(112233), true);
assert_eq!(is_valid_password(123444), false);
assert_eq!(is_valid_password(111122), true);
} | rust_cleaned_test_functions.jsonl/82656 | {
"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,
6892,
8337,
10122,
368,
341,
6948,
10714,
10297,
285,
8337,
10122,
7,
16,
16,
17,
17,
18,
18,
701,
830,
317,
6948,
10714,
10297,
285,
8337,
10122,
7,
16,
17,
18,
19,
19,
19,
701,
895,
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 |
#[test]
fn test_call_hierarchy_on_def() {
check_hierarchy(
r#"
//- /lib.rs
fn call$0ee() {}
fn caller() {
callee();
}
"#,
expect![["callee Function FileId(0) 0..14 3..9"]],
expect![["caller Function FileId(0) 15..44 18..24 : [33..39]"]],
expect![[]],
);
} | rust_cleaned_test_functions.jsonl/38285 | {
"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,
13429,
95043,
4470,
7844,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
8822,
1618,
3,
15,
2127,
368,
5613,
8822,
19865,
368,
341,
262,
94800,
543,
532,
57676... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_special_tokens() {
let trainer = UnigramTrainerBuilder::default()
.show_progress(false)
.special_tokens(vec![
AddedToken::from("[SEP]", true),
AddedToken::from("[CLS]", true),
])
.build()
.unwrap();
let (unigram, _) = trainer
.train(HashMap::from_iter(vec![
("The".into(), 12),
("are".into(), 11),
]))
.unwrap();
let mut pieces = unigram.iter();
assert_eq!(pieces.next(), Some(&("[SEP]".into(), 0.0)));
assert_eq!(pieces.next(), Some(&("[CLS]".into(), 0.0)));
} | rust_cleaned_test_functions.jsonl/18988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41629,
28838,
368,
341,
286,
1077,
28894,
284,
1230,
49127,
1282,
1743,
3297,
486,
2258,
741,
310,
659,
3445,
27200,
3576,
340,
310,
659,
15144,
28838,
25592,
90515,
394,
17684,
3323,
486,
1499,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arginfo_cmp() {
let info = flag!("-foo", FooFlag);
assert_eq!(info.cmp("-foo"), Ordering::Equal);
assert_eq!(info.cmp("bar"), Ordering::Less);
assert_eq!(info.cmp("-bar"), Ordering::Greater);
assert_eq!(info.cmp("-qux"), Ordering::Less);
assert_eq!(info.cmp("-foobar"), Ordering::Less);
assert_eq!(info.cmp("-foo="), Ordering::Less);
assert_eq!(info.cmp("-foo=bar"), Ordering::Less);
let info = take_arg!("-foo", OsString, Separated, Foo);
assert_eq!(info.cmp("-foo"), Ordering::Equal);
assert_eq!(info.cmp("bar"), Ordering::Less);
assert_eq!(info.cmp("-bar"), Ordering::Greater);
assert_eq!(info.cmp("-qux"), Ordering::Less);
assert_eq!(info.cmp("-foobar"), Ordering::Less);
assert_eq!(info.cmp("-foo="), Ordering::Less);
assert_eq!(info.cmp("-foo=bar"), Ordering::Less);
let info = take_arg!("-foo", OsString, Concatenated, Foo);
assert_eq!(info.cmp("-foo"), Ordering::Equal);
assert_eq!(info.cmp("bar"), Ordering::Less);
assert_eq!(info.cmp("-bar"), Ordering::Greater);
assert_eq!(info.cmp("-qux"), Ordering::Less);
assert_eq!(info.cmp("-foobar"), Ordering::Equal);
assert_eq!(info.cmp("-foo="), Ordering::Equal);
assert_eq!(info.cmp("-foo=bar"), Ordering::Equal);
let info = take_arg!("-foo", OsString, Concatenated('='), Foo);
assert_eq!(info.cmp("-foo"), Ordering::Equal);
assert_eq!(info.cmp("bar"), Ordering::Less);
assert_eq!(info.cmp("-bar"), Ordering::Greater);
assert_eq!(info.cmp("-qux"), Ordering::Less);
assert_eq!(info.cmp("-foobar"), Ordering::Greater);
assert_eq!(info.cmp("-foo="), Ordering::Equal);
assert_eq!(info.cmp("-foo=bar"), Ordering::Equal);
let info = take_arg!("-foo", OsString, CanBeSeparated, Foo);
assert_eq!(info.cmp("-foo"), Ordering::Equal);
assert_eq!(info.cmp("bar"), Ordering::Less);
assert_eq!(info.cmp("-bar"), Ordering::Greater);
assert_eq!(info.cmp("-qux"), Ordering::Less);
assert_eq!(info.cmp("-foobar"), Ordering::Equal);
assert_eq!(info.cmp("-foo="), Ordering::Equal);
assert_eq!(info.cmp("-foo=bar"), Ordering::Equal);
let info = take_arg!("-foo", OsString, CanBeSeparated('='), Foo);
assert_eq!(info.cmp("-foo"), Ordering::Equal);
assert_eq!(info.cmp("bar"), Ordering::Less);
assert_eq!(info.cmp("-bar"), Ordering::Greater);
assert_eq!(info.cmp("-qux"), Ordering::Less);
assert_eq!(info.cmp("-foobar"), Ordering::Greater);
assert_eq!(info.cmp("-foo="), Ordering::Equal);
assert_eq!(info.cmp("-foo=bar"), Ordering::Equal);
} | rust_cleaned_test_functions.jsonl/16227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6057,
2733,
35193,
368,
341,
286,
1077,
3546,
284,
5181,
0,
13645,
7975,
497,
33428,
12135,
317,
286,
2060,
10714,
10297,
2733,
520,
1307,
13645,
7975,
3975,
68621,
486,
2993,
317,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_superclass() {
let hdr = indoc! {"
#include <memory>
class A {
public:
virtual void foo() const {};
virtual ~A() {}
};
class B : public A {
public:
void bar() const {}
};
inline std::unique_ptr<B> get_b() { return std::make_unique<B>(); }
"};
let rs = quote! {
let b = ffi::get_b();
b.as_ref().unwrap().as_ref().foo();
};
run_test("", hdr, rs, &["A", "B", "get_b"], &[]);
} | rust_cleaned_test_functions.jsonl/9975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
38886,
1040,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
17269,
397,
262,
536,
362,
341,
262,
584,
510,
286,
4108,
737,
15229,
368,
733,
9321,
286,
4108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pacemaker_time_interval() {
let interval = ExponentialTimeInterval::new(Duration::from_millis(3000), 1.5, 2);
assert_eq!(3000, interval.get_round_duration(0).as_millis());
assert_eq!(4500, interval.get_round_duration(1).as_millis());
assert_eq!(
6750,
interval.get_round_duration(2).as_millis()
);
// Test that there is no integer overflow
assert_eq!(6750, interval.get_round_duration(1000).as_millis());
} | rust_cleaned_test_functions.jsonl/9071 | {
"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,
620,
580,
58675,
3009,
20541,
368,
341,
262,
1077,
9873,
284,
1374,
59825,
68041,
486,
931,
64114,
486,
1499,
717,
56212,
7,
18,
15,
15,
15,
701,
220,
16,
13,
20,
11,
220,
17,
317,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_subsequences() {
assert_eq!(
Solution::find_subsequences(vec![4, 6, 7, 7]),
vec![
vec![4, 6],
vec![4, 6, 7],
vec![4, 6, 7, 7],
vec![4, 7],
vec![4, 7, 7],
vec![6, 7],
vec![6, 7, 7],
vec![7, 7]
]
);
assert_eq!(
Solution::find_subsequences(vec![4, 4, 3, 2, 1]),
vec![vec![4, 4]]
);
} | rust_cleaned_test_functions.jsonl/60427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5228,
61708,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
3903,
5228,
61708,
25592,
20703,
19,
11,
220,
21,
11,
220,
22,
11,
220,
22,
17036,
310,
7486,
90515,
394,
7486,
20703,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_swab_256_test() {
new_ucmd!()
.args(&["conv=swab"])
.pipe_in_fixture("seq-byte-values.test")
.succeeds()
.stdout_is_fixture_bytes("seq-byte-values-swapped.test");
} | rust_cleaned_test_functions.jsonl/99856 | {
"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,
32581,
370,
62,
17,
20,
21,
4452,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12027,
28,
2280,
370,
14108,
286,
659,
13768,
1243,
74409,
445,
13262,
53952,
69050,
5958,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bloom_indexer_single_column_prune() -> Result<()> {
struct Test {
name: &'static str,
expr: Expression,
expected_eval_result: BloomFilterExprEvalResult,
}
let tests: Vec<Test> = vec![
Test {
name: "ColumnUInt8 = 34",
expr: col("ColumnUInt8").eq(lit(34u8)),
expected_eval_result: BloomFilterExprEvalResult::False,
},
Test {
name: "ColumnUInt16 = 30",
expr: col("ColumnUInt16").eq(lit(30u16)),
expected_eval_result: BloomFilterExprEvalResult::False,
},
Test {
name: "ColumnUInt32 = 12134",
expr: col("ColumnUInt32").eq(lit(12134u32)),
expected_eval_result: BloomFilterExprEvalResult::False,
},
Test {
name: "ColumnUInt64 = 21323722",
expr: col("ColumnUInt64").eq(lit(21323722_u64)),
expected_eval_result: BloomFilterExprEvalResult::False,
},
Test {
name: "ColumnString = 'batman'",
expr: col("ColumnString").eq(lit("batman".as_bytes())),
expected_eval_result: BloomFilterExprEvalResult::False,
},
];
let data_blocks = create_blocks();
let indexer = BloomFilterIndexer::from_data_and_seeds(data_blocks.as_ref(), create_seeds())?;
for test in tests {
let res = indexer.eval(&test.expr)?;
assert_eq!(res, test.expected_eval_result, "{}", test.name);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/101376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 738
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
18474,
3560,
261,
19487,
8744,
5294,
2886,
368,
1464,
5714,
71698,
341,
262,
2036,
3393,
341,
286,
829,
25,
30136,
1978,
607,
345,
286,
15169,
25,
16378,
345,
286,
3601,
21296,
5287,
25,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bounding_box() {
let layout = Layout::new(Vector::new(13, 2), Vertex::new(2, 0), 10, 10);
let s = Tile::new(3, 4);
assert_eq!(layout.bounding_box_of(s), (23, 42, 10, 10));
} | rust_cleaned_test_functions.jsonl/95168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
13586,
10194,
368,
341,
286,
1077,
6789,
284,
13821,
486,
931,
20258,
486,
931,
7,
16,
18,
11,
220,
17,
701,
23225,
486,
931,
7,
17,
11,
220,
15,
701,
220,
16,
15,
11,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spj_0_with_re() {
let task = generate_judge_task(SOURCE_RE, PROBLEM);
let judge = Judge::new();
for report in judge.judge(task) {
match report {
Report::RuntimeError => {}
res => panic!("Wrong judge result: {}", res),
}
}
} | rust_cleaned_test_functions.jsonl/52122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
73,
62,
15,
6615,
1288,
368,
341,
262,
1077,
3383,
284,
6923,
5374,
19561,
12184,
3759,
13077,
2192,
11,
5308,
69292,
317,
262,
1077,
11651,
284,
20207,
486,
931,
543,
262,
369,
1895,
304... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_intersection_size_hint() {
let x = BTreeSet::from([3, 4]);
let y = BTreeSet::from([1, 2, 3]);
let mut iter = x.intersection(&y);
assert_eq!(iter.size_hint(), (1, Some(1)));
assert_eq!(iter.next(), Some(&3));
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
iter = y.intersection(&y);
assert_eq!(iter.size_hint(), (0, Some(3)));
assert_eq!(iter.next(), Some(&1));
assert_eq!(iter.size_hint(), (0, Some(2)));
} | rust_cleaned_test_functions.jsonl/13736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
2368,
45825,
368,
341,
262,
1077,
856,
284,
425,
6533,
1649,
486,
1499,
2561,
18,
11,
220,
19,
2558,
262,
1077,
379,
284,
425,
6533,
1649,
486,
1499,
2561,
16,
11,
220,
17,
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_mut_rev_iterator() {
let mut xs = [1, 2, 3, 4, 5];
for (i, x) in xs.iter_mut().rev().enumerate() {
*x += i;
}
assert!(xs == [5, 5, 5, 5, 5])
} | rust_cleaned_test_functions.jsonl/12891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
38082,
13491,
368,
341,
262,
1077,
5206,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
369,
320,
72,
11,
856,
8,
304,
11943,
19471,
29523,
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_encode_many() {
let pems = parse_many(SAMPLE_CRLF);
let encoded = encode_many(&pems);
assert_eq!(SAMPLE_CRLF, encoded);
} | rust_cleaned_test_functions.jsonl/61397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
22101,
368,
341,
286,
1077,
281,
11852,
284,
4715,
22101,
3759,
18918,
920,
80658,
317,
286,
1077,
20498,
284,
16164,
22101,
2099,
79,
11852,
626,
286,
2060,
10714,
10297,
82725,
920,
80658,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serde_stakes_enum_compat() {
#[derive(Debug, PartialEq, Deserialize, Serialize)]
struct Dummy {
head: String,
#[serde(with = "serde_stakes_enum_compat")]
stakes: Arc<StakesEnum>,
tail: String,
}
let mut rng = rand::thread_rng();
let stakes_cache = StakesCache::new(Stakes {
unused: rng.gen(),
epoch: rng.gen(),
..Stakes::default()
});
for _ in 0..rng.gen_range(5usize, 10) {
let vote_pubkey = solana_sdk::pubkey::new_rand();
let vote_account = vote_state::create_account(
&vote_pubkey,
&solana_sdk::pubkey::new_rand(), // node_pubkey
rng.gen_range(0, 101), // commission
rng.gen_range(0, 1_000_000), // lamports
);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
for _ in 0..rng.gen_range(10usize, 20) {
let stake_pubkey = solana_sdk::pubkey::new_rand();
let rent = Rent::with_slots_per_epoch(rng.gen());
let stake_account = stake_state::create_account(
&stake_pubkey, // authorized
&vote_pubkey,
&vote_account,
&rent,
rng.gen_range(0, 1_000_000), // lamports
);
stakes_cache.check_and_store(&stake_pubkey, &stake_account);
}
}
let stakes: Stakes<StakeAccount> = stakes_cache.stakes().clone();
assert!(stakes.vote_accounts.as_ref().len() >= 5);
assert!(stakes.stake_delegations.len() >= 50);
let dummy = Dummy {
head: String::from("dummy-head"),
stakes: Arc::new(StakesEnum::from(stakes.clone())),
tail: String::from("dummy-tail"),
};
assert!(dummy.stakes.vote_accounts().as_ref().len() >= 5);
let data = bincode::serialize(&dummy).unwrap();
let other: Dummy = bincode::deserialize(&data).unwrap();
assert_eq!(other, dummy);
let stakes = Stakes::<Delegation>::from(stakes);
assert!(stakes.vote_accounts.as_ref().len() >= 5);
assert!(stakes.stake_delegations.len() >= 50);
let other = match &*other.stakes {
StakesEnum::Accounts(_) => panic!("wrong type!"),
StakesEnum::Delegations(delegations) => delegations,
};
assert_eq!(other, &stakes)
} | rust_cleaned_test_functions.jsonl/22044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
1261,
2050,
31054,
89602,
368,
341,
286,
11506,
27098,
42618,
11,
55039,
11,
48440,
11,
39900,
5563,
286,
2036,
50567,
341,
310,
1968,
25,
923,
345,
310,
11506,
47024,
16980,
284,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_example_1_1() {
assert_eq!(
solve_1(&parse("80871224585914546619083218645595")),
String::from("24176176")
);
} | rust_cleaned_test_functions.jsonl/103743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
16,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
11625,
62,
16,
2099,
6400,
445,
23,
15,
23,
22,
16,
17,
17,
19,
20,
23,
20,
24,
16,
19,
20,
19,
21,
21,
16,
24,
15,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut_chunks_rev() {
let mut v = [0u8, 1, 2, 3, 4, 5, 6];
for (i, chunk) in v.chunks_mut(3).rev().enumerate() {
for x in chunk.iter_mut() {
*x = i as u8;
}
}
let result = [2u8, 2, 2, 1, 1, 1, 0];
assert!(v == result);
} | rust_cleaned_test_functions.jsonl/31859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
65470,
38082,
368,
341,
286,
1077,
5206,
348,
284,
508,
15,
84,
23,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
286,
369,
320,
72,
11,
11879... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expand_template() {
let rv = expand_template("{{ {foo} {bar} }}", |var| var.key.to_uppercase());
assert_eq!(&rv, "{ FOO BAR }");
} | rust_cleaned_test_functions.jsonl/76136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
8693,
368,
341,
262,
1077,
17570,
284,
9225,
8693,
445,
2979,
314,
7975,
92,
314,
2257,
92,
3869,
497,
760,
947,
91,
762,
4735,
2389,
34445,
5638,
1423,
262,
2060,
10714,
0,
2099,
10553,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tiledinputpart_level_height_failure_invalid_level() {
let input = MultiPartInputFile::new(&*SRC_IMAGE_PATH, 0, true).unwrap();
let tiled_input_part = super::TiledInputPart::new(&input, 0);
tiled_input_part.level_height(i32::MIN).unwrap();
} | rust_cleaned_test_functions.jsonl/59304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2181,
1355,
4480,
8274,
9561,
43618,
31433,
8274,
368,
341,
286,
1077,
1946,
284,
17439,
5800,
2505,
1703,
486,
931,
2099,
9,
56017,
19121,
7944,
11,
220,
15,
11,
830,
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... | 1 |
#[test]
fn test_capture_quantifiers() {
struct Row {
description: &'static str,
language: Language,
pattern: &'static str,
capture_quantifiers: &'static [(usize, &'static str, CaptureQuantifier)],
}
let rows = &[
// Simple quantifiers
Row {
description: "Top level capture",
language: get_language("python"),
pattern: r#"
(module) @mod
"#,
capture_quantifiers: &[(0, "mod", CaptureQuantifier::One)],
},
Row {
description: "Nested list capture capture",
language: get_language("javascript"),
pattern: r#"
(array (_)* @elems) @array
"#,
capture_quantifiers: &[
(0, "array", CaptureQuantifier::One),
(0, "elems", CaptureQuantifier::ZeroOrMore),
],
},
Row {
description: "Nested non-empty list capture capture",
language: get_language("javascript"),
pattern: r#"
(array (_)+ @elems) @array
"#,
capture_quantifiers: &[
(0, "array", CaptureQuantifier::One),
(0, "elems", CaptureQuantifier::OneOrMore),
],
},
// Nested quantifiers
Row {
description: "capture nested in optional pattern",
language: get_language("javascript"),
pattern: r#"
(array (call_expression (arguments (_) @arg))? @call) @array
"#,
capture_quantifiers: &[
(0, "array", CaptureQuantifier::One),
(0, "call", CaptureQuantifier::ZeroOrOne),
(0, "arg", CaptureQuantifier::ZeroOrOne),
],
},
Row {
description: "optional capture nested in non-empty list pattern",
language: get_language("javascript"),
pattern: r#"
(array (call_expression (arguments (_)? @arg))+ @call) @array
"#,
capture_quantifiers: &[
(0, "array", CaptureQuantifier::One),
(0, "call", CaptureQuantifier::OneOrMore),
(0, "arg", CaptureQuantifier::ZeroOrMore),
],
},
Row {
description: "non-empty list capture nested in optional pattern",
language: get_language("javascript"),
pattern: r#"
(array (call_expression (arguments (_)+ @args))? @call) @array
"#,
capture_quantifiers: &[
(0, "array", CaptureQuantifier::One),
(0, "call", CaptureQuantifier::ZeroOrOne),
(0, "args", CaptureQuantifier::ZeroOrMore),
],
},
// Quantifiers in alternations
Row {
description: "capture is the same in all alternatives",
language: get_language("javascript"),
pattern: r#"[
(function_declaration name:(identifier) @name)
(call_expression function:(identifier) @name)
]"#,
capture_quantifiers: &[(0, "name", CaptureQuantifier::One)],
},
Row {
description: "capture appears in some alternatives",
language: get_language("javascript"),
pattern: r#"[
(function_declaration name:(identifier) @name)
(function)
] @fun"#,
capture_quantifiers: &[
(0, "fun", CaptureQuantifier::One),
(0, "name", CaptureQuantifier::ZeroOrOne),
],
},
Row {
description: "capture has different quantifiers in alternatives",
language: get_language("javascript"),
pattern: r#"[
(call_expression arguments:(arguments (_)+ @args))
(new_expression arguments:(arguments (_)? @args))
] @call"#,
capture_quantifiers: &[
(0, "call", CaptureQuantifier::One),
(0, "args", CaptureQuantifier::ZeroOrMore),
],
},
// Quantifiers in siblings
Row {
description: "siblings have different captures with different quantifiers",
language: get_language("javascript"),
pattern: r#"
(call_expression (arguments (identifier)? @self (_)* @args)) @call
"#,
capture_quantifiers: &[
(0, "call", CaptureQuantifier::One),
(0, "self", CaptureQuantifier::ZeroOrOne),
(0, "args", CaptureQuantifier::ZeroOrMore),
],
},
Row {
description: "siblings have same capture with different quantifiers",
language: get_language("javascript"),
pattern: r#"
(call_expression (arguments (identifier) @args (_)* @args)) @call
"#,
capture_quantifiers: &[
(0, "call", CaptureQuantifier::One),
(0, "args", CaptureQuantifier::OneOrMore),
],
},
// Combined scenarios
Row {
description: "combined nesting, alternatives, and siblings",
language: get_language("javascript"),
pattern: r#"
(array
(call_expression
(arguments [
(identifier) @self
(_)+ @args
])
)+ @call
) @array
"#,
capture_quantifiers: &[
(0, "array", CaptureQuantifier::One),
(0, "call", CaptureQuantifier::OneOrMore),
(0, "self", CaptureQuantifier::ZeroOrMore),
(0, "args", CaptureQuantifier::ZeroOrMore),
],
},
// Multiple patterns
Row {
description: "multiple patterns",
language: get_language("javascript"),
pattern: r#"
(function_declaration name: (identifier) @x)
(statement_identifier) @y
(property_identifier)+ @z
(array (identifier)* @x)
"#,
capture_quantifiers: &[
// x
(0, "x", CaptureQuantifier::One),
(1, "x", CaptureQuantifier::Zero),
(2, "x", CaptureQuantifier::Zero),
(3, "x", CaptureQuantifier::ZeroOrMore),
// y
(0, "y", CaptureQuantifier::Zero),
(1, "y", CaptureQuantifier::One),
(2, "y", CaptureQuantifier::Zero),
(3, "y", CaptureQuantifier::Zero),
// z
(0, "z", CaptureQuantifier::Zero),
(1, "z", CaptureQuantifier::Zero),
(2, "z", CaptureQuantifier::OneOrMore),
(3, "z", CaptureQuantifier::Zero),
],
},
Row {
description: "multiple alternatives",
language: get_language("javascript"),
pattern: r#"
[
(array (identifier) @x)
(function_declaration name: (identifier)+ @x)
]
[
(array (identifier) @x)
(function_declaration name: (identifier)+ @x)
]
"#,
capture_quantifiers: &[
(0, "x", CaptureQuantifier::OneOrMore),
(1, "x", CaptureQuantifier::OneOrMore),
],
},
];
allocations::record(|| {
eprintln!("");
for row in rows.iter() {
if let Some(filter) = EXAMPLE_FILTER.as_ref() {
if !row.description.contains(filter.as_str()) {
continue;
}
}
eprintln!(" query example: {:?}", row.description);
let query = Query::new(row.language, row.pattern).unwrap();
for (pattern, capture, expected_quantifier) in row.capture_quantifiers {
let index = query.capture_index_for_name(capture).unwrap();
let actual_quantifier = query.capture_quantifiers(*pattern)[index as usize];
assert_eq!(
actual_quantifier,
*expected_quantifier,
"Description: {}, Pattern: {:?}, expected quantifier of @{} to be {:?} instead of {:?}",
row.description,
row.pattern
.split_ascii_whitespace()
.collect::<Vec<_>>()
.join(" "),
capture,
*expected_quantifier,
actual_quantifier,
)
}
}
});
} | rust_cleaned_test_functions.jsonl/77482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4750
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55148,
53346,
11836,
368,
341,
262,
2036,
10801,
341,
286,
4008,
25,
30136,
1978,
607,
345,
286,
4128,
25,
11434,
345,
286,
5383,
25,
30136,
1978,
607,
345,
286,
12322,
53346,
11836,
25,
30136,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_str() {
assert_eq!(from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2)));
assert_eq!(from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5)));
assert_eq!(from_str("\"\""), Ok(String("".to_string())));
assert_eq!(from_str("\"foo\""), Ok(String("foo".to_string())));
assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_string())));
assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_string())));
assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_string())));
assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_string())));
assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_string())));
assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_string())));
assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u{12ab}".to_string())));
assert_eq!(from_str("\"\\uAB12\""), Ok(String("\u{AB12}".to_string())));
} | rust_cleaned_test_functions.jsonl/41698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2895,
368,
341,
286,
2060,
10714,
10297,
1499,
2895,
38915,
3975,
262,
15495,
93549,
1454,
7,
23483,
7983,
68839,
703,
11,
220,
16,
11,
220,
17,
4945,
286,
2060,
10714,
10297,
1499,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_kubeconfig_path() {
let expect_str = "/fake/.kube/config";
env::set_var(KUBECONFIG, expect_str);
assert_eq!(PathBuf::from(expect_str), kubeconfig_path().unwrap());
} | rust_cleaned_test_functions.jsonl/94957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
3760,
1676,
2638,
368,
341,
286,
1077,
1720,
2895,
284,
3521,
30570,
11930,
97717,
14730,
876,
286,
6105,
486,
746,
4612,
16738,
42389,
24652,
11,
1720,
2895,
317,
286,
2060,
10714,
10297,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_make_mac() {
let key = key();
let mac = Mac::new(
MacType::Header,
&key,
sys_time(1000, 100),
"nonny",
"POST",
"mysite.com",
443,
"/v1/api",
None,
None,
)
.unwrap();
println!("got {:?}", mac);
assert!(
mac.0
== vec![
192, 227, 235, 121, 157, 185, 197, 79, 189, 214, 235, 139, 9, 232, 99, 55, 67,
30, 68, 0, 150, 187, 192, 238, 21, 200, 209, 107, 245, 159, 243, 178
]
);
} | rust_cleaned_test_functions.jsonl/52131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
22802,
368,
341,
286,
1077,
1376,
284,
1376,
543,
286,
1077,
8978,
284,
7401,
486,
931,
1006,
310,
7401,
929,
486,
4047,
345,
310,
609,
792,
345,
310,
5708,
3009,
7,
16,
15,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_no_available_assoc_id() {
let mut aid_map: Map = Default::default();
for i in 0..31 {
aid_map.aids[i] = u64::max_value();
}
// Set the remaining 24 aids in the last array positions
for i in 0..24 {
aid_map.aids[31] += 1 << i;
}
let result = aid_map.assign_aid();
assert!(result.is_err());
assert_eq!(format!("{}", result.unwrap_err()), "no available association ID");
} | rust_cleaned_test_functions.jsonl/42226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
6536,
26962,
18891,
842,
368,
341,
286,
1077,
5206,
12296,
5376,
25,
5027,
284,
7899,
486,
2258,
543,
1789,
286,
369,
600,
304,
220,
15,
496,
18,
16,
341,
310,
12296,
5376,
5849,
3365,
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... | 3 |
#[test]
fn test_iter() {
let mut iter = ArrayVec::from([1, 2, 3]).into_iter();
assert_eq!(iter.size_hint(), (3, Some(3)));
assert_eq!(iter.next_back(), Some(3));
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next_back(), Some(2));
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next_back(), None);
} | rust_cleaned_test_functions.jsonl/36763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
1077,
5206,
5367,
284,
2910,
10050,
486,
1499,
2561,
16,
11,
220,
17,
11,
220,
18,
10697,
18122,
11723,
543,
262,
2060,
10714,
10297,
2015,
2486,
45825,
1507,
320,
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... | 1 |
#[test]
fn test_class_declaration() {
expect_printed("class A {}", "class A {}");
expect_printed("class A extends B {}", "class A extends B {}");
expect_printed("class A { b() {} }", "class A { b() {} }");
expect_printed("class A { null() {} }", "class A { null() {} }");
expect_printed("class A { undefined() {} }", "class A { undefined() {} }");
expect_printed("class A { 123() {} }", "class A { 123() {} }");
expect_printed("class A { \"abc\"() {} }", "class A { \"abc\"() {} }");
expect_printed("class A { [b]() {} }", "class A { [b]() {} }");
expect_printed(
"class A { constructor(a) {}\nb() {} }",
"class A { constructor(a) {}\nb() {} }",
);
expect_printed("class A { get b() {} }", "class A { get b() {} }");
expect_printed("class A { get [b]() {} }", "class A { get [b]() {} }");
expect_printed("class A { set [b]() {} }", "class A { set [b]() {} }");
expect_printed("class A { b() {}; c() {}; }", "class A { b() {}\nc() {} }");
expect_printed("class A {;}", "class A {}");
} | rust_cleaned_test_functions.jsonl/93451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
77926,
368,
341,
262,
1720,
10064,
291,
445,
1040,
362,
24689,
330,
1040,
362,
4687,
797,
262,
1720,
10064,
291,
445,
1040,
362,
2239,
425,
24689,
330,
1040,
362,
2239,
425,
4687,
797,
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_eval() {
let result = Packet::parse("C200B40A82\n").unwrap().eval();
assert_eq!(result, 3);
let result = Packet::parse("04005AC33890").unwrap().eval();
assert_eq!(result, 54);
let result = Packet::parse("880086C3E88112").unwrap().eval();
assert_eq!(result, 7);
let result = Packet::parse("CE00C43D881120").unwrap().eval();
assert_eq!(result, 9);
let result = Packet::parse("D8005AC2A8F0").unwrap().eval();
assert_eq!(result, 1);
let result = Packet::parse("F600BC2D8F").unwrap().eval();
assert_eq!(result, 0);
let result = Packet::parse("9C005AC2F8F0").unwrap().eval();
assert_eq!(result, 0);
let result = Packet::parse("9C0141080250320F1802104A08").unwrap().eval();
assert_eq!(result, 1);
} | rust_cleaned_test_functions.jsonl/129858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
368,
341,
286,
1077,
1102,
284,
28889,
486,
6400,
445,
34,
17,
15,
15,
33,
19,
15,
32,
23,
17,
1699,
1827,
15454,
1005,
14170,
543,
286,
2060,
10714,
10297,
1382,
11,
220,
18,
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_list_primitive_accessors() {
// primitives
let list = make_list(vec![Field::Bool(false)]);
assert_eq!(false, list.get_bool(0).unwrap());
let list = make_list(vec![Field::Byte(3), Field::Byte(4)]);
assert_eq!(4, list.get_byte(1).unwrap());
let list = make_list(vec![Field::Short(4), Field::Short(5), Field::Short(6)]);
assert_eq!(6, list.get_short(2).unwrap());
let list = make_list(vec![Field::Int(5)]);
assert_eq!(5, list.get_int(0).unwrap());
let list = make_list(vec![Field::Long(6), Field::Long(7)]);
assert_eq!(7, list.get_long(1).unwrap());
let list = make_list(vec![Field::UByte(3), Field::UByte(4)]);
assert_eq!(4, list.get_ubyte(1).unwrap());
let list = make_list(vec![Field::UShort(4), Field::UShort(5), Field::UShort(6)]);
assert_eq!(6, list.get_ushort(2).unwrap());
let list = make_list(vec![Field::UInt(5)]);
assert_eq!(5, list.get_uint(0).unwrap());
let list = make_list(vec![Field::ULong(6), Field::ULong(7)]);
assert_eq!(7, list.get_ulong(1).unwrap());
let list = make_list(vec![
Field::Float(8.1),
Field::Float(9.2),
Field::Float(10.3),
]);
assert_eq!(10.3, list.get_float(2).unwrap());
let list = make_list(vec![Field::Double(3.1415)]);
assert_eq!(3.1415, list.get_double(0).unwrap());
let list = make_list(vec![Field::Str("abc".to_string())]);
assert_eq!(&"abc".to_string(), list.get_string(0).unwrap());
let list = make_list(vec![Field::Bytes(ByteArray::from(vec![1, 2, 3, 4, 5]))]);
assert_eq!(&[1, 2, 3, 4, 5], list.get_bytes(0).unwrap().data());
let list = make_list(vec![Field::Decimal(Decimal::from_i32(4, 5, 2))]);
assert_eq!(&[0, 0, 0, 4], list.get_decimal(0).unwrap().data());
} | rust_cleaned_test_functions.jsonl/43813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
84087,
12759,
1087,
368,
341,
262,
442,
71194,
198,
262,
1077,
1140,
284,
1281,
2019,
25592,
20703,
1877,
486,
11233,
3576,
41958,
262,
2060,
10714,
10297,
3849,
11,
1140,
670,
22159,
7,
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_invalid_request() {
let mut block = default_block();
let mem = default_mem();
let vq = VirtQueue::new(GuestAddress(0), &mem, 16);
block.set_queue(0, vq.create_queue());
block.activate(mem.clone()).unwrap();
initialize_virtqueue(&vq);
let request_type_addr = GuestAddress(vq.dtable[0].addr.get());
// Request is invalid because the first descriptor is write-only.
vq.dtable[0]
.flags
.set(VIRTQ_DESC_F_NEXT | VIRTQ_DESC_F_WRITE);
mem.write_obj::<u32>(VIRTIO_BLK_T_IN, request_type_addr)
.unwrap();
invoke_handler_for_queue_event(&mut block);
assert_eq!(vq.used.idx.get(), 1);
assert_eq!(vq.used.ring[0].get().id, 0);
assert_eq!(vq.used.ring[0].get().len, 0);
} | rust_cleaned_test_functions.jsonl/73917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
7893,
368,
341,
286,
1077,
5206,
2504,
284,
1638,
7113,
543,
286,
1077,
1833,
284,
1638,
12976,
543,
286,
1077,
348,
80,
284,
47775,
7554,
486,
931,
6699,
3045,
4286,
7,
15,
701,
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... | 1 |
#[test]
fn test_find() {
::init().unwrap();
// Our find
let vec = vec![1i32, 2, 3];
let val = Iterator::from_vec(vec).find(|val| val == 2);
assert_eq!(val.unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/50295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
286,
3504,
2327,
1005,
15454,
1428,
286,
442,
5633,
1477,
198,
286,
1077,
7486,
284,
7486,
20703,
16,
72,
18,
17,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
1044,
284,
23023,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bank_squash() {
solana_logger::setup();
let (genesis_block, mint_keypair) = GenesisBlock::new(2);
let key1 = Keypair::new();
let key2 = Keypair::new();
let parent = Arc::new(Bank::new(&genesis_block));
let tx_transfer_mint_to_1 =
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
trace!("parent process tx ");
assert_eq!(parent.process_transaction(&tx_transfer_mint_to_1), Ok(()));
trace!("done parent process tx ");
assert_eq!(parent.transaction_count(), 1);
assert_eq!(
parent.get_signature_status(&tx_transfer_mint_to_1.signatures[0]),
Some(Ok(()))
);
trace!("new form parent");
let bank = new_from_parent(&parent);
trace!("done new form parent");
assert_eq!(
bank.get_signature_status(&tx_transfer_mint_to_1.signatures[0]),
Some(Ok(()))
);
assert_eq!(bank.transaction_count(), parent.transaction_count());
let tx_transfer_1_to_2 =
system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash(), 0);
assert_eq!(bank.process_transaction(&tx_transfer_1_to_2), Ok(()));
assert_eq!(bank.transaction_count(), 2);
assert_eq!(parent.transaction_count(), 1);
assert_eq!(
parent.get_signature_status(&tx_transfer_1_to_2.signatures[0]),
None
);
for _ in 0..3 {
assert_eq!(bank.get_balance(&key1.pubkey()), 0);
assert_eq!(bank.get_account(&key1.pubkey()), None);
assert_eq!(bank.get_balance(&key2.pubkey()), 1);
trace!("start");
assert_eq!(
bank.get_signature_status(&tx_transfer_mint_to_1.signatures[0]),
Some(Ok(()))
);
assert_eq!(
bank.get_signature_status(&tx_transfer_1_to_2.signatures[0]),
Some(Ok(()))
);
trace!("SQUASH");
bank.squash();
assert_eq!(parent.transaction_count(), 1);
assert_eq!(bank.transaction_count(), 2);
}
} | rust_cleaned_test_functions.jsonl/41903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
643,
446,
988,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
7,
17,
317,
286,
1077,
1376,
16,
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... | 2 |
#[test]
fn test_is_string_at_position_g() {
let example: Vec<char> = "abaa".to_string().chars().collect();
assert!(!is_string_at_position(&example, 1, "a"));
} | rust_cleaned_test_functions.jsonl/126891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
3904,
3752,
9661,
1889,
368,
341,
286,
1077,
3110,
25,
11312,
21919,
29,
284,
330,
370,
5305,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
2060,
0,
3471,
285,
3904,
3752,
9661,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lines() {
let arena = Arena::new();
assert_syntaxes(
&parse(&arena, "foo\nbar"),
&[
Syntax::new_comment(
&arena,
vec![SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 3,
}],
"foo",
),
Syntax::new_comment(
&arena,
vec![SingleLineSpan {
line: 1.into(),
start_col: 0,
end_col: 3,
}],
"bar",
),
],
);
} | rust_cleaned_test_functions.jsonl/16027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 567
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
18323,
368,
341,
286,
1077,
24902,
284,
27047,
486,
931,
1428,
286,
2060,
78894,
288,
1006,
310,
609,
6400,
2099,
30527,
11,
330,
7975,
1699,
2257,
4461,
310,
609,
9640,
394,
32117,
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... | 1 |
#[test]
fn test_close_range_native() -> Result<()> {
let fd = fcntl::open("/dev/null", fcntl::OFlag::O_RDWR, sys::stat::Mode::empty())?;
let syscall = LinuxSyscall {};
syscall
.close_range(0)
.context("failed to clean up the fds")?;
let fd_flag = fcntl::fcntl(fd, fcntl::F_GETFD)?;
if (fd_flag & fcntl::FdFlag::FD_CLOEXEC.bits()) == 0 {
bail!("CLOEXEC flag is not set correctly");
}
unistd::close(fd)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/84397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12704,
9698,
44494,
368,
1464,
5714,
71698,
341,
286,
1077,
12414,
284,
282,
75017,
486,
2508,
4283,
3583,
19293,
497,
282,
75017,
486,
46,
12135,
486,
46,
66266,
11,
5708,
486,
9878,
486,
3636,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_panic_hook_single_method() {
local_test_e(|runtime| async move {
let canister = Project::new(std::env::var("CARGO_MANIFEST_DIR").unwrap())
.cargo_bin("panics", &[])
.install_(&runtime, Vec::new())
.await
.unwrap();
let res: Result<Vec<u8>, String> =
canister.update_("test_panic_hook", bytes, Vec::new()).await;
assert_matches!(res, Err(msg) if msg.contains("This message should be passed as trap message thanks to the hook"));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/126879 | {
"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,
620,
31270,
32005,
19487,
9032,
368,
341,
262,
2205,
4452,
2204,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
646,
1571,
284,
5787,
486,
931,
5194,
486,
3160,
486,
947,
445,
34,
7581,
46,
25143... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rng_32_true_values() {
let seed: &[_] = &[1, 23, 456, 7890, 12345];
let mut ra: IsaacRng = SeedableRng::from_seed(seed);
// Regression test that isaac is actually using the above vector
let v = (0..10).map(|_| ra.next_u32()).collect::<Vec<_>>();
assert_eq!(v,
vec!(2558573138, 873787463, 263499565, 2103644246, 3595684709,
4203127393, 264982119, 2765226902, 2737944514, 3900253796));
let seed: &[_] = &[12345, 67890, 54321, 9876];
let mut rb: IsaacRng = SeedableRng::from_seed(seed);
// skip forward to the 10000th number
for _ in 0..10000 {
rb.next_u32();
}
let v = (0..10).map(|_| rb.next_u32()).collect::<Vec<_>>();
assert_eq!(v,
vec!(3676831399, 3183332890, 2834741178, 3854698763, 2717568474,
1576568959, 3507990155, 179069555, 141456972, 2478885421));
} | rust_cleaned_test_functions.jsonl/42033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
62,
18,
17,
16082,
9146,
368,
341,
286,
1077,
10320,
25,
609,
13496,
60,
284,
44590,
16,
11,
220,
17,
18,
11,
220,
19,
20,
21,
11,
220,
22,
23,
24,
15,
11,
220,
16,
17,
18,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_next() {
let mut kc = KeltnerChannel::new(3, 2.0_f64).unwrap();
let a = kc.next(2.0);
let b = kc.next(5.0);
let c = kc.next(1.0);
let d = kc.next(6.25);
assert_eq!(round(a.average), 2.0);
assert_eq!(round(b.average), 3.5);
assert_eq!(round(c.average), 2.25);
assert_eq!(round(d.average), 4.25);
assert_eq!(round(a.upper), 2.0);
assert_eq!(round(b.upper), 6.5);
assert_eq!(round(c.upper), 7.75);
assert_eq!(round(d.upper), 12.25);
assert_eq!(round(a.lower), 2.0);
assert_eq!(round(b.lower), 0.5);
assert_eq!(round(c.lower), -3.25);
assert_eq!(round(d.lower), -3.75);
} | rust_cleaned_test_functions.jsonl/130306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
368,
341,
286,
1077,
5206,
87518,
284,
730,
3818,
1194,
9629,
486,
931,
7,
18,
11,
220,
17,
13,
15,
761,
21,
19,
568,
15454,
1428,
286,
1077,
264,
284,
87518,
4529,
7,
17,
13,
15,
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_sparse_index() -> Result<()> {
let schema = DataSchemaRefExt::create(vec![
DataField::new("name", DataType::Utf8, true),
DataField::new("age", DataType::Int32, false),
]);
let block1 = DataBlock::create_by_array(schema.clone(), vec![
Series::new(vec!["jack", "ace", "bohu"]),
Series::new(vec![11, 6, 24]),
]);
let block2 = DataBlock::create_by_array(schema.clone(), vec![
Series::new(vec!["xjack", "xace", "xbohu"]),
Series::new(vec![11, 6, 24]),
]);
let idx_slice = vec![
SparseIndex {
col: "name".to_string(),
values: vec![
SparseIndexValue {
min: DataValue::Utf8(Some("jack".to_string())),
max: DataValue::Utf8(Some("bohu".to_string())),
page_no: 0,
},
SparseIndexValue {
min: DataValue::Utf8(Some("xjack".to_string())),
max: DataValue::Utf8(Some("xbohu".to_string())),
page_no: 1,
},
],
version: IndexSchemaVersion::V1,
},
SparseIndex {
col: "age".to_string(),
values: vec![
SparseIndexValue {
min: DataValue::Int32(Some(11)),
max: DataValue::Int32(Some(24)),
page_no: 0,
},
SparseIndexValue {
min: DataValue::Int32(Some(11)),
max: DataValue::Int32(Some(24)),
page_no: 1,
},
],
version: IndexSchemaVersion::V1,
},
];
// Create index.
{
let actual =
SparseIndex::create_index(&["name".to_string(), "age".to_string()], &[block1, block2])?;
let expected = idx_slice.clone();
assert_eq!(actual, expected);
}
// Apply index.
{
let mut idx_map = HashMap::new();
idx_map.insert("name".to_string(), idx_slice[0].clone());
idx_map.insert("age".to_string(), idx_slice[1].clone());
let expr = col("name").eq(lit(24));
let (actual, _) = SparseIndex::apply_index(idx_map, &expr)?;
let expected = true;
assert_eq!(actual, expected);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/34177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
3560,
368,
1464,
5714,
71698,
341,
262,
1077,
10802,
284,
2885,
8632,
3945,
6756,
486,
3182,
25592,
90515,
286,
2885,
1877,
486,
931,
445,
606,
497,
33172,
486,
38980,
23,
11,
830,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_file_style_underline() {
_do_test_file_style_underline(&[
"--file-style",
"magenta",
"--file-decoration-style",
"magenta underline",
]);
} | rust_cleaned_test_functions.jsonl/70078 | {
"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,
2458,
15117,
58228,
1056,
368,
341,
286,
716,
2982,
4452,
2458,
15117,
58228,
1056,
2099,
9640,
310,
14482,
1192,
11297,
756,
310,
330,
76,
47062,
756,
310,
14482,
1192,
30266,
11297,
756,
310,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.