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_parse_compression() {
assert_eq!(parse_compression("none").unwrap(), false);
assert_eq!(parse_compression("lz4").unwrap(), false);
parse_compression("?").unwrap_err();
} | rust_cleaned_test_functions.jsonl/23541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2965,
4011,
368,
341,
286,
2060,
10714,
10297,
6400,
2965,
4011,
445,
6697,
1827,
15454,
1507,
895,
317,
286,
2060,
10714,
10297,
6400,
2965,
4011,
445,
95505,
19,
1827,
15454,
1507,
895,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_id() {
let documents = load_document("../tests/Soft_Job_M.1181801925.A.86E.html");
assert_eq!(parse_id(&documents), "M.1181801925.A.86E".to_owned());
} | rust_cleaned_test_functions.jsonl/87140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
842,
368,
341,
286,
1077,
9293,
284,
2795,
26231,
17409,
23841,
14,
30531,
10598,
674,
1245,
13,
16,
16,
23,
16,
23,
15,
16,
24,
17,
20,
875,
13,
23,
21,
36,
2564,
3071,
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_zero_array_from_unit() {
assert_de_tokens_error::<[isize; 0]>(
&[Token::Unit],
"invalid type: unit value, expected an empty array",
);
} | rust_cleaned_test_functions.jsonl/129538 | {
"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,
19359,
3858,
5673,
14832,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
58,
285,
551,
26,
220,
15,
60,
17055,
286,
44590,
3323,
486,
4562,
1259,
286,
330,
11808,
943,
25,
4982,
897,
11,
3601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_claim_not_exist() {
new_test_ext().execute_with(|| {
let not_exist_claim = vec![2];
// case 1
assert_noop!(
PoeModule::revoke_claim(Origin::signed(1), not_exist_claim.clone()),
Error::<Test>::ClaimNotExist
);
// case 2
assert_noop!(
PoeModule::transfer_claim(Origin::signed(1), 2, not_exist_claim.clone()),
Error::<Test>::ClaimNotExist
);
});
} | rust_cleaned_test_functions.jsonl/12048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84969,
7913,
35906,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
537,
35906,
84969,
284,
7486,
20703,
17,
4821,
197,
197,
322,
1142,
220,
16,
198,
197,
6948,
6536,
453,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_savepoint_names() {
let mut db = checked_memory_handle();
{
let mut sp1 = db.savepoint_with_name("my_sp").unwrap();
insert(1, &sp1);
assert_current_sum(1, &sp1);
{
let mut sp2 = sp1.savepoint_with_name("my_sp").unwrap();
sp2.set_drop_behavior(DropBehavior::Commit);
insert(2, &sp2);
assert_current_sum(3, &sp2);
sp2.rollback().unwrap();
assert_current_sum(1, &sp2);
insert(4, &sp2);
}
assert_current_sum(5, &sp1);
sp1.rollback().unwrap();
{
let mut sp2 = sp1.savepoint_with_name("my_sp").unwrap();
sp2.set_drop_behavior(DropBehavior::Ignore);
insert(8, &sp2);
}
assert_current_sum(8, &sp1);
sp1.commit().unwrap();
}
assert_current_sum(8, &db);
} | rust_cleaned_test_functions.jsonl/64093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 591
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15376,
2768,
9187,
368,
341,
286,
1077,
5206,
2927,
284,
10067,
19195,
10630,
1428,
286,
341,
310,
1077,
5206,
978,
16,
284,
2927,
5681,
2768,
6615,
1269,
445,
2408,
10123,
1827,
15454,
543,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffered_value() {
let data = vec![1, 2, 3, 4];
let buffered = BufferedIO {
cursor: Cursor::new(data.clone()),
};
assert_eq!(buffered.getvalue(), data);
} | rust_cleaned_test_functions.jsonl/63616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
291,
3142,
368,
341,
310,
1077,
821,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
310,
1077,
53057,
284,
30702,
3810,
341,
394,
8128,
25,
28067,
486,
931,
2592,
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 |
#[test]
fn test_parse() {
assert_eq!(
parse("1 day + 2 months").unwrap().1,
DateMath::Periods(Period::Day(1), vec![PeriodOp::Add(Period::Month(2))])
);
assert_eq!(
parse("Jan 2, 2021 + 15 weeks").unwrap().1,
DateMath::StartWithPeriods(
CalculatedDate::Raw(NaiveDate::from_ymd_opt(2021, 1, 2).unwrap()),
PeriodOp::Add(Period::Week(15)),
vec![]
)
);
assert_eq!(
parse("Mar 31, 2021 + 15 weeks + 2 days").unwrap().1,
DateMath::StartWithPeriods(
CalculatedDate::Raw(NaiveDate::from_ymd_opt(2021, 3, 31).unwrap()),
PeriodOp::Add(Period::Week(15)),
vec![PeriodOp::Add(Period::Day(2))]
)
);
assert_eq!(
parse("Mar 31, 2021 - 15 weeks + 2 days").unwrap().1,
DateMath::StartWithPeriods(
CalculatedDate::Raw(NaiveDate::from_ymd_opt(2021, 3, 31).unwrap()),
PeriodOp::Subtract(Period::Week(15)),
vec![PeriodOp::Add(Period::Day(2))]
)
);
assert_eq!(
parse("Mar 31, 2021").unwrap().1,
DateMath::Start(CalculatedDate::Raw(
NaiveDate::from_ymd_opt(2021, 3, 31).unwrap()
))
);
assert_eq!(
parse("today").unwrap().1,
DateMath::Start(CalculatedDate::Today)
);
} | rust_cleaned_test_functions.jsonl/43992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 855
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
445,
16,
1899,
488,
220,
17,
3951,
1827,
15454,
1005,
16,
345,
310,
2631,
8815,
486,
23750,
82,
7,
23750,
486,
10159,
7,
16,
701,
7486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_1_tb_file_min_cluster() {
let mut header = test_huge_header();
header[24] = 0;
header[26] = 1;
header[31] = 0;
with_basic_file(&header, |disk_file: RawFile| {
QcowFile::from(disk_file).expect_err("Failed to create file.");
});
} | rust_cleaned_test_functions.jsonl/96729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
62,
16,
23481,
2458,
7260,
28441,
368,
341,
286,
1077,
5206,
4247,
284,
1273,
1523,
4733,
8757,
543,
286,
4247,
58,
17,
19,
60,
284,
220,
15,
280,
286,
4247,
58,
17,
21,
60,
284,
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_find_cookie_value() {
let table = vec![
("refresh=1; wengine_vpn_ticketwebvpn_neu_edu_cn=3c2cca8a854e8122", "wengine_vpn_ticketwebvpn_neu_edu_cn", Some("3c2cca8a854e8122".to_owned())),
("CASTGC=TGT-20180000-1827000-izbHeCI9y53RyIpMoYKxKbdyjtkgmfOy0NwbJHHiwXQabRYYKK-tpass; Language=zh_CN; jsessionid_tpass=ZLr9vBLe0xcX0nPsDfv3WASFiziyH-sMuy4CDoiIcqJkASjw136y!-1701433832", "CASTGC", Some("TGT-20180000-1827000-izbHeCI9y53RyIpMoYKxKbdyjtkgmfOy0NwbJHHiwXQabRYYKK-tpass".to_owned())),
("CASTGC=TGT-20180000-1827000-izbHeCI9y53RyIpMoYKxKbdyjtkgmfOy0NwbJHHiwXQabRYYKK-tpass; Language=zh_CN; jsessionid_tpass=ZLr9vBLe0xcX0nPsDfv3WASFiziyH-sMuy4CDoiIcqJkASjw136y!-1701433832", "jsessionid_tpass", Some("ZLr9vBLe0xcX0nPsDfv3WASFiziyH-sMuy4CDoiIcqJkASjw136y!-1701433832".to_owned())),
("", "wengine_vpn_ticketwebvpn_neu_edu_cn", None),
];
for (raw, name, expected) in table {
assert_eq!(find_cookie_value(raw, name), expected)
}
} | rust_cleaned_test_functions.jsonl/42455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
38663,
3142,
368,
341,
286,
1077,
1965,
284,
7486,
90515,
310,
3489,
17168,
28,
16,
26,
289,
8512,
2273,
19958,
45718,
2911,
59589,
13925,
84,
32370,
84,
52177,
28,
18,
66,
17,
24441,
23,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_namespace_one() {
let mut l = Lexer::<DefaultContext>::new(b"A");
let p = NsNamesParser::new(&mut l);
let (_, ns) = p.parse();
assert_eq!(
ns.unwrap(),
vec![NsName {
inline: false,
name: "A".to_string(),
}]
);
} | rust_cleaned_test_functions.jsonl/70644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41571,
11667,
368,
341,
286,
1077,
5206,
326,
284,
85082,
27638,
3675,
1972,
6831,
931,
1883,
29133,
797,
286,
1077,
281,
284,
451,
82,
7980,
6570,
486,
931,
2099,
6984,
326,
317,
286,
1077,
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... | 1 |
#[test]
fn test_bookmark() {
let b = Paragraph::new()
.add_bookmark_start(0, "article")
.add_run(Run::new().add_text("Hello"))
.add_bookmark_end(0)
.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:p w14:paraId="12345678"><w:pPr><w:rPr /></w:pPr><w:bookmarkStart w:id="0" w:name="article" /><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r><w:bookmarkEnd w:id="0" /></w:p>"#
);
} | rust_cleaned_test_functions.jsonl/50376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26421,
3987,
368,
341,
286,
1077,
293,
284,
49351,
486,
931,
741,
310,
659,
718,
26421,
3987,
4906,
7,
15,
11,
330,
7058,
1138,
310,
659,
718,
14007,
2785,
359,
486,
931,
1005,
718,
4326,
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_move_zeroes() {
let mut nums = vec![1, 2, 0, 3, 0];
move_zeroes(&mut nums);
assert_eq!(nums, vec![1, 2, 3, 0, 0]);
} | rust_cleaned_test_functions.jsonl/30011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
19359,
288,
368,
341,
262,
1077,
5206,
10307,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
15,
11,
220,
18,
11,
220,
15,
935,
262,
3271,
19359,
288,
2099,
6984,
10307,
317,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cairo_short_string_to_felt_too_long() {
assert!(matches!(
cairo_short_string_to_felt("12345678901234567890123456789012"),
Err(CairoShortStringToFeltError::StringTooLong)
));
} | rust_cleaned_test_functions.jsonl/53657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
25549,
16673,
3904,
2346,
761,
3818,
2346,
78,
17799,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
53648,
16673,
3904,
2346,
761,
3818,
445,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
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_acosh() {
assert_eq!(1.0f32.acosh(), 0.0f32);
assert!(0.999f32.acosh().is_nan());
let inf: f32 = f32::INFINITY;
let neg_inf: f32 = f32::NEG_INFINITY;
let nan: f32 = f32::NAN;
assert_eq!(inf.acosh(), inf);
assert!(neg_inf.acosh().is_nan());
assert!(nan.acosh().is_nan());
assert_approx_eq!(2.0f32.acosh(), 1.31695789692481670862504634730796844f32);
assert_approx_eq!(3.0f32.acosh(), 1.76274717403908605046521864995958461f32);
} | rust_cleaned_test_functions.jsonl/8128 | {
"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,
14718,
9267,
368,
341,
286,
2060,
10714,
10297,
16,
13,
15,
69,
18,
17,
15399,
9267,
1507,
220,
15,
13,
15,
69,
18,
17,
317,
286,
2060,
10297,
15,
13,
24,
24,
24,
69,
18,
17,
15399,
9267,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query_sqlite() {
test_read_query(
Connection::with_sqlite(SqliteConnection::open_in_memory().unwrap()),
TestSemantics::Sqlite,
);
} | rust_cleaned_test_functions.jsonl/62223 | {
"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,
6443,
5738,
18063,
632,
368,
341,
262,
1273,
6443,
5738,
1006,
286,
11032,
486,
4197,
18063,
632,
71469,
632,
4526,
486,
2508,
1243,
19195,
1005,
15454,
14702,
286,
3393,
29499,
36233,
486,
8269,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cos() {
let test_cases = vec![
(0f64, 1f64),
(std::f64::consts::PI / 2f64, 0f64),
(std::f64::consts::PI, -1f64),
(-std::f64::consts::PI, -1f64),
];
for (input, expect) in test_cases {
let output: Option<Real> = RpnFnScalarEvaluator::new()
.push_param(Some(Real::new(input).unwrap()))
.evaluate(ScalarFuncSig::Cos)
.unwrap();
assert!((output.unwrap().into_inner() - expect).abs() < f64::EPSILON);
}
} | rust_cleaned_test_functions.jsonl/9491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61192,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
15,
69,
21,
19,
11,
220,
16,
69,
21,
19,
1326,
310,
320,
1834,
486,
69,
21,
19,
486,
95773,
486,
1893,
608,
220,
17,
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... | 2 |
#[test]
fn test_expr_order() {
let rules = create_rules(
r#"
macro_rules! foo {
($ i:expr) => {
fn bar() { $ i * 2; }
}
}
"#,
);
assert_eq!(
format!("{:#?}", expand_to_items(&rules, "foo! { 1 + 1 }").syntax()).trim(),
r#"MACRO_ITEMS@[0; 15)
FN_DEF@[0; 15)
FN_KW@[0; 2) "fn"
NAME@[2; 5)
IDENT@[2; 5) "bar"
PARAM_LIST@[5; 7)
L_PAREN@[5; 6) "("
R_PAREN@[6; 7) ")"
BLOCK_EXPR@[7; 15)
BLOCK@[7; 15)
L_CURLY@[7; 8) "{"
EXPR_STMT@[8; 14)
BIN_EXPR@[8; 13)
BIN_EXPR@[8; 11)
LITERAL@[8; 9)
INT_NUMBER@[8; 9) "1"
PLUS@[9; 10) "+"
LITERAL@[10; 11)
INT_NUMBER@[10; 11) "1"
STAR@[11; 12) "*"
LITERAL@[12; 13)
INT_NUMBER@[12; 13) "2"
SEMI@[13; 14) ";"
R_CURLY@[14; 15) "}""#,
);
} | rust_cleaned_test_functions.jsonl/14712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 671
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
7869,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
600,
96011,
8,
589,
341,
338,
5168,
3619,
368,
314,
400,
600,
353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_number_of_keys() {
let dir = tempfile::tempdir().unwrap();
let rocksfs = RocksFs::new(dir.path()).unwrap();
for i in 0..10 {
rocksfs.put(&format!("foo{i}"), [i; 128]).unwrap();
}
assert_eq!(rocksfs.number_of_keys().unwrap(), 10);
for i in 0..10 {
assert_eq!(&rocksfs.get(&format!("foo{i}")).unwrap()[..], [i; 128]);
assert_eq!(rocksfs.get_size(&format!("foo{i}")).unwrap(), 128);
}
drop(rocksfs);
// Reread for size
let rocksfs = RocksFs::new(dir.path()).unwrap();
assert_eq!(rocksfs.number_of_keys().unwrap(), 10);
} | rust_cleaned_test_functions.jsonl/3265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
3062,
5500,
3575,
12631,
368,
341,
286,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
23035,
3848,
284,
68031,
48300,
486,
931,
14161,
3875,
6011,
15454,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_from_str_trait() {
let s = "null";
assert!(::std::str::from_str::<Json>(s).unwrap() == from_str(s).unwrap());
} | rust_cleaned_test_functions.jsonl/6529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
78491,
368,
341,
286,
1077,
274,
284,
330,
2921,
876,
286,
2060,
10297,
486,
1834,
486,
495,
486,
1499,
2895,
27638,
5014,
2235,
82,
568,
15454,
368,
621,
504,
2895,
1141,
568,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_load_accounts_programdata_with_write_lock() {
let mut accounts: Vec<TransactionAccount> = Vec::new();
let mut error_counters = ErrorCounters::default();
let keypair = Keypair::new();
let key0 = keypair.pubkey();
let key1 = Pubkey::new(&[5u8; 32]);
let key2 = Pubkey::new(&[6u8; 32]);
let mut account = AccountSharedData::new(1, 0, &Pubkey::default());
account.set_rent_epoch(1);
accounts.push((key0, account));
let program_data = UpgradeableLoaderState::ProgramData {
slot: 42,
upgrade_authority_address: None,
};
let mut account =
AccountSharedData::new_data(40, &program_data, &bpf_loader_upgradeable::id()).unwrap();
account.set_rent_epoch(1);
accounts.push((key1, account));
let mut account = AccountSharedData::new(40, 1, &native_loader::id());
account.set_executable(true);
account.set_rent_epoch(1);
accounts.push((key2, account));
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let mut message = Message::new_with_compiled_instructions(
1,
0,
1, // only the program marked as readonly
vec![key0, key1, key2],
Hash::default(),
instructions,
);
let tx = Transaction::new(&[&keypair], message.clone(), Hash::default());
let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters);
assert_eq!(error_counters.invalid_writable_account, 1);
assert_eq!(loaded_accounts.len(), 1);
assert_eq!(
loaded_accounts[0],
(Err(TransactionError::InvalidWritableAccount), None)
);
// Solution 1: include bpf_loader_upgradeable account
let mut account = AccountSharedData::new(40, 1, &native_loader::id()); // create mock bpf_loader_upgradeable
account.set_executable(true);
account.set_rent_epoch(1);
let accounts_with_upgradeable_loader = vec![
accounts[0].clone(),
accounts[1].clone(),
(bpf_loader_upgradeable::id(), account),
];
message.account_keys = vec![key0, key1, bpf_loader_upgradeable::id()];
let tx = Transaction::new(&[&keypair], message.clone(), Hash::default());
let loaded_accounts =
load_accounts(tx, &accounts_with_upgradeable_loader, &mut error_counters);
assert_eq!(error_counters.invalid_writable_account, 1);
assert_eq!(loaded_accounts.len(), 1);
let result = loaded_accounts[0].0.as_ref().unwrap();
assert_eq!(result.accounts[..2], accounts_with_upgradeable_loader[..2]);
assert_eq!(
result.accounts[result.program_indices[0][0]],
accounts_with_upgradeable_loader[2]
);
// Solution 2: mark programdata as readonly
message.account_keys = vec![key0, key1, key2]; // revert key change
message.header.num_readonly_unsigned_accounts = 2; // extend readonly set to include programdata
let tx = Transaction::new(&[&keypair], message, Hash::default());
let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters);
assert_eq!(error_counters.invalid_writable_account, 1);
assert_eq!(loaded_accounts.len(), 1);
let result = loaded_accounts[0].0.as_ref().unwrap();
assert_eq!(result.accounts[..2], accounts[..2]);
assert_eq!(result.accounts[result.program_indices[0][0]], accounts[2]);
} | rust_cleaned_test_functions.jsonl/13214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
55665,
25096,
691,
6615,
9165,
9818,
368,
341,
286,
1077,
5206,
9618,
25,
11312,
86314,
7365,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
1465,
85632,
284,
4600,
2507,
388,
486,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conversion() {
let nad83_m = Proj::new("
+proj=pipeline
+step +inv +proj=lcc +lat_1=33.88333333333333
+lat_2=32.78333333333333 +lat_0=32.16666666666666
+lon_0=-116.25 +x_0=2000000.0001016 +y_0=500000.0001016001 +ellps=GRS80
+towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs
+step +proj=lcc +lat_1=33.88333333333333 +lat_2=32.78333333333333 +lat_0=32.16666666666666
+lon_0=-116.25 +x_0=2000000 +y_0=500000
+ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
").unwrap();
let t = nad83_m
.convert(Point::new(4760096.421921, 3744293.729449))
.unwrap();
assert_almost_eq(t.x(), 1450880.29);
assert_almost_eq(t.y(), 1141263.01);
} | rust_cleaned_test_functions.jsonl/104011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64132,
368,
341,
286,
1077,
33534,
23,
18,
717,
284,
42952,
486,
931,
70576,
310,
488,
30386,
17385,
8790,
198,
310,
488,
9520,
488,
14057,
488,
30386,
40627,
638,
488,
5524,
62,
16,
28,
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... | 1 |
#[test]
fn test_for_cycle() {
let t = ForCycle {
values: &[1, 2, 3, 4, 5, 6, 7, 8, 9],
};
assert_eq!(t.render().unwrap(), "r1,g2,b3,r4,g5,b6,r7,g8,b9,");
} | rust_cleaned_test_functions.jsonl/100234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
39079,
368,
341,
262,
1077,
259,
284,
1752,
44820,
341,
286,
2750,
25,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
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_boolean_array_eq() {
let a: BooleanArray =
vec![Some(true), Some(false), Some(false), Some(true), Some(true), None]
.into();
let b: BooleanArray =
vec![Some(true), Some(true), Some(false), Some(false), None, Some(false)]
.into();
let res: Vec<Option<bool>> = eq_bool(&a, &b).unwrap().iter().collect();
assert_eq!(
res,
vec![Some(true), Some(false), Some(true), Some(false), None, None]
)
} | rust_cleaned_test_functions.jsonl/45792 | {
"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,
46642,
3858,
10714,
368,
341,
286,
1077,
264,
25,
6992,
1857,
4035,
310,
7486,
20703,
8373,
3715,
701,
4329,
3576,
701,
4329,
3576,
701,
4329,
3715,
701,
4329,
3715,
701,
2240,
921,
394,
659,
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_server_compile() {
match env_logger::init() {
Ok(_) => {},
Err(_) => {},
}
let f = TestFixture::new();
let (port, sender, server_creator, child) = run_server_thread(&f.tempdir.path(), None);
// Connect to the server.
const PREPROCESSOR_STDOUT : &'static [u8] = b"preprocessor stdout";
const PREPROCESSOR_STDERR : &'static [u8] = b"preprocessor stderr";
const STDOUT : &'static [u8] = b"some stdout";
const STDERR : &'static [u8] = b"some stderr";
let conn = connect_to_server(port).unwrap();
{
let mut c = server_creator.lock().unwrap();
c.next_command_spawns(Ok(MockChild::new(exit_status(0), "gcc", "")));
// Preprocessor invocation.
c.next_command_spawns(Ok(MockChild::new(exit_status(0), PREPROCESSOR_STDOUT, PREPROCESSOR_STDERR)));
// Compiler invocation.
//TODO: wire up a way to get data written to stdin.
let obj = f.tempdir.path().join("file.o");
c.next_command_calls(move |_| {
// Pretend to compile something.
let mut f = File::create(&obj)?;
f.write_all(b"file contents")?;
Ok(MockChild::new(exit_status(0), STDOUT, STDERR))
});
}
// Ask the server to compile something.
//TODO: MockCommand should validate these!
let exe = &f.bins[0];
let cmdline = vec!["-c".into(), "file.c".into(), "-o".into(), "file.o".into()];
let cwd = f.tempdir.path();
// This creator shouldn't create any processes. It will assert if
// it tries to.
let client_creator = new_creator();
let mut stdout = Cursor::new(Vec::new());
let mut stderr = Cursor::new(Vec::new());
let path = Some(f.paths);
let mut core = Core::new().unwrap();
assert_eq!(0, do_compile(client_creator.clone(), &mut core, conn, exe, cmdline, cwd, path, vec![], &mut stdout, &mut stderr).unwrap());
// Make sure we ran the mock processes.
assert_eq!(0, server_creator.lock().unwrap().children.len());
assert_eq!(STDOUT, stdout.into_inner().as_slice());
assert_eq!(STDERR, stderr.into_inner().as_slice());
// Shut down the server.
sender.send(ServerMessage::Shutdown).ok().unwrap();
// Ensure that it shuts down.
child.join().unwrap();
} | rust_cleaned_test_functions.jsonl/82349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 968
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
74170,
368,
341,
262,
2432,
6105,
27413,
486,
2327,
368,
341,
286,
7622,
48139,
589,
14573,
286,
15495,
48139,
589,
14573,
262,
456,
262,
1077,
282,
284,
3393,
18930,
486,
931,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_gen_ascii_str() {
let mut r = task_rng();
assert_eq!(r.gen_ascii_chars().take(0).count(), 0u);
assert_eq!(r.gen_ascii_chars().take(10).count(), 10u);
assert_eq!(r.gen_ascii_chars().take(16).count(), 16u);
} | rust_cleaned_test_functions.jsonl/23763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
50238,
2895,
368,
341,
286,
1077,
5206,
435,
284,
3383,
66849,
543,
286,
2060,
10714,
10297,
81,
22822,
50238,
37418,
1005,
22769,
7,
15,
568,
1830,
1507,
220,
15,
84,
317,
286,
2060,
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_generate_whitelist_hash() {
let neighbors: HashSet<u64> = generate_whitelist_set(&[7], 3).unwrap();
let mut output: Vec<u64> = neighbors.into_iter().collect();
output.sort_unstable();
output.dedup();
assert_eq!(
output,
vec![1, 3, 4, 5, 6, 9, 11, 12, 13, 14, 15, 23, 28, 29, 30, 31, 39, 55]
);
} | rust_cleaned_test_functions.jsonl/118243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
36225,
57645,
8950,
368,
341,
286,
1077,
18709,
25,
18931,
34837,
21,
19,
29,
284,
6923,
36225,
57645,
2602,
2099,
58,
22,
1125,
220,
18,
568,
15454,
543,
286,
1077,
5206,
2550,
25,
11312... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_suspicious_tags() {
// that profile tags will then differ or cause failures compared to
let cases = [
(" begins with non-letter".to_string(), "value".to_owned()),
(
"the-tag-length-is-over-200-characters".repeat(6),
"value".to_owned(),
),
];
for case in cases {
let result = Tag::new(case.0, case.1);
assert!(result.is_ok())
}
} | rust_cleaned_test_functions.jsonl/16657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
29763,
9627,
16333,
368,
341,
1789,
286,
442,
429,
5526,
9492,
686,
1221,
1745,
476,
5240,
27850,
7707,
311,
8945,
286,
1077,
5048,
284,
2278,
310,
3489,
12033,
448,
2477,
79368,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_versioned_message() {
let tx = test_tx();
let mut packet = sigverify::make_packet_from_transaction(tx);
let mut legacy_offsets = sigverify::do_get_packet_offsets(&packet, 0).unwrap();
// set message version to 0
let msg_start = legacy_offsets.msg_start as usize;
let msg_bytes = packet.data[msg_start..packet.meta.size].to_vec();
packet.data[msg_start] = MESSAGE_VERSION_PREFIX;
packet.meta.size += 1;
packet.data[msg_start + 1..packet.meta.size].copy_from_slice(&msg_bytes);
let offsets = sigverify::do_get_packet_offsets(&packet, 0).unwrap();
let expected_offsets = {
legacy_offsets.pubkey_start += 1;
legacy_offsets
};
assert_eq!(expected_offsets, offsets);
} | rust_cleaned_test_functions.jsonl/22081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
291,
6462,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
5206,
10151,
284,
8366,
12446,
486,
6927,
21078,
5673,
28884,
27301,
626,
286,
1077,
5206,
19588,
56924,
284,
8366,
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,
1... | 1 |
#[test]
fn test_split_once() {
assert_eq!(split_once("abc", 'b'), ("a", Some("c")));
assert_eq!(split_once("abc", 'c'), ("ab", Some("")));
assert_eq!(split_once("abc", 'd'), ("abc", None));
} | rust_cleaned_test_functions.jsonl/84425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
7630,
368,
341,
286,
2060,
10714,
10297,
6960,
7630,
445,
13683,
497,
364,
65,
4567,
3489,
64,
497,
4329,
445,
66,
17621,
286,
2060,
10714,
10297,
6960,
7630,
445,
13683,
497,
364,
66,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_font_regexp() {
let reg = init_font_regexp();
let caps = reg.captures("1.2em \"Fira Sans\"");
assert!(caps.is_some());
let caps = caps.unwrap();
for i in 1usize..=5usize {
assert_eq!(caps.get(i), None);
}
// size
assert_eq!(caps.get(7).map(|m| m.as_str()), Some("1.2"));
// unit
assert_eq!(caps.get(8).map(|m| m.as_str()), Some("em"));
// family
assert_eq!(caps.get(9).map(|m| m.as_str()), Some("\"Fira Sans\""));
} | rust_cleaned_test_functions.jsonl/15472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17451,
4920,
4580,
368,
341,
220,
1077,
1217,
284,
2930,
17451,
4920,
4580,
543,
220,
1077,
18568,
284,
1217,
520,
2689,
1413,
445,
16,
13,
17,
336,
7245,
37,
8832,
14747,
88385,
220,
2060,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_persistent_build() -> Result<()> {
let mut user_file = String::from(USER);
let mut build_file = String::from(BUILD);
let mut global_file = String::from(GLOBAL);
let persistent_config = Persistent::load(
Some(BufReader::new(global_file.as_bytes())),
Some(BufReader::new(build_file.as_bytes())),
Some(BufReader::new(user_file.as_bytes())),
None,
)?;
let value = persistent_config.get(&"name".into(), &identity);
assert!(value.is_some());
assert_eq!(value.unwrap(), Value::String(String::from("User")));
let mut user_file_out = String::new();
let mut build_file_out = String::new();
let mut global_file_out = String::new();
unsafe {
persistent_config.save(
Some(BufWriter::new(global_file_out.as_mut_vec())),
Some(BufWriter::new(build_file_out.as_mut_vec())),
Some(BufWriter::new(user_file_out.as_mut_vec())),
)?;
}
// Remove whitespace
user_file.retain(|c| !c.is_whitespace());
build_file.retain(|c| !c.is_whitespace());
global_file.retain(|c| !c.is_whitespace());
user_file_out.retain(|c| !c.is_whitespace());
build_file_out.retain(|c| !c.is_whitespace());
global_file_out.retain(|c| !c.is_whitespace());
assert_eq!(user_file, user_file_out);
assert_eq!(build_file, build_file_out);
assert_eq!(global_file, global_file_out);
Ok(())
} | rust_cleaned_test_functions.jsonl/67375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 778
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
13931,
20801,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
1196,
2458,
284,
923,
486,
1499,
71389,
317,
286,
1077,
5206,
1936,
2458,
284,
923,
486,
1499,
5349,
18023,
317,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_part1_b() {
let input =
"#######
#G..#E#
#E#E.E#
#G.##.#
#...#E#
#...E.#
#######";
assert_eq!(part1(&as_input(input)), 36334);
} | rust_cleaned_test_functions.jsonl/13272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
880,
368,
341,
286,
1077,
1946,
4035,
310,
330,
82024,
1797,
671,
38,
496,
2,
36,
4956,
1797,
671,
36,
2,
36,
5142,
4956,
1797,
671,
38,
13,
565,
13,
4956,
1797,
671,
1112,
2,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slow_node_restore() {
setup_for_test();
let mut nt = Network::new(vec![None, None, None]);
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
nt.isolate(3);
for _ in 0..100 {
nt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
}
next_ents(&mut nt.peers.get_mut(&1).unwrap(), &nt.storage[&1]);
let mut cs = ConfState::new();
cs.set_nodes(nt.peers[&1].prs().voter_ids().iter().cloned().collect());
nt.storage[&1]
.wl()
.create_snapshot(nt.peers[&1].raft_log.applied, Some(cs), vec![])
.expect("");
nt.storage[&1]
.wl()
.compact(nt.peers[&1].raft_log.applied)
.expect("");
nt.recover();
// send heartbeats so that the leader can learn everyone is active.
// node 3 will only be considered as active when node 1 receives a reply from it.
loop {
nt.send(vec![new_message(1, 1, MessageType::MsgBeat, 0)]);
if nt.peers[&1].prs().get(3).unwrap().recent_active {
break;
}
}
// trigger a snapshot
nt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
// trigger a commit
nt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
assert_eq!(
nt.peers[&3].raft_log.committed,
nt.peers[&1].raft_log.committed
);
} | rust_cleaned_test_functions.jsonl/107149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82447,
5084,
62677,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
31412,
284,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
11,
2240,
2558,
262,
31412,
5219,
25592,
20703,
931,
6462,
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... | 3 |
#[test]
fn test_vector_convert_ops() {
let context = Context::create();
let module = context.create_module("test");
let int8_vec_type = context.i8_type().vec_type(3);
let int32_vec_type = context.i32_type().vec_type(3);
let float32_vec_type = context.f32_type().vec_type(3);
let float16_vec_type = context.f16_type().vec_type(3);
// Here we're building a function that takes in a <3 x i8> and returns it casted to and from a <3 x i32>
// Casting to and from means we can ensure the cast build functions return a vector when one is provided.
let fn_type = int32_vec_type.fn_type(&[int8_vec_type.into()], false);
let fn_value = module.add_function("test_int_vec_cast", fn_type, None);
let entry = fn_value.append_basic_block("entry");
let builder = context.create_builder();
builder.position_at_end(&entry);
let in_vec = fn_value.get_first_param().unwrap().into_vector_value();
let casted_vec = builder.build_int_cast(in_vec, int32_vec_type, "casted_vec");
let _uncasted_vec = builder.build_int_cast(casted_vec, int8_vec_type, "uncasted_vec");
builder.build_return(Some(&casted_vec));
assert!(fn_value.verify(true));
// Here we're building a function that takes in a <3 x f32> and returns it casted to and from a <3 x f16>
let fn_type = float16_vec_type.fn_type(&[float32_vec_type.into()], false);
let fn_value = module.add_function("test_float_vec_cast", fn_type, None);
let entry = fn_value.append_basic_block("entry");
let builder = context.create_builder();
builder.position_at_end(&entry);
let in_vec = fn_value.get_first_param().unwrap().into_vector_value();
let casted_vec = builder.build_float_cast(in_vec, float16_vec_type, "casted_vec");
let _uncasted_vec = builder.build_float_cast(casted_vec, float32_vec_type, "uncasted_vec");
builder.build_return(Some(&casted_vec));
assert!(fn_value.verify(true));
// Here we're building a function that takes in a <3 x f32> and returns it casted to and from a <3 x i32>
let fn_type = int32_vec_type.fn_type(&[float32_vec_type.into()], false);
let fn_value = module.add_function("test_float_to_int_vec_cast", fn_type, None);
let entry = fn_value.append_basic_block("entry");
let builder = context.create_builder();
builder.position_at_end(&entry);
let in_vec = fn_value.get_first_param().unwrap().into_vector_value();
let casted_vec = builder.build_float_to_signed_int(in_vec, int32_vec_type, "casted_vec");
let _uncasted_vec = builder.build_signed_int_to_float(casted_vec, float32_vec_type, "uncasted_vec");
builder.build_return(Some(&casted_vec));
assert!(fn_value.verify(true));
} | rust_cleaned_test_functions.jsonl/39119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
34910,
21959,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
1944,
797,
262,
1077,
526,
23,
13251,
1819,
284,
2266,
8607,
23,
1819,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_parameter_extraction_works_without_params() {
let original_path = syn::parse_str::<TypePath>("std::module1::module2::Hello")
.expect("Could not parse str into syn::Path");
let (transformed_path, extracted_type_params) =
generic_path_to_concrete_type_path(original_path);
assert!(extracted_type_params.is_none());
assert_eq!(
transformed_path,
syn::parse_str::<TypePath>("std::module1::module2::Hello").unwrap()
)
} | rust_cleaned_test_functions.jsonl/101065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
24899,
94842,
11498,
82,
39904,
6745,
368,
341,
286,
1077,
4024,
2638,
284,
6782,
486,
6400,
2895,
27638,
929,
1820,
13211,
1834,
486,
4352,
16,
486,
4352,
17,
486,
9707,
1138,
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,
1... | 1 |
#[test]
fn test_124() {
assert_eq!(
Solution::max_path_sum(to_tree(vec![Some(1), Some(2), Some(3),])),
6
);
assert_eq!(
Solution::max_path_sum(to_tree(vec![
Some(-10),
Some(9),
Some(20),
None,
None,
Some(15),
Some(7)
])),
42
);
} | rust_cleaned_test_functions.jsonl/69912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
17,
19,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
2810,
2638,
10160,
12186,
11663,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
4329,
7,
18,
701,
87619,
310,
220,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_auth_from_json() {
let json = "{\"sentry_client\":\"raven-js/3.23.3\",\"sentry_version\":7,\"sentry_key\":\"4bb5d94de752a36b8b87851a3f82726a\"}";
let auth: Auth = serde_json::from_str(json).expect("could not deserialize");
assert_eq!(auth.timestamp(), None);
assert_eq!(auth.client_agent(), Some("raven-js/3.23.3"));
assert_eq!(auth.version(), 7);
assert_eq!(auth.public_key(), "4bb5d94de752a36b8b87851a3f82726a");
assert_eq!(auth.secret_key(), None);
} | rust_cleaned_test_functions.jsonl/119266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14014,
5673,
9455,
368,
341,
262,
1077,
2951,
284,
54734,
82,
4085,
8179,
23488,
81,
5276,
25802,
14,
18,
13,
17,
18,
13,
18,
34333,
82,
4085,
9438,
11693,
22,
52318,
82,
4085,
3097,
23488,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_of_input_string_invalid() {
let parent = dangerous::input("β₯β₯");
let sub = &parent.as_dangerous()[0..3];
assert_eq!(Span::from(sub).of(parent.clone()).unwrap(), sub);
let non_span = Span::from(&parent.as_dangerous().as_bytes()[0..1]);
assert_eq!(non_span.of(parent), None);
} | rust_cleaned_test_functions.jsonl/124297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3575,
5898,
3904,
31433,
368,
341,
262,
1077,
2681,
284,
11406,
486,
1355,
445,
76709,
76709,
3071,
262,
1077,
1186,
284,
609,
3765,
5357,
814,
4003,
782,
10116,
15,
496,
18,
935,
262,
2060,
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_level_filter_as_str() {
let tests = &[
(LevelFilter::Off, "OFF"),
(LevelFilter::Error, "ERROR"),
(LevelFilter::Warn, "WARN"),
(LevelFilter::Info, "INFO"),
(LevelFilter::Debug, "DEBUG"),
(LevelFilter::Trace, "TRACE"),
];
for (input, expected) in tests {
assert_eq!(*expected, input.as_str());
}
} | rust_cleaned_test_functions.jsonl/71735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8274,
8727,
11898,
2895,
368,
341,
286,
1077,
7032,
284,
609,
9640,
310,
320,
4449,
5632,
486,
4596,
11,
330,
27068,
4461,
310,
320,
4449,
5632,
486,
1454,
11,
330,
3682,
4461,
310,
320,
4449,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_constants_and_back_to_name() {
assert_eq!(Some("K_s0xFFFFFFF"), keycode_to_name(-1));
assert_eq!(K_SP, 32);
assert_eq!("K_SP", keycode_to_name(K_SP).unwrap());
assert_eq!(K_quotedbl, 34);
assert_eq!("K_quotedbl", keycode_to_name(K_quotedbl).unwrap());
assert_eq!(K_apostrophe, 39);
assert_eq!("K_apostrophe", keycode_to_name(K_apostrophe).unwrap());
assert_eq!(K_backslash, 92);
assert_eq!("K_backslash", keycode_to_name(K_backslash).unwrap());
} | rust_cleaned_test_functions.jsonl/102721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55642,
8378,
3895,
2346,
1269,
368,
341,
286,
2060,
10714,
10297,
8373,
445,
42,
643,
15,
14384,
31203,
3975,
86991,
2346,
1269,
4080,
16,
1106,
1789,
286,
2060,
10714,
10297,
42,
17747,
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_delete_backward_beginning_string() {
let (mut ime, statechan, _actionchan) = set_up("abcdefghi", 0, 0);
simulate_keypress(&mut ime, HID_USAGE_KEY_BACKSPACE, true, false);
let state = statechan.try_recv().unwrap();
assert_eq!(2, state.revision);
assert_eq!("abcdefghi", state.text);
assert_eq!(0, state.selection.base);
assert_eq!(0, state.selection.extent);
} | rust_cleaned_test_functions.jsonl/54267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
70477,
23338,
1229,
3904,
368,
341,
286,
1077,
320,
6984,
74434,
11,
1584,
5658,
11,
716,
1311,
5658,
8,
284,
738,
8237,
445,
56747,
72,
497,
220,
15,
11,
220,
15,
626,
286,
37453,
3097... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_from_string() {
let creds = gcs_source_key!();
let key = key_from_string(&creds.private_key);
assert!(key.is_ok());
let json_key = serde_json::to_string(&creds.private_key).unwrap();
let json_like_key = json_key.trim_matches('"');
let key = key_from_string(json_like_key);
assert!(key.is_ok());
} | rust_cleaned_test_functions.jsonl/113598 | {
"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,
3097,
5673,
3904,
368,
341,
286,
1077,
73177,
284,
342,
4837,
10347,
3097,
0,
1428,
286,
1077,
1376,
284,
1376,
5673,
3904,
2099,
85734,
61603,
3097,
317,
286,
2060,
10297,
792,
2079,
19817,
5231,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_insert() {
let slot0 = 0;
let key0 = Keypair::new().pubkey();
let key1 = Keypair::new().pubkey();
let index = AccountsIndex::<bool>::default();
let account_infos = [true, false];
index.insert_new_if_missing_into_primary_index(
slot0,
vec![(&key0, account_infos[0]), (&key1, account_infos[1])],
);
for (i, key) in [key0, key1].iter().enumerate() {
let entry = index.get_account_read_entry(key).unwrap();
assert_eq!(entry.ref_count().load(Ordering::Relaxed), 1);
assert_eq!(entry.slot_list().to_vec(), vec![(slot0, account_infos[i]),]);
}
} | rust_cleaned_test_functions.jsonl/45164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
17678,
368,
341,
286,
1077,
9446,
15,
284,
220,
15,
280,
286,
1077,
1376,
15,
284,
6569,
1082,
1310,
486,
931,
1005,
9585,
792,
543,
286,
1077,
1376,
16,
284,
6569,
1082,
1310,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_hover_test_has_action() {
check_actions(
r#"
#[test]
fn foo_$0test() {}
"#,
expect![[r#"
[
Reference(
FilePosition {
file_id: FileId(
0,
),
offset: 11,
},
),
Runnable(
Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..24,
focus_range: 11..19,
name: "foo_test",
kind: Function,
},
kind: Test {
test_id: Path(
"foo_test",
),
attr: TestAttr {
ignore: false,
},
},
cfg: None,
},
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
4452,
21778,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
13353,
1944,
921,
8822,
15229,
34421,
15,
1944,
368,
5613,
57676,
345,
310,
1720,
0,
15505,
81,
2,
698,
394,
2278,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_with_immediate() {
let prog = vec![3, 3, 1108, -1, 8, 3, 4, 3, 99];
let input = vec![8];
assert_eq!(eval_with_io(&prog, input), vec![1]);
let input = vec![42];
assert_eq!(eval_with_io(&prog, input), vec![0]);
let input = vec![-8];
assert_eq!(eval_with_io(&prog, input), vec![0]);
} | rust_cleaned_test_functions.jsonl/55728 | {
"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,
10714,
6615,
17895,
14636,
368,
341,
16885,
286,
1077,
29271,
284,
7486,
20703,
18,
11,
220,
18,
11,
220,
16,
16,
15,
23,
11,
481,
16,
11,
220,
23,
11,
220,
18,
11,
220,
19,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone() {
let epoch_schedule = EpochSchedule {
slots_per_epoch: 1,
leader_schedule_slot_offset: 2,
warmup: true,
first_normal_epoch: 4,
first_normal_slot: 5,
};
#[allow(clippy::clone_on_copy)]
let cloned_epoch_schedule = epoch_schedule.clone();
assert_eq!(cloned_epoch_schedule, epoch_schedule);
} | rust_cleaned_test_functions.jsonl/112824 | {
"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,
54742,
368,
341,
286,
1077,
16342,
34530,
284,
87379,
32210,
341,
310,
15711,
5678,
20682,
25,
220,
16,
345,
310,
7653,
34530,
27563,
6917,
25,
220,
17,
345,
310,
8205,
454,
25,
830,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arena_clear() {
let mut arena = Arena::new();
arena.insert("test");
arena.insert("foo");
arena.insert("bar");
assert_eq!(3, arena.len());
arena.clear();
assert!(arena.is_empty());
} | rust_cleaned_test_functions.jsonl/30755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
30527,
21811,
368,
341,
286,
1077,
5206,
24902,
284,
27047,
486,
931,
543,
286,
24902,
7030,
445,
1944,
797,
286,
24902,
7030,
445,
7975,
797,
286,
24902,
7030,
445,
2257,
797,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_commit_style_box_raw() {
let config = integration_test_utils::make_config_from_args(&[
"--commit-style",
"raw",
"--commit-decoration-style",
"box ul",
]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
ansi_test_utils::assert_line_has_no_color(
&output,
1,
"commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e β",
);
assert!(output.contains(
"\
βββββββββββββββββββββββββββββββββββββββββββββββββ
commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e β
βββββββββββββββββββββββββββββββββββββββββββββββββ΄β"
));
} | rust_cleaned_test_functions.jsonl/70064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
15117,
10194,
16067,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
9640,
310,
14482,
17413,
11297,
756,
310,
330,
1041,
756,
310,
14482,
17413,
30266,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error() {
assert!(LookupFuture::lookup(
vec![Name::root()],
RecordType::A,
DnsRequestOptions::default(),
CachingClient::new(0, mock(vec![error()])),
)
.wait()
.is_err());
} | rust_cleaned_test_functions.jsonl/122938 | {
"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,
4096,
368,
341,
286,
2060,
10297,
34247,
24206,
486,
21020,
1006,
310,
7486,
20703,
675,
486,
2888,
73845,
310,
13583,
929,
486,
32,
345,
310,
422,
4412,
1900,
3798,
486,
2258,
3148,
310,
356,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode() -> Result<()> {
assert_eq!(decode("some_project_colon_utils"), "some_project:utils");
assert_eq!(decode("_quotequote_dot_"), "_quotedot_");
Ok(())
} | rust_cleaned_test_functions.jsonl/83022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
1464,
5714,
71698,
341,
286,
2060,
10714,
10297,
18196,
445,
14689,
16352,
10211,
263,
17309,
3975,
330,
14689,
16352,
25,
6031,
797,
286,
2060,
10714,
10297,
18196,
16975,
2949,
2949,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_store1() {
let mut vm = VirtualMachine::new();
vm.add_class(Class::new(
"Point".to_owned(),
vec![
Field::new("x".to_owned(), TypeId::Int32),
Field::new("y".to_owned(), TypeId::Int32),
]
));
vm.add_function(Function::new(
FunctionDeclaration::with_managed("main".to_owned(), Vec::new(), TypeId::Int32),
vec![TypeId::Class("Point".to_owned())],
vec![
Instruction::NewObject("Point".to_owned()),
Instruction::StoreLocal(0),
Instruction::LoadLocal(0),
Instruction::LoadInt32(4711),
Instruction::StoreField("Point".to_owned(), "y".to_owned()),
Instruction::LoadLocal(0),
Instruction::LoadField("Point".to_owned(), "y".to_owned()),
Instruction::Return,
]
)).unwrap();
let execution_result = vm.execute().unwrap();
assert_eq!(4711, execution_result);
} | rust_cleaned_test_functions.jsonl/17393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
16,
368,
341,
262,
1077,
5206,
10995,
284,
20721,
21605,
486,
931,
1428,
262,
10995,
1364,
4790,
31368,
486,
931,
1006,
286,
330,
2609,
3263,
983,
51973,
3148,
286,
7486,
90515,
310,
8601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resume_interpreter_2_asm() {
resume_interpreter_2_asm(VERSION1, 8126917);
resume_interpreter_2_asm(VERSION0, 8126917);
} | rust_cleaned_test_functions.jsonl/82891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58132,
15318,
28637,
62,
17,
67529,
368,
341,
262,
15688,
15318,
28637,
62,
17,
67529,
7,
17636,
16,
11,
220,
23,
16,
17,
21,
24,
16,
22,
317,
262,
15688,
15318,
28637,
62,
17,
67529,
7,
176... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_not_collection_empty() {
let text = " {% if array == empty %} true {% else %} false {% endif %} ";
assert_template_result!(" false ", text, v!({"array": [1, 2, 3]}));
} | rust_cleaned_test_functions.jsonl/28136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
7913,
25019,
15124,
368,
341,
262,
1077,
1467,
284,
330,
52261,
421,
1334,
621,
4287,
1018,
92,
830,
52261,
770,
1018,
92,
895,
52261,
12330,
1018,
92,
7620,
262,
2060,
8693,
5287,
17223,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ccsds_parser_min_length() {
let mut parser = CcsdsParser::new();
parser.config.min_packet_length = Some(11);
parser.recv_slice(&[0x1F,0xFF,0xFF,0xFF,0x00,3,0xFF, 0xFF, 0xFF, 0xFF]);
assert_eq!(parser.current_status(), CcsdsParserStatus::BelowMinPacketLength);
assert_eq!(parser.pull_packet(), None);
} | rust_cleaned_test_functions.jsonl/105740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28955,
82,
5356,
18517,
7260,
5118,
368,
972,
262,
1077,
5206,
6729,
284,
356,
4837,
5356,
6570,
486,
931,
1647,
262,
6729,
5423,
4358,
21078,
5118,
284,
4329,
7,
16,
16,
736,
262,
6729,
40433,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fetch_no_such_remote() {
let test_data = GitRepoData::create();
let mut tx = test_data.repo.start_transaction("test");
let result = git::fetch(tx.mut_repo(), &test_data.git_repo, "invalid-remote");
assert!(matches!(result, Err(GitFetchError::NoSuchRemote(_))));
} | rust_cleaned_test_functions.jsonl/96069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
6536,
643,
1387,
36425,
368,
341,
262,
1077,
1273,
1769,
284,
21120,
25243,
1043,
486,
3182,
1428,
262,
1077,
5206,
9854,
284,
1273,
1769,
46169,
4962,
28884,
445,
1944,
797,
262,
1077,
110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assert_receive() {
let tracker = AssertCollect::new();
let t2 = tracker.clone();
let join = thread::spawn(move || t2.panic("This is a panic"));
let _ = join.join();
tracker.collect();
} | rust_cleaned_test_functions.jsonl/1271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
38557,
368,
341,
286,
1077,
28331,
284,
5319,
47504,
486,
931,
543,
286,
1077,
259,
17,
284,
28331,
15997,
1428,
286,
1077,
5138,
284,
4516,
486,
46087,
34081,
1369,
259,
17,
556,
31270,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_version() {
let content = r###"
[package]
name = "tester"
version = "0.1.0-rc.0"
"###;
assert_eq!(get_version(content).unwrap(), "0.1.0-rc.0".to_string());
} | rust_cleaned_test_functions.jsonl/68181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9438,
368,
341,
286,
1077,
2213,
284,
435,
14374,
698,
286,
508,
1722,
921,
286,
829,
284,
330,
73358,
698,
286,
2319,
284,
330,
15,
13,
16,
13,
15,
12,
1287,
13,
15,
698,
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,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_real_backend() {
check_stmt_err("GPIO backend not compiled in", "GPIO_SETUP 0, \"IN\"");
check_stmt_err("GPIO backend not compiled in", "GPIO_CLEAR");
check_stmt_err("GPIO backend not compiled in", "GPIO_CLEAR 0");
check_expr_error(
"Error in call to GPIO_READ: GPIO backend not compiled in",
"GPIO_READ(0)",
);
check_stmt_err("GPIO backend not compiled in", "GPIO_WRITE 0, TRUE");
} | rust_cleaned_test_functions.jsonl/82622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
40011,
368,
341,
286,
1779,
21824,
9266,
445,
26337,
19163,
537,
19697,
304,
497,
330,
26337,
61178,
220,
15,
11,
7245,
687,
88385,
286,
1779,
21824,
9266,
445,
26337,
19163,
537,
19697,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_prefixed_encoded_int_1() {
let mut d = QpackData::default();
d.encode_prefixed_encoded_int(Prefix::new(0xC0, 2), 5);
assert_eq!(d[..], [0xc5]);
} | rust_cleaned_test_functions.jsonl/38307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
43331,
3286,
73069,
4042,
62,
16,
368,
341,
286,
1077,
5206,
294,
284,
1207,
4748,
1043,
486,
2258,
543,
286,
294,
17313,
43331,
3286,
73069,
4042,
5304,
5060,
486,
931,
7,
15,
12125,
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 |
#[test]
fn test_cached_url_provider() {
let tar_index = {
let mut builder = TarIndexBuilder::new();
builder
.push("plain.tex", b"test")
.push("other.tex", b"other content")
.push(
tectonic::digest::DIGEST_NAME,
b"0000000000000000000000000000000000000000000000000000000000000000",
);
builder.finish()
};
let requests = run_test(Some(tar_index), |_, url| {
let tempdir = tempfile::tempdir().unwrap();
let mut status = TermcolorStatusBackend::new(ChatterLevel::Minimal);
let config = PersistentConfig::default();
{
let mut cache = config
.make_cached_url_provider(url, false, Some(tempdir.path()), &mut status)
.unwrap();
match cache.input_open_name("plain.tex", &mut status) {
OpenResult::Ok(_) => {}
_ => panic!("Failed to open plain.tex"),
}
match cache.input_open_name("plain.tex", &mut status) {
OpenResult::Ok(_) => {}
_ => panic!("Failed to open plain.tex"),
}
}
{
let mut cache = config
.make_cached_url_provider(url, false, Some(tempdir.path()), &mut status)
.unwrap();
// should be cached
match cache.input_open_name("plain.tex", &mut status) {
OpenResult::Ok(_) => {}
_ => panic!("Failed to open plain.tex"),
}
}
{
let mut cache = config
.make_cached_url_provider(url, false, Some(tempdir.path()), &mut status)
.unwrap();
// should be cached
match cache.input_open_name("plain.tex", &mut status) {
OpenResult::Ok(_) => {}
_ => panic!("Failed to open plain.tex"),
}
match cache.input_open_name("other.tex", &mut status) {
OpenResult::Ok(_) => {}
_ => panic!("Failed to open other.tex"),
}
}
{
let mut cache = config
.make_cached_url_provider(url, false, Some(tempdir.path()), &mut status)
.unwrap();
// not in index
match cache.input_open_name("my-favourite-file.tex", &mut status) {
OpenResult::NotAvailable => {}
_ => panic!("'my-favourite-file.tex' file exists?"),
}
}
});
check_req_count(&requests, TectonicRequest::Index, 1);
check_req_count(
&requests,
TectonicRequest::File(tectonic::digest::DIGEST_NAME.into()),
2,
);
// This files should be cached.
check_req_count(&requests, TectonicRequest::File("plain.tex".into()), 1);
check_req_count(&requests, TectonicRequest::File("other.tex".into()), 1);
} | rust_cleaned_test_functions.jsonl/90620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
2903,
29518,
368,
341,
262,
1077,
12183,
3560,
284,
341,
286,
1077,
5206,
7363,
284,
23959,
1552,
3297,
486,
931,
543,
286,
7363,
198,
310,
659,
9077,
445,
20772,
57895,
497,
293,
1,
1944... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_add_voter_peer_promotes_self_sets_is_learner() -> Result<()> {
let l = default_logger();
let mut n1 = new_test_raft(1, vec![1], 10, 1, new_storage(), &l);
// Node is already voter.
n1.add_learner(1).ok();
assert!(n1.promotable());
assert!(n1.prs().voter_ids().contains(&1));
n1.remove_node(1)?;
n1.add_learner(1)?;
assert!(!n1.promotable());
assert!(n1.prs().learner_ids().contains(&1));
Ok(())
} | rust_cleaned_test_functions.jsonl/30342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
2273,
25392,
45159,
47877,
6295,
25637,
21289,
6892,
62,
93595,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
1428,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
2944,
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... | 3 |
#[test]
fn test_version_sum() {
assert_eq!(Transmission::from("D2FE28").version_sum, 6);
assert_eq!(Transmission::from("38006F45291200").version_sum, 9);
assert_eq!(Transmission::from("EE00D40C823060").version_sum, 14);
} | rust_cleaned_test_functions.jsonl/133804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
10160,
368,
341,
286,
2060,
10714,
10297,
91201,
486,
1499,
445,
35,
17,
11419,
17,
23,
1827,
4366,
10160,
11,
220,
21,
317,
286,
2060,
10714,
10297,
91201,
486,
1499,
445,
18,
23,
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_verify_hash_unfrozen() {
let (genesis_config, _mint_keypair) = create_genesis_config(2_000);
let bank = Bank::new(&genesis_config);
assert!(bank.verify_hash());
} | rust_cleaned_test_functions.jsonl/2582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
8950,
4907,
69,
42240,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
17,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
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 |
#[test]
fn test_flag_init() {
let empty_vec = Vec::<FlagNo>::new();
let f1 = FlagVec::default();
let f2 = FlagVec::new();
let f3 = FlagVec::with_capacity(0);
assert_eq!(f1, f2);
assert_eq!(f1, f3);
assert_eq!(f2, f3);
assert_eq!(f1.capacity(), 0);
assert_eq!(f1.iter().collect::<Vec<_>>(), empty_vec);
assert_eq!(f2.capacity(), 0);
assert_eq!(f2.iter().collect::<Vec<_>>(), empty_vec);
assert_eq!(f3.capacity(), 0);
assert_eq!(f3.iter().collect::<Vec<_>>(), empty_vec);
let f4 = FlagVec::with_capacity(10);
assert_eq!(f1, f4);
assert_eq!(f4.capacity(), 16);
assert_eq!(f4.iter().collect::<Vec<_>>(), empty_vec);
} | rust_cleaned_test_functions.jsonl/24802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10933,
6137,
368,
341,
286,
1077,
4287,
13251,
284,
11312,
27638,
12135,
2753,
6831,
931,
1428,
286,
1077,
282,
16,
284,
22666,
10050,
486,
2258,
543,
286,
1077,
282,
17,
284,
22666,
10050,
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_get_ufo_path_unique_extension_empty_extension() {
let op = get_ufo_outpath(&Path::new("one/two/three.ufo"), &None, &Some("".to_string()));
assert_eq!(op, PathBuf::from("one/two/three"));
} | rust_cleaned_test_functions.jsonl/21547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7300,
824,
2638,
21218,
31035,
15124,
31035,
368,
341,
286,
1077,
1179,
284,
633,
7300,
824,
6068,
2343,
2099,
1820,
486,
931,
445,
603,
5523,
1126,
20439,
765,
11634,
824,
3975,
609,
4064,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggregate_verify_too_many_public_keys() {
let mut rng = &mut rand::thread_rng();
let msg = vec![1u8; 32];
let mut public_keys: Vec<PublicKey> = vec![];
let mut aggregate_signature = AggregateSignature::new();
let key_pair = Keypair::random(&mut rng);
let signature = Signature::new(&msg, &key_pair.sk);
public_keys.push(key_pair.pk.clone());
public_keys.push(key_pair.pk);
aggregate_signature.add(&signature);
// Convert to references
let public_keys_refs: Vec<&PublicKey> = public_keys.iter().map(|x| x).collect();
// Verification should be false due to too many public keys
assert!(!aggregate_signature.aggregate_verify(&[&msg], &public_keys_refs));
} | rust_cleaned_test_functions.jsonl/112221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
14240,
35638,
2346,
78,
22101,
27074,
12631,
368,
341,
286,
1077,
5206,
28422,
284,
609,
6984,
10382,
486,
4528,
66849,
543,
286,
1077,
3750,
284,
7486,
20703,
16,
84,
23,
26,
220,
18,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytevector() {
unsafe {
let mut error = 0;
let error_ptr = &mut error as *mut c_int;
let bytes: [c_uchar; 4] = [2, 114, 34, 255];
let bytes_ptr = byte_vector_create(bytes.as_ptr(), bytes.len() as c_uint, error_ptr);
assert_eq!(error, 0);
let length = byte_vector_get_length(bytes_ptr, error_ptr);
assert_eq!(error, 0);
assert_eq!(length, bytes.len() as c_uint);
let byte = byte_vector_get_at(bytes_ptr, 2, error_ptr);
assert_eq!(error, 0);
assert_eq!(byte, bytes[2]);
byte_vector_destroy(bytes_ptr);
}
} | rust_cleaned_test_functions.jsonl/66621 | {
"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,
19737,
3215,
368,
341,
286,
19860,
341,
310,
1077,
5206,
1465,
284,
220,
15,
280,
310,
1077,
1465,
4348,
284,
609,
6984,
1465,
438,
353,
6984,
272,
4042,
280,
310,
1077,
5820,
25,
508,
66,
62,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nproc_ignore_all_omp() {
let result = TestScenario::new(util_name!())
.ucmd_keepenv()
.env("OMP_NUM_THREADS", "42")
.arg("--ignore=40")
.succeeds();
let nproc: u8 = result.stdout_str().trim().parse().unwrap();
assert_eq!(nproc, 2);
} | rust_cleaned_test_functions.jsonl/43692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
15782,
58493,
5705,
62,
14435,
368,
341,
262,
1077,
1102,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
2398,
286,
659,
1754,
2277,
50293,
3160,
741,
286,
659,
3160,
445,
51607,
9631,
56239,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_info_types() {
let vcf = Reader::from_path(&"test/test.bcf").unwrap();
let header = vcf.header();
let truth = vec![
(
"INDEL",
header::TagType::Flag,
header::TagLength::Fixed(0),
),
(
"DP",
header::TagType::Integer,
header::TagLength::Fixed(1),
),
(
"QS",
header::TagType::Float,
header::TagLength::Alleles,
),
(
"I16",
header::TagType::Float,
header::TagLength::Fixed(16),
),
];
for (ref_name, ref_type, ref_length) in truth {
let (tag_type, tag_length) = header.info_type(ref_name.as_bytes()).unwrap();
assert_eq!(tag_type, ref_type);
assert_eq!(tag_length, ref_length);
}
let vcf = Reader::from_path(&"test/test_svlen.vcf").unwrap();
let header = vcf.header();
let truth = vec![
(
"IMPRECISE",
header::TagType::Flag,
header::TagLength::Fixed(0),
),
(
"SVTYPE",
header::TagType::String,
header::TagLength::Fixed(1),
),
(
"SVLEN",
header::TagType::Integer,
header::TagLength::Variable,
),
(
"CIGAR",
header::TagType::String,
header::TagLength::AltAlleles,
),
];
for (ref_name, ref_type, ref_length) in truth {
let (tag_type, tag_length) = header.info_type(ref_name.as_bytes()).unwrap();
assert_eq!(tag_type, ref_type);
assert_eq!(tag_length, ref_length);
}
assert!(header.info_type(b"NOT_THERE").is_err());
} | rust_cleaned_test_functions.jsonl/8771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
3109,
9763,
368,
341,
286,
1077,
348,
9792,
284,
25166,
486,
1499,
2638,
2099,
1,
1944,
12697,
948,
9792,
1827,
15454,
543,
286,
1077,
4247,
284,
348,
9792,
17093,
543,
286,
1077,
8046,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_mul_buffer_correctness() {
use super::*;
type Buf = MulBuffer<10>;
let temp = Buf::new([10u64; 10], [20u64; 10]);
for i in 0..20 {
if i < 10 {
assert_eq!(temp[i], 10);
} else {
assert_eq!(temp[i], 20);
}
}
} | rust_cleaned_test_functions.jsonl/97880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
7776,
31550,
2090,
368,
341,
286,
990,
2256,
56162,
286,
943,
69013,
284,
29351,
4095,
27,
16,
15,
10133,
286,
1077,
2730,
284,
69013,
486,
931,
2561,
16,
15,
84,
21,
19,
26,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_eval_disabled() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine.disable_symbol("eval");
assert!(matches!(
*engine
.compile(r#"eval("40 + 2")"#)
.expect_err("should error")
.0,
ParseErrorType::BadInput(LexError::ImproperSymbol(err, _)) if err == "eval"
));
Ok(())
} | rust_cleaned_test_functions.jsonl/129463 | {
"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,
21296,
51401,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
5206,
4712,
284,
8200,
486,
931,
1428,
262,
4712,
42628,
21179,
445,
14170,
3071,
262,
2060,
10297,
19914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reading_enum_type_pass() -> Result<(), Box<dyn std::error::Error>> {
let a = indoc!(r#"
openapi: 3.0.1
info:
title: Swagger Petstore
version: 1.2.3
paths: {}
components:
schemas:
Fish:
type: string
enum: [Whale, Shrimp]
"#);
let b = serde_yaml::from_str::<Doc>(a)?;
let mut x = Context::default();
b.lint(Path::default(), &mut x);
println!("{}", x);
x.check()?;
let c = b.scan(Path::default())?;
assert_eq!(c.types.len(), 1);
assert_eq!(c.types[0], KType::Enum(KEnumType {
name: "Fish".to_string(),
cases: vec![
KEnumTypeCase {
name: "Whale".to_string(),
comment: "".to_string(),
},
KEnumTypeCase {
name: "Shrimp".to_string(),
comment: "".to_string(),
},
],
comment: "".to_string(),
}));
Ok(())
} | rust_cleaned_test_functions.jsonl/59558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 598
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81859,
31054,
1819,
15464,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
264,
284,
1257,
509,
10297,
81,
2,
698,
286,
1787,
2068,
25,
220,
18,
13,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_accounts_locks() {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
let keypair3 = Keypair::new();
let account0 = Account::new(1, 0, &Pubkey::default());
let account1 = Account::new(2, 0, &Pubkey::default());
let account2 = Account::new(3, 0, &Pubkey::default());
let account3 = Account::new(4, 0, &Pubkey::default());
let accounts = Accounts::new(Vec::new());
accounts.store_slow(0, &keypair0.pubkey(), &account0);
accounts.store_slow(0, &keypair1.pubkey(), &account1);
accounts.store_slow(0, &keypair2.pubkey(), &account2);
accounts.store_slow(0, &keypair3.pubkey(), &account3);
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair0.pubkey(), keypair1.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let tx = Transaction::new(&[&keypair0], message, Hash::default());
let results0 = accounts.lock_accounts(&[tx.clone()], None);
assert!(results0[0].is_ok());
assert_eq!(
*accounts
.readonly_locks
.read()
.unwrap()
.as_ref()
.unwrap()
.get(&keypair1.pubkey())
.unwrap()
.lock_count
.lock()
.unwrap(),
1
);
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair2.pubkey(), keypair1.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let tx0 = Transaction::new(&[&keypair2], message, Hash::default());
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair1.pubkey(), keypair3.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let tx1 = Transaction::new(&[&keypair1], message, Hash::default());
let txs = vec![tx0, tx1];
let results1 = accounts.lock_accounts(&txs, None);
assert!(results1[0].is_ok());
assert!(results1[1].is_err());
assert_eq!(
*accounts
.readonly_locks
.read()
.unwrap()
.as_ref()
.unwrap()
.get(&keypair1.pubkey())
.unwrap()
.lock_count
.lock()
.unwrap(),
2
);
accounts.unlock_accounts(&[tx], None, &results0);
accounts.unlock_accounts(&txs, None, &results1);
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair1.pubkey(), keypair3.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let tx = Transaction::new(&[&keypair1], message, Hash::default());
let results2 = accounts.lock_accounts(&[tx], None);
assert!(results2[0].is_ok()); // Now keypair1 account can be locked as writable
// Check that read-only locks are still cached in accounts struct
let readonly_locks = accounts.readonly_locks.read().unwrap();
let readonly_locks = readonly_locks.as_ref().unwrap();
let keypair1_lock = readonly_locks.get(&keypair1.pubkey());
assert!(keypair1_lock.is_some());
assert_eq!(*keypair1_lock.unwrap().lock_count.lock().unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/50623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2047
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
9818,
82,
368,
341,
286,
1077,
1376,
12670,
15,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1376,
12670,
16,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1376,
12670,
17,
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_chunks_exact_mut_remainder() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4];
let c = v.chunks_exact_mut(2);
assert_eq!(c.into_remainder(), &[4]);
} | rust_cleaned_test_functions.jsonl/9640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
71084,
29523,
86607,
1107,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_staging_folder() -> Result<()> {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
let status_count = |s: StatusType| -> usize {
get_status(repo_path, s, true).unwrap().len()
};
fs::create_dir_all(&root.join("a/d"))?;
File::create(&root.join(Path::new("a/d/f1.txt")))?
.write_all(b"foo")?;
File::create(&root.join(Path::new("a/d/f2.txt")))?
.write_all(b"foo")?;
File::create(&root.join(Path::new("a/f3.txt")))?
.write_all(b"foo")?;
assert_eq!(status_count(StatusType::WorkingDir), 3);
stage_add_all(repo_path, "a/d").unwrap();
assert_eq!(status_count(StatusType::WorkingDir), 1);
assert_eq!(status_count(StatusType::Stage), 2);
Ok(())
} | rust_cleaned_test_functions.jsonl/36666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
4118,
15268,
368,
1464,
5714,
71698,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_get_sub_message_via_reflection() {
let mut m = M::new();
m.mut_sub_m().set_n(42);
assert!(m.has_sub_m());
let descriptor = m.descriptor().field_by_name("sub_m").unwrap();
assert_eq!("sub_m", descriptor.name());
let sub_m = descriptor.get_message(&m);
assert_eq!("test_reflect.SubM", sub_m.descriptor().full_name());
assert_eq!(42, sub_m.descriptor().field_by_name("n").unwrap().get_i32(sub_m));
} | rust_cleaned_test_functions.jsonl/84801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5228,
6462,
80710,
7793,
1170,
368,
341,
262,
1077,
5206,
296,
284,
386,
486,
931,
543,
262,
296,
744,
332,
5228,
717,
1005,
746,
1089,
7,
19,
17,
317,
262,
2060,
10297,
76,
6858,
5228,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seconds() {
let logger = LogEntryLogger::new(
slog::Logger::root(slog::Discard, slog::o!()),
slog::Level::Critical,
vec![],
HashMap::new(),
vec!["my_tag".into()],
);
for i in 1u32..10u32 {
assert!(
logger.is_n_seconds(
1,
LogMetadata {
level: slog::Level::Warning,
module_path: std::module_path!(),
line: std::line!(),
column: std::column!(),
}
) == ((i == 1u32) || i == 6u32)
);
if i == 4u32 {
std::thread::sleep(Duration::from_millis(500));
}
if i == 5u32 {
std::thread::sleep(Duration::from_millis(5001));
}
}
} | rust_cleaned_test_functions.jsonl/88451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
34825,
368,
341,
286,
1077,
5925,
284,
2835,
5874,
7395,
486,
931,
1006,
310,
34949,
486,
7395,
486,
2888,
1141,
839,
486,
23477,
567,
11,
34949,
486,
78,
0,
14702,
310,
34949,
486,
4449,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_copy_within_panics_src_out_of_bounds() {
let mut bytes = *b"Hello, World!";
// an inclusive range ending at usize::MAX would make src_end overflow
bytes.copy_within(usize::MAX..=usize::MAX, 0);
} | rust_cleaned_test_functions.jsonl/9710 | {
"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,
16096,
72385,
71099,
1211,
16274,
6068,
3575,
36878,
368,
341,
262,
1077,
5206,
5820,
284,
353,
65,
1,
9707,
11,
4337,
26782,
262,
442,
458,
28308,
2088,
13391,
518,
22301,
486,
10586,
1035,
1281,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_acl() {
assert!(matches!(
parse_predefined_acl("private"),
Ok(Some(PredefinedAcl::Private))
));
assert!(matches!(parse_predefined_acl(""), Ok(None)));
assert!(matches!(parse_predefined_acl("notAnACL"), Err("notAnACL")));
} | rust_cleaned_test_functions.jsonl/30685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
63692,
368,
341,
1789,
286,
2060,
10297,
19914,
33673,
310,
4715,
10442,
9711,
63692,
445,
1996,
4461,
310,
7622,
65405,
7,
4703,
9711,
32,
564,
486,
16787,
1171,
286,
16518,
286,
2060,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_background_event_handling() {
let mut nodes = create_nodes(2, "test_background_event_handling".to_string());
let channel_value = 100000;
let data_dir = nodes[0].persister.get_data_dir();
let persister = move |node: &_| FilesystemPersister::persist_manager(data_dir.clone(), node);
// Set up a background event handler for FundingGenerationReady events.
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
let event_handler = move |event: &Event| {
sender.send(handle_funding_generation_ready!(event, channel_value)).unwrap();
};
let bg_processor = BackgroundProcessor::start(persister.clone(), event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].net_graph_msg_handler.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone());
// Open a channel and check that the FundingGenerationReady event was handled.
begin_open_channel!(nodes[0], nodes[1], channel_value);
let (temporary_channel_id, funding_tx) = receiver
.recv_timeout(Duration::from_secs(EVENT_DEADLINE))
.expect("FundingGenerationReady not handled within deadline");
end_open_channel!(nodes[0], nodes[1], temporary_channel_id, funding_tx);
// Confirm the funding transaction.
confirm_transaction(&mut nodes[0], &funding_tx);
let as_funding = get_event_msg!(nodes[0], MessageSendEvent::SendFundingLocked, nodes[1].node.get_our_node_id());
confirm_transaction(&mut nodes[1], &funding_tx);
let bs_funding = get_event_msg!(nodes[1], MessageSendEvent::SendFundingLocked, nodes[0].node.get_our_node_id());
nodes[0].node.handle_funding_locked(&nodes[1].node.get_our_node_id(), &bs_funding);
let _as_channel_update = get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id());
nodes[1].node.handle_funding_locked(&nodes[0].node.get_our_node_id(), &as_funding);
let _bs_channel_update = get_event_msg!(nodes[1], MessageSendEvent::SendChannelUpdate, nodes[0].node.get_our_node_id());
assert!(bg_processor.stop().is_ok());
// Set up a background event handler for SpendableOutputs events.
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
let event_handler = move |event: &Event| sender.send(event.clone()).unwrap();
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].net_graph_msg_handler.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone());
// Force close the channel and check that the SpendableOutputs event was handled.
nodes[0].node.force_close_channel(&nodes[0].node.list_channels()[0].channel_id).unwrap();
let commitment_tx = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().pop().unwrap();
confirm_transaction_depth(&mut nodes[0], &commitment_tx, BREAKDOWN_TIMEOUT as u32);
let event = receiver
.recv_timeout(Duration::from_secs(EVENT_DEADLINE))
.expect("SpendableOutputs not handled within deadline");
match event {
Event::SpendableOutputs { .. } => {},
Event::ChannelClosed { .. } => {},
_ => panic!("Unexpected event: {:?}", event),
}
assert!(bg_processor.stop().is_ok());
} | rust_cleaned_test_functions.jsonl/26266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24103,
6748,
75642,
368,
341,
197,
10217,
5206,
7798,
284,
1855,
14896,
7,
17,
11,
330,
1944,
24103,
6748,
75642,
3263,
983,
3904,
1423,
197,
10217,
5496,
3142,
284,
220,
16,
15,
15,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scan_config() {
for collect_all_unsorted in [false, true] {
let config = ScanConfig::new(collect_all_unsorted);
assert_eq!(config.collect_all_unsorted, collect_all_unsorted);
assert!(config.abort.is_none()); // not allocated
assert!(!config.is_aborted());
config.abort(); // has no effect
assert!(!config.is_aborted());
}
let config = ScanConfig::default();
assert!(!config.collect_all_unsorted);
assert!(config.abort.is_none());
let config = config.recreate_with_abort();
assert!(config.abort.is_some());
assert!(!config.is_aborted());
config.abort();
assert!(config.is_aborted());
let config = config.recreate_with_abort();
assert!(config.is_aborted());
} | rust_cleaned_test_functions.jsonl/71355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
5332,
368,
341,
286,
369,
6530,
5705,
4907,
28298,
304,
508,
3849,
11,
830,
60,
341,
310,
1077,
2193,
284,
31108,
2648,
486,
931,
19611,
767,
5705,
4907,
28298,
317,
310,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_top_level_ctx_enum() {
#[derive(PartialEq, Debug, DekuRead, DekuWrite)]
#[deku(type = "u8", ctx = "a: u8, b: u8")]
enum TopLevelCtxEnum {
#[deku(id = "1")]
VariantA(
#[deku(
reader = "(|rest|{u8::read(rest,()).map(|(slice,c)|(slice,(a+b+c)))})(deku::rest)",
writer = "(|c|{u8::write(&(c-a-b), deku::output, ())})(field_0)"
)]
u8,
),
}
let test_data = [0x01_u8, 0x03];
let (rest, ret_read) = TopLevelCtxEnum::read(test_data.view_bits(), (1, 2)).unwrap();
assert!(rest.is_empty());
assert_eq!(ret_read, TopLevelCtxEnum::VariantA(0x06));
let mut ret_write = bitvec![Msb0, u8;];
ret_read.write(&mut ret_write, (1, 2)).unwrap();
assert_eq!(ret_write.into_vec(), &test_data[..]);
} | rust_cleaned_test_functions.jsonl/81454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
8274,
15147,
31054,
368,
341,
262,
11506,
27098,
5304,
20894,
27312,
11,
11091,
11,
74463,
84,
4418,
11,
74463,
84,
7985,
5563,
262,
11506,
450,
12133,
5808,
284,
330,
84,
23,
497,
5635,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pcr_ext() {
let mut p = PacketInfo::null_packet();
let ext: u16 = 137;
p.set_pcr_ext(ext);
assert_eq!(p.pcr_ext(), ext);
} | rust_cleaned_test_functions.jsonl/47195 | {
"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,
620,
5082,
9927,
368,
341,
286,
1077,
5206,
281,
284,
28889,
1731,
486,
2921,
21078,
543,
286,
1077,
1303,
25,
575,
16,
21,
284,
220,
16,
18,
22,
280,
286,
281,
980,
620,
5082,
9927,
48531,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_incorrect_hostname() {
let mut hostname = hostname::get()
.expect("failed to get hostname for testing")
.to_str()
.expect("failed to convert to str")
.to_owned();
hostname.push_str("-invalid");
let hostname_test = Hostname(hostname);
let has_hostname: bool = hostname_test.try_into().expect("checking hostname failed");
assert!(!has_hostname);
} | rust_cleaned_test_functions.jsonl/10701 | {
"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,
1243,
19928,
63840,
368,
341,
286,
1077,
5206,
28115,
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,
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_secure_channel() {
simple_logging::log_to_stderr(LevelFilter::Debug);
let server_key = PathBuf::from(format!(
"{}/../test_pki/resources/openssl/out/{}",
env!("CARGO_MANIFEST_DIR"),
"test_server.key"
));
log::debug!("{}", server_key.display());
let client_key = PathBuf::from(format!(
"{}/../test_pki/resources/openssl/out/{}",
env!("CARGO_MANIFEST_DIR"),
"/test_client.key"
));
log::debug!("{}", client_key.display());
let server_chain = PathBuf::from(format!(
"{}/../test_pki/resources/openssl/out/{}",
env!("CARGO_MANIFEST_DIR"),
"test_server.chain"
));
let client_chain = PathBuf::from(format!(
"{}/../test_pki/resources/openssl/out/{}",
env!("CARGO_MANIFEST_DIR"),
"test_client.chain"
));
let ca_cert = PathBuf::from(format!(
"{}/../test_pki/resources/openssl/{}",
env!("CARGO_MANIFEST_DIR"),
"root-ca/certs/rootCA.crt"
));
let addr = OpensslAddr {
port: 1234,
hostname: "127.0.0.1".to_string(),
domain: "idscp-test.de".to_string(),
};
let mut server = OpensslServer::new(server_key, server_chain, ca_cert.clone());
server
.listen(
addr.clone(),
Arc::new(Mutex::new(Box::new(move |sc| {
println!("server received new connection");
(*sc).send_msg(b"hello".to_vec()).unwrap();
let msg = (*sc).recv_msg().unwrap();
println!("server received message: {:?}", msg);
}))),
)
.unwrap();
let client = OpensslClient {
key_file_path: client_key,
cert_file_path: client_chain,
trusted_ca_file_path: ca_cert,
};
let mut retry = 3;
let secure_channel = loop {
sleep(Duration::from_millis(20));
match client.connect(&addr) {
Err(e) => {
println!("error while connceting {:?}", e);
if retry > 0 {
println!("retrying {} more times", retry);
retry = -1;
continue;
} else {
panic!("error connecting, no more retrying")
}
}
Ok(channel) => break channel,
};
};
println!("client connected");
let msg = secure_channel.recv_msg().unwrap();
println!("client received msg: {:?}", msg);
secure_channel.send_msg(b"world".to_vec()).unwrap();
secure_channel.terminate();
server.stop();
} | rust_cleaned_test_functions.jsonl/103499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73088,
14571,
368,
341,
286,
4285,
59982,
486,
839,
2346,
93033,
30263,
5632,
486,
7939,
317,
286,
1077,
3538,
3097,
284,
7933,
15064,
486,
1499,
20698,
33673,
310,
13868,
4472,
1244,
1944,
620,
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... | 3 |
#[test]
fn test_replace_headers() {
use http::HeaderMap;
let mut headers = HeaderMap::new();
headers.insert("foo", "bar".parse().unwrap());
headers.append("foo", "baz".parse().unwrap());
let client = Client::new();
let req = client
.get("https://hyper.rs")
.header("im-a", "keeper")
.header("foo", "pop me")
.headers(headers)
.build()
.expect("request build");
assert_eq!(req.headers()["im-a"], "keeper");
let foo = req.headers().get_all("foo").iter().collect::<Vec<_>>();
assert_eq!(foo.len(), 2);
assert_eq!(foo[0], "bar");
assert_eq!(foo[1], "baz");
} | rust_cleaned_test_functions.jsonl/37631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
26719,
368,
341,
286,
990,
1758,
486,
4047,
2227,
401,
286,
1077,
5206,
7102,
284,
12104,
2227,
486,
931,
543,
286,
7102,
7030,
445,
7975,
497,
330,
2257,
3263,
6400,
1005,
15454,
1423,
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_raft_storage_rollback_before_prewrite() {
let (_cluster, storage, ctx) = new_raft_storage();
let ret = storage.rollback(ctx.clone(), vec![make_key(b"key")], 10);
assert!(ret.is_ok());
let ret = storage.prewrite(
ctx.clone(),
vec![Mutation::Put((make_key(b"key"), b"value".to_vec()))],
b"key".to_vec(),
10,
);
assert!(ret.is_err());
let err = ret.unwrap_err();
match err {
storage::Error::Txn(txn::Error::Mvcc(mvcc::Error::WriteConflict { .. })) => {}
_ => {
panic!("expect WriteConflict error, but got {:?}", err);
}
}
} | rust_cleaned_test_functions.jsonl/82479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2944,
23310,
62,
33559,
23708,
620,
52473,
368,
341,
262,
1077,
5453,
18855,
11,
5819,
11,
5635,
8,
284,
501,
62,
2944,
23310,
543,
262,
1077,
2112,
284,
5819,
58011,
7502,
15997,
1507,
7486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_strings_errors() {
let parsed_data = parse(&"test: \"$false_var\"");
assert!(parsed_data
.unwrap_err()
.downcast_ref::<VariableNotDefinedError>()
.is_some());
} | rust_cleaned_test_functions.jsonl/11162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
33500,
20196,
368,
341,
262,
1077,
15676,
1769,
284,
4715,
2099,
1,
1944,
25,
65486,
3849,
4612,
88385,
262,
2060,
10297,
41030,
1769,
198,
286,
659,
15454,
9266,
741,
286,
659,
2923,
3829,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_key_trust() {
assert_eq!(
KeyTrust::NotAuth,
KeyTrust::from(u16::from(KeyTrust::NotAuth))
);
assert_eq!(
KeyTrust::NotPrivate,
KeyTrust::from(u16::from(KeyTrust::NotPrivate))
);
assert_eq!(
KeyTrust::AuthOrPrivate,
KeyTrust::from(u16::from(KeyTrust::AuthOrPrivate))
);
assert_eq!(
KeyTrust::DoNotTrust,
KeyTrust::from(u16::from(KeyTrust::DoNotTrust))
);
} | rust_cleaned_test_functions.jsonl/37280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
3547,
590,
368,
341,
262,
2060,
10714,
33673,
286,
5309,
45548,
486,
2623,
5087,
345,
286,
5309,
45548,
486,
1499,
8154,
16,
21,
486,
1499,
21358,
45548,
486,
2623,
5087,
1171,
262,
1439,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_single_default_parameter() {
check_assist(
add_missing_impl_members,
r#"
trait Foo<T = Self> {
fn bar(&self, other: &T);
}
struct S;
impl Foo for S { <|> }"#,
r#"
trait Foo<T = Self> {
fn bar(&self, other: &T);
}
struct S;
impl Foo for S {
fn bar(&self, other: &Self) {
${0:todo!()}
}
}"#,
)
} | rust_cleaned_test_functions.jsonl/110454 | {
"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,
41232,
19487,
9993,
24899,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
435,
2,
698,
29432,
33428,
3125,
284,
10115,
29,
341,
262,
5168,
3619,
2099,
721,
11,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_client_header_override() {
let req = Client::build()
.header(header::CONTENT_TYPE, "111")
.finish()
.get("/")
.set_header(header::CONTENT_TYPE, "222");
assert_eq!(
req.head
.headers
.get(header::CONTENT_TYPE)
.unwrap()
.to_str()
.unwrap(),
"222"
);
} | rust_cleaned_test_functions.jsonl/38610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
8757,
48576,
368,
341,
286,
1077,
4232,
284,
8423,
486,
5834,
741,
310,
659,
2708,
25534,
486,
67872,
4189,
11,
330,
16,
16,
16,
1138,
310,
659,
30150,
741,
310,
659,
455,
61710,
310,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_london_inverse() {
let osgb36 = Proj::new(
"
+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy
+towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs
",
)
.unwrap();
let t = osgb36
.project(Point::new(548295.39, 182498.46), true)
.unwrap();
assert_almost_eq(t.x(), 0.0023755864848281206);
assert_almost_eq(t.y(), 0.8992274896304518);
} | rust_cleaned_test_functions.jsonl/104010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
6474,
63333,
368,
341,
286,
1077,
50848,
65,
18,
21,
284,
42952,
486,
931,
1006,
310,
6228,
310,
488,
30386,
24000,
64422,
488,
5524,
62,
15,
28,
19,
24,
488,
12212,
62,
15,
10829,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffer() {
let gil = Python::acquire_gil();
let py = gil.python();
let t = Py::new(
py,
TestClass {
vec: vec![b' ', b'2', b'3'],
},
)
.unwrap();
let d = [("ob", t)].into_py_dict(py);
py.run("assert memoryview(ob).tobytes() == ' 23'", None, Some(d))
.unwrap();
} | rust_cleaned_test_functions.jsonl/19785 | {
"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,
7776,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
259,
284,
5355,
486,
931,
1006,
286,
4510,
345,
286,
339... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vtstq_u8() {
unsafe {
let a: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let b: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let e: [u8; 16] = [
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF,
];
let r = vtstq_u8(transmute(a), transmute(b));
assert!(cmp_arm(r, transmute(e)));
let a: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let b: [u8; 16] = [0, 0, 1, 4, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let e: [u8; 16] = [
0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF,
];
let r = vtstq_u8(transmute(a), transmute(b));
assert!(cmp_arm(r, transmute(e)));
}
} | rust_cleaned_test_functions.jsonl/33013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
83,
267,
80,
7300,
23,
368,
341,
286,
19860,
341,
310,
1077,
264,
25,
508,
84,
23,
26,
220,
16,
21,
60,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
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_duration_array_from_vec() {
let arr = DurationSecondArray::from(vec![Some(1), None, Some(-5)]);
assert_eq!(3, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(1, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(1, arr.values()[0]);
assert!(arr.is_null(1));
assert_eq!(-5, arr.value(2));
assert_eq!(-5, arr.values()[2]);
let arr = DurationMillisecondArray::from(vec![Some(1), None, Some(-5)]);
assert_eq!(3, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(1, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(1, arr.values()[0]);
assert!(arr.is_null(1));
assert_eq!(-5, arr.value(2));
assert_eq!(-5, arr.values()[2]);
let arr = DurationMicrosecondArray::from(vec![Some(1), None, Some(-5)]);
assert_eq!(3, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(1, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(1, arr.values()[0]);
assert!(arr.is_null(1));
assert_eq!(-5, arr.value(2));
assert_eq!(-5, arr.values()[2]);
let arr = DurationNanosecondArray::from(vec![Some(1), None, Some(-5)]);
assert_eq!(3, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(1, arr.null_count());
assert_eq!(1, arr.value(0));
assert_eq!(1, arr.values()[0]);
assert!(arr.is_null(1));
assert_eq!(-5, arr.value(2));
assert_eq!(-5, arr.values()[2]);
} | rust_cleaned_test_functions.jsonl/27280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 814
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
3858,
5673,
13251,
368,
341,
286,
1077,
2890,
284,
21045,
15666,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
701,
2240,
11,
4329,
4080,
20,
41958,
286,
2060,
10714,
10297,
18,
11,
2890,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_incomplete_header() {
let v = vec![0x03, 0x02, 0x23, 0x07];
let mut c = RetainingConsumer::new();
let p = Parser::new(&v, &mut c);
assert_matches!(p.parse(),
Err(State::HeaderIncomplete(DecodeError::StreamExpected(4))));
} | rust_cleaned_test_functions.jsonl/85731 | {
"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,
620,
28598,
1243,
14737,
8757,
368,
341,
286,
1077,
348,
284,
7486,
20703,
15,
87,
15,
18,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
17,
18,
11,
220,
15,
87,
15,
22,
935,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lexicographic_largest() {
assert!(!bool::from(Fp6::zero().lexicographically_largest()));
assert!(!bool::from(Fp6::one().lexicographically_largest()));
// a = 13413783073807968269*u^5 + 15191285573968924193*u^4 + 6249462481928133327*u^3
// + 12517261035513395024*u^2 + 17772767032074153840*u + 16347749849157988583
let a = Fp6 {
c0: Fp::new(16347749849157988583),
c1: Fp::new(17772767032074153840),
c2: Fp::new(12517261035513395024),
c3: Fp::new(6249462481928133327),
c4: Fp::new(15191285573968924193),
c5: Fp::new(13413783073807968269),
};
// b = -a = 5032960995606616052*u^5 + 3255458495445660128*u^4 + 12197281587486450994*u^3
// + 5929483033901189297*u^2 + 673977037340430481*u + 2098994220256595738
let b = Fp6 {
c0: Fp::new(2098994220256595738),
c1: Fp::new(673977037340430481),
c2: Fp::new(5929483033901189297),
c3: Fp::new(12197281587486450994),
c4: Fp::new(3255458495445660128),
c5: Fp::new(5032960995606616052),
};
assert_eq!(a.square(), b.square());
assert!(bool::from(a.lexicographically_largest()));
assert!(!bool::from(b.lexicographically_largest()));
assert!(bool::from(
Fp6 {
c0: Fp::new(16164148524715685436),
c1: Fp::new(13417117976106719244),
c2: Fp::zero(),
c3: Fp::zero(),
c4: Fp::zero(),
c5: Fp::zero(),
}
.lexicographically_largest()
));
} | rust_cleaned_test_functions.jsonl/132393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 995
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
292,
12679,
907,
32381,
368,
341,
286,
2060,
0,
3471,
2641,
486,
1499,
7832,
79,
21,
486,
14154,
1005,
2571,
292,
63931,
907,
32381,
7392,
286,
2060,
0,
3471,
2641,
486,
1499,
7832,
79,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unicode() {
test_case!("{name:π^10}", name = "πππππ");
test_case!("{name:ο·½^10}", name = "π");
test_case!("{}", 'γ¨');
test_case!("Hello {var}", var = 'γ¨');
} | rust_cleaned_test_functions.jsonl/2743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54662,
368,
341,
262,
1273,
19096,
88928,
606,
25,
144236,
61,
16,
15,
9545,
829,
284,
330,
145618,
145618,
145618,
145618,
145618,
797,
262,
1273,
19096,
88928,
606,
25,
149861,
61,
16,
15,
9545,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_constant() {
let hdr = indoc! {"
#include <cstdint>
const char* STRING = \"Foo\";
"};
let rs = quote! {
let a = std::str::from_utf8(ffi::STRING).unwrap().trim_end_matches(char::from(0));
assert_eq!(a, "Foo");
};
run_test("", hdr, rs, &["STRING"], &[]);
} | rust_cleaned_test_functions.jsonl/9814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
34967,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
733,
1161,
9,
35255,
284,
7245,
40923,
59,
876,
262,
330,
2440,
262,
1077,
10036,
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_mm_anon() {
let siz = 1024 * 1024;
let addr = mm_anon(siz).unwrap();
unsafe {
assert_eq!(*(addr.add(siz - 1) as *const u8), 0_u8);
}
} | rust_cleaned_test_functions.jsonl/89230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35599,
12008,
263,
368,
341,
286,
1077,
64896,
284,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
280,
286,
1077,
10789,
284,
9465,
12008,
263,
1141,
449,
568,
15454,
543,
286,
19860,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.