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_intersect_ray_sphere_0() {
//Ray Sphere intersection
{
let a = Ray::init(&[5f64, 0f64, 0f64], &[1f64, 0f64, 0f64]);
let b = Sphere::init(&[20f64, 0f64, 0f64], 5f64);
match a.get_intersect(&b) {
(true, Some(loc)) => {
assert_eq!(loc, Matrix::from([[15f64, 0f64, 0f64, 1f64]]).t());
}
_ => panic!("unexpected result for ray sphere intersection"),
}
}
} | rust_cleaned_test_functions.jsonl/33719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72747,
72690,
86973,
62,
15,
368,
341,
262,
442,
29187,
54499,
19246,
198,
262,
341,
286,
1077,
264,
284,
13255,
486,
2327,
2099,
58,
20,
69,
21,
19,
11,
220,
15,
69,
21,
19,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rpool_k1_ok() {
let dh_secret: Secp256k1Scalar = ECScalar::from(
&BigInt::from_hex("953fe5d3d0f74c98dc78fec8482f4d5245727e21109177851a338e92a0b717c2")
.unwrap(),
)
.unwrap();
let dh_public = Secp256k1Point::from_bigint(
&BigInt::from_hex("2dc0573e3f91dc0915f50f053c1f361772a916b927dc782068dedb44c02d54eee")
.unwrap(),
)
.unwrap();
let dh_secret_vec = vec![dh_secret.clone()];
let dh_public_vec = vec![dh_public];
let computed = compute_rpool_secp256k1(&dh_secret_vec, &dh_public_vec).unwrap();
let mut expected = HashMap::new();
expected.insert(
"03388cb4cecb898818ff8fa00fc28b7c1a8d9cbb4aedcec83b7a86434900141aae".to_string(),
dh_secret,
);
assert_eq!(computed, expected);
} | rust_cleaned_test_functions.jsonl/62601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
10285,
4698,
16,
19817,
368,
341,
286,
1077,
34096,
21962,
25,
4520,
79,
17,
20,
21,
74,
16,
20639,
284,
20633,
20639,
486,
1499,
1006,
310,
609,
87474,
486,
1499,
32655,
445,
24,
20,
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_elem_mul() {
test::run(
test_file!("bigint_elem_mul_tests.txt"),
|section, test_case| {
assert_eq!(section, "");
let m = consume_modulus::<M>(test_case, "M");
let expected_result = consume_elem(test_case, "ModMul", &m);
let a = consume_elem(test_case, "A", &m);
let b = consume_elem(test_case, "B", &m);
let b = into_encoded(b, &m);
let a = into_encoded(a, &m);
let actual_result = elem_mul(&a, b, &m);
let actual_result = actual_result.into_unencoded(&m);
assert_elem_eq(&actual_result, &expected_result);
Ok(())
},
)
} | rust_cleaned_test_functions.jsonl/55426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28179,
24944,
368,
341,
286,
1273,
486,
6108,
1006,
310,
1273,
2458,
17223,
84674,
28179,
24944,
32509,
3909,
4461,
310,
760,
2809,
11,
1273,
19096,
91,
341,
394,
2060,
10714,
10297,
2809,
11,
509... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append() {
// Empty to empty
{
let mut m = LinkedList::<i32>::new();
let mut n = LinkedList::new();
m.append(&mut n);
check_links(&m);
assert_eq!(m.len(), 0);
assert_eq!(n.len(), 0);
}
// Non-empty to empty
{
let mut m = LinkedList::new();
let mut n = LinkedList::new();
n.push_back(2);
m.append(&mut n);
check_links(&m);
assert_eq!(m.len(), 1);
assert_eq!(m.pop_back(), Some(2));
assert_eq!(n.len(), 0);
check_links(&m);
}
// Empty to non-empty
{
let mut m = LinkedList::new();
let mut n = LinkedList::new();
m.push_back(2);
m.append(&mut n);
check_links(&m);
assert_eq!(m.len(), 1);
assert_eq!(m.pop_back(), Some(2));
check_links(&m);
}
// Non-empty to non-empty
let v = vec![1, 2, 3, 4, 5];
let u = vec![9, 8, 1, 2, 3, 4, 5];
let mut m = list_from(&v);
let mut n = list_from(&u);
m.append(&mut n);
check_links(&m);
let mut sum = v;
sum.extend_from_slice(&u);
assert_eq!(sum.len(), m.len());
for elt in sum {
assert_eq!(m.pop_front(), Some(elt))
}
assert_eq!(n.len(), 0);
// did some direct changes to private members
n.push_back(3);
assert_eq!(n.len(), 1);
assert_eq!(n.pop_front(), Some(3));
check_links(&n);
} | rust_cleaned_test_functions.jsonl/21480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 962
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
368,
341,
286,
442,
22228,
311,
4287,
198,
286,
341,
310,
1077,
5206,
296,
284,
22917,
27638,
72,
18,
17,
6831,
931,
543,
310,
1077,
5206,
308,
284,
22917,
486,
931,
543,
310,
296,
2057... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_h1_body_length() {
let mut srv = TestServer::new(|| {
HttpService::build().h1(|_| {
let body = once(Ok(Bytes::from_static(STR.as_ref())));
ok::<_, ()>(
Response::Ok().body(body::SizedStream::new(STR.len() as u64, body)),
)
})
});
let response = srv.block_on(srv.get("/").send()).unwrap();
assert!(response.status().is_success());
// read response
let bytes = srv.load_body(response).unwrap();
assert_eq!(bytes, Bytes::from_static(STR.as_ref()));
} | rust_cleaned_test_functions.jsonl/102556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
16,
14114,
5118,
368,
341,
262,
1077,
5206,
43578,
284,
3393,
5475,
486,
931,
79453,
341,
286,
4823,
1860,
486,
5834,
1005,
71,
16,
22428,
35395,
341,
310,
1077,
2487,
284,
3055,
7,
11578,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_magic() -> io::Result<()> {
let data = b"BAM\x01";
let mut reader = &data[..];
assert!(read_magic(&mut reader).is_ok());
let data = [];
let mut reader = &data[..];
assert!(matches!(
read_magic(&mut reader),
Err(ref e) if e.kind() == io::ErrorKind::UnexpectedEof
));
let data = b"MThd";
let mut reader = &data[..];
assert!(matches!(
read_magic(&mut reader),
Err(ref e) if e.kind() == io::ErrorKind::InvalidData
));
Ok(())
} | rust_cleaned_test_functions.jsonl/64396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
54612,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
293,
63590,
1402,
3462,
15,
16,
876,
286,
1077,
5206,
6604,
284,
609,
691,
95874,
935,
286,
2060,
10297,
878,
54612,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_authors() {
crate::utils::setup_logger();
let mut content = r#"sdfsdf
sdfsdf
authors: things, joe
dsfsdf
sdf
authors: nope"#;
let mut authors = NewRFD::get_authors(content, true).unwrap();
let mut expected = "things, joe".to_string();
assert_eq!(expected, authors);
content = r#"sdfsdf
= sdfgsdfgsdfg
things, joe
dsfsdf
sdf
:authors: nope"#;
authors = NewRFD::get_authors(content, true).unwrap();
expected = "".to_string();
assert_eq!(expected, authors);
content = r#"sdfsdf
= sdfgsdfgsdfg
things <things@email.com>, joe <joe@email.com>
dsfsdf
sdf
authors: nope"#;
authors = NewRFD::get_authors(content, false).unwrap();
expected = r#"things <things@email.com>, joe <joe@email.com>"#.to_string();
assert_eq!(expected, authors);
content = r#":authors: Jess <jess@thing.com>
= sdfgsdfgsdfg
{authors}
dsfsdf
sdf"#;
authors = NewRFD::get_authors(content, false).unwrap();
expected = r#"Jess <jess@thing.com>"#.to_string();
assert_eq!(expected, authors);
} | rust_cleaned_test_functions.jsonl/2865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
14014,
1087,
368,
341,
286,
17717,
486,
6031,
486,
15188,
27413,
1428,
286,
1077,
5206,
2213,
284,
435,
55543,
82,
34378,
2940,
198,
82,
34378,
2940,
198,
47005,
25,
2513,
11,
93341,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_agent_check() {
let check = read_single_check("checks/tests/test5.json").unwrap();
let page: &Page = &check.pages.unwrap()[0];
let options = page.options.clone().unwrap();
let agent = options.agent;
assert!(agent.is_some());
assert_eq!(agent.unwrap(), "Krtecek-Underground-Agent");
} | rust_cleaned_test_functions.jsonl/80334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25730,
7200,
368,
341,
286,
1077,
1779,
284,
1349,
19487,
7200,
445,
49383,
62468,
12697,
20,
4323,
1827,
15454,
543,
286,
1077,
2150,
25,
609,
2665,
284,
609,
2028,
37980,
55395,
10116,
15,
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_concat_error() -> Result<()> {
let result = return_type(&BuiltinScalarFunction::Concat, &vec![]);
if result.is_ok() {
Err(DataFusionError::Plan(
"Function 'concat' cannot accept zero arguments".to_string(),
))
} else {
Ok(())
}
} | rust_cleaned_test_functions.jsonl/21907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
4096,
368,
1464,
5714,
71698,
341,
286,
1077,
1102,
284,
470,
1819,
2099,
33,
25628,
20639,
5152,
486,
78440,
11,
609,
4083,
0,
56703,
286,
421,
1102,
2079,
19817,
368,
341,
310,
15495,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_guild_integration() {
let route = Route::UpdateGuildIntegration {
guild_id: GUILD_ID,
integration_id: INTEGRATION_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/integrations/{integration_id}",
guild_id = GUILD_ID,
integration_id = INTEGRATION_ID
)
);
} | rust_cleaned_test_functions.jsonl/119896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
1889,
1498,
90250,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4289,
72574,
52464,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
17590,
842,
25,
1964,
68003,
3495,
3450,
345,
286,
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_risk_level_ordering() {
assert!(
RiskLevel::Info < RiskLevel::Low
&& RiskLevel::Low < RiskLevel::Med
&& RiskLevel::Med < RiskLevel::High
&& RiskLevel::High < RiskLevel::Crit,
"Ordering of risk levels is invalid"
);
} | rust_cleaned_test_functions.jsonl/53379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3187,
8274,
7869,
287,
368,
341,
286,
2060,
33673,
310,
31288,
4449,
486,
1731,
366,
31288,
4449,
486,
24187,
198,
394,
1009,
31288,
4449,
486,
24187,
366,
31288,
4449,
486,
13310,
198,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_h1_2() {
let mut srv = TestServer::new(|| {
HttpService::build()
.keep_alive(KeepAlive::Disabled)
.client_timeout(1000)
.client_disconnect(1000)
.finish(|req: Request| {
assert!(req.peer_addr().is_some());
assert_eq!(req.version(), http::Version::HTTP_11);
future::ok::<_, ()>(Response::Ok().finish())
})
.map(|_| ())
});
let response = srv.block_on(srv.get("/").send()).unwrap();
assert!(response.status().is_success());
} | rust_cleaned_test_functions.jsonl/102529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
16,
62,
17,
368,
341,
262,
1077,
5206,
43578,
284,
3393,
5475,
486,
931,
79453,
341,
286,
4823,
1860,
486,
5834,
741,
310,
659,
13096,
58850,
7,
19434,
32637,
486,
25907,
340,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_disburse_maturity() {
local_test_on_sns_subnet(|runtime| async move {
let user = Sender::from_keypair(&TEST_USER1_KEYPAIR);
let account_identifier = AccountIdentifier::from(user.get_principal_id());
let alloc = Tokens::from_tokens(1000).unwrap();
let sys_params = NervousSystemParameters {
neuron_claimer_permissions: Some(NeuronPermissionList {
permissions: NeuronPermissionType::all(),
}),
..NervousSystemParameters::with_default_values()
};
let sns_init_payload = SnsInitPayloadsBuilder::new()
.with_ledger_account(account_identifier, alloc)
.with_nervous_system_parameters(sys_params.clone())
.build();
let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await;
// Stake and claim a neuron capable of making a proposal
let neuron_id = sns_canisters
.stake_and_claim_neuron(&user, Some(ONE_YEAR_SECONDS as u32))
.await;
let subaccount = neuron_id
.subaccount()
.expect("Error creating the subaccount");
// Earn some maturity to test disburse_maturity
sns_canisters
.earn_maturity(&neuron_id, &user)
.await
.expect("Error when earning maturity");
let neuron = sns_canisters.get_neuron(&neuron_id).await;
let earned_maturity_e8s = neuron.maturity_e8s_equivalent;
assert!(earned_maturity_e8s > 0);
let balance_before_disbursal = sns_canisters.get_user_account_balance(&user).await;
// Disburse all of the neuron's rewards aka maturity.
let manage_neuron_response: ManageNeuronResponse = sns_canisters
.governance
.update_from_sender(
"manage_neuron",
candid_one,
ManageNeuron {
subaccount: subaccount.to_vec(),
command: Some(Command::DisburseMaturity(DisburseMaturity {
percentage_to_disburse: 100,
to_account: None,
})),
},
&user,
)
.await
.expect("Error calling the manage_neuron API.");
let response = match manage_neuron_response.command.unwrap() {
CommandResponse::DisburseMaturity(response) => response,
response => panic!("Unexpected response from manage_neuron: {:?}", response),
};
assert!(response.transfer_block_height > 0);
assert_eq!(response.amount_disbursed_e8s, earned_maturity_e8s);
let neuron = sns_canisters.get_neuron(&neuron_id).await;
assert_eq!(neuron.maturity_e8s_equivalent, 0);
let balance_after_disbursal = sns_canisters.get_user_account_balance(&user).await;
let expected_balance =
(balance_before_disbursal + Tokens::from_e8s(response.amount_disbursed_e8s)).unwrap();
assert_eq!(expected_balance, balance_after_disbursal);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/107251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
37982,
717,
37854,
368,
341,
262,
2205,
4452,
4470,
643,
4412,
95681,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
1196,
284,
54610,
486,
1499,
3097,
12670,
2099,
10033,
9107,
16,
6600,
829... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple_updates() {
let mut m = Sha1::new();
m.reset();
m.update("The quick brown ".as_bytes());
m.update("fox jumps over ".as_bytes());
m.update("the lazy dog".as_bytes());
let hh = m.digest().to_string();
let h = "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12";
assert_eq!(hh.len(), h.len());
assert_eq!(hh, &*h);
} | rust_cleaned_test_functions.jsonl/74479 | {
"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,
45233,
57829,
368,
341,
286,
1077,
5206,
296,
284,
27970,
16,
486,
931,
1428,
286,
296,
13857,
543,
286,
296,
5317,
445,
785,
3974,
13876,
5933,
300,
12524,
1423,
286,
296,
5317,
445,
15011,
342... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_slice_excess_length() {
let v = vec![0, 0, 0, 0];
let _ = Color::try_from(&v[..]).unwrap();
} | rust_cleaned_test_functions.jsonl/14007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
2702,
1120,
5118,
368,
341,
286,
1077,
348,
284,
7486,
20703,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
935,
286,
1077,
716,
284,
3478,
486,
1539,
5673,
2099,
85,
95874,
10697,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_null_byte() {
use path::null_byte::cond;
let mut handled = false;
let mut p = cond.trap(|v| {
handled = true;
assert_eq!(v.as_slice(), b!("foo/bar", 0));
(b!("/bar").to_owned())
}).inside(|| {
Path::new(b!("foo/bar", 0))
});
assert!(handled);
assert_eq!(p.as_vec(), b!("/bar"));
handled = false;
cond.trap(|v| {
handled = true;
assert_eq!(v.as_slice(), b!("f", 0, "o"));
(b!("foo").to_owned())
}).inside(|| {
p.set_filename(b!("f", 0, "o"))
});
assert!(handled);
assert_eq!(p.as_vec(), b!("/foo"));
handled = false;
cond.trap(|v| {
handled = true;
assert_eq!(v.as_slice(), b!("f", 0, "o"));
(b!("foo").to_owned())
}).inside(|| {
p.push(b!("f", 0, "o"));
});
assert!(handled);
assert_eq!(p.as_vec(), b!("/foo/foo"));
} | rust_cleaned_test_functions.jsonl/120985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
19737,
368,
341,
286,
990,
1815,
486,
2921,
19737,
486,
1297,
401,
286,
1077,
5206,
17608,
284,
895,
280,
286,
1077,
5206,
281,
284,
9756,
5427,
391,
22428,
85,
91,
341,
310,
17608,
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... | 4 |
#[test]
fn test_phone_and_email_data_only() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("maxtract")?;
cmd.arg(common::get_uri()).arg("--phone").arg("--email").arg("--data-only");
let expected = "(985) 655-2500
test.email@test.org
123-123-1234
123.123.1234
123/123.1234
test.email@test.edu
test.email@test.co
012 345 6789
i_am_an_email@some_school.edu
test.email@test.com\n";
cmd.assert()
.success()
.stdout(predicate::str::similar(expected));
Ok(())
} | rust_cleaned_test_functions.jsonl/67452 | {
"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,
22154,
8378,
9172,
1769,
18410,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
2810,
2144,
899,
69493,
262,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_convert_to_two_touch_string_normal() {
let c = Converter::new();
let result = c
.convert_to_two_touch_string("こんにちは".to_string())
.unwrap();
assert_eq!(result.len(), 1);
assert_eq!(result[0], "2503524261");
let result = c
.convert_to_two_touch_string("ごくろうさん".to_string())
.unwrap();
let expected = vec!["5963".to_string(), "25042395133103".to_string()];
assert_eq!(result, expected);
let result = c
.convert_to_two_touch_string("ご苦労さん".to_string())
.unwrap();
let expected = vec!["5963".to_string()];
assert_eq!(result, expected);
let result = c
.convert_to_two_touch_string("だA*(¥ぽG".to_string())
.unwrap();
let expected = vec!["410416868276650527".to_string()];
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/101148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
2346,
23241,
60840,
3904,
13973,
368,
341,
286,
1077,
272,
284,
39328,
486,
931,
543,
286,
1077,
1102,
284,
272,
198,
310,
659,
14166,
2346,
23241,
60840,
3904,
445,
89015,
3263,
983,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_negative() {
assert!(!infinity.is_negative());
assert!(!1f32.is_negative());
assert!(!0f32.is_negative());
assert!((-0f32).is_negative());
assert!((-1f32).is_negative());
assert!(neg_infinity.is_negative());
assert!((1f32/neg_infinity).is_negative());
assert!(!NaN.is_negative());
} | rust_cleaned_test_functions.jsonl/33115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
53865,
368,
341,
286,
2060,
0,
3471,
80016,
2079,
53865,
1423,
286,
2060,
0,
3471,
16,
69,
18,
17,
2079,
53865,
1423,
286,
2060,
0,
3471,
15,
69,
18,
17,
2079,
53865,
1423,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_state_with_end_marker() {
let state = TspReaderStates::OUTSECTION;
assert_eq!(TspReaderStates::END, next_state(&state, &"EOF".to_string()))
} | rust_cleaned_test_functions.jsonl/58858 | {
"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,
11257,
4387,
6615,
6213,
26267,
368,
341,
286,
1077,
1584,
284,
350,
2154,
5062,
23256,
486,
3656,
58778,
401,
286,
2060,
10714,
10297,
51,
2154,
5062,
23256,
486,
4689,
11,
1790,
4387,
2099,
2454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_starts_with() {
macro_rules! test {
( $result:expr , $string:expr , $substring:expr ) => {
#[allow(clippy::bool_assert_comparison)]
{
assert_eq!(
$result,
RawOsStr::from_str($string)
.starts_with_os(RawOsStr::from_str($substring)),
);
}
};
}
test!(true, "", "");
test!(false, "", "f");
test!(false, "", "fo");
} | rust_cleaned_test_functions.jsonl/55747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
86552,
6615,
368,
341,
262,
18072,
21407,
0,
1273,
341,
286,
320,
400,
1382,
96011,
1154,
400,
917,
96011,
1154,
400,
33874,
96011,
873,
589,
341,
310,
11506,
7183,
9849,
45749,
486,
2641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_abs() {
let minus = BigInt::from(-100);
assert_eq!(Util::abs(&minus), BigInt::from(100));
let minus = BigInt::from(-0);
assert_eq!(Util::abs(&minus), BigInt::from(0));
let plus = BigInt::from(0);
assert_eq!(Util::abs(&plus), BigInt::from(0));
let plus = BigInt::from(100);
assert_eq!(Util::abs(&plus), BigInt::from(100));
} | rust_cleaned_test_functions.jsonl/130999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31170,
368,
341,
286,
1077,
27283,
284,
62608,
486,
1499,
4080,
16,
15,
15,
317,
286,
2060,
10714,
10297,
2742,
486,
3435,
2099,
38365,
701,
62608,
486,
1499,
7,
16,
15,
15,
3237,
286,
1077,
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_sys_no_proxy() {
// Stop other threads from modifying process-global ENV while we are.
let _lock = ENVLOCK.lock();
// save system setting first.
let _g1 = env_guard("HTTP_PROXY");
let _g2 = env_guard("NO_PROXY");
let target = "http://example.domain/";
env::set_var("HTTP_PROXY", target);
env::set_var(
"NO_PROXY",
".foo.bar, bar.baz,10.42.1.1/24,::1,10.124.7.8,2001::/17",
);
// Manually construct this so we aren't use the cache
let mut p = Proxy::new(Intercept::System(Arc::new(get_sys_proxies(None))));
p.no_proxy = NoProxy::new();
assert_eq!(intercepted_uri(&p, "http://hyper.rs"), target);
// make sure that random non-subdomain string prefixes don't match
assert_eq!(intercepted_uri(&p, "http://notfoo.bar"), target);
// make sure that random non-subdomain string prefixes don't match
assert_eq!(intercepted_uri(&p, "http://notbar.baz"), target);
// ipv4 address out of range
assert_eq!(intercepted_uri(&p, "http://10.43.1.1"), target);
// ipv4 address out of range
assert_eq!(intercepted_uri(&p, "http://10.124.7.7"), target);
// ipv6 address out of range
assert_eq!(intercepted_uri(&p, "http://[ffff:db8:a0b:12f0::1]"), target);
// ipv6 address out of range
assert_eq!(intercepted_uri(&p, "http://[2005:db8:a0b:12f0::1]"), target);
assert!(p.intercept(&url("http://hello.foo.bar")).is_none());
assert!(p.intercept(&url("http://bar.baz")).is_none());
// check case sensitivity
assert!(p.intercept(&url("http://BAR.baz")).is_none());
assert!(p.intercept(&url("http://foo.bar.baz")).is_none());
assert!(p.intercept(&url("http://foo.bar")).is_none());
// ipv4 address match within range
assert!(p.intercept(&url("http://10.42.1.100")).is_none());
// ipv6 address exact match
assert!(p.intercept(&url("http://[::1]")).is_none());
// ipv6 address match within range
assert!(p.intercept(&url("http://[2001:db8:a0b:12f0::1]")).is_none());
// ipv4 address exact match
assert!(p.intercept(&url("http://10.124.7.8")).is_none());
// reset user setting when guards drop
drop(_g1);
drop(_g2);
// Let other threads run now
drop(_lock);
} | rust_cleaned_test_functions.jsonl/6814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20344,
6536,
29712,
368,
341,
286,
442,
14215,
1008,
14564,
504,
46041,
1882,
73319,
32791,
1393,
582,
525,
624,
286,
1077,
716,
1023,
284,
32791,
8044,
21003,
543,
286,
442,
3581,
1849,
6243,
115... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_case_16() {
let key = "a3087eaeac1f2a58e2c2763d01b55744c4a65f4db93adff0078c63f090fb607a";
let nonce = "90c87defd622e5f55977877cec9ed883";
let expected_output =
"1d882fa80248882c6bc311a693ebd06b8c09aa2776e6e90df523d12bfeeed77a";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
16,
21,
368,
341,
310,
1077,
1376,
284,
330,
64,
18,
15,
23,
22,
68,
5918,
580,
16,
69,
17,
64,
20,
23,
68,
17,
66,
17,
22,
21,
18,
67,
15,
16,
65,
20,
20,
22,
19,
19,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contains() -> Result<()> {
let family =
"ffffffffffffffffffffffffffffffffffffffff eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
.parse::<RelayFamily>()?;
let in_family = RsaIdentity::from_bytes(
&hex::decode("ffffffffffffffffffffffffffffffffffffffff").unwrap()[..],
)
.unwrap();
let not_in_family = RsaIdentity::from_bytes(
&hex::decode("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").unwrap()[..],
)
.unwrap();
assert!(family.contains(&in_family), "Relay not found in family");
assert!(
!family.contains(¬_in_family),
"Extra relay found in family"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/4322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
368,
1464,
5714,
71698,
341,
286,
1077,
2997,
4035,
310,
330,
53697,
53697,
53697,
53697,
53697,
384,
68616,
68616,
68616,
68616,
68616,
68616,
68616,
68616,
68616,
34063,
698,
394,
659,
6400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_basic_repr_emit() {
let repr = packet_repr();
let mut bytes = vec![0xff; repr.buffer_len() + REPR_PAYLOAD_BYTES.len()];
let mut packet = Packet::new(&mut bytes);
repr.emit(&mut packet);
packet.payload_mut().copy_from_slice(&REPR_PAYLOAD_BYTES);
assert_eq!(&packet.into_inner()[..], &REPR_PACKET_BYTES[..]);
} | rust_cleaned_test_functions.jsonl/91041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
68535,
69082,
368,
341,
286,
1077,
30636,
284,
10151,
68535,
543,
286,
1077,
5206,
5820,
284,
7486,
20703,
15,
9020,
26,
30636,
24465,
6043,
368,
488,
3596,
6480,
79493,
40705,
19406,
33800,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_apply_backspace_direct() {
assert_eq!(
&apply_backspace_direct("Hel\u{0008}\u{0008}el\u{0008}llo ☹\u{0008}☺"),
"Hello ☺"
);
} | rust_cleaned_test_functions.jsonl/122131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
3895,
8746,
32871,
368,
341,
262,
2060,
10714,
33673,
286,
609,
10280,
3895,
8746,
32871,
445,
32713,
3770,
90,
15,
15,
15,
23,
11035,
84,
90,
15,
15,
15,
23,
92,
301,
3770,
90,
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_into_compression() {
assert_eq!(
parquet::CompressionCodec::Uncompressed,
Compression::Uncompressed.into()
);
assert_eq!(
parquet::CompressionCodec::Snappy,
Compression::Snappy.into()
);
assert_eq!(parquet::CompressionCodec::Gzip, Compression::Gzip.into());
assert_eq!(parquet::CompressionCodec::Lzo, Compression::Lzo.into());
assert_eq!(
parquet::CompressionCodec::Brotli,
Compression::Brotli.into()
);
assert_eq!(parquet::CompressionCodec::Lz4, Compression::Lz4.into());
assert_eq!(parquet::CompressionCodec::Zstd, Compression::Zstd.into());
} | rust_cleaned_test_functions.jsonl/126076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
2965,
4011,
368,
341,
197,
6948,
10714,
33673,
298,
197,
1732,
23300,
486,
81411,
36913,
486,
1806,
45703,
345,
298,
197,
81411,
486,
1806,
45703,
39860,
741,
197,
197,
317,
197,
6948,
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_invalid_proposals_fail() {
let fake_driver = fake::FakeDriver::default();
let fixture = fixture_two_neurons_second_is_bigger();
let mut gov = Governance::new(
fixture,
fake_driver.get_fake_env(),
fake_driver.get_fake_ledger(),
);
let long_string = (0..(PROPOSAL_MOTION_TEXT_BYTES_MAX + 1))
.map(|_| "X")
.collect::<String>();
// Now let's send a proposal
gov.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "proposal 1".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: long_string,
})),
..Default::default()
},
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/1126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
21663,
85975,
22121,
368,
341,
262,
1077,
12418,
20602,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
12507,
284,
12507,
23241,
96156,
29644,
6892,
880,
4500,
543,
262,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete() {
let base_rope: Rope = vec![0, 1, 2, 3].into();
let mut delta_builder = DeltaBuilder::new(base_rope.len());
delta_builder.delete(0..1);
let deletion = delta_builder.build();
let inversion = Action {
delta: deletion.clone(),
}
.invert(&base_rope);
let erased_rope = base_rope.apply_delta(&deletion);
assert_eq!(&erased_rope.slice_to_cow(..), &vec![1, 2, 3]);
let unerased_rope = erased_rope.apply_delta(&inversion.delta);
assert_eq!(&unerased_rope.slice_to_cow(..), &vec![0, 1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/10020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
368,
341,
286,
1077,
2331,
26608,
375,
25,
97896,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
936,
18122,
543,
286,
1077,
5206,
9477,
28532,
284,
24957,
3297,
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_aligned_eof() {
let mut log = new_record_test();
let n = BLOCK_SIZE - 2 * HEADER_SIZE + 4;
log.write(big_string("foo", n).as_str());
assert_eq!(BLOCK_SIZE - HEADER_SIZE + 4, log.written_bytes());
assert_eq!(big_string("foo", n).as_str(), log.read());
assert_eq!(EOF, log.read());
} | rust_cleaned_test_functions.jsonl/46685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66385,
90792,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
1077,
308,
284,
28677,
4098,
481,
220,
17,
353,
39665,
4098,
488,
220,
19,
280,
286,
1487,
3836,
75616,
3904,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_delete() {
let mut cf = CuckooFilter::default();
let _ = cf.add(b"test");
assert_eq!(cf.size(), 1);
assert!(cf.contains(b"test"));
assert!(cf.delete(b"test"));
assert_eq!(cf.size(), 0);
assert!(!cf.contains(b"test"));
} | rust_cleaned_test_functions.jsonl/128154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
368,
341,
286,
1077,
5206,
24111,
284,
356,
1942,
2624,
5632,
486,
2258,
543,
286,
1077,
716,
284,
24111,
1364,
1883,
1,
1944,
797,
286,
2060,
10714,
10297,
9792,
2486,
1507,
220,
16,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_int_constants() {
assert_eq!(
expand(b"%{1}%{2}%d%d", &[], &mut Variables::new()).unwrap(),
"21".bytes().collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/35444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
4042,
55642,
368,
341,
262,
2060,
10714,
33673,
286,
9225,
1883,
31391,
90,
16,
43715,
90,
17,
43715,
67,
14841,
497,
609,
12995,
609,
6984,
21419,
486,
931,
6011,
15454,
3148,
286,
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 |
#[test]
fn test_from_string() {
let s: ByteString = "hello".to_string().into();
assert_eq!(&s, "hello");
let t: &str = s.as_ref();
assert_eq!(t, "hello");
} | rust_cleaned_test_functions.jsonl/130002 | {
"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,
5673,
3904,
368,
341,
286,
1077,
274,
25,
95302,
284,
330,
14990,
3263,
983,
3904,
1005,
18122,
543,
286,
2060,
10714,
0,
2099,
82,
11,
330,
14990,
797,
286,
1077,
259,
25,
609,
495,
284,
274,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_split_files() {
let new_partitioned_file = |path: &str| PartitionedFile {
file_meta: FileMeta {
sized_file: SizedFile {
path: path.to_owned(),
size: 10,
},
last_modified: None,
},
};
let files = vec![
new_partitioned_file("a"),
new_partitioned_file("b"),
new_partitioned_file("c"),
new_partitioned_file("d"),
new_partitioned_file("e"),
];
let chunks = split_files(files.clone(), 1);
assert_eq!(1, chunks.len());
assert_eq!(5, chunks[0].len());
let chunks = split_files(files.clone(), 2);
assert_eq!(2, chunks.len());
assert_eq!(3, chunks[0].len());
assert_eq!(2, chunks[1].len());
let chunks = split_files(files.clone(), 5);
assert_eq!(5, chunks.len());
assert_eq!(1, chunks[0].len());
assert_eq!(1, chunks[1].len());
assert_eq!(1, chunks[2].len());
assert_eq!(1, chunks[3].len());
assert_eq!(1, chunks[4].len());
let chunks = split_files(files, 123);
assert_eq!(5, chunks.len());
assert_eq!(1, chunks[0].len());
assert_eq!(1, chunks[1].len());
assert_eq!(1, chunks[2].len());
assert_eq!(1, chunks[3].len());
assert_eq!(1, chunks[4].len());
} | rust_cleaned_test_functions.jsonl/105610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 772
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
10931,
368,
341,
286,
1077,
501,
43840,
291,
2458,
284,
760,
2343,
25,
609,
495,
91,
54626,
291,
1703,
341,
310,
1034,
13381,
25,
2887,
12175,
341,
394,
29287,
2458,
25,
21967,
1703,
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_matcher_data_attribute_ends() {
let m = Matcher::from("a[target$=\"_blank\"]");
let mut attr = HashMap::new();
attr.insert(
"target".to_string(),
AttributeSpec::Ends("_blank".to_string()),
);
assert_eq!(m.attribute, attr);
} | rust_cleaned_test_functions.jsonl/66005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
261,
1769,
16791,
90729,
368,
341,
286,
1077,
296,
284,
60632,
486,
1499,
445,
64,
57033,
3,
4070,
62,
10189,
75104,
797,
286,
1077,
5206,
6376,
284,
10528,
486,
931,
543,
286,
6376,
7030... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_getpid() {
let pid: ::libc::pid_t = getpid().into();
let ppid: ::libc::pid_t = getppid().into();
assert!(pid > 0);
assert!(ppid > 0);
} | rust_cleaned_test_functions.jsonl/8988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
10412,
368,
341,
262,
1077,
14814,
25,
3504,
55576,
486,
10412,
528,
284,
95378,
1005,
18122,
543,
262,
1077,
281,
10412,
25,
3504,
55576,
486,
10412,
528,
284,
633,
602,
307,
1005,
18122,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pattern_matches_case_insensitive() {
let pat = Pattern::new("aBcDeFg").unwrap();
let options = MatchOptions {
case_sensitive: false,
require_literal_separator: false,
require_literal_leading_dot: false,
};
assert!(pat.matches_with("aBcDeFg", options));
assert!(pat.matches_with("abcdefg", options));
assert!(pat.matches_with("ABCDEFG", options));
assert!(pat.matches_with("AbCdEfG", options));
} | rust_cleaned_test_functions.jsonl/40577 | {
"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,
21260,
38344,
19096,
34386,
18723,
368,
341,
286,
1077,
3272,
284,
18834,
486,
931,
445,
64,
33,
66,
1912,
37,
70,
1827,
15454,
543,
286,
1077,
2606,
284,
14152,
3798,
341,
310,
1142,
65324,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_catmull_arr3() {
let input = vec![0., 1., 2., 3., 4.];
let output = vec![
[1., 0., 0.],
[0., 0., 0.],
[1., 0., 0.],
[0., 0., 0.],
[-1., 0., 0.],
[0., 0., 0.],
[-1., 0., 0.],
];
assert_eq!(
[0.625, 0., 0.],
catmull_rom_spline_interpolate(0.5, &input, &output, false)
);
} | rust_cleaned_test_functions.jsonl/8633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20825,
76,
617,
11210,
18,
368,
341,
286,
1077,
1946,
284,
7486,
20703,
15,
2572,
220,
16,
2572,
220,
17,
2572,
220,
18,
2572,
220,
19,
13,
935,
286,
1077,
2550,
284,
7486,
90515,
310,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lookfor() {
assert_eq!(LookedUp::NeedInsert, p_lookfor(5, &[3,1,2], 0));
assert_eq!(LookedUp::NeedInsert, p_lookfor(5, &[3,0,2], 0));
assert_eq!(LookedUp::KeyFound(3), p_lookfor(7, &[0,0,0,7], 0));
} | rust_cleaned_test_functions.jsonl/14589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24271,
1958,
368,
341,
262,
2060,
10714,
10297,
10380,
291,
2324,
486,
23657,
13780,
11,
281,
24271,
1958,
7,
20,
11,
44590,
18,
11,
16,
11,
17,
1125,
220,
15,
1106,
262,
2060,
10714,
10297,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all() {
let res = parse_cfg::<(_, nom::error::ErrorKind)>("cfg(all(windows, unix))");
println!("res = {:?}", res);
assert_eq!(res, Ok(("", All(vec![Windows, Unix]))))
} | rust_cleaned_test_functions.jsonl/50600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
368,
341,
310,
1077,
592,
284,
4715,
18343,
27638,
41117,
9662,
486,
841,
486,
1454,
10629,
8,
13211,
14072,
20388,
3622,
1491,
11,
51866,
593,
797,
310,
13751,
17223,
416,
284,
71964,
592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_catmull_vec3() {
let input = vec![0., 1., 2., 3., 4.];
let output = vec![
Vector3::from([1., 0., 0.]),
Vector3::from([0., 0., 0.]),
Vector3::from([1., 0., 0.]),
Vector3::from([0., 0., 0.]),
Vector3::from([-1., 0., 0.]),
Vector3::from([0., 0., 0.]),
Vector3::from([-1., 0., 0.]),
];
assert_eq!(
Vector3::from([0.625, 0., 0.]),
catmull_rom_spline_interpolate(0.5, &input, &output, false)
);
} | rust_cleaned_test_functions.jsonl/8635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20825,
76,
617,
13251,
18,
368,
341,
286,
1077,
1946,
284,
7486,
20703,
15,
2572,
220,
16,
2572,
220,
17,
2572,
220,
18,
2572,
220,
19,
13,
935,
286,
1077,
2550,
284,
7486,
90515,
310,
4196,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_between_equals() {
let uid1 = Uid{position: big(0b1_00110011100000000010), site_id: 1, counter: 1};
let uid2 = Uid{position: big(0b1_00110011100000000010), site_id: 2, counter: 1};
let uid = Uid::between(&uid1, &uid2, DOT);
assert!(uid.position > big(0b1_00110011100000000010_000000000000000000000));
assert!(uid.position < big(0b1_00110011100000000010_000000000000000101001));
} | rust_cleaned_test_functions.jsonl/58318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48302,
61664,
368,
341,
286,
1077,
14617,
16,
284,
547,
307,
90,
3487,
25,
2409,
7,
15,
65,
16,
62,
15,
15,
16,
16,
15,
15,
16,
16,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_btreemap_from_unit_struct() {
assert_de_tokens_error::<BTreeMap<isize, isize>>(
&[Token::UnitStruct { name: "Anything" }],
"invalid type: unit value, expected a map",
);
} | rust_cleaned_test_functions.jsonl/129541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
10157,
42040,
5673,
14832,
15126,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
33,
6533,
2227,
27,
285,
551,
11,
91373,
97238,
286,
44590,
3323,
486,
4562,
9422,
314,
829,
25,
330,
77303,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_point_on_edge2() {
// the edge d-e.
// d-----+
// a--b--c |
// e-----+
let mut builder = Path::builder();
builder.begin(point(1.0, 1.0));
builder.line_to(point(2.0, 1.0));
builder.line_to(point(3.0, 1.0));
builder.line_to(point(3.0, 2.0));
builder.line_to(point(1.0, 2.0));
builder.end(true);
builder.begin(point(2.0, 0.0));
builder.line_to(point(2.0, 3.0));
builder.line_to(point(4.0, 3.0));
builder.line_to(point(4.0, 0.0));
builder.end(true);
test_path(builder.build().as_slice());
} | rust_cleaned_test_functions.jsonl/102429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
4470,
17932,
17,
368,
341,
1066,
262,
442,
279,
6821,
294,
5655,
624,
1066,
262,
442,
257,
294,
15081,
16930,
1066,
262,
442,
220,
264,
313,
65,
313,
66,
220,
9248,
41693,
262,
442,
257,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_indirect_hasher() {
let mut hasher = MyHasher { hash: 0 };
{
let mut indirect_hasher: &mut Hasher = &mut hasher;
5u32.hash(&mut indirect_hasher);
}
assert_eq!(hasher.hash, 5);
} | rust_cleaned_test_functions.jsonl/42839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9122,
1226,
8950,
261,
368,
341,
262,
1077,
5206,
90819,
284,
3017,
6370,
261,
314,
5175,
25,
220,
15,
2605,
262,
341,
286,
1077,
5206,
24614,
8950,
261,
25,
609,
6984,
6531,
261,
284,
609,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_completed_ical_parsing() {
let version_tag = VersionTag::from(String::from("test-tag"));
let sync_status = SyncStatus::Synced(version_tag);
let item_url: Url = "http://some.id/for/testing".parse().unwrap();
let item = parse(EXAMPLE_ICAL_COMPLETED, item_url.clone(), sync_status.clone()).unwrap();
let task = item.unwrap_task();
assert_eq!(task.completed(), true);
assert_eq!(task.completion_status(), &CompletionStatus::Completed(Some(Utc.ymd(2021, 04, 02).and_hms(8, 15, 57))));
} | rust_cleaned_test_functions.jsonl/99771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49068,
62,
938,
620,
28598,
368,
341,
286,
1077,
2319,
9372,
284,
6079,
5668,
486,
1499,
2242,
486,
1499,
445,
1944,
38204,
4010,
286,
1077,
12811,
4773,
284,
28937,
2522,
486,
12154,
291,
37770,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check_config_files_fails() {
let levels = vec![
ConfigLevel::Runtime,
ConfigLevel::Default,
ConfigLevel::Global,
ConfigLevel::Build,
];
let build_dir = None;
levels.iter().for_each(|level| {
let result = check_config_files(&level, &build_dir);
assert!(result.is_err());
});
} | rust_cleaned_test_functions.jsonl/10094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
5332,
10931,
761,
6209,
368,
341,
286,
1077,
5866,
284,
7486,
90515,
310,
5532,
4449,
486,
15123,
345,
310,
5532,
4449,
486,
3675,
345,
310,
5532,
4449,
486,
11646,
345,
310,
5532,
4449,
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_max_product() {
let test_vec = vec![
vec![1, 2, 3, 4],
vec![2, 3, 5, 7],
vec![3, 4, 5, 6],
vec![4, 5, 6, 7],
];
assert_eq!(max_product(&test_vec, (1, 0), 1), 7);
assert_eq!(max_product(&test_vec, (1, 0), 2), 7 * 6);
assert_eq!(max_product(&test_vec, (1, 0), 3), 7 * 6 * 7);
assert_eq!(max_product(&test_vec, (1, 0), 4), 4 * 7 * 6 * 7);
assert_eq!(max_product(&test_vec, (1, 0), 5), 0);
assert_eq!(max_product(&test_vec, (0, 1), 1), 7);
assert_eq!(max_product(&test_vec, (0, 1), 2), 6 * 7);
assert_eq!(max_product(&test_vec, (0, 1), 3), 5 * 6 * 7);
assert_eq!(max_product(&test_vec, (0, 1), 4), 4 * 5 * 6 * 7);
assert_eq!(max_product(&test_vec, (0, 1), 5), 0);
assert_eq!(max_product(&test_vec, (1, 1), 1), 7);
assert_eq!(max_product(&test_vec, (1, 1), 2), 5 * 7);
assert_eq!(max_product(&test_vec, (1, 1), 3), 3 * 5 * 7);
assert_eq!(max_product(&test_vec, (1, 1), 4), 1 * 3 * 5 * 7);
assert_eq!(max_product(&test_vec, (1, 1), 5), 0);
assert_eq!(max_product(&test_vec, (1, -1), 1), 7);
assert_eq!(max_product(&test_vec, (1, -1), 2), 6 * 6);
assert_eq!(max_product(&test_vec, (1, -1), 3), 5 * 5 * 7);
assert_eq!(max_product(&test_vec, (1, -1), 4), 4 * 5 * 4 * 4);
assert_eq!(max_product(&test_vec, (1, -1), 5), 0);
} | rust_cleaned_test_functions.jsonl/9131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
9840,
368,
341,
262,
1077,
1273,
13251,
284,
7486,
90515,
286,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
1259,
286,
7486,
20703,
17,
11,
220,
18,
11,
220,
20,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_update_character() {
let querier = new_valid_db("simple_update_character.db");
let mut character = common_character();
character.components = Some(String::from("{\"updated\": true}"));
assert_eq!(
1,
querier.update_character("Test_Character", character.clone())
);
let got_character = querier.get_character("Test_Character");
assert_eq!(character.clone(), got_character);
} | rust_cleaned_test_functions.jsonl/107701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
8882,
40988,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
22944,
8882,
40988,
7076,
797,
286,
1077,
5206,
3668,
284,
4185,
40988,
543,
286,
3668,
20040,
284,
4329,
2242,
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_overflow() {
let mut buf = [0; 3];
let mut buf = SliceVec::empty(&mut buf);
buf.extend_from_slice(b"abc").unwrap();
assert_eq!(buf.as_ref(), b"abc");
assert_eq!(buf.push(b'd').unwrap_err(), libc::ENAMETOOLONG);
assert_eq!(buf.extend_from_slice(b"d").unwrap_err(), libc::ENAMETOOLONG);
assert_eq!(
buf.insert_from_slice(2, b"d").unwrap_err(),
libc::ENAMETOOLONG
);
buf.pop();
assert_eq!(
buf.insert_from_slice(2, b"de").unwrap_err(),
libc::ENAMETOOLONG
);
buf.insert_from_slice(2, b"d").unwrap();
assert_eq!(buf.replace(b"abcd").unwrap_err(), libc::ENAMETOOLONG);
assert_eq!(buf.as_ref(), b"abd");
buf.replace(b"efg").unwrap();
assert_eq!(buf.as_ref(), b"efg");
} | rust_cleaned_test_functions.jsonl/26323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79073,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
26,
220,
18,
935,
286,
1077,
5206,
6607,
284,
56476,
10050,
486,
3194,
2099,
6984,
6607,
626,
286,
6607,
15831,
5673,
26488,
1883,
1,
13683,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_and_iter_blocks() {
let tmp_dir = tempfile::tempdir().unwrap();
let chain_dir = tmp_dir.path().join("foo.test");
let block1 = MetadataFactory::metadata_block()
.system_time(Utc.ymd(2000, 1, 1).and_hms(12, 0, 0))
.seed_random()
.source(MetadataFactory::dataset_source_root().build())
.build();
let (mut chain, block1_hash) = MetadataChainImpl::create(&chain_dir, block1.clone()).unwrap();
let block2 = MetadataFactory::metadata_block()
.system_time(Utc.ymd(2000, 1, 2).and_hms(12, 0, 0))
.prev(&block1_hash)
.output_watermark(Utc.ymd(2000, 1, 2).and_hms(12, 0, 0))
.build();
let block2_hash = chain.append(block2.clone());
let block3 = MetadataFactory::metadata_block()
.system_time(Utc.ymd(2000, 1, 3).and_hms(12, 0, 0))
.prev(&block2_hash)
.output_watermark(Utc.ymd(2000, 1, 2).and_hms(12, 0, 0))
.build();
let block3_hash = chain.append(block3.clone());
let mut block_iter = chain.iter_blocks();
assert_eq!(block_iter.next(), Some((block3_hash, block3)));
assert_eq!(block_iter.next(), Some((block2_hash, block2)));
assert_eq!(block_iter.next(), Some((block1_hash, block1)));
assert_eq!(block_iter.next(), None);
} | rust_cleaned_test_functions.jsonl/119229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
8378,
11723,
25201,
368,
341,
262,
1077,
4174,
4334,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
8781,
4334,
284,
4174,
4334,
3875,
1005,
5987,
445,
7975,
5958,
3071,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_term_query_count_when_there_are_deletes() {
let mut schema_builder = Schema::builder();
let text_field = schema_builder.add_text_field("text", TEXT);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index.writer_with_num_threads(1, 5_000_000).unwrap();
index_writer.add_document(doc!(text_field=>"a b"));
index_writer.add_document(doc!(text_field=>"a c"));
index_writer.delete_term(Term::from_field_text(text_field, "b"));
index_writer.commit().unwrap();
let term_a = Term::from_field_text(text_field, "a");
let term_query = TermQuery::new(term_a, IndexRecordOption::Basic);
let reader = index.reader().unwrap();
assert_eq!(term_query.count(&*reader.searcher()).unwrap(), 1);
} | rust_cleaned_test_functions.jsonl/53380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
5738,
3180,
47636,
5854,
485,
56855,
2259,
13881,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cubic_curve_curve_intersections() {
do_test(
&CubicBezierSegment {
from: point(0.0, 0.0),
ctrl1: point(0.0, 1.0),
ctrl2: point(0.0, 1.0),
to: point(1.0, 1.0),
},
&CubicBezierSegment {
from: point(0.0, 1.0),
ctrl1: point(1.0, 1.0),
ctrl2: point(1.0, 1.0),
to: point(1.0, 0.0),
},
1,
);
do_test(
&CubicBezierSegment {
from: point(48.0f32, 84.0),
ctrl1: point(104.0, 176.0),
ctrl2: point(190.0, 37.0),
to: point(121.0, 75.0),
},
&CubicBezierSegment {
from: point(68.0, 145.0),
ctrl1: point(74.0, 6.0),
ctrl2: point(143.0, 197.0),
to: point(138.0, 55.0),
},
4,
);
do_test(
&CubicBezierSegment {
from: point(0.0, 0.0),
ctrl1: point(0.5, 1.0),
ctrl2: point(0.5, 1.0),
to: point(1.0, 0.0),
},
&CubicBezierSegment {
from: point(0.0, 1.0),
ctrl1: point(0.5, 0.0),
ctrl2: point(0.5, 0.0),
to: point(1.0, 1.0),
},
2,
);
do_test(
&CubicBezierSegment {
from: point(0.2, 0.0),
ctrl1: point(0.5, 3.0),
ctrl2: point(0.5, -2.0),
to: point(0.8, 1.0),
},
&CubicBezierSegment {
from: point(0.0, 0.0),
ctrl1: point(2.5, 0.5),
ctrl2: point(-1.5, 0.5),
to: point(1.0, 0.0),
},
9,
);
// (A previous version of the code was returning two practically identical
do_test(
&CubicBezierSegment {
from: point(718133.1363092018, 673674.987999388),
ctrl1: point(-53014.13135835016, 286988.87959900266),
ctrl2: point(-900630.1880107201, -7527.6889376943),
to: point(417822.48349384824, -149039.14932848653),
},
&CubicBezierSegment {
from: point(924715.3309247112, 719414.5221912428),
ctrl1: point(965365.9679664494, -563421.3040676294),
ctrl2: point(273552.85484064696, 643090.0890117711),
to: point(-113963.134524995, 732017.9466050486),
},
1,
);
// On these curves the algorithm runs to a state at which the new clipped domain1 becomes a
// point even though t_min_clip < t_max_clip (because domain1 was small enough to begin with
do_test(
&CubicBezierSegment {
from: point(423394.5967598548, -91342.7434613118),
ctrl1: point(333212.450870987, 225564.45711810607),
ctrl2: point(668108.668469816, -626100.8367380127),
to: point(-481885.0610437216, 893767.5320803947),
},
&CubicBezierSegment {
from: point(-484505.2601961801, -222621.44229855016),
ctrl1: point(22432.829984141514, -944727.7102144773),
ctrl2: point(-433294.66549074976, -168018.60431004688),
to: point(567688.5977972192, 13975.09633399453),
},
3,
);
} | rust_cleaned_test_functions.jsonl/14569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1939
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41181,
43407,
43407,
15318,
24661,
368,
341,
262,
653,
4452,
1006,
286,
609,
34,
41181,
95050,
21086,
341,
310,
504,
25,
1459,
7,
15,
13,
15,
11,
220,
15,
13,
15,
1326,
310,
23743,
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_insert_data_blobs_multiple() {
let num_blobs = 10;
let entries = make_tiny_test_entries(num_blobs);
let shared_blobs = entries.to_blobs();
for (i, b) in shared_blobs.iter().enumerate() {
b.write().unwrap().set_index(i as u64).unwrap();
}
let blob_locks: Vec<_> = shared_blobs.iter().map(|b| b.read().unwrap()).collect();
let blobs: Vec<&Blob> = blob_locks.iter().map(|b| &**b).collect();
let ledger_path = get_tmp_ledger_path("test_insert_data_blobs_multiple");
let ledger = DbLedger::open(&ledger_path).unwrap();
for i in (0..num_blobs).rev() {
let result = ledger.insert_data_blobs(vec![blobs[i]]).unwrap();
let meta = ledger
.meta_cf
.get(&ledger.db, &MetaCf::key(DEFAULT_SLOT_HEIGHT))
.unwrap()
.expect("Expected metadata object to exist");
if i != 0 {
assert_eq!(result.len(), 0);
assert!(meta.consumed == 0 && meta.received == num_blobs as u64);
} else {
assert_eq!(result, entries);
assert!(meta.consumed == num_blobs as u64 && meta.received == num_blobs as u64);
}
}
// Destroying database without closing it first is undefined behavior
drop(ledger);
DbLedger::destroy(&ledger_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/133181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
1769,
880,
68164,
45233,
368,
341,
286,
1077,
1629,
880,
68164,
284,
220,
16,
15,
280,
286,
1077,
10695,
284,
1281,
528,
6441,
4452,
26092,
8068,
880,
68164,
317,
286,
1077,
6094,
880,
68... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fanout() {
// node should:
// - Populate fanout peers
// - Send publish message to fanout peers
//turn off flood publish to test fanout behaviour
let config = GossipsubConfigBuilder::default()
.flood_publish(false)
.build()
.unwrap();
let fanout_topic = String::from("test_fanout");
let (mut gs, _, topic_hashes) = inject_nodes1()
.peer_no(20)
.topics(vec![fanout_topic.clone()])
.to_subscribe(true)
.gs_config(config)
.create_network();
assert!(
gs.mesh.get(&topic_hashes[0]).is_some(),
"Subscribe should add a new entry to the mesh[topic] hashmap"
);
// Unsubscribe from topic
assert!(
gs.unsubscribe(&Topic::new(fanout_topic.clone())).unwrap(),
"should be able to unsubscribe successfully from topic"
);
// Publish on unsubscribed topic
let publish_data = vec![0; 42];
gs.publish(Topic::new(fanout_topic.clone()), publish_data)
.unwrap();
assert_eq!(
gs.fanout
.get(&TopicHash::from_raw(fanout_topic.clone()))
.unwrap()
.len(),
gs.config.mesh_n(),
"Fanout should contain `mesh_n` peers for fanout topic"
);
// Collect all publish messages
let publishes = gs
.events
.iter()
.fold(vec![], |mut collected_publish, e| match e {
NetworkBehaviourAction::NotifyHandler { event, .. } => {
let event = proto_to_message(event);
for s in &event.messages {
collected_publish.push(s.clone());
}
collected_publish
}
_ => collected_publish,
});
// Transform the inbound message
let message = &gs
.data_transform
.inbound_transform(
publishes
.first()
.expect("Should contain > 0 entries")
.clone(),
)
.unwrap();
let msg_id = gs.config.message_id(&message);
assert_eq!(
publishes.len(),
gs.config.mesh_n(),
"Should send a publish message to `mesh_n` fanout peers"
);
assert!(
gs.mcache.get(&msg_id).is_some(),
"Message cache should contain published message"
);
} | rust_cleaned_test_functions.jsonl/66882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
276,
411,
368,
341,
286,
442,
2436,
1265,
510,
286,
442,
481,
70938,
8405,
411,
25029,
198,
286,
442,
481,
11000,
3415,
1943,
311,
8405,
411,
25029,
198,
23459,
286,
442,
412,
1007,
17726,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hover_goto_type_action_links_order() {
check_actions(
r#"
trait ImplTrait<T> {}
trait DynTrait<T> {}
struct B<T> {}
struct S {}
fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
"#,
expect![[r#"
[
GoToType(
[
HoverGotoTypeData {
mod_path: "test::ImplTrait",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..21,
focus_range: Some(
6..15,
),
name: "ImplTrait",
kind: TRAIT,
container_name: None,
description: Some(
"trait ImplTrait",
),
docs: None,
},
},
HoverGotoTypeData {
mod_path: "test::B",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 43..57,
focus_range: Some(
50..51,
),
name: "B",
kind: STRUCT,
container_name: None,
description: Some(
"struct B",
),
docs: None,
},
},
HoverGotoTypeData {
mod_path: "test::DynTrait",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 22..42,
focus_range: Some(
28..36,
),
name: "DynTrait",
kind: TRAIT,
container_name: None,
description: Some(
"trait DynTrait",
),
docs: None,
},
},
HoverGotoTypeData {
mod_path: "test::S",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 58..69,
focus_range: Some(
65..66,
),
name: "S",
kind: STRUCT,
container_name: None,
description: Some(
"struct S",
),
docs: None,
},
},
],
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
97732,
1819,
7931,
25258,
7869,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
29432,
88092,
49257,
3125,
29,
5613,
29432,
43938,
49257,
3125,
29,
5613,
1235,
425,
3125,
29,
5613,
1235... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_until() {
let inner: &[u8] = &[0, 1, 2, 1, 0];
let mut reader = BufReader::with_capacity(2, inner);
let mut v = Vec::new();
reader.read_until(0, &mut v).unwrap();
assert_eq!(v, [0]);
v.truncate(0);
reader.read_until(2, &mut v).unwrap();
assert_eq!(v, [1, 2]);
v.truncate(0);
reader.read_until(1, &mut v).unwrap();
assert_eq!(v, [1]);
v.truncate(0);
reader.read_until(8, &mut v).unwrap();
assert_eq!(v, [0]);
v.truncate(0);
reader.read_until(9, &mut v).unwrap();
assert_eq!(v, []);
} | rust_cleaned_test_functions.jsonl/12409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
44352,
368,
341,
286,
1077,
9179,
25,
44590,
84,
23,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
16,
11,
220,
15,
935,
286,
1077,
5206,
6604,
284,
69013,
5062,
486,
4197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_delay() {
let f = || fail_point!("delay");
let timer = Instant::now();
fail::cfg("delay", "delay(1000)").unwrap();
f();
assert!(timer.elapsed() > Duration::from_millis(1000));
} | rust_cleaned_test_functions.jsonl/102084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22198,
368,
341,
262,
1077,
282,
284,
1369,
3690,
6085,
17223,
22263,
797,
262,
1077,
9021,
284,
18058,
486,
3328,
543,
262,
3690,
486,
14072,
445,
22263,
497,
330,
22263,
7,
16,
15,
15,
15,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_credential() {
let _setup = SetupMocks::init();
let handle_cred = credential::from_string(CREDENTIAL_SM_FINISHED).unwrap();
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_get_credential(cb.command_handle, handle_cred, Some(cb.get_callback())), error::SUCCESS.code_num);
cb.receive(TimeoutUtils::some_medium()).unwrap().unwrap();
let bad_handle = 1123;
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_get_credential(cb.command_handle, bad_handle, Some(cb.get_callback())), error::INVALID_CREDENTIAL_HANDLE.code_num);
} | rust_cleaned_test_functions.jsonl/115038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
666,
30320,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
73475,
284,
40207,
486,
1499,
3904,
3025,
81509,
28845,
45280,
38879,
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_invoke_context_verify() {
let accounts = vec![(solana_sdk::pubkey::new_rand(), AccountSharedData::default())];
let instruction_accounts = vec![];
let program_indices = vec![0];
let mut transaction_context = TransactionContext::new(accounts, 1, 1);
let mut invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
invoke_context
.push(&instruction_accounts, &program_indices, &[])
.unwrap();
assert!(invoke_context
.verify(&instruction_accounts, &program_indices)
.is_ok());
} | rust_cleaned_test_functions.jsonl/14509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
8467,
35638,
368,
341,
286,
1077,
9618,
284,
7486,
0,
9697,
38198,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
1507,
8615,
16997,
1043,
486,
2258,
2140,
935,
286,
1077,
7600,
55665,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_such_dir() {
new_ucmd!()
.args(&["-s", "0", "a/b"])
.fails()
.no_stdout()
.stderr_contains("cannot open 'a/b' for writing: No such file or directory");
} | rust_cleaned_test_functions.jsonl/77103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
643,
1387,
4334,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
82,
497,
330,
15,
497,
330,
64,
3470,
14108,
286,
659,
59631,
741,
286,
659,
2152,
67416,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mhdr_major() {
let examples = [(0, Major::LoRaWANR1), (1, Major::RFU)];
for &(ref v, ref expected) in &examples {
let mhdr = MHDR::new(*v);
assert_eq!(mhdr.major(), *expected);
}
} | rust_cleaned_test_functions.jsonl/81586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
28785,
47916,
368,
341,
262,
1077,
10295,
284,
17826,
15,
11,
17121,
486,
4262,
55535,
54,
1093,
49,
16,
701,
320,
16,
11,
17121,
486,
17612,
52,
12587,
262,
369,
22796,
1097,
348,
11,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_config_initialize_no_panic() {
let from_pubkey = Pubkey::new_unique();
let config_pubkey = Pubkey::new_unique();
let (_, _config_account) = create_config_account(vec![]);
let instructions =
config_instruction::create_account::<MyConfig>(&from_pubkey, &config_pubkey, 1, vec![]);
assert_eq!(
process_instruction(&instructions[1].data, &[]),
Err(InstructionError::NotEnoughAccountKeys)
);
} | rust_cleaned_test_functions.jsonl/36702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
40889,
6536,
620,
31270,
368,
341,
286,
1077,
504,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2193,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
39464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_process_ledger_options_override_threads() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(123);
let (ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_config);
let blockstore = Blockstore::open(&ledger_path).unwrap();
let opts = ProcessOptions {
override_num_threads: Some(1),
..ProcessOptions::default()
};
let evm_state_dir = TempDir::new().unwrap();
let evm_genesis_path = ledger_path.join(solana_sdk::genesis_config::EVM_GENESIS);
genesis_config
.generate_evm_state(&ledger_path, None)
.unwrap();
process_blockstore(
&genesis_config,
&blockstore,
&evm_state_dir,
evm_genesis_path,
Vec::new(),
opts,
None,
)
.unwrap();
PAR_THREAD_POOL.with(|pool| {
assert_eq!(pool.borrow().current_num_threads(), 1);
});
} | rust_cleaned_test_functions.jsonl/47529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 522
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
38367,
1389,
8743,
48576,
29725,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
17,
18,
317,
286,
1077,
320,
50704,
2638,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_put_value_sets() {
let mut keys = vec![];
let total_updates = 20;
let values: Vec<_> = (0..total_updates).map(|_i| gen_value()).collect();
for _i in 0..total_updates {
keys.push(HashValue::random());
}
let mut root_hashes_one_by_one = vec![];
let mut batch_one_by_one = TreeUpdateBatch::default();
{
let db = MockTreeStore::default();
let tree = JellyfishMerkleTree::new(&db);
let mut index = 0;
for version in 0..10 {
let mut keyed_value_set = vec![];
for _ in 0..total_updates / 10 {
keyed_value_set.push((keys[index], &values[index]));
index += 1;
}
let (root, batch) = tree
.put_value_set_test(keyed_value_set, version as Version)
.unwrap();
db.write_tree_update_batch(batch.clone()).unwrap();
root_hashes_one_by_one.push(root);
batch_one_by_one.node_batch.extend(batch.node_batch);
batch_one_by_one
.stale_node_index_batch
.extend(batch.stale_node_index_batch);
batch_one_by_one.node_stats.extend(batch.node_stats);
}
}
{
let db = MockTreeStore::default();
let tree = JellyfishMerkleTree::new(&db);
let mut value_sets = vec![];
let mut index = 0;
for _ in 0..10 {
let mut keyed_value_set = vec![];
for _ in 0..total_updates / 10 {
keyed_value_set.push((keys[index], &values[index]));
index += 1;
}
value_sets.push(keyed_value_set);
}
let (root_hashes, batch) = tree
.batch_put_value_sets_test(value_sets, None, 0 /* version */)
.unwrap();
assert_eq!(root_hashes, root_hashes_one_by_one);
assert_eq!(batch, batch_one_by_one);
}
} | rust_cleaned_test_functions.jsonl/9458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1004
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
3142,
21289,
368,
341,
262,
1077,
5206,
6894,
284,
7486,
0,
15078,
262,
1077,
2790,
57829,
284,
220,
17,
15,
280,
262,
1077,
2750,
25,
11312,
32399,
29,
284,
320,
15,
496,
5035,
57829,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_max_vote_tx_fits() {
solana_logger::setup();
let node_keypair = Keypair::new();
let vote_keypair = Keypair::new();
let slots: Vec<_> = (0..31).collect();
let vote_tx = vote_transaction::new_vote_transaction(
slots,
Hash::default(),
Hash::default(),
&node_keypair,
&vote_keypair,
&vote_keypair,
Some(Hash::default()),
);
use bincode::serialized_size;
info!("max vote size {}", serialized_size(&vote_tx).unwrap());
let msgs = packet::to_packets_chunked(&[vote_tx], 1); // panics if won't fit
assert_eq!(msgs.len(), 1);
} | rust_cleaned_test_functions.jsonl/32271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
54360,
17805,
761,
1199,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2436,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
6910,
3097,
12670,
284,
6569,
1082,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_constant() {
const X: &str = indent!("abc\ndef\nghi\njkl\n", "- ");
const Y: &str = "- abc\n- def\n- ghi\n- jkl\n";
assert_eq!(X, Y);
} | rust_cleaned_test_functions.jsonl/70367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
368,
341,
262,
733,
1599,
25,
609,
495,
284,
17504,
17223,
13683,
59,
5037,
1699,
75076,
1699,
73,
10561,
1699,
497,
6523,
7318,
262,
733,
809,
25,
609,
495,
284,
6523,
39022,
1699,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rm_one_file() {
let (at, mut ucmd) = testing(UTIL_NAME);
let file = "test_rm_one_file";
at.touch(file);
let result = ucmd.arg(file).run();
assert_empty_stderr!(result);
assert!(result.success);
assert!(!at.file_exists(file));
} | rust_cleaned_test_functions.jsonl/61411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58537,
11667,
2458,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
7497,
7,
36969,
4708,
317,
262,
1077,
1034,
284,
330,
1944,
58537,
11667,
2458,
3302,
262,
518,
42129,
4866,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part1() -> Result<()> {
let input = "L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL";
let world = input_generator(input)?;
assert_eq!(solve_part1(&world), 37);
Ok(())
} | rust_cleaned_test_functions.jsonl/127660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
1464,
5714,
71698,
341,
286,
1077,
1946,
284,
330,
43,
1214,
43,
1214,
43,
1214,
43,
198,
49356,
86708,
1214,
43,
198,
43,
1214,
1214,
496,
43,
33947,
49356,
1214,
43,
1214,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_items_inside_linkage_spec_decl_are_considered_toplevel() {
// The test below assumes the first top_level_item_ids element is the one added
assert!(ir_from_cc("").unwrap().top_level_item_ids().next().is_none());
let ir = ir_from_cc(
r#"
extern "C" {
struct MyStruct {};
}"#,
)
.unwrap();
let item_id = proc_macro2::Literal::usize_unsuffixed(ir.top_level_item_ids().next().unwrap().0);
assert_ir_matches!(
ir,
quote! {
...
Record {
... cc_name: "MyStruct" ...
... id: ItemId(#item_id) ...
}
...
}
);
} | rust_cleaned_test_functions.jsonl/37242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12134,
72860,
7233,
424,
13594,
35814,
56855,
31971,
1776,
291,
528,
67780,
368,
341,
262,
442,
576,
1273,
3685,
21484,
279,
1156,
1909,
8274,
5634,
8077,
2392,
374,
279,
825,
3694,
7213,
262,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_orthographic() {
let left = -4.0;
let right = 4.0;
let bottom = -2.0;
let top = 2.0;
let near = 1.0;
let far = 100.0;
let expected = Matrix4x4::new(
1.0 / 4.0, 0.0, 0.0, 0.0,
0.0, 1.0 / 2.0, 0.0, 0.0,
0.0, 0.0, -2.0 / 99.0, 0.0,
0.0, 0.0, -101.0 / 99.0, 1.0
);
let result = Matrix4x4::from_orthographic(left, right, bottom, top, near, far);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
62,
2364,
12679,
368,
341,
286,
1077,
2115,
284,
481,
19,
13,
15,
280,
286,
1077,
1290,
284,
220,
19,
13,
15,
280,
286,
1077,
5622,
284,
481,
17,
13,
15,
280,
286,
1077,
1909,
284,
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_put_snapshot() {
use std::path::PathBuf;
use vmm::vmm_config::snapshot::SnapshotType;
let mut body = r#"{
"snapshot_type": "Diff",
"snapshot_path": "foo",
"mem_file_path": "bar",
"version": "0.23.0"
}"#;
let mut expected_cfg = CreateSnapshotParams {
snapshot_type: SnapshotType::Diff,
snapshot_path: PathBuf::from("foo"),
mem_file_path: PathBuf::from("bar"),
version: Some(String::from("0.23.0")),
};
match vmm_action_from_request(
parse_put_snapshot(&Body::new(body), Some(&"create")).unwrap(),
) {
VmmAction::CreateSnapshot(cfg) => assert_eq!(cfg, expected_cfg),
_ => panic!("Test failed."),
}
body = r#"{
"snapshot_path": "foo",
"mem_file_path": "bar"
}"#;
expected_cfg = CreateSnapshotParams {
snapshot_type: SnapshotType::Full,
snapshot_path: PathBuf::from("foo"),
mem_file_path: PathBuf::from("bar"),
version: None,
};
match vmm_action_from_request(
parse_put_snapshot(&Body::new(body), Some(&"create")).unwrap(),
) {
VmmAction::CreateSnapshot(cfg) => assert_eq!(cfg, expected_cfg),
_ => panic!("Test failed."),
}
let invalid_body = r#"{
"invalid_field": "foo",
"mem_file_path": "bar"
}"#;
assert!(parse_put_snapshot(&Body::new(invalid_body), Some(&"create")).is_err());
body = r#"{
"snapshot_path": "foo",
"mem_backend": {
"backend_path": "bar",
"backend_type": "File"
}
}"#;
let mut expected_cfg = LoadSnapshotParams {
snapshot_path: PathBuf::from("foo"),
mem_backend: MemBackendConfig {
backend_path: PathBuf::from("bar"),
backend_type: MemBackendType::File,
},
enable_diff_snapshots: false,
resume_vm: false,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some(&"load")).unwrap();
assert!(parsed_request
.parsing_info()
.take_deprecation_message()
.is_none());
match vmm_action_from_request(parsed_request) {
VmmAction::LoadSnapshot(cfg) => assert_eq!(cfg, expected_cfg),
_ => panic!("Test failed."),
}
body = r#"{
"snapshot_path": "foo",
"mem_backend": {
"backend_path": "bar",
"backend_type": "File"
},
"enable_diff_snapshots": true
}"#;
expected_cfg = LoadSnapshotParams {
snapshot_path: PathBuf::from("foo"),
mem_backend: MemBackendConfig {
backend_path: PathBuf::from("bar"),
backend_type: MemBackendType::File,
},
enable_diff_snapshots: true,
resume_vm: false,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some(&"load")).unwrap();
assert!(parsed_request
.parsing_info()
.take_deprecation_message()
.is_none());
match vmm_action_from_request(parsed_request) {
VmmAction::LoadSnapshot(cfg) => assert_eq!(cfg, expected_cfg),
_ => panic!("Test failed."),
}
body = r#"{
"snapshot_path": "foo",
"mem_backend": {
"backend_path": "bar",
"backend_type": "Uffd"
},
"resume_vm": true
}"#;
expected_cfg = LoadSnapshotParams {
snapshot_path: PathBuf::from("foo"),
mem_backend: MemBackendConfig {
backend_path: PathBuf::from("bar"),
backend_type: MemBackendType::Uffd,
},
enable_diff_snapshots: false,
resume_vm: true,
};
let mut parsed_request = parse_put_snapshot(&Body::new(body), Some(&"load")).unwrap();
assert!(parsed_request
.parsing_info()
.take_deprecation_message()
.is_none());
match vmm_action_from_request(parsed_request) {
VmmAction::LoadSnapshot(cfg) => assert_eq!(cfg, expected_cfg),
_ => panic!("Test failed."),
}
body = r#"{
"snapshot_path": "foo",
"mem_file_path": "bar",
"resume_vm": true
}"#;
expected_cfg = LoadSnapshotParams {
snapshot_path: PathBuf::from("foo"),
mem_backend: MemBackendConfig {
backend_path: PathBuf::from("bar"),
backend_type: MemBackendType::File,
},
enable_diff_snapshots: false,
resume_vm: true,
};
let parsed_request = parse_put_snapshot(&Body::new(body), Some(&"load")).unwrap();
match depr_action_from_req(parsed_request, Some(LOAD_DEPRECATION_MESSAGE.to_string())) {
VmmAction::LoadSnapshot(cfg) => assert_eq!(cfg, expected_cfg),
_ => panic!("Test failed."),
}
body = r#"{
"snapshot_path": "foo",
"mem_backend": {
"backend_path": "bar"
}
}"#;
assert_eq!(
parse_put_snapshot(&Body::new(body), Some(&"load")).err().unwrap().to_string(),
"An error occurred when deserializing the json body of a request: missing field `backend_type` at line 5 column 17."
);
body = r#"{
"snapshot_path": "foo",
"mem_backend": {
"backend_type": "File",
}
}"#;
assert_eq!(
parse_put_snapshot(&Body::new(body), Some(&"load"))
.err().unwrap().to_string(),
"An error occurred when deserializing the json body of a request: trailing comma at line 5 column 17."
);
body = r#"{
"snapshot_path": "foo",
"mem_file_path": "bar",
"mem_backend": {
"backend_path": "bar",
"backend_type": "Uffd"
}
}"#;
assert_eq!(
parse_put_snapshot(&Body::new(body), Some(&"load"))
.err()
.unwrap()
.to_string(),
Error::SerdeJson(serde_json::Error::custom(TOO_MANY_FIELDS.to_string())).to_string()
);
body = r#"{
"snapshot_path": "foo"
}"#;
assert_eq!(
parse_put_snapshot(&Body::new(body), Some(&"load"))
.err()
.unwrap()
.to_string(),
Error::SerdeJson(serde_json::Error::custom(MISSING_FIELD.to_string())).to_string()
);
body = r#"{
"mem_backend": {
"backend_path": "bar",
"backend_type": "Uffd"
}
}"#;
assert_eq!(
parse_put_snapshot(&Body::new(body), Some(&"load"))
.err().unwrap().to_string(),
"An error occurred when deserializing the json body of a request: missing field `snapshot_path` at line 6 column 15."
);
assert!(parse_put_snapshot(&Body::new(body), Some(&"invalid")).is_err());
assert!(parse_put_snapshot(&Body::new(body), None).is_err());
} | rust_cleaned_test_functions.jsonl/67679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15557,
53265,
368,
341,
286,
990,
1460,
486,
2343,
486,
1820,
15064,
280,
286,
990,
348,
3821,
486,
85,
3821,
5332,
486,
35501,
486,
15009,
929,
401,
286,
1077,
5206,
2487,
284,
435,
5554... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_spoofed_vote() {
assert_eq!(
process_instruction(&vote(
&invalid_vote_state_pubkey(),
&Pubkey::default(),
Vote::default(),
)),
Err(InstructionError::InvalidAccountOwner),
);
} | rust_cleaned_test_functions.jsonl/97473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5368,
1055,
291,
54360,
368,
341,
286,
2060,
10714,
33673,
310,
1882,
54923,
2099,
29358,
1006,
394,
609,
11808,
54360,
4387,
34014,
792,
3148,
394,
609,
29162,
792,
486,
2258,
3148,
394,
340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_process_initialize_ix_no_keyed_accs_fail() {
assert_eq!(
process_instruction(
&Pubkey::default(),
vec![],
&serialize(&SystemInstruction::InitializeNonceAccount(Pubkey::default())).unwrap(),
),
Err(InstructionError::NotEnoughAccountKeys),
);
} | rust_cleaned_test_functions.jsonl/73070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
40889,
62686,
6536,
3097,
291,
17737,
82,
22121,
368,
341,
286,
2060,
10714,
33673,
310,
1882,
54923,
1006,
394,
609,
29162,
792,
486,
2258,
3148,
394,
7486,
20703,
1259,
394,
609,
24166,
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_append_bits_1() {
let byte_array_1: Vec<u8> = vec![0xE6, 0x38, 0x87];
let byte_array_2: Vec<u8> = vec![0x6E, 0x7f];
let mut begin: Vec<u8> = vec![];
assert_eq!(begin.len(), 0, "Binary buffer length should be 0 bits");
begin = concatinate_bits(&begin, 0, &byte_array_1, 22);
assert_eq!(begin.len(), 3);
assert_eq!(
"e63884",
to_hex(&begin),
"Byte array 1 should have been correctly added to the binary buffer"
);
begin = concatinate_bits(&begin, 22, &byte_array_2, 13);
assert_eq!(begin.len(), 5);
assert_eq!(
"e63885b9e0",
to_hex(&begin),
"Byte array 2 should have been correctly added to the binary buffer"
);
} | rust_cleaned_test_functions.jsonl/57148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
20034,
62,
16,
368,
341,
262,
1077,
4922,
3858,
62,
16,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
12606,
21,
11,
220,
15,
87,
18,
23,
11,
220,
15,
87,
23,
22,
5265,
715,
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_existing_file_truncated() {
let fname = "this-file-exists-truncated.txt";
let fpath = fixture_path!(fname);
match fpath.metadata() {
Ok(m) if m.len() == 256 => {}
_ => build_test_file!(&fpath, &vec![0; 256]),
}
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&["status=none", "if=null.txt", of!(fname)])
.run()
.no_stdout()
.no_stderr()
.success();
assert_eq!(0, fix.metadata(fname).len());
} | rust_cleaned_test_functions.jsonl/59390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62630,
2458,
3547,
38007,
368,
341,
1066,
262,
1077,
22548,
284,
330,
574,
14203,
10187,
1671,
10188,
38007,
3909,
876,
262,
1077,
282,
2343,
284,
12507,
2638,
10297,
23993,
317,
262,
2432,
282,
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_from_str_parse() -> Result<(), Error> {
let kp = SampiKeyPair::new();
let data = SampiData::String("Hello, World".to_string());
let s = kp.new_sampi().build(vec![data.clone()])?;
assert_eq!(s.data(), &vec![data]);
let s_2: Sampi = s.to_base64().parse()?;
assert_eq!(s.data(), s_2.data());
Ok(())
} | rust_cleaned_test_functions.jsonl/67856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
21039,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
60319,
284,
90174,
72,
1592,
12443,
486,
931,
543,
262,
1077,
821,
284,
90174,
72,
1043,
486,
703,
445,
9707,
11,
4337,
3263,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_sort_to_indices_primitives() {
test_sort_to_indices_primitive_arrays::<Int8Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Int16Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Int32Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Int64Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Float32Type>(
vec![
None,
Some(-0.05),
Some(2.225),
Some(-1.01),
Some(-0.05),
None,
],
None,
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![
None,
Some(-0.05),
Some(2.225),
Some(-1.01),
Some(-0.05),
None,
],
None,
None,
vec![0, 5, 3, 1, 4, 2],
);
// descending
test_sort_to_indices_primitive_arrays::<Int8Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int16Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int32Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int64Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Float32Type>(
vec![
None,
Some(0.005),
Some(20.22),
Some(-10.3),
Some(0.005),
None,
],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![None, Some(0.0), Some(2.0), Some(-1.0), Some(0.0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int8Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Int16Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Int32Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Int64Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Float32Type>(
vec![None, Some(0.1), Some(0.2), Some(-1.3), Some(0.01), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![None, Some(10.1), Some(100.2), Some(-1.3), Some(10.01), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![5, 0, 2, 1, 4, 3],
);
// valid values less than limit with extra nulls
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![Some(2.0), None, None, Some(1.0)],
Some(SortOptions {
descending: false,
nulls_first: false,
}),
Some(3),
vec![3, 0, 1],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![Some(2.0), None, None, Some(1.0)],
Some(SortOptions {
descending: false,
nulls_first: true,
}),
Some(3),
vec![1, 2, 3],
);
// more nulls than limit
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![Some(1.0), None, None, None],
Some(SortOptions {
descending: false,
nulls_first: true,
}),
Some(2),
vec![1, 2],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![Some(1.0), None, None, None],
Some(SortOptions {
descending: false,
nulls_first: false,
}),
Some(2),
vec![0, 1],
);
} | rust_cleaned_test_functions.jsonl/6164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
2346,
18333,
5294,
35209,
368,
341,
286,
1273,
18435,
2346,
18333,
84087,
68983,
27638,
1072,
23,
929,
17055,
310,
7486,
20703,
4064,
11,
4329,
7,
15,
701,
4329,
7,
17,
701,
4329,
4080,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_glbaserender() {
let s = std::env::var("ASSETS").expect("$env::ASSETS is not ref to a minecraft version.jar");
let ifile = std::fs::File::open(s).unwrap();
let zip = std::rc::Rc::new(std::cell::RefCell::new(AssetsArchive::new(ifile).unwrap()));
let pvd = TextureImageProvider::from(zip.clone());
use context::Context;
let ctx = context::WindowHideContext::build(256, 256, glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 3)));
let mut gen = CombinedTextureGen::new( ctx.facade(), pvd );
for name in &["block/crafting_table_front", "block/diamond_block", "block/bricks", "block/water_still"] {
println!("{:?}", gen.get(name));
}
let tex = gen.build(16, 16, glium::texture::MipmapsOption::AutoGeneratedMipmaps).unwrap();
println!("{:?}", tex);
use mesh::{MeshVertex, Mesh};
use mc_render::model::model::Cubic;
use mc_render::assets::data_type::Face;
use mc_render::assets::data_type::Rotate90;
use cgmath::{Matrix3, Vector3, Matrix4, Vector4, SquareMatrix, Deg};
let c = Cubic {
from: Vector3::new(0.0, 0.0, 0.0),
to: Vector3::new(16.0, 16.0, 16.0),
};
let mut bl = Vector3::unit_x();
let mut br = Vector3::unit_x();
let mut tl = Vector3::unit_x();
let mut tr = Vector3::unit_x();
let mut m1 = Mesh::new();
c.get_face_vert(Face::East, &mut bl, &mut br, &mut tl, &mut tr);
println!("{:?} {:?} {:?} {:?}", bl, br, tl, tr);
m1.append(&[
MeshVertex { loc: [0, 0, 0], pos: bl.into(), tex: [0.0, 0.0], tex_id: 1, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: br.into(), tex: [16.0, 0.0], tex_id: 1, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: tl.into(), tex: [0.0, 16.0], tex_id: 1, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: tr.into(), tex: [16.0, 16.0], tex_id: 1, color: [255, 255, 255, 255], light: 0xFF },
]);
c.get_face_vert(Face::Down, &mut bl, &mut br, &mut tl, &mut tr);
println!("{:?} {:?} {:?} {:?}", bl, br, tl, tr);
m1.append(&[
MeshVertex { loc: [0, 0, 0], pos: bl.into(), tex: [0.0, 0.0], tex_id: 2, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: br.into(), tex: [16.0, 0.0], tex_id: 2, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: tl.into(), tex: [0.0, 16.0], tex_id: 2, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: tr.into(), tex: [16.0, 16.0], tex_id: 2, color: [255, 255, 255, 255], light: 0xFF },
]);
c.get_face_vert(Face::North, &mut bl, &mut br, &mut tl, &mut tr);
println!("{:?} {:?} {:?} {:?}", bl, br, tl, tr);
m1.append(&[
MeshVertex { loc: [0, 0, 0], pos: bl.into(), tex: [0.0, 0.0], tex_id: 3, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: br.into(), tex: [16.0, 0.0], tex_id: 3, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: tl.into(), tex: [0.0, 16.0], tex_id: 3, color: [255, 255, 255, 255], light: 0xFF },
MeshVertex { loc: [0, 0, 0], pos: tr.into(), tex: [16.0, 16.0], tex_id: 3, color: [255, 255, 255, 255], light: 0xFF },
]);
c.get_face_vert(Face::North, &mut bl, &mut br, &mut tl, &mut tr);
println!("{:?} {:?} {:?} {:?}", bl, br, tl, tr);
m1.append(&[
MeshVertex { loc: [0, 0, -1], pos: bl.into(), tex: [0.0, 0.0], tex_id: 4, color: [ 69, 173, 242, 255], light: 0xFF },
MeshVertex { loc: [0, 0, -1], pos: br.into(), tex: [16.0, 0.0], tex_id: 4, color: [ 69, 173, 242, 255], light: 0xFF },
MeshVertex { loc: [0, 0, -1], pos: tl.into(), tex: [0.0, 16.0], tex_id: 4, color: [ 69, 173, 242, 255], light: 0xFF },
MeshVertex { loc: [0, 0, -1], pos: tr.into(), tex: [16.0, 16.0], tex_id: 4, color: [ 69, 173, 242, 255], light: 0xFF },
]);
let lmmp = glium::texture::Texture2d::new(ctx.facade(), glrender::default_lmmp(false)).unwrap();
let mut r = glrender::OffScreenRenderer::new(&ctx, &tex, &lmmp);
let world =
Matrix4::from_diagonal(Vector4::new(0.5, 0.5, 0.5, 1.0)) *
Matrix4::from_angle_x(Deg(30.0)) *
Matrix4::from_angle_y(Deg(30.0));
let center = Vector3::new(0, 0, 0);
r.draw([m1].iter(), world, center).unwrap().save("../target/glium-test_texture_2.png").unwrap();
} | rust_cleaned_test_functions.jsonl/11281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
21123,
12080,
1659,
368,
341,
1066,
262,
1077,
274,
284,
1460,
486,
3160,
486,
947,
445,
1911,
71793,
1827,
17119,
20912,
3160,
486,
1911,
71793,
374,
537,
2053,
311,
264,
73873,
2319,
27628... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_value() {
let mut mmds = Mmds::new().unwrap();
let data = r#"{
"name": {
"first": "John",
"second": "Doe"
},
"age": 43,
"phones": [
"+401234567",
"+441234567"
],
"member": false,
"shares_percentage": 12.12,
"balance": -24
}"#;
let data_store: Value = serde_json::from_str(data).unwrap();
mmds.put_data(data_store).unwrap();
// Test invalid path.
assert_eq!(
mmds.get_value("/invalid_path".to_string(), OutputFormat::Json)
.unwrap_err()
.to_string(),
Error::NotFound.to_string()
);
assert_eq!(
mmds.get_value("/invalid_path".to_string(), OutputFormat::Imds)
.unwrap_err()
.to_string(),
Error::NotFound.to_string()
);
// Retrieve an object.
let mut expected_json = r#"{
"first": "John",
"second": "Doe"
}"#
.to_string();
expected_json.retain(|c| !c.is_whitespace());
assert_eq!(
mmds.get_value("/name".to_string(), OutputFormat::Json)
.unwrap(),
expected_json
);
let expected_imds = "first\nsecond";
assert_eq!(
mmds.get_value("/name".to_string(), OutputFormat::Imds)
.unwrap(),
expected_imds
);
// Retrieve an integer.
assert_eq!(
mmds.get_value("/age".to_string(), OutputFormat::Json)
.unwrap(),
"43"
);
assert_eq!(
mmds.get_value("/age".to_string(), OutputFormat::Imds)
.err()
.unwrap()
.to_string(),
Error::UnsupportedValueType.to_string()
);
// Test path ends with /; Value is a dictionary.
// Retrieve an array.
let mut expected = r#"[
"+401234567",
"+441234567"
]"#
.to_string();
expected.retain(|c| !c.is_whitespace());
assert_eq!(
mmds.get_value("/phones/".to_string(), OutputFormat::Json)
.unwrap(),
expected
);
assert_eq!(
mmds.get_value("/phones/".to_string(), OutputFormat::Imds)
.err()
.unwrap()
.to_string(),
Error::UnsupportedValueType.to_string()
);
// Test path does NOT end with /; Value is a dictionary.
assert_eq!(
mmds.get_value("/phones".to_string(), OutputFormat::Json)
.unwrap(),
expected
);
assert_eq!(
mmds.get_value("/phones".to_string(), OutputFormat::Imds)
.err()
.unwrap()
.to_string(),
Error::UnsupportedValueType.to_string()
);
// Retrieve the first element of an array.
assert_eq!(
mmds.get_value("/phones/0/".to_string(), OutputFormat::Json)
.unwrap(),
"\"+401234567\""
);
assert_eq!(
mmds.get_value("/phones/0/".to_string(), OutputFormat::Imds)
.unwrap(),
"+401234567"
);
// Retrieve a boolean.
assert_eq!(
mmds.get_value("/member".to_string(), OutputFormat::Json)
.unwrap(),
"false"
);
assert_eq!(
mmds.get_value("/member".to_string(), OutputFormat::Imds)
.err()
.unwrap()
.to_string(),
Error::UnsupportedValueType.to_string()
);
// Retrieve a float.
assert_eq!(
mmds.get_value("/shares_percentage".to_string(), OutputFormat::Json)
.unwrap(),
"12.12"
);
assert_eq!(
mmds.get_value("/shares_percentage".to_string(), OutputFormat::Imds)
.err()
.unwrap()
.to_string(),
Error::UnsupportedValueType.to_string()
);
// Retrieve a negative integer.
assert_eq!(
mmds.get_value("/balance".to_string(), OutputFormat::Json)
.unwrap(),
"-24"
);
assert_eq!(
mmds.get_value("/balance".to_string(), OutputFormat::Imds)
.err()
.unwrap()
.to_string(),
Error::UnsupportedValueType.to_string()
);
} | rust_cleaned_test_functions.jsonl/40963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3142,
368,
341,
286,
1077,
5206,
296,
2277,
82,
284,
386,
2277,
82,
486,
931,
1005,
15454,
543,
286,
1077,
821,
284,
435,
55543,
515,
310,
330,
606,
788,
341,
394,
330,
3896,
788,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_any_of_match_header() {
let _m = mock("GET", "/")
.match_header(
"Via",
Matcher::AnyOf(vec![
Matcher::Exact("one".into()),
Matcher::Exact("two".into()),
]),
)
.with_body("{}")
.create();
let (_, _, body_json) = request("GET /", "Via: one\r\n");
assert_eq!("{}", body_json);
let (_, _, body_json) = request("GET /", "Via: two\r\n");
assert_eq!("{}", body_json);
let (_, _, body_json) = request("GET /", "Via: one\r\nVia: two\r\n");
assert_eq!("{}", body_json);
let (status_line, _, _) = request("GET /", "Via: one\r\nVia: two\r\nVia: wrong\r\n");
assert!(status_line.starts_with("HTTP/1.1 501 "));
let (status_line, _, _) = request("GET /", "Via: wrong\r\n");
assert!(status_line.starts_with("HTTP/1.1 501 "));
} | rust_cleaned_test_functions.jsonl/82408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37248,
3575,
10708,
8757,
368,
341,
262,
1077,
716,
76,
284,
7860,
445,
3806,
497,
3521,
1138,
286,
659,
6347,
8757,
1006,
310,
330,
54428,
756,
310,
60632,
486,
8610,
2124,
25592,
90515,
394,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop_and_select() -> Result<()> {
let df = fruits_cars();
// we test that the schema is still correct for drop to work.
// typically the projection is pushed to before the drop and then the drop may think that some
// columns are still there to be projected
// we test this on both dataframe scan and csv scan.
let out = df
.lazy()
.drop_columns(["A", "B"])
.select([col("fruits")])
.collect()?;
assert_eq!(out.get_column_names(), &["fruits"]);
let out = scan_foods_csv()
.drop_columns(["calories", "sugar_g"])
.select([col("category")])
.collect()?;
assert_eq!(out.get_column_names(), &["category"]);
Ok(())
} | rust_cleaned_test_functions.jsonl/178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
8378,
13051,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
25322,
666,
1561,
1428,
262,
442,
582,
1273,
429,
279,
10802,
374,
2058,
4396,
369,
5943,
311,
975,
624,
262,
442,
11136,
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_schedule_after_renege() {
let total_lamports = 3;
let mut contract_account = AccountSharedData::new(total_lamports, 512, &id());
let mut payee_account = AccountSharedData::new(0, 0, &system_program::id());
let mut vest_state = VestState {
total_lamports,
start_date_time: Utc.ymd(2019, 1, 1).and_hms(0, 0, 0),
..VestState::default()
};
vest_state
.serialize(contract_account.data_as_mut_slice())
.unwrap();
let current_date = Utc.ymd(2020, 1, 1);
assert_eq!(vest_state.calc_vested_lamports(current_date), 1);
// Verify vesting schedule is calculated with original amount.
vest_state.renege(&mut contract_account, &mut payee_account, 1);
assert_eq!(vest_state.calc_vested_lamports(current_date), 1);
assert_eq!(vest_state.reneged_lamports, 1);
// Verify reneged tokens aren't redeemable.
assert_eq!(vest_state.calc_vested_lamports(Utc.ymd(2022, 1, 1)), 2);
// Verify reneged tokens aren't redeemable after fully vesting.
vest_state.vest_all();
assert_eq!(vest_state.calc_vested_lamports(Utc.ymd(2022, 1, 1)), 2);
} | rust_cleaned_test_functions.jsonl/61906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34530,
19844,
1288,
811,
709,
368,
341,
286,
1077,
2790,
907,
309,
3394,
284,
220,
18,
280,
286,
1077,
5206,
5116,
13500,
284,
8615,
16997,
1043,
486,
931,
22842,
907,
309,
3394,
11,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f64x4_none() {
let a = f64x4::from([1.0, 0.0, 2.0, 3.0]);
assert!(a.none());
let a = f64x4::from([1.0, -0.0, 2.0, 3.0]);
assert!(!a.none());
} | rust_cleaned_test_functions.jsonl/34782 | {
"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,
761,
21,
19,
87,
19,
31488,
368,
341,
220,
1077,
264,
284,
282,
21,
19,
87,
19,
486,
1499,
2561,
16,
13,
15,
11,
220,
15,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
2558,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub_reg_reg() {
assert_emit!(0x29, 0xd8; emit_sub_reg_reg(0, RBX, RAX));
assert_emit!(0x44, 0x29, 0xf9; emit_sub_reg_reg(0, R15, RCX));
assert_emit!(0x48, 0x29, 0xd8; emit_sub_reg_reg(1, RBX, RAX));
assert_emit!(0x4c, 0x29, 0xf9; emit_sub_reg_reg(1, R15, RCX));
} | rust_cleaned_test_functions.jsonl/85448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
4920,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
17,
24,
11,
220,
15,
9703,
23,
26,
16691,
5228,
4920,
4920,
7,
15,
11,
27974,
55,
11,
431,
2954,
1106,
286,
2060,
69082,
10297,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attr2() {
let mut ff = FontFaceDecl::new();
ff.set_font_family("Helvetica");
assert_eq!(
ff.attrmap().attr("svg:font-family"),
Some(&"Helvetica".to_string())
);
ff.set_font_family_generic("fool");
assert_eq!(
ff.attrmap().attr("style:font-family-generic"),
Some(&"fool".to_string())
);
ff.set_font_pitch(FontPitch::Fixed);
assert_eq!(
ff.attrmap().attr("style:font-pitch"),
Some(&"fixed".to_string())
);
} | rust_cleaned_test_functions.jsonl/60149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10422,
17,
368,
341,
262,
1077,
5206,
25539,
284,
9562,
16281,
21629,
486,
931,
1428,
262,
25539,
980,
17451,
26823,
445,
49091,
797,
262,
2060,
10714,
33673,
286,
25539,
12843,
2186,
1005,
2991,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_context() {
let mut context = HashMapContext::new();
context
.set_value("tr".into(), Value::Boolean(true))
.unwrap();
context
.set_value("fa".into(), Value::Boolean(false))
.unwrap();
context.set_value("five".into(), Value::Int(5)).unwrap();
context.set_value("six".into(), Value::Int(6)).unwrap();
context.set_value("half".into(), Value::Float(0.5)).unwrap();
context.set_value("zero".into(), Value::Int(0)).unwrap();
assert_eq!(eval_with_context("tr", &context), Ok(Value::Boolean(true)));
assert_eq!(eval_with_context("fa", &context), Ok(Value::Boolean(false)));
assert_eq!(
eval_with_context("tr && false", &context),
Ok(Value::Boolean(false))
);
assert_eq!(
eval_with_context("five + six", &context),
Ok(Value::Int(11))
);
assert_eq!(
eval_with_context("five * half", &context),
Ok(Value::Float(2.5))
);
assert_eq!(
eval_with_context("five < six && true", &context),
Ok(Value::Boolean(true))
);
} | rust_cleaned_test_functions.jsonl/105344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
8467,
368,
341,
262,
1077,
5206,
2266,
284,
10528,
1972,
486,
931,
543,
262,
2266,
198,
286,
659,
746,
3142,
445,
376,
3263,
18122,
1507,
5162,
486,
6890,
3715,
1171,
286,
659,
15454,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_block_header() -> Result<(), failure::Error> {
let decoded = HashType::BlockHash.bytes_to_string(&hex::decode("46a6aefde9243ae18b191a8d010b7237d5130b3530ce5d1f60457411b2fa632d")?);
let expected = "BLFQ2JjYWHC95Db21cRZC4cgyA1mcXmx1Eg6jKywWy9b8xLzyK9";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
7113,
8757,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
4713,
6370,
42697,
2346,
3904,
2099,
17308,
486,
18196,
445,
19,
21,
64,
21,
64,
823,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_correct_hostname() {
let host = hostname::get()
.expect("failed to get hostname for testing")
.to_str()
.expect("failed to convert to str")
.to_owned();
let hostname_test = Hostname(host);
let has_hostname: bool = hostname_test.try_into().expect("checking hostname failed");
assert!(has_hostname);
} | rust_cleaned_test_functions.jsonl/10700 | {
"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,
31550,
63840,
368,
341,
286,
1077,
3468,
284,
28115,
486,
455,
741,
310,
659,
17119,
445,
16091,
311,
633,
28115,
369,
7497,
1138,
310,
659,
983,
2895,
741,
310,
659,
17119,
445,
16091,
311,
550... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_backwards() {
let mut src: [u32; 3] = [0, 1, 2];
let mut dest: [u32; 3] = [0; 3];
for i in 0..3 {
assert_eq!(src[i], i as u32);
assert_eq!(dest[i], 0);
}
unsafe {
move_backward(
src.as_mut_ptr(),
src.as_mut_ptr().add(src.len()),
dest.as_mut_ptr().add(dest.len()),
);
}
for i in 0..3 {
assert_eq!(src[i], dest[i]);
}
} | rust_cleaned_test_functions.jsonl/12648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
3895,
4014,
368,
341,
286,
1077,
5206,
2286,
25,
508,
84,
18,
17,
26,
220,
18,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
935,
286,
1077,
5206,
3201,
25,
508,
84,
18,
17,
26,
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... | 3 |
#[test]
fn test_lookup_compound_with_bigrams() {
let edit_distance_max = 2;
let mut sym_spell = SymSpell::<UnicodeStringStrategy>::default();
sym_spell.load_dictionary("./data/frequency_dictionary_en_82_765.txt", 0, 1, " ");
sym_spell.load_bigram_dictionary(
"./data/frequency_bigramdictionary_en_243_342.txt",
0,
2,
" ",
);
let typo = "Can yu readthis";
let correction = "can you read this";
let results = sym_spell.lookup_compound(typo, edit_distance_max);
assert_eq!(1, results.len());
assert_eq!(correction, results[0].term);
assert_eq!(3, results[0].distance);
assert_eq!(1366, results[0].count);
} | rust_cleaned_test_functions.jsonl/98944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
18177,
795,
6615,
36386,
94701,
368,
341,
286,
1077,
4499,
19464,
6345,
284,
220,
17,
280,
286,
1077,
5206,
7886,
64717,
284,
11375,
29028,
27638,
33920,
703,
19816,
6831,
2258,
543,
286,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map() {
let input = r#"
TT = [Foo, Bar => Baz, Bark => <&'static Whooh>()],
match v {
VectorValue::TT => EvalType::TT,
EvalType::Other => unreachable!(),
}
"#;
let expect_output = r#"
match v {
VectorValue::Foo => EvalType::Foo,
VectorValue::Bar => EvalType::Baz,
VectorValue::Bark => EvalType:: < & 'static Whooh>(),
EvalType::Other => unreachable!(),
}
"#;
let expect_output_stream: TokenStream = expect_output.parse().unwrap();
let mt: MatchTemplate = syn::parse_str(input).unwrap();
let output = mt.expand();
assert_eq!(output.to_string(), expect_output_stream.to_string());
} | rust_cleaned_test_functions.jsonl/87505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
368,
341,
286,
1077,
1946,
284,
435,
2,
698,
310,
32744,
284,
508,
40923,
11,
4716,
589,
91711,
11,
59529,
589,
366,
5,
6,
1978,
10479,
2267,
13555,
1259,
310,
2432,
348,
341,
394,
4196,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_rest() {
let mut buf = Buffer::new();
buf.insert(0, &['a', 'b', 'c', 'd', 'e', 'f', 'g']);
let mut buf2 = Buffer::new();
buf2.insert(0, &['a', 'b', 'c']);
let mut out: Vec<u8> = vec![];
buf.print_rest(&mut out, buf2.data.len()).unwrap();
assert_eq!(out.len(), 4);
} | rust_cleaned_test_functions.jsonl/61900 | {
"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,
10064,
32231,
368,
341,
286,
1077,
5206,
6607,
284,
10312,
486,
931,
543,
286,
6607,
7030,
7,
15,
11,
609,
677,
64,
516,
364,
65,
516,
364,
66,
516,
364,
67,
516,
364,
68,
516,
364,
69,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_doc_runnables_impl_mod() {
check(
r#"
//- /lib.rs
mod foo;
//- /foo.rs
struct Foo;$0
impl Foo {
/// ```
/// let x = 5;
/// ```
fn foo() {}
}
"#,
&[&DOCTEST],
expect![[r#"
[
Runnable {
nav: NavigationTarget {
file_id: FileId(
1,
),
full_range: 27..81,
name: "foo",
},
kind: DocTest {
test_id: Path(
"foo::Foo::foo",
),
},
cfg: None,
},
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/2495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
14007,
77,
4788,
21007,
7480,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
280,
61463,
608,
7975,
25638,
198,
1235,
33428,
25675,
15,
198,
6383,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_text() {
let s = "LINK 800
copy 1 x \t
@rep 2
addi @{-5,-4} 1 x ; comment
@end
muli 1 0 #nrv
note we groovin";
assert_eq!(
parse_text(s),
Ok(vec![
Instruction::Link(Target::Literal(800)),
Instruction::Copy(Target::Literal(1), Target::Register(String::from("x"))),
Instruction::Addi(
Target::Literal(-5),
Target::Literal(1),
Target::Register(String::from("x"))
),
Instruction::Addi(
Target::Literal(-9),
Target::Literal(1),
Target::Register(String::from("x"))
),
Instruction::Muli(
Target::Literal(1),
Target::Literal(0),
Target::Register(String::from("#nrv"))
),
])
);
} | rust_cleaned_test_functions.jsonl/72901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4326,
368,
972,
286,
1077,
274,
284,
330,
35956,
220,
23,
15,
15,
319,
286,
2975,
256,
220,
16,
262,
856,
1124,
83,
871,
31,
9995,
220,
17,
319,
912,
72,
569,
19999,
20,
4999,
19,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_polynomial_division_by_constant() {
type F = GoldilocksField;
let mut rng = thread_rng();
let a_deg = rng.gen_range(1..10_000);
let a = PolynomialCoeffs::new(F::rand_vec(a_deg));
let b = PolynomialCoeffs::from(vec![F::rand()]);
let (q, r) = a.div_rem(&b);
for _ in 0..1000 {
let x = F::rand();
assert_eq!(a.eval(x), b.eval(x) * q.eval(x) + r.eval(x));
}
} | rust_cleaned_test_functions.jsonl/15045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47323,
25358,
16237,
1816,
3710,
34967,
368,
341,
286,
943,
434,
284,
7421,
321,
25183,
1877,
280,
286,
1077,
5206,
28422,
284,
4516,
66849,
543,
286,
1077,
264,
46057,
284,
28422,
22822,
9698,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_capacity() {
let mut v: SmallVec<[u8; 2]> = SmallVec::new();
v.reserve(1);
assert_eq!(v.capacity(), 2);
assert!(!v.spilled());
v.reserve_exact(0x100);
assert!(v.capacity() >= 0x100);
v.push(0);
v.push(1);
v.push(2);
v.push(3);
v.shrink_to_fit();
assert!(v.capacity() < 0x100);
} | rust_cleaned_test_functions.jsonl/88146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35603,
368,
341,
286,
1077,
5206,
348,
25,
14994,
10050,
66746,
84,
23,
26,
220,
17,
25669,
284,
14994,
10050,
486,
931,
543,
286,
348,
48520,
7,
16,
317,
286,
2060,
10714,
10297,
85,
59168,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_record_with_invalid_line_bases() {
let data = b">sq0\nACGT\nACG\nACGT\nAC\n";
let mut indexer = Indexer::new(&data[..]);
assert!(matches!(
indexer.index_record(),
Err(IndexError::InvalidLineBases(4, 3))
));
} | rust_cleaned_test_functions.jsonl/27392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
14192,
6615,
31433,
6528,
96290,
368,
341,
286,
1077,
821,
284,
293,
755,
28343,
15,
1699,
1706,
25388,
1699,
1706,
38,
1699,
1706,
25388,
1699,
1706,
1699,
876,
286,
1077,
5206,
87216,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_topojson() {
let input_str = include_str!("../fixtures/input.topojson").to_string();
let outlines = handle_topojson(input_str.clone(), 0., false).unwrap();
let lines = outlines.iter().filter(|g| matches!(g, GridGeom::Line(_)));
let areas = handle_topojson(input_str, 0., true).unwrap();
let poly = areas.iter().filter(|g| matches!(g, GridGeom::Polygon(_)));
assert_eq!(outlines.len(), 14);
assert_eq!(lines.count(), 13);
assert_eq!(areas.len(), 5);
assert_eq!(poly.count(), 3);
} | rust_cleaned_test_functions.jsonl/132996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
10426,
78,
2236,
368,
341,
286,
1077,
1946,
2895,
284,
2924,
2895,
17223,
1244,
45247,
39990,
8772,
78,
2236,
1827,
983,
3904,
543,
286,
1077,
49629,
284,
3705,
10426,
78,
2236,
5384,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.