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_math_function() -> Result<()> {
let exp_f64 = "2.718281828459045";
let exp_f32 = "2.7182817459106445";
generic_test_math(ScalarValue::Int32(1i32), exp_f64)?;
generic_test_math(ScalarValue::UInt32(1u32), exp_f64)?;
generic_test_math(ScalarValue::UInt64(1u64), exp_f64)?;
generic_test_math(ScalarValue::Float64(1f64), exp_f64)?;
generic_test_math(ScalarValue::Float32(1f32), exp_f32)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/111687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65561,
9174,
368,
1464,
5714,
71698,
341,
1789,
286,
1077,
1343,
761,
21,
19,
284,
330,
17,
13,
22,
16,
23,
17,
23,
16,
23,
17,
23,
19,
20,
24,
15,
19,
20,
876,
286,
1077,
1343,
761,
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... | 6 |
#[test]
fn test_check_comment_not_js() {
let valid_comments = [
line(r#"/ <reference types="./mod.d.ts" />"#),
line(r#"/ <reference path="./mod.d.ts" />"#),
line(r#"/ <reference lib="./mod.d.ts" />"#),
line(r#"/ <reference no-default-lib="true" />"#),
line(r#"/<reference types="./mod.d.ts" />"#),
line(r#"/ <reference types="./mod.d.ts" /> foo bar "#),
line(r#"/ foo <reference path="./mod.d.ts" />"#),
line(r#"<reference path="./mod.d.ts" />"#),
block(r#"<reference path="./mod.d.ts" />"#),
];
for valid_comment in &valid_comments {
assert!(check_comment(valid_comment, false).is_none());
}
let invalid_comments = [
line(r#"/ <reference foo="./mod.d.ts" />"#),
line(r#"/<reference bar />"#),
];
for invalid_comment in &invalid_comments {
let report_kind = check_comment(invalid_comment, false).unwrap();
assert_eq!(report_kind, ReportKind::InvalidDirective(DUMMY_SP))
}
} | rust_cleaned_test_functions.jsonl/52845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 487
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
17638,
7913,
26250,
368,
341,
262,
1077,
2697,
30359,
284,
2278,
414,
1555,
2601,
2,
3115,
366,
16291,
4494,
26420,
2593,
950,
21288,
1,
6206,
57676,
1326,
414,
1555,
2601,
2,
3115,
366,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_mls() {
assert_eq!(
decode_32(0xfb02921a),
Instruction::MLS {
params: Reg4NoSetFlagsParams {
rd: Reg::R2,
rn: Reg::R2,
rm: Reg::R10,
ra: Reg::R9,
}
}
);
} | rust_cleaned_test_functions.jsonl/64830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
717,
4730,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
46071,
15,
17,
24,
17,
16,
64,
1326,
286,
29051,
486,
49976,
341,
310,
3628,
25,
3184,
19,
2753,
164... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rounding() {
testing_env!(VMContextBuilder::new().build());
let mut pool = SimplePool {
token_account_ids: vec![accounts(0).to_string(), accounts(1).to_string()],
amounts: vec![367701466208080431008668441, 2267116519548219219535],
volumes: vec![SwapVolume::default(), SwapVolume::default()],
total_fee: 30,
exchange_fee: 5,
referral_fee: 1,
shares_total_supply: 35967818779820559673547466,
shares: LookupMap::new(StorageKey::Shares {
pool_id: 0,
}),
};
let mut amounts = vec![145782, 1];
let _ = pool.add_liquidity(&accounts(2).to_string(), &mut amounts);
} | rust_cleaned_test_functions.jsonl/90753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
287,
368,
341,
286,
7497,
15879,
10297,
11187,
1972,
3297,
486,
931,
1005,
5834,
1423,
286,
1077,
5206,
7314,
284,
8993,
10551,
341,
310,
3950,
13500,
8077,
25,
7486,
20703,
26206,
7,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_first_err() {
assert_eq!(first_err(&[Ok(())]), Ok(()));
assert_eq!(
first_err(&[Ok(()), Err(TransactionError::DuplicateSignature)]),
Err(TransactionError::DuplicateSignature)
);
assert_eq!(
first_err(&[
Ok(()),
Err(TransactionError::DuplicateSignature),
Err(TransactionError::AccountInUse)
]),
Err(TransactionError::DuplicateSignature)
);
assert_eq!(
first_err(&[
Ok(()),
Err(TransactionError::AccountInUse),
Err(TransactionError::DuplicateSignature)
]),
Err(TransactionError::AccountInUse)
);
assert_eq!(
first_err(&[
Err(TransactionError::AccountInUse),
Ok(()),
Err(TransactionError::DuplicateSignature)
]),
Err(TransactionError::AccountInUse)
);
} | rust_cleaned_test_functions.jsonl/118154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
9266,
368,
341,
286,
2060,
10714,
10297,
3896,
9266,
2099,
58,
11578,
7,
2140,
9719,
7622,
5065,
1106,
286,
2060,
10714,
33673,
310,
1156,
9266,
2099,
58,
11578,
5065,
701,
15495,
76627,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_manual_wal_flush() {
let path = tempdir_with_prefix("_rust_rocksdb_manual_wal_flush");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
opts.manual_wal_flush(true);
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
for i in 0..200 {
db.put(format!("k_{}", i).as_bytes(), b"v").unwrap();
}
} | rust_cleaned_test_functions.jsonl/34119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75428,
1670,
278,
39213,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
75428,
1670,
278,
39213,
797,
262,
1077,
5206,
12185,
284,
5952,
3798,
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_find_sort_exprs() -> Result<()> {
let exprs = &[
Expr::WindowFunction {
fun: WindowFunction::AggregateFunction(AggregateFunction::Max),
args: vec![col("name")],
partition_by: vec![],
order_by: vec![
Expr::Sort {
expr: Box::new(col("age")),
asc: true,
nulls_first: true,
},
Expr::Sort {
expr: Box::new(col("name")),
asc: false,
nulls_first: true,
},
],
window_frame: None,
},
Expr::WindowFunction {
fun: WindowFunction::AggregateFunction(AggregateFunction::Sum),
args: vec![col("age")],
partition_by: vec![],
order_by: vec![
Expr::Sort {
expr: Box::new(col("name")),
asc: false,
nulls_first: true,
},
Expr::Sort {
expr: Box::new(col("age")),
asc: true,
nulls_first: true,
},
Expr::Sort {
expr: Box::new(col("created_at")),
asc: false,
nulls_first: true,
},
],
window_frame: None,
},
];
let expected = vec![
Expr::Sort {
expr: Box::new(col("age")),
asc: true,
nulls_first: true,
},
Expr::Sort {
expr: Box::new(col("name")),
asc: false,
nulls_first: true,
},
Expr::Sort {
expr: Box::new(col("created_at")),
asc: false,
nulls_first: true,
},
];
let result = find_sort_exprs(exprs);
assert_eq!(expected, result);
Ok(())
} | rust_cleaned_test_functions.jsonl/24745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
18435,
21915,
82,
368,
1464,
5714,
71698,
341,
286,
1077,
15169,
82,
284,
609,
9640,
310,
28819,
486,
4267,
5152,
341,
394,
2464,
25,
13642,
5152,
486,
64580,
5152,
4346,
70,
14240,
5152,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_html5_custom_elements() {
let input = load_fixture("TEST_HTML5_CUSTOM_ELEMENTS.html");
let links: HashSet<Uri> =
extract_links(&InputContent::from_string(&input, FileType::Html), None)
.into_iter()
.map(|r| r.uri)
.collect();
let expected_links = [
website("https://example.org/some-weird-element"),
website("https://example.org/even-weirder-src"),
website("https://example.org/even-weirder-href"),
website("https://example.org/citations"),
]
.iter()
.cloned()
.collect();
assert_eq!(links, expected_links);
} | rust_cleaned_test_functions.jsonl/93898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
9564,
20,
15875,
22801,
368,
341,
1789,
286,
1077,
1946,
284,
2795,
74409,
445,
10033,
56726,
20,
36314,
66169,
2564,
797,
286,
1077,
7746,
25,
18931,
27,
13899,
29,
4035,
310,
8649,
25258,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_bb_directives() {
let p = r#"
blah
more code
goes here
(* blackbox *)
module my_famous_module(
super_secret_arg1,
super_secret_arg2,
super_secret_arg3);
/* Comment */
endmodule
stuff
"#;
let q = filter_blackbox_directives(p);
println!("{}", q);
assert!(!q.contains("blackbox"));
assert!(!q.contains("module"));
assert!(!q.contains("endmodule"));
assert!(q.contains("more code"));
assert!(q.contains("stuff"));
} | rust_cleaned_test_functions.jsonl/1862 | {
"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,
8727,
50255,
32871,
1886,
368,
341,
262,
1077,
281,
284,
435,
2,
698,
70614,
198,
6384,
2038,
198,
3346,
288,
1588,
271,
4071,
3691,
2011,
17400,
4352,
847,
761,
22517,
10750,
1006,
262,
2256,
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_valid_queue_01() {
let sys_space = address_space_init();
let mut queue_config = QueueConfig::new(QUEUE_SIZE);
// failed when the type of queue is invalid
let queue = Queue::new(queue_config, 0);
assert!(queue.is_err());
let queue = Queue::new(queue_config, QUEUE_TYPE_PACKED_VRING);
assert!(queue.is_err());
// it is valid
queue_config.desc_table = GuestAddress(0);
queue_config.avail_ring = GuestAddress((QUEUE_SIZE as u64) * DESCRIPTOR_LEN);
queue_config.used_ring = GuestAddress(align(
(QUEUE_SIZE as u64) * DESCRIPTOR_LEN
+ VRING_AVAIL_LEN_EXCEPT_AVAILELEM
+ AVAILELEM_LEN * (QUEUE_SIZE as u64),
4096,
));
queue_config.ready = true;
queue_config.size = QUEUE_SIZE;
let queue = Queue::new(queue_config, QUEUE_TYPE_SPLIT_VRING).unwrap();
assert_eq!(queue.is_valid(&sys_space), true);
// it is invalid when the status is not ready
queue_config.ready = false;
let queue = Queue::new(queue_config, QUEUE_TYPE_SPLIT_VRING).unwrap();
assert_eq!(queue.is_valid(&sys_space), false);
queue_config.ready = true;
// it is invalid when the size of virtual ring is more than the max size
queue_config.size = QUEUE_SIZE + 1;
let queue = Queue::new(queue_config, QUEUE_TYPE_SPLIT_VRING).unwrap();
assert_eq!(queue.is_valid(&sys_space), false);
// it is invalid when the size of virtual ring is zero
queue_config.size = 0;
let queue = Queue::new(queue_config, QUEUE_TYPE_SPLIT_VRING).unwrap();
assert_eq!(queue.is_valid(&sys_space), false);
// it is invalid when the size of virtual ring isn't power of 2
queue_config.size = 15;
let queue = Queue::new(queue_config, QUEUE_TYPE_SPLIT_VRING).unwrap();
assert_eq!(queue.is_valid(&sys_space), false);
} | rust_cleaned_test_functions.jsonl/15188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 903
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
10841,
62,
15,
16,
368,
341,
286,
1077,
5708,
14663,
284,
2621,
14663,
6137,
1428,
286,
1077,
5206,
7177,
5332,
284,
18745,
2648,
486,
931,
7,
28945,
4098,
626,
286,
442,
4641,
979,
279,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_refinements() {
check_match(
"i32 [x > 0]",
any_type,
Type::Refinement(
Box::from(Type::i32),
vec![Refinement {
operator: ComparisonOperator::Greater,
left: wrap(Expr::from("x")),
right: wrap(Expr::from(0)),
}],
),
);
} | rust_cleaned_test_functions.jsonl/111020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
258,
3723,
368,
341,
310,
1779,
10708,
1006,
394,
330,
72,
18,
17,
508,
87,
861,
220,
15,
45016,
394,
894,
1819,
345,
394,
3990,
486,
3945,
37184,
1006,
503,
8261,
486,
1499,
22498,
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_paste_doc() {
macro_rules! m {
($ret:ident) => {
paste! {
#[doc = "Create a new [`" $ret "`] object."]
fn new() -> $ret { todo!() }
}
};
}
struct Paste;
m!(Paste);
let _ = new;
} | rust_cleaned_test_functions.jsonl/36570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
5525,
18869,
368,
341,
262,
18072,
21407,
0,
296,
341,
286,
1711,
2122,
25,
1713,
8,
589,
341,
310,
24937,
0,
341,
394,
11506,
5236,
284,
330,
4021,
264,
501,
40518,
1,
400,
2122,
35973,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alt_ctrl() {
assert_eq!(
parse_event(b"\x1B\x14", false).unwrap(),
Some(InternalEvent::Event(Event::Key(KeyEvent::new(
KeyCode::Char('t'),
KeyModifiers::ALT | KeyModifiers::CONTROL
)))),
);
} | rust_cleaned_test_functions.jsonl/21322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32105,
22667,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6748,
1883,
11934,
87,
16,
33,
3462,
16,
19,
497,
895,
568,
15454,
3148,
310,
4329,
7,
11569,
1556,
486,
1556,
30469,
486,
1592,
67108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_from_two_touch_string_error() {
let c = Converter::new();
let result = c.convert_from_two_touch_string("8080".to_string());
assert!(result.is_err());
let c = Converter::new();
let result = c.convert_from_two_touch_string("111".to_string());
assert!(result.is_err());
let c = Converter::new();
let result = c.convert_from_two_touch_string("".to_string());
assert!(result.is_err());
let c = Converter::new();
let result = c.convert_from_two_touch_string("筋肉".to_string());
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/101151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
5673,
23241,
60840,
3904,
4096,
368,
341,
286,
1077,
272,
284,
39328,
486,
931,
543,
286,
1077,
1102,
284,
272,
24012,
5673,
23241,
60840,
3904,
445,
23,
15,
23,
15,
3263,
983,
3904,
1423... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_token_account_id() {
let e = Env::init(None);
let result = e.get_token_account_id();
assert_eq!(result, e.token.valid_account_id());
} | rust_cleaned_test_functions.jsonl/38759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
6458,
13500,
842,
368,
341,
262,
1077,
384,
284,
37039,
486,
2327,
26717,
626,
262,
1077,
1102,
284,
384,
670,
6458,
13500,
842,
543,
262,
2060,
10714,
10297,
1382,
11,
384,
14416,
20586,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_use_loc() {
check_location(r"use f$0", ImmediateLocation::Use);
check_location(r"use f$0;", ImmediateLocation::Use);
check_location(r"use f::{f$0}", None);
check_location(r"use {f$0}", None);
} | rust_cleaned_test_functions.jsonl/24638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15951,
13400,
368,
341,
286,
1779,
13126,
2601,
25372,
282,
3,
15,
497,
80310,
4707,
486,
10253,
317,
286,
1779,
13126,
2601,
25372,
282,
3,
15,
32503,
80310,
4707,
486,
10253,
317,
286,
1779,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_range_prefix_bloom_case() {
let path = TempDir::new("_raftstore_util_delete_range_prefix_bloom").expect("");
let path_str = path.path().to_str().unwrap();
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let mut cf_opts = ColumnFamilyOptions::new();
cf_opts
.set_prefix_extractor(
"FixedSuffixSliceTransform",
Box::new(rocksdb_util::FixedSuffixSliceTransform::new(8)),
)
.unwrap_or_else(|err| exit_with_err(format!("{:?}", err)));
// Create prefix bloom filter for memtable.
cf_opts.set_memtable_prefix_bloom_size_ratio(0.1 as f64);
let cf = "default";
let db = DB::open_cf(opts, path_str, vec![(cf, cf_opts)]).unwrap();
let wb = WriteBatch::new();
let kvs: Vec<(&[u8], &[u8])> = vec![
(b"kabcdefg1", b"v1"),
(b"kabcdefg2", b"v2"),
(b"kabcdefg3", b"v3"),
(b"kabcdefg4", b"v4"),
];
let kvs_left: Vec<(&[u8], &[u8])> = vec![(b"kabcdefg1", b"v1"), (b"kabcdefg4", b"v4")];
for &(k, v) in kvs.as_slice() {
let handle = get_cf_handle(&db, cf).unwrap();
wb.put_cf(handle, k, v).unwrap();
}
db.write(wb).unwrap();
check_data(&db, &[cf], kvs.as_slice());
delete_all_in_range(&db, b"kabcdefg2", b"kabcdefg4", true).unwrap();
check_data(&db, &[cf], kvs_left.as_slice());
} | rust_cleaned_test_functions.jsonl/10730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 837
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
9698,
13974,
880,
18474,
19096,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
2944,
4314,
18974,
11353,
9698,
13974,
880,
18474,
1827,
17119,
13056,
286,
1077,
1815,
2895,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_compare() {
use std::cmp::Ordering;
use std::collections::hash_map::DefaultHasher;
let collations = [
(Collation::Utf8Mb4Bin, 0),
(Collation::Utf8Mb4BinNoPadding, 1),
(Collation::Utf8Mb4GeneralCi, 2),
(Collation::Utf8Mb4UnicodeCi, 3),
(Collation::Latin1Bin, 4),
(Collation::GbkBin, 5),
];
let cases = vec![
(
"a".as_bytes(),
"a".as_bytes(),
[
Ordering::Equal,
Ordering::Equal,
Ordering::Equal,
Ordering::Equal,
Ordering::Equal,
Ordering::Equal,
],
),
(
"a".as_bytes(),
"a ".as_bytes(),
[
Ordering::Equal,
Ordering::Less,
Ordering::Equal,
Ordering::Equal,
Ordering::Equal,
Ordering::Equal,
],
),
(
"a".as_bytes(),
"A ".as_bytes(),
[
Ordering::Greater,
Ordering::Greater,
Ordering::Equal,
Ordering::Equal,
Ordering::Greater,
Ordering::Greater,
],
),
(
"aa ".as_bytes(),
"a a".as_bytes(),
[
Ordering::Greater,
Ordering::Greater,
Ordering::Greater,
Ordering::Greater,
Ordering::Greater,
Ordering::Greater,
],
),
(
"A".as_bytes(),
"a\t".as_bytes(),
[
Ordering::Less,
Ordering::Less,
Ordering::Less,
Ordering::Less,
Ordering::Less,
Ordering::Less,
],
),
(
"cAfe".as_bytes(),
"café".as_bytes(),
[
Ordering::Less,
Ordering::Less,
Ordering::Equal,
Ordering::Equal,
Ordering::Less,
Ordering::Less,
],
),
(
"cAfe ".as_bytes(),
"café".as_bytes(),
[
Ordering::Less,
Ordering::Less,
Ordering::Equal,
Ordering::Equal,
Ordering::Less,
Ordering::Less,
],
),
(
"ß".as_bytes(),
"ss".as_bytes(),
[
Ordering::Greater,
Ordering::Greater,
Ordering::Less,
Ordering::Equal,
Ordering::Greater,
Ordering::Less,
],
),
(
"中文".as_bytes(),
"汉字".as_bytes(),
[
Ordering::Less,
Ordering::Less,
Ordering::Less,
Ordering::Less,
Ordering::Less,
Ordering::Greater,
],
),
];
for (sa, sb, expected) in cases {
for (collation, order_in_expected) in &collations {
let (cmp, ha, hb) = match_template_collator! {
TT, match collation {
Collation::TT => {
let eval_hash = |s| {
let mut hasher = DefaultHasher::default();
TT::sort_hash(&mut hasher, s).unwrap();
hasher.finish()
};
let cmp = TT::sort_compare(sa, sb).unwrap();
let ha = eval_hash(sa);
let hb = eval_hash(sb);
(cmp, ha, hb)
}
}
};
assert_eq!(
cmp, expected[*order_in_expected],
"when comparing {:?} and {:?} by {:?}",
sa, sb, collation
);
if expected[*order_in_expected] == Ordering::Equal {
assert_eq!(
ha, hb,
"when comparing the hash of {:?} and {:?} by {:?}, which should be equal",
sa, sb, collation
);
} else {
assert_ne!(
ha, hb,
"when comparing the hash of {:?} and {:?} by {:?}, which should not be equal",
sa, sb, collation
);
}
}
}
} | rust_cleaned_test_functions.jsonl/45979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
368,
341,
286,
990,
1460,
486,
7293,
486,
4431,
287,
280,
286,
990,
1460,
486,
51137,
486,
8296,
5376,
486,
3675,
6370,
261,
401,
286,
1077,
4530,
804,
284,
2278,
310,
320,
15265,
367,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cast_i32_to_u8_sliced() {
let a = Int32Array::from(vec![-5, 6, -7, 8, 100000000]);
let array = Arc::new(a) as ArrayRef;
assert_eq!(0, array.offset());
let array = array.slice(2, 3);
assert_eq!(2, array.offset());
let b = cast(&array, &DataType::UInt8).unwrap();
assert_eq!(3, b.len());
assert_eq!(0, b.offset());
let c = b.as_any().downcast_ref::<UInt8Array>().unwrap();
assert_eq!(false, c.is_valid(0));
assert_eq!(8, c.value(1));
// overflows return None
assert_eq!(false, c.is_valid(2));
} | rust_cleaned_test_functions.jsonl/29601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5318,
18,
17,
2346,
7300,
23,
643,
74630,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
0,
7609,
20,
11,
220,
21,
11,
481,
22,
11,
220,
23,
11,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boot_from_virtio_pmem() {
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(&mut focal);
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
let kernel_path = direct_kernel_boot_path().unwrap();
let mut child = GuestCommand::new(&guest)
.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&[
"--disk",
format!(
"path={}",
guest.disk_config.disk(DiskType::CloudInit).unwrap()
)
.as_str(),
])
.default_net()
.args(&[
"--pmem",
format!(
"file={},size={}",
guest
.disk_config
.disk(DiskType::RawOperatingSystem)
.unwrap(),
fs::metadata(
&guest
.disk_config
.disk(DiskType::RawOperatingSystem)
.unwrap()
)
.unwrap()
.len()
)
.as_str(),
])
.args(&[
"--cmdline",
DIRECT_KERNEL_BOOT_CMDLINE
.replace("vda1", "pmem0p1")
.as_str(),
])
.capture_output()
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
let r = std::panic::catch_unwind(|| {
// Simple checks to validate the VM booted properly
assert_eq!(guest.get_cpu_count().unwrap_or_default(), 1);
assert!(guest.get_total_memory().unwrap_or_default() > 480_000);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/23988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1514
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
5673,
2273,
2106,
815,
620,
10536,
368,
341,
310,
1077,
5206,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
310,
1077,
8640,
284,
26215,
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_resolve_module_3() {
let (_temp_dir, deno_dir) = test_setup();
let specifier_ =
deno_dir.deps_http.join("unpkg.com/liltest@0.0.5/index.ts");
let specifier = specifier_.to_str().unwrap();
let referrer = ".";
let expected_module_name = "http://unpkg.com/liltest@0.0.5/index.ts";
let expected_filename = deno_fs::normalize_path(
deno_dir
.deps_http
.join("unpkg.com/liltest@0.0.5/index.ts")
.as_ref(),
);
let (module_name, filename) =
deno_dir.resolve_module(specifier, referrer).unwrap();
assert_eq!(module_name, expected_module_name);
assert_eq!(filename, expected_filename);
} | rust_cleaned_test_functions.jsonl/72754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10750,
62,
18,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
97616,
62,
4035,
414,
3371,
78,
4334,
2285,
1690,
25888,
5446,
445,
359,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_multi() {
let filter = Filter::new()
.appid(240)
.gametype(&vec!["friendlyfire", "alltalk"])
.nand()
.map("de_dust2")
.end();
assert_eq!(
filter.as_string(),
"\\appid\\240\\gametype\\friendlyfire,alltalk\\nand\\1\\map\\de_dust2"
);
} | rust_cleaned_test_functions.jsonl/4945 | {
"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,
8727,
25133,
368,
341,
262,
1077,
4051,
284,
12339,
486,
931,
741,
286,
659,
58342,
7,
17,
19,
15,
340,
286,
659,
39329,
16214,
2099,
4083,
0,
1183,
81530,
10796,
497,
330,
541,
35241,
14108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delta_byte_array_single_array() {
let data = vec![vec![ByteArray::from(vec![1, 2, 3, 4, 5, 6])]];
test_delta_byte_array_decode(data);
} | rust_cleaned_test_functions.jsonl/38532 | {
"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,
26710,
19737,
3858,
19487,
3858,
368,
341,
286,
1077,
821,
284,
7486,
20703,
4083,
20703,
18394,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
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 |
#[test]
fn test_transaction_missing_keypair() {
let program_id = Pubkey::default();
let keypair0 = Keypair::new();
let id0 = keypair0.pubkey();
let ix = Instruction::new(program_id, &0, vec![AccountMeta::new(id0, true)]);
Transaction::new_unsigned_instructions(&[ix])
.sign(&Vec::<&Keypair>::new(), Hash::default());
} | rust_cleaned_test_functions.jsonl/20134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
40447,
3097,
12670,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
2258,
543,
286,
1077,
1376,
12670,
15,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
877,
15,
284,
1376,
12670... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_else() {
let result = Command::new("cargo")
.args(&[
"run",
"-q",
"--release",
"--",
"tests/resources/if/else.lox",
])
.output()
.expect("Error while running if/test_else()");
assert_eq!(
str::from_utf8(&result.stdout).unwrap(),
"good\ngood\nblock\n"
);
assert!(result.status.success());
} | rust_cleaned_test_functions.jsonl/133809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62628,
368,
341,
262,
1077,
1102,
284,
7348,
486,
931,
445,
66715,
1138,
286,
659,
2116,
2099,
9640,
310,
330,
6108,
756,
310,
6523,
80,
756,
310,
14482,
22998,
756,
310,
14482,
756,
310,
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_into_request_line() {
let expected_request_line = RequestLine {
http_version: Version::Http10,
method: Method::Get,
uri: Uri::new("http://localhost/home"),
};
let request_line = b"GET http://localhost/home HTTP/1.0";
assert_eq!(
RequestLine::try_from(request_line).unwrap(),
expected_request_line
);
let expected_request_line = RequestLine {
http_version: Version::Http11,
method: Method::Get,
uri: Uri::new("http://localhost/home"),
};
// Happy case with request line ending in CRLF.
let request_line = b"GET http://localhost/home HTTP/1.1";
assert_eq!(
RequestLine::try_from(request_line).unwrap(),
expected_request_line
);
// Happy case with request line ending in LF instead of CRLF.
let request_line = b"GET http://localhost/home HTTP/1.1";
assert_eq!(
RequestLine::try_from(request_line).unwrap(),
expected_request_line
);
// Test for invalid method.
let request_line = b"POST http://localhost/home HTTP/1.0";
assert_eq!(
RequestLine::try_from(request_line).unwrap_err(),
RequestError::InvalidHttpMethod("Unsupported HTTP method.")
);
// Test for invalid uri.
let request_line = b"GET HTTP/1.0";
assert_eq!(
RequestLine::try_from(request_line).unwrap_err(),
RequestError::InvalidUri("Empty URI not allowed.")
);
// Test for invalid HTTP version.
let request_line = b"GET http://localhost/home HTTP/2.0";
assert_eq!(
RequestLine::try_from(request_line).unwrap_err(),
RequestError::InvalidHttpVersion("Unsupported HTTP version.")
);
let request_line = b"nothing";
assert_eq!(
RequestLine::try_from(request_line).unwrap_err(),
RequestError::InvalidHttpMethod("Unsupported HTTP method.")
);
// Test for invalid format with no version.
let request_line = b"GET /";
assert_eq!(
RequestLine::try_from(request_line).unwrap_err(),
RequestError::InvalidHttpVersion("Unsupported HTTP version.")
);
} | rust_cleaned_test_functions.jsonl/41854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1079
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
7893,
6528,
368,
341,
286,
1077,
3601,
7893,
6528,
284,
6145,
2460,
341,
310,
1758,
9438,
25,
6079,
486,
2905,
16,
15,
345,
310,
1714,
25,
6730,
486,
1949,
345,
310,
13071,
25,
17226,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vfn_multi_network() {
let vfn_0 = PeerId::random();
let vfn_0_public_network_id = PeerId::random();
let vfn_1 = PeerId::random();
let vfn_1_public_network_id = PeerId::random();
let pfn = PeerId::random();
let mut vfn_0_config = NodeConfig::default();
vfn_0_config.base.role = RoleType::FullNode;
vfn_0_config.mempool.shared_mempool_batch_size = 1;
vfn_0_config.upstream.networks = vec![NetworkId::vfn_network(), NetworkId::Public];
let mut vfn_1_config = NodeConfig::default();
vfn_1_config.base.role = RoleType::FullNode;
let mut pfn_config = NodeConfig::default();
pfn_config.base.role = RoleType::FullNode;
pfn_config.upstream.networks = vec![NetworkId::Public];
let mut smp = SharedMempoolNetwork::default();
init_smp_multiple_networks(
&mut smp,
vec![
(NetworkId::vfn_network(), vfn_0),
(NetworkId::Public, vfn_0_public_network_id),
],
vfn_0_config,
);
init_smp_multiple_networks(
&mut smp,
vec![
(NetworkId::vfn_network(), vfn_1),
(NetworkId::Public, vfn_1_public_network_id),
],
vfn_1_config,
);
init_single_shared_mempool(&mut smp, pfn, NetworkId::Public, pfn_config);
//vfn 0 discovers pfn as inbound
smp.send_new_peer_event(&vfn_0_public_network_id, &pfn, true);
// vfn 0 discovers vfn 1 as outbound
smp.send_new_peer_event(&vfn_0_public_network_id, &vfn_1_public_network_id, false);
// add txn to fn_0
smp.add_txns(&vfn_0, vec![TestTransaction::new(1, 0, 1)]);
// vfn should broadcast to failover upstream vfn in public network
assert_eq!(
vfn_1_public_network_id,
smp.deliver_message(&vfn_0_public_network_id, 1, false, true, false)
.1
);
// vfn should not broadcast to downstream peer in public network
smp.assert_no_message_sent(&vfn_0_public_network_id);
smp.assert_no_message_sent(&vfn_0);
} | rust_cleaned_test_functions.jsonl/54562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 905
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
8822,
25133,
20966,
368,
341,
262,
1077,
348,
8822,
62,
15,
284,
45147,
764,
486,
11463,
543,
262,
1077,
348,
8822,
62,
15,
27074,
20966,
842,
284,
45147,
764,
486,
11463,
543,
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_iterator_min() {
let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
assert_eq!(v[..4].iter().cloned().min(), Some(0));
assert_eq!(v.iter().cloned().min(), Some(0));
assert_eq!(v[..0].iter().cloned().min(), None);
} | rust_cleaned_test_functions.jsonl/25927 | {
"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,
13491,
7260,
368,
341,
262,
1077,
348,
25,
609,
13496,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
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_clock_tick_frame_rate() {
let time = TimeStd::from(Arc::new(ContextData::new())).unwrap();
let mut clock = time.new_clock();
let ticks = clock.tick();
assert_eq!(0.0, ticks);
let ticks = clock.tick_frame_rate(100);
assert!(ticks >= 9.9 && ticks < 30.0);
} | rust_cleaned_test_functions.jsonl/52809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23062,
43612,
8929,
9246,
368,
341,
286,
1077,
882,
284,
4120,
22748,
486,
1499,
4346,
1287,
486,
931,
14001,
1043,
486,
931,
34670,
15454,
543,
286,
1077,
5206,
8866,
284,
882,
4618,
23062,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_update_guild_scheduled_event() {
let route = Route::UpdateGuildScheduledEvent {
guild_id: GUILD_ID,
scheduled_event_id: SCHEDULED_EVENT_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/scheduled-events/{scheduled_event_id}",
guild_id = GUILD_ID,
scheduled_event_id = SCHEDULED_EVENT_ID
)
);
} | rust_cleaned_test_functions.jsonl/119973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
1889,
1498,
643,
26644,
6748,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4289,
72574,
88137,
1556,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
13537,
6748,
842,
25,
328,
55222,
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_find_intersections() {
let first_moves = vec![
Move {
start: START_POINT,
end: Point { x: 10, y: 0 },
move_type: MoveType::Horizontal,
},
Move {
start: Point { x: 10, y: 0 },
end: Point { x: 10, y: 50 },
move_type: MoveType::Vertical,
},
Move {
start: Point { x: 10, y: 50 },
end: Point { x: 20, y: 50 },
move_type: MoveType::Horizontal,
},
Move {
start: Point { x: 20, y: 50 },
end: Point { x: 20, y: 0 },
move_type: MoveType::Vertical,
},
];
let second_moves = vec![
Move{
start: Point { x: 25, y: 25},
end: Point { x:-25, y: 25},
move_type: MoveType::Horizontal
}
];
let expected_intersections = vec![Point{x: 10, y: 25}, Point{x: 20, y: 25}];
assert_eq!(expected_intersections, first_moves.find_intersections(&second_moves));
} | rust_cleaned_test_functions.jsonl/44993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
15318,
24661,
368,
341,
286,
1077,
1156,
45390,
284,
7486,
90515,
310,
14561,
341,
394,
1191,
25,
20998,
27407,
345,
394,
835,
25,
5126,
314,
856,
25,
220,
16,
15,
11,
379,
25,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_that_golang_code_compiles_and_demo_runs() {
let registry = get_diem_registry();
let abis = get_stdlib_script_abis();
let dir = tempdir().unwrap();
let config = serdegen::CodeGeneratorConfig::new("diemtypes".to_string())
.with_encodings(vec![serdegen::Encoding::Bcs]);
let bcs_installer = serdegen::golang::Installer::new(
dir.path().to_path_buf(),
/* default Serde module */ None,
);
bcs_installer.install_module(&config, ®istry).unwrap();
let abi_installer = buildgen::golang::Installer::new(
dir.path().to_path_buf(),
/* default Serde module */ None,
Some("testing".to_string()),
);
abi_installer
.install_transaction_builders("diemstdlib", &abis)
.unwrap();
std::fs::copy(
"examples/golang/stdlib_demo.go",
dir.path().join("stdlib_demo.go"),
)
.unwrap();
let status = Command::new("go")
.current_dir(dir.path())
.arg("mod")
.arg("init")
.arg("testing")
.status()
.unwrap();
assert!(status.success());
let status = Command::new("go")
.current_dir(dir.path())
.arg("mod")
.arg("edit")
.arg("-replace")
.arg(format!("testing={}", dir.path().to_string_lossy(),))
.status()
.unwrap();
assert!(status.success());
let output = Command::new("go")
.current_dir(dir.path())
.arg("run")
.arg(dir.path().join("stdlib_demo.go"))
.output()
.unwrap();
eprintln!("{}", std::str::from_utf8(&output.stderr).unwrap());
assert_eq!(
std::str::from_utf8(&output.stdout).unwrap(),
EXPECTED_OUTPUT
);
assert!(output.status.success());
} | rust_cleaned_test_functions.jsonl/3894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 837
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70197,
1889,
37287,
4136,
18177,
3658,
8378,
47830,
67352,
368,
341,
262,
1077,
19424,
284,
633,
814,
26862,
50650,
543,
262,
1077,
668,
285,
284,
633,
15656,
2740,
14660,
62,
15367,
543,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ptrace_setoptions() {
require_capability!(CAP_SYS_PTRACE);
let err = ptrace::setoptions(getpid(), Options::PTRACE_O_TRACESYSGOOD).unwrap_err();
assert!(err != Error::UnsupportedOperation);
} | rust_cleaned_test_functions.jsonl/92533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
578,
2602,
2875,
368,
341,
262,
1373,
89686,
10297,
31400,
26783,
20657,
5576,
317,
262,
1077,
1848,
284,
10087,
578,
486,
746,
2875,
5433,
10412,
1507,
14566,
486,
47,
33361,
2232,
6410,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_empty() {
let needle = b"";
let haystack = b"ACGACTAGTTATAAAAATTCNACTCCANTTAGCTCCCTACTTTCCGAGAG";
check_test(needle, haystack, 0);
} | rust_cleaned_test_functions.jsonl/83258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
368,
341,
286,
1077,
30309,
284,
293,
1,
876,
286,
1077,
88447,
284,
293,
1,
1706,
38,
6823,
1890,
14903,
4485,
50107,
828,
7749,
45,
6823,
3706,
2821,
32144,
1162,
3706,
1162,
6823,
1490... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fd_err() {
let _l = lock_env();
set_current_pid();
let fd = create_fd(AddressFamily::Unix, SockType::Stream);
// Assume that this fd is the start of all fds systemd would give us.
// that fds created within the tests start at 3.
let listen_fds_start = fd;
// set the env var so that it contains the created fd
env::set_var(ENV_FDS, format!("{}", fd - listen_fds_start + 1));
let url = Url::parse("fd://100").unwrap();
let run = Http::new().bind_url(url, move || {
let service = TestService {
status_code: StatusCode::OK,
error: false,
};
Ok::<_, io::Error>(service)
});
unistd::close(fd).unwrap();
assert!(run.is_err());
} | rust_cleaned_test_functions.jsonl/28056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17676,
9266,
368,
341,
262,
1077,
716,
75,
284,
5296,
15879,
543,
262,
738,
11080,
30065,
543,
262,
1077,
12414,
284,
1855,
17676,
68492,
15192,
486,
55832,
11,
328,
1176,
929,
486,
3027,
626,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_join_parsing() {
let mut buf = vec![];
write!(&mut buf, ":tiny!~tiny@192.168.0.1 JOIN #haskell\r\n").unwrap();
assert_eq!(
parse_irc_msg(&mut buf).unwrap().unwrap(),
Msg {
pfx: Some(Pfx::User {
nick: "tiny".to_owned(),
user: "~tiny@192.168.0.1".to_owned(),
}),
cmd: Cmd::JOIN {
chan: ChanName::new("#haskell".to_owned()),
},
}
);
assert_eq!(buf.len(), 0);
} | rust_cleaned_test_functions.jsonl/24487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
620,
28598,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
15078,
286,
3270,
0,
2099,
6984,
6607,
11,
13022,
46116,
0,
93,
46116,
31,
16,
24,
17,
13,
16,
21,
23,
13,
15,
13,
16,
130... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_16() {
assert_eq!(
parse_column_type(&mut Parser::new("TEXT CHARACTER SET latin1")),
ColumnType::Text(StringAttr {
length: None,
charset: Some(CharSet::Latin1),
collation: None,
})
);
} | rust_cleaned_test_functions.jsonl/73845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
21,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
12708,
70805,
9019,
62919,
16,
30154,
310,
9332,
929,
486,
1178,
2242,
13371,
341,
394,
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_count_unique_word_passphrases_counts_only_phrases_with_unique_anagrams() {
assert_eq!(2, count_unique_word_passphrases("foo bar\nfoo bar\nfoo bar rab", contains_no_duplicate_anagrams));
assert_eq!(3, count_unique_word_passphrases("foo bar\nfoo bar\nfoo bar", contains_no_duplicate_anagrams));
} | rust_cleaned_test_functions.jsonl/40081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
21218,
13533,
15464,
759,
26565,
25977,
18410,
57729,
2264,
6615,
21218,
12008,
68772,
368,
341,
286,
2060,
10714,
10297,
17,
11,
1760,
21218,
13533,
15464,
759,
26565,
445,
7975,
3619,
1699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_fee_calculator_for_blockhash() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let RpcHandler { io, meta, bank, .. } = start_rpc_handler_with_tx(&bob_pubkey);
let (blockhash, fee_calculator) = bank.last_blockhash_with_fee_calculator();
let fee_calculator = RpcFeeCalculator { fee_calculator };
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getFeeCalculatorForBlockhash","params":["{:?}"]}}"#,
blockhash
);
let res = io.handle_request_sync(&req, meta.clone());
let expected = json!({
"jsonrpc": "2.0",
"result": {
"context":{"slot":0},
"value":fee_calculator,
},
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getFeeCalculatorForBlockhash","params":["{:?}"]}}"#,
Hash::default()
);
let res = io.handle_request_sync(&req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": {
"context":{"slot":0},
"value":Value::Null,
},
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/3039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 905
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
34305,
24005,
20022,
5478,
7113,
8296,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
79961,
3050,
314,
6399,
11,
882... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scoring_p5() {
let mut peer_score_params = PeerScoreParams::default();
peer_score_params.app_specific_weight = 2.0;
//build mesh with one peer
let (mut gs, peers, _) = inject_nodes1()
.peer_no(1)
.topics(vec!["test".into()])
.to_subscribe(true)
.gs_config(GossipsubConfig::default())
.explicit(0)
.outbound(0)
.scoring(Some((peer_score_params, PeerScoreThresholds::default())))
.create_network();
gs.set_application_score(&peers[0], 1.1);
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[0]),
1.1 * 2.0
);
} | rust_cleaned_test_functions.jsonl/66932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
5503,
620,
20,
368,
341,
286,
1077,
5206,
14397,
10405,
6745,
284,
45147,
10570,
4870,
486,
2258,
543,
286,
14397,
10405,
6745,
1601,
56592,
15876,
284,
220,
17,
13,
15,
401,
286,
442,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_coord_sys_transform() {
let cs = match parse_coord_sys_transform(FileSpan::new(Rc::new(String::from("CoordSysTransform \"test\"")), Rc::new(String::from("input")))).unwrap().1 {
Transformation::CoordSysTransform(c) => c,
_ => panic!()
};
assert_eq!(cs.identity.value, String::from("test"));
} | rust_cleaned_test_functions.jsonl/68352 | {
"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,
21039,
30096,
20344,
18449,
368,
341,
262,
1077,
10532,
284,
2432,
4715,
30096,
20344,
18449,
19821,
12485,
486,
931,
2785,
66,
486,
931,
2242,
486,
1499,
445,
19437,
32792,
8963,
7245,
1944,
2105,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_incr() {
let ctx = TestContext::new();
let mut con = ctx.connection();
redis::cmd("SET").arg("foo").arg(42).execute(&mut con);
assert_eq!(redis::cmd("INCR").arg("foo").query(&mut con), Ok(43usize));
} | rust_cleaned_test_functions.jsonl/108943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
5082,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
20870,
486,
8710,
445,
5884,
1827,
858,
445,
7975,
1827,
858,
7,
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... | 1 |
#[test]
fn test_tcp_stuff() {
let mut stream = TcpStream::connect("127.0.0.1:2224").unwrap();
let lenz = stream.write(b"hello world").unwrap();
assert_eq!(lenz, 11)
} | rust_cleaned_test_functions.jsonl/67811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45562,
95396,
368,
341,
286,
1077,
5206,
4269,
284,
64876,
3027,
486,
6459,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
17,
17,
17,
19,
1827,
15454,
543,
286,
1077,
2422,
89,
284,
4269,
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_mock() {
let res_body = vec![1, 2, 3];
let mut mock = MockHttpRequest::new(Response::new(res_body.clone().into()));
let req_body = vec![4, 5, 6];
let uri = "https://mock.uri/";
let req =
Request::get(uri).header("X-Custom-Foo", "Bar").body(req_body.clone().into()).unwrap();
block_on(async {
let response = await!(mock.request(req)).unwrap();
assert_eq!(res_body, await!(response_to_vec(response)));
mock.assert_method(&hyper::Method::GET);
mock.assert_uri(uri);
mock.assert_header("X-Custom-Foo", "Bar");
await!(mock.assert_body(req_body.as_slice()));
});
} | rust_cleaned_test_functions.jsonl/80645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34134,
368,
341,
262,
1077,
592,
14114,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
262,
1077,
5206,
7860,
284,
14563,
26362,
486,
931,
47979,
486,
931,
4590,
14114,
15997,
1005,
18122,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inherit_env() {
use std::env;
if running_on_valgrind() { return; }
let result = env_cmd().output().unwrap();
let output = String::from_utf8(result.stdout).unwrap();
for (ref k, ref v) in env::vars() {
// don't check windows magical empty-named variables
assert!(k.is_empty() ||
output.contains(format!("{}={}", *k, *v).as_slice()),
"output doesn't contain `{}={}`\n{}",
k, v, output);
}
} | rust_cleaned_test_functions.jsonl/5988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
9263,
15879,
368,
341,
286,
990,
1460,
486,
3160,
280,
286,
421,
4303,
4470,
6189,
901,
484,
368,
314,
470,
26,
555,
286,
1077,
1102,
284,
6105,
11684,
1005,
3006,
1005,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_functor_laws() {
// identity:
fn identity<T>(x: T) -> T { x }
assert_eq!((0..10).map(identity).sum::<usize>(), (0..10).sum());
// composition:
fn f(x: usize) -> usize { x + 3 }
fn g(x: usize) -> usize { x * 2 }
fn h(x: usize) -> usize { g(f(x)) }
assert_eq!((0..10).map(f).map(g).sum::<usize>(), (0..10).map(h).sum());
} | rust_cleaned_test_functions.jsonl/54199 | {
"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,
28315,
4904,
907,
8635,
368,
341,
262,
442,
9569,
510,
262,
5168,
9569,
3125,
2235,
87,
25,
350,
8,
1464,
350,
314,
856,
456,
262,
2060,
10714,
0,
1188,
15,
496,
16,
15,
568,
2186,
86843,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_selected_cell_when_one_cell_selected() {
// 1 |a| b c
// 2 d e f
let mut component = TableComponent::new(KeyConfig::default());
component.headers = vec!["1", "2", "3"].iter().map(|h| h.to_string()).collect();
component.rows = vec![
vec!["a", "b", "c"].iter().map(|h| h.to_string()).collect(),
vec!["d", "e", "f"].iter().map(|h| h.to_string()).collect(),
];
component.selected_row.select(Some(0));
assert_eq!(component.selected_cells(), Some("a".to_string()));
} | rust_cleaned_test_functions.jsonl/120821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23755,
16648,
47636,
11667,
16648,
23755,
368,
341,
1789,
286,
442,
220,
16,
760,
64,
91,
293,
272,
198,
286,
442,
220,
17,
220,
294,
220,
384,
282,
271,
286,
1077,
5206,
3692,
284,
6633,
2189... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_func() {
let isa = lookup(triple!("aarch64"))
.expect("expect aarch64 ISA")
.finish(Flags::new(builder()));
let mut context = Context::for_function(create_function(
CallConv::SystemV,
Some(StackSlotData::new(StackSlotKind::ExplicitSlot, 64)),
));
context.compile(&*isa).expect("expected compilation");
let result = context.mach_compile_result.unwrap();
let unwind_info = result.unwind_info.unwrap();
assert_eq!(
unwind_info,
UnwindInfo {
prologue_size: 12,
prologue_unwind_codes: vec![
(4, UnwindCode::StackAlloc { size: 16 }),
(
4,
UnwindCode::SaveRegister {
reg: regs::fp_reg(),
stack_offset: 0
}
),
(
4,
UnwindCode::SaveRegister {
reg: regs::link_reg(),
stack_offset: 8
}
),
(
8,
UnwindCode::SetFramePointer {
reg: regs::fp_reg()
}
)
],
epilogues_unwind_codes: vec![],
function_size: 24,
word_size: 8,
initial_sp_offset: 0,
}
);
} | rust_cleaned_test_functions.jsonl/21347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1063
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
9596,
368,
341,
286,
1077,
51335,
284,
18615,
7624,
3778,
17223,
64,
1113,
21,
19,
5455,
310,
659,
17119,
445,
17119,
264,
1113,
21,
19,
84290,
1138,
310,
659,
30150,
7,
9195,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mld_serialize_and_parse_report() {
use crate::icmp::mld::MulticastListenerReport;
use crate::testdata::mld_router_report::*;
let bytes = serialize_to_bytes_with_builder::<&[u8], _>(
SRC_IP,
DST_IP,
MulticastListenerReport,
MulticastAddr::new(HOST_GROUP_ADDRESS).unwrap(),
(),
);
assert_eq!(&bytes[..], REPORT);
let mut req = &bytes[..];
let ip = req.parse_with::<_, Ipv6Packet<_>>(()).unwrap();
check_ip(&ip, SRC_IP, DST_IP);
let icmp = req
.parse_with::<_, IcmpPacket<_, _, MulticastListenerReport>>(IcmpParseArgs::new(
SRC_IP, DST_IP,
))
.unwrap();
check_icmp(&icmp, 0, HOST_GROUP_ADDRESS);
} | rust_cleaned_test_functions.jsonl/82325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
507,
88686,
8378,
21039,
14813,
368,
341,
286,
990,
17717,
486,
50774,
486,
76,
507,
486,
40404,
35446,
2743,
10361,
280,
286,
990,
17717,
486,
92425,
486,
76,
507,
55587,
14813,
56162,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fp2_frobenius() {
use std::convert::TryFrom;
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
let characteristic: Vec<u64> = Fp::char()
.chunks(8)
.map(|chunk| u64::from_le_bytes(<[u8; 8]>::try_from(chunk).unwrap()))
.collect();
let maxpower = 13;
for _ in 0..100 {
for i in 0..(maxpower + 1) {
let mut a = Fp2::random(&mut rng);
let mut b = a;
for _ in 0..i {
a = a.pow_vartime(&characteristic);
}
b.frobenius_map(i);
assert_eq!(a, b);
}
}
} | rust_cleaned_test_functions.jsonl/62492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34160,
17,
761,
299,
7964,
9156,
368,
341,
286,
990,
1460,
486,
14166,
486,
21453,
3830,
401,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_parsing_spec_constant_op_missing_parameter() {
let mut v = ZERO_BOUND_HEADER.to_vec();
v.append(&mut vec![0x34, 0x00, 0x05, 0x00]); // OpTypeFloat
v.append(&mut vec![0x01, 0x00, 0x00, 0x00]); // result type: 1
v.append(&mut vec![0x02, 0x00, 0x00, 0x00]); // result id: 2
v.append(&mut vec![0x80, 0x00, 0x00, 0x00]); // OpIAdd
v.append(&mut vec![0x03, 0x00, 0x00, 0x00]); // id ref: 3
let mut c = RetainingConsumer::new();
let p = Parser::new(&v, &mut c);
assert_matches!(p.parse(),
// so in total 40 bytes.
Err(State::OperandError(DecodeError::LimitReached(40))));
} | rust_cleaned_test_functions.jsonl/85753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
13594,
34967,
10287,
40447,
24899,
368,
341,
286,
1077,
5206,
348,
284,
54593,
73644,
20330,
2389,
13251,
543,
286,
348,
2057,
2099,
6984,
7486,
20703,
15,
87,
18,
19,
11,
220,
15,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_seq() {
let url_params = create_url_params(vec![("a", "1"), ("b", "true"), ("c", "abc")]);
assert_eq!(
<(i32, bool, String)>::deserialize(PathDeserializer::new(&url_params)).unwrap(),
(1, true, "abc".to_owned())
);
#[derive(Debug, Deserialize, Eq, PartialEq)]
struct TupleStruct(i32, bool, String);
assert_eq!(
TupleStruct::deserialize(PathDeserializer::new(&url_params)).unwrap(),
TupleStruct(1, true, "abc".to_owned())
);
let url_params = create_url_params(vec![("a", "1"), ("b", "2"), ("c", "3")]);
assert_eq!(
<Vec<i32>>::deserialize(PathDeserializer::new(&url_params)).unwrap(),
vec![1, 2, 3]
);
let url_params = create_url_params(vec![("a", "c"), ("a", "B")]);
assert_eq!(
<Vec<MyEnum>>::deserialize(PathDeserializer::new(&url_params)).unwrap(),
vec![MyEnum::C, MyEnum::B]
);
} | rust_cleaned_test_functions.jsonl/16600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14486,
368,
341,
286,
1077,
2515,
6745,
284,
1855,
2903,
6745,
25592,
20703,
445,
64,
497,
330,
16,
3975,
3489,
65,
497,
330,
1866,
3975,
3489,
66,
497,
330,
13683,
899,
2558,
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_utf_16le_decode_three_at_a_time() {
let input = b"\xE4\x00\x03\x26\x3D\xD8\xA9\xDC\x61\x00\xE4\x00";
let mut output = [0u16; 20];
let mut decoder = UTF_16LE.new_decoder();
for b in input.chunks(3) {
assert_eq!(b.len(), 3);
let needed = decoder.max_utf16_buffer_length(b.len()).unwrap();
let (result, read, _, had_errors) =
decoder.decode_to_utf16(b, &mut output[..needed], false);
assert_eq!(result, CoderResult::InputEmpty);
assert_eq!(read, b.len());
assert!(!had_errors);
}
} | rust_cleaned_test_functions.jsonl/86897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
62,
16,
21,
273,
15227,
50016,
3752,
4306,
3009,
368,
341,
286,
1077,
1946,
284,
293,
11934,
12606,
19,
3462,
15,
15,
3462,
15,
18,
3462,
17,
21,
3462,
18,
35,
3462,
35,
23,
3462,
32,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rlp_display() {
let data = hex!("f84d0589010efbef67941f79b2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");
let rlp = Rlp::new(&data);
assert_eq!(format!("{}", rlp), "[\"0x05\", \"0x010efbef67941f79b2\", \"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\", \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"]");
} | rust_cleaned_test_functions.jsonl/74203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
13545,
14825,
368,
341,
10217,
821,
284,
12371,
17223,
69,
23,
19,
67,
15,
20,
23,
24,
15,
16,
15,
823,
57647,
21,
22,
24,
19,
16,
69,
22,
24,
65,
17,
64,
15,
20,
21,
68,
23,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_metadata_latest() {
let (mock_db, client, _runtime) = create_database_client_and_runtime();
let (actual_version, actual_timestamp) = mock_db.get_latest_commit_metadata().unwrap();
let metadata = client.get_metadata().unwrap().into_inner();
assert_eq!(metadata.version, actual_version);
assert_eq!(metadata.timestamp, actual_timestamp);
} | rust_cleaned_test_functions.jsonl/102706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
22220,
64880,
368,
341,
262,
1077,
320,
16712,
8685,
11,
2943,
11,
716,
22255,
8,
284,
1855,
27341,
8179,
8378,
33232,
1428,
262,
1077,
320,
11944,
9438,
11,
5042,
23073,
8,
284,
7860,
868... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_vertex_shader_into_spirv_assembly() {
let mut c = Compiler::new().unwrap();
let result = c
.compile_into_spirv_assembly(VOID_MAIN, ShaderKind::Vertex, "shader.glsl", "main", None)
.unwrap();
assert_eq!(VOID_MAIN_ASSEMBLY, result.as_text());
} | rust_cleaned_test_functions.jsonl/41044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
26611,
35485,
45514,
643,
5565,
85,
11898,
5642,
368,
341,
286,
1077,
5206,
272,
284,
45631,
486,
931,
1005,
15454,
543,
286,
1077,
1102,
284,
272,
198,
310,
659,
20433,
45514,
643,
5565,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_validate() {
let cfg = Config::default();
cfg.validate().unwrap();
let mut invalid_cfg = Config::default();
invalid_cfg.wait_for_lock_timeout = 0;
assert!(invalid_cfg.validate().is_err());
let mut invalid_cfg = Config::default();
invalid_cfg.monitor_membership_interval = 500;
assert!(invalid_cfg.validate().is_err());
} | rust_cleaned_test_functions.jsonl/24067 | {
"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,
5332,
42681,
368,
341,
286,
1077,
13286,
284,
5532,
486,
2258,
543,
286,
13286,
19520,
1005,
15454,
1428,
286,
1077,
5206,
8318,
18343,
284,
5532,
486,
2258,
543,
286,
8318,
18343,
16294,
5478,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rb_remove_leaf_black() {
let mut t: TreeRb<isize, isize> = TreeRb::new();
for i in 0..10 {
t.insert(i, i);
}
t.check_nodes();
let t_size = t.len();
let mut count_remove = 0;
for i in 8..9 {
let r = t.remove(&i).expect("remove unsuccessful");
assert!(r == i);
count_remove += 1;
assert!(t.len() == t_size - count_remove);
}
t.check_nodes();
} | rust_cleaned_test_functions.jsonl/78800 | {
"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,
68544,
18193,
38909,
40272,
368,
341,
262,
1077,
5206,
259,
25,
8942,
49,
65,
27,
285,
551,
11,
91373,
29,
284,
8942,
49,
65,
486,
931,
543,
262,
369,
600,
304,
220,
15,
496,
16,
15,
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... | 3 |
#[test]
fn test_sum_two_doubles() {
assert_eq!(sum_two_doubles(2.2222222222222222, 1.1111111111111111), 3.3333333333333333);
} | rust_cleaned_test_functions.jsonl/123619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
23241,
814,
85613,
368,
972,
286,
2060,
10714,
10297,
1242,
23241,
814,
85613,
7,
17,
13,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
17,
11,
220,
16,
13,
16,
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_parse_valid_redshift_copy_cluster_snapshot() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-copy-cluster-snapshot.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = CopyClusterSnapshotMessage::default();
let result = client.copy_cluster_snapshot(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
26058,
13418,
16096,
28441,
53265,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
1151,
13418,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_datetime_frac_from_int_fail() {
assert!(Value::datetime_frac_from_int(2012, 1, 0, 3, 30, 30, 3030).is_err());
} | rust_cleaned_test_functions.jsonl/86214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
28943,
70358,
5673,
4042,
22121,
368,
341,
262,
2060,
10297,
1130,
486,
15450,
70358,
5673,
4042,
7,
17,
15,
16,
17,
11,
220,
16,
11,
220,
15,
11,
220,
18,
11,
220,
18,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fq() {
let mut rng = test_rng();
let a: Fq = rng.gen();
let b: Fq = rng.gen();
field_test(a, b);
primefield_test::<Fq>();
sqrt_field_test(a);
let byte_size = a.serialized_size();
let (_, buffer_size) = buffer_bit_byte_size(Fq::size_in_bits());
assert_eq!(byte_size, buffer_size);
field_serialization_test::<Fq>(byte_size);
} | rust_cleaned_test_functions.jsonl/59283 | {
"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,
761,
80,
368,
341,
262,
1077,
5206,
28422,
284,
1273,
66849,
543,
262,
1077,
264,
25,
434,
80,
284,
28422,
22822,
543,
262,
1077,
293,
25,
434,
80,
284,
28422,
22822,
543,
262,
2070,
4452,
287... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version() {
for version_flg in vec!["-V", "--version"] {
assert!(new_ucmd!()
.arg(&version_flg)
.succeeds()
.no_stderr()
.stdout_str()
.starts_with("basename"));
}
} | rust_cleaned_test_functions.jsonl/82218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
368,
341,
262,
369,
2319,
86258,
304,
7486,
0,
1183,
12,
53,
497,
14482,
4366,
1341,
341,
286,
2060,
10297,
931,
68887,
2277,
0,
741,
310,
659,
858,
2099,
4366,
86258,
340,
310,
659,
82,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_param_completion_last_param() {
assert_debug_snapshot!(
do_magic_completion(
r"
fn foo(file_id: FileId) {}
fn bar(file_id: FileId) {}
fn baz(file<|>) {}
",
),
@r###"
[
CompletionItem {
label: "file_id: FileId",
source_range: [110; 114),
delete: [110; 114),
insert: "file_id: FileId",
lookup: "file_id",
},
]
"###
);
} | rust_cleaned_test_functions.jsonl/67164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
60164,
12195,
4090,
368,
341,
286,
2060,
15446,
53265,
33673,
286,
653,
54612,
60164,
1006,
394,
435,
698,
394,
5168,
15229,
4866,
842,
25,
2887,
764,
8,
5613,
394,
5168,
3619,
4866,
842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vdj_asm() {
let outdir = "test/outputs/asm";
let true_fasta_name = "test/inputs/test_asm.fasta";
let true_seqs = get_seqs_by_barcode(&true_fasta_name);
let mut args = Args {
cmd_asm: true,
arg_inbam: Some("test/inputs/test_asm.bam".to_string()),
arg_outdir: Some(outdir.to_string()),
flag_kmers: Some(0),
flag_min_contig: Some(150),
flag_min_sw_score: Some(50.0),
flag_rt_error: Some(0.0001),
flag_min_qual: Some(2),
flag_qual_factor: Some(0.9),
flag_score_factor: Some(0.6),
flag_frac_reads: Some(0.3),
flag_min_umi_reads: Some(1),
flag_use_unmapped: true,
.. Args::default()
};
init_test(outdir);
{
vdj_asm(args.clone()).unwrap(); // use all read-pairs
let assembled_seqs = get_seqs_by_barcode(&"test/outputs/asm/test_asm.fasta");
for (bc, seqs) in true_seqs.iter() {
assert_eq!(*seqs, *assembled_seqs.get(bc).unwrap());
}
let mut bam = bam::Reader::from_path(Path::new(&"test/outputs/asm/test_asm.bam")).ok().expect("Error reading test_asm.bam");
let (mapped, unmapped) = count_records(&mut bam);
assert_eq!(unmapped, 6);
assert_eq!(mapped, 48);
let header = bam.header();
assert_eq!(header.target_count(), 6);
let header_names : HashSet<String> = header.target_names().iter().map(|x| String::from_utf8_lossy(x).into_owned()).collect();
let summary = BufReader::new(File::open("test/outputs/asm/test_asm_summary.tsv").unwrap());
// Skip the header and test that all other contig names are present in the header
for wrapped_line in summary.lines().skip(1) {
let line = wrapped_line.unwrap();
let contig_name = line.split('\t').nth(1).unwrap();
assert!(header_names.contains(contig_name));
}
let summary = BufReader::new(File::open("test/outputs/asm/test_asm_umi_summary.tsv").unwrap());
for wrapped_line in summary.lines().skip(1) {
let line = wrapped_line.unwrap();
let contig_name = line.split('\t').nth(6).unwrap();
assert!(contig_name == "" || header_names.contains(contig_name));
}
}
{
// Use only the first 3 read-pairs per barcode per chain.
// So in all barcodes we'll use as much data as in the last barcode.
// 4 + 2 readpairs will be left unmapped.
vdj_asm(args.clone()).unwrap();
let assembled_seqs = get_seqs_by_barcode(&"test/outputs/asm/test_asm.fasta");
for (bc, seqs) in assembled_seqs.iter() {
assert_eq!(*seqs, *true_seqs.get(bc).unwrap());
}
let bam = bam::Reader::from_path(Path::new(&"test/outputs/asm/test_asm.bam")).ok().expect("Error reading test_asm.bam");
let header = bam.header();
assert_eq!(header.target_count(), 6);
}
{
args.flag_min_contig = Some(250);
vdj_asm(args.clone()).unwrap();
let mut bam = bam::Reader::from_path(Path::new(&"test/outputs/asm/test_asm.bam")).ok().expect("Error reading test_asm.bam");
let (_, unmapped) = count_records(&mut bam);
assert_eq!(unmapped, 18);
// We won't assemble anything from the last barcode.
let header = bam.header();
assert_eq!(header.target_count(), 4);
}
{
args.flag_single_end = true;
args.flag_min_contig = Some(150);
vdj_asm(args.clone()).unwrap(); // use all reads
let assembled_seqs = get_seqs_by_barcode(&"test/outputs/asm/test_asm.fasta");
for (bc, seqs) in true_seqs.iter() {
assert_eq!(*seqs, *assembled_seqs.get(bc).unwrap());
}
let mut bam = bam::Reader::from_path(Path::new(&"test/outputs/asm/test_asm.bam")).ok().expect("Error reading test_asm.bam");
let (mapped, unmapped) = count_records(&mut bam);
assert_eq!(unmapped, 6);
assert_eq!(mapped, 48);
let header = bam.header();
assert_eq!(header.target_count(), 6);
}
{
// Truly single end BAM
args.arg_inbam = Some("test/inputs/test_asm_se.bam".to_string());
args.flag_single_end = true;
args.flag_min_contig = Some(150);
vdj_asm(args.clone()).unwrap();
let assembled_seqs = get_seqs_by_barcode(&"test/outputs/asm/test_asm_se.fasta");
for (bc, seqs) in true_seqs.iter() {
assert_eq!(*seqs, *assembled_seqs.get(bc).unwrap());
}
let mut bam = bam::Reader::from_path(Path::new(&"test/outputs/asm/test_asm_se.bam")).ok().expect("Error reading test_asm.bam");
let (mapped, unmapped) = count_records(&mut bam);
// every other read in the input is unmapped
assert_eq!(unmapped, 24);
assert_eq!(mapped, 24);
let header = bam.header();
assert_eq!(header.target_count(), 6);
}
{
args.flag_cons = true;
args.flag_min_umi_reads = Some(1);
args.flag_seed = Some(1);
args.flag_min_sw_score = Some(50.0);
vdj_asm(args.clone()).unwrap();
let bam = bam::Reader::from_path(Path::new(&"test/outputs/asm/test_asm_se.bam")).ok().expect("Error reading test_asm.bam");
let header = bam.header();
assert_eq!(header.target_count(), 3);
}
} | rust_cleaned_test_functions.jsonl/38108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
77504,
67529,
368,
1476,
286,
1077,
700,
3741,
284,
330,
1944,
14,
41006,
14,
10530,
876,
286,
1077,
830,
761,
14300,
1269,
284,
330,
1944,
14,
24941,
12697,
67529,
99050,
876,
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_try_fold_rotated() {
let mut v: VecDeque<_> = (0..12).collect();
for n in 0..10 {
if n & 1 == 0 {
v.rotate_left(n);
} else {
v.rotate_right(n);
}
assert_eq!(Ok::<_, ()>(66), v.iter().try_fold(0, |a, b| Ok(a + b)));
}
} | rust_cleaned_test_functions.jsonl/73746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
61187,
38256,
657,
368,
341,
262,
1077,
5206,
348,
25,
11312,
73891,
32399,
29,
284,
320,
15,
496,
16,
17,
568,
17384,
543,
262,
369,
308,
304,
220,
15,
496,
16,
15,
341,
286,
421,
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... | 3 |
#[test]
fn test_dispatch_with_selecting_request_valid_selecting_request_returns_ack() {
let mut req = new_test_request();
let requested_ip_addr = Ipv4Addr::new(192, 168, 1, 2);
req.ciaddr = requested_ip_addr;
req.options.remove(0);
let mut server = new_test_server(|| 42);
server.cache.insert(
req.chaddr,
CachedConfig {
client_addr: requested_ip_addr,
options: vec![],
expiration: std::i64::MAX,
},
);
server.pool.allocate_addr(requested_ip_addr);
let got = server.dispatch(req).unwrap();
let mut want = new_test_ack();
want.ciaddr = requested_ip_addr;
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/61719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
13051,
287,
7893,
8337,
13051,
287,
7893,
58900,
48447,
368,
341,
286,
1077,
5206,
4232,
284,
501,
4452,
7893,
543,
286,
1077,
11223,
10385,
7387,
284,
358,
30168,
19,
13986,
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_restrict_to_common_domain() {
let f = BoundedQuadratic::new(1., 3., 1., 1., 1.);
let g = BoundedQuadratic::new(-1., 2., 1., 1., 1.);
let h = BoundedQuadratic::new(-3., 3., 1., 1., 1.);
let restricted = BoundedQuadratic::restrict_to_common_domain(&vec![f, g, h]).unwrap();
assert_eq!(3, restricted.len());
let (lower, upper) = (restricted[0].lower, restricted[0].upper);
assert!(restricted
.iter()
.all(|f| f.lower == lower && f.upper == upper));
assert_eq!((1., 2.), (lower, upper), "{:?}", (lower, upper));
} | rust_cleaned_test_functions.jsonl/19855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97684,
2346,
21107,
20111,
368,
341,
286,
1077,
282,
284,
425,
13082,
2183,
88678,
486,
931,
7,
16,
2572,
220,
18,
2572,
220,
16,
2572,
220,
16,
2572,
220,
16,
58957,
286,
1077,
342,
284,
425,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_breakpad_symbols() -> Result<(), Error> {
let view = ByteView::open(fixture("windows/crash.sym"))?;
let object = Object::parse(&view)?;
let symbols = object.symbol_map();
insta::assert_debug_snapshot!("breakpad_symbols", SymbolsDebug(&symbols));
Ok(())
} | rust_cleaned_test_functions.jsonl/82869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39494,
13242,
55752,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
1651,
284,
10906,
851,
486,
2508,
94886,
445,
27077,
2899,
81,
988,
50901,
2761,
37445,
262,
1077,
1633,
284,
3002,
486,
6400... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_load_server_dictated_poll_interval() {
block_on(async {
let config = config_generator();
let mut storage = MemStorage::new();
storage.set_int(SERVER_DICTATED_POLL_INTERVAL, 56789).await.unwrap();
let state_machine = StateMachineBuilder::new(
StubPolicyEngine,
StubHttpRequest,
StubInstaller::default(),
StubTimer,
StubMetricsReporter,
Rc::new(Mutex::new(storage)),
config,
make_test_app_set(),
)
.build()
.await;
assert_eq!(
Some(Duration::from_micros(56789)),
state_machine.context.state.server_dictated_poll_interval
);
});
} | rust_cleaned_test_functions.jsonl/126413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
12015,
5243,
657,
40002,
20541,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
5819,
284,
13550,
5793,
486,
931,
543,
310,
5819,
980,
4042,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_machine_for_test_is_empty() {
let writer = Writer::new_test(None);
writer.machine(&"hello").unwrap();
assert!(writer.test_output().unwrap().is_empty());
} | rust_cleaned_test_functions.jsonl/125541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
38695,
5478,
4452,
6892,
15124,
368,
341,
286,
1077,
6916,
284,
29404,
486,
931,
4452,
26717,
317,
286,
6916,
77726,
2099,
1,
14990,
1827,
15454,
1428,
286,
2060,
10297,
18189,
5958,
7645,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_interval_ym() {
assert_eq!(IntervalYM::ZERO, IntervalYM::try_from_ym(0, 0).unwrap());
assert_eq!(
IntervalYM::MIN,
-IntervalYM::try_from_ym(178000000, 0).unwrap()
);
assert_eq!(
IntervalYM::MAX,
IntervalYM::try_from_ym(178000000, 0).unwrap()
);
let interval = IntervalYM::try_from_ym(0, 0).unwrap();
assert_eq!(interval.months(), 0);
assert_eq!(interval.extract(), (Positive, 0, 0));
let interval = IntervalYM::try_from_ym(178000000, 0).unwrap();
assert_eq!(interval.extract(), (Positive, 178000000, 0));
let fmt = format!("{}", interval.format("yyyy-mm").unwrap());
assert_eq!(fmt, "+178000000-00");
let interval2 = IntervalYM::parse("178000000-00", "yyyy-mm").unwrap();
assert_eq!(interval2, interval);
let interval = -IntervalYM::try_from_ym(1, 0).unwrap();
let fmt = format!("{}", interval.format("yy-mm").unwrap());
assert_eq!(fmt, "-01-00");
let interval = IntervalYM::try_from_ym(123, 2).unwrap();
let fmt = format!("{}", interval.format("yy-mm").unwrap());
assert_eq!(fmt, "+123-02");
let interval = -IntervalYM::try_from_ym(178000000, 0).unwrap();
assert_eq!(interval.extract(), (Negative, 178000000, 0));
let interval = IntervalYM::try_from_ym(178000000, 0).unwrap().negate();
assert_eq!(interval.extract(), (Negative, 178000000, 0));
let fmt = format!("{}", interval.format("yyyy-mm").unwrap());
assert_eq!(fmt, "-178000000-00");
let fmt = format!("{}", interval.format("yy-mm").unwrap());
assert_eq!(fmt, "-178000000-00");
let interval2 = IntervalYM::parse("-178000000-00", "yyyy-mm").unwrap();
assert_eq!(interval2, interval);
let interval2 = IntervalYM::parse("+178000000-00", "yyyy-mm").unwrap();
assert_eq!(interval2, -interval);
let interval = IntervalYM::try_from_ym(177999999, 11).unwrap();
assert_eq!(interval.extract(), (Positive, 177999999, 11));
let interval = -IntervalYM::try_from_ym(177999999, 11).unwrap();
assert_eq!(interval.extract(), (Negative, 177999999, 11));
let interval = IntervalYM::try_from_months(0).unwrap();
assert_eq!(interval.extract(), (Positive, 0, 0));
let interval = IntervalYM::try_from_months(-11).unwrap();
assert_eq!(interval.extract(), (Negative, 0, 11));
let fmt = format!("{}", interval.format("yyyy-mm").unwrap());
assert_eq!(fmt, "-0000-11");
let interval2 = IntervalYM::parse("-0000-11", "yyyy-mm").unwrap();
assert_eq!(interval, interval2);
let interval2 = IntervalYM::parse("-0000 - 11", "yyyy - mm").unwrap();
assert_eq!(interval, interval2);
let interval2 = IntervalYM::parse(" -0000 - 11 ", "yyyy - mm").unwrap();
assert_eq!(interval, interval2);
let interval2 = IntervalYM::parse(" -0000 - 11 ", " yyyy - mm ").unwrap();
assert_eq!(interval, interval2);
let interval2 = IntervalYM::parse("-0000-11", "yyyy - mm").unwrap();
assert_eq!(interval, interval2);
let interval = IntervalYM::try_from_months(11).unwrap();
let interval2 = IntervalYM::parse("0000-11", "yyyy-mm").unwrap();
assert_eq!(interval, interval2);
let interval = IntervalYM::try_from_ym(12345, 1).unwrap();
let interval2 = IntervalYM::parse("12345-1", "yyyy-mm").unwrap();
assert_eq!(interval, interval2);
let interval = IntervalYM::try_from_ym(12345, 1).unwrap();
let interval2 = IntervalYM::parse("12345-1", "yy-mm").unwrap();
assert_eq!(interval, interval2);
let interval = IntervalYM::try_from_ym(1, 1).unwrap();
let interval2 = IntervalYM::parse("1-1", "yy-mm").unwrap();
assert_eq!(interval, interval2);
// Invalid
assert!(IntervalYM::parse("178000000-1", "yyyy-mm").is_err());
assert!(IntervalYM::parse("178000001-0", "yyyy-mm").is_err());
assert!(IntervalYM::parse("-178000001-0", "yyyy-mm").is_err());
assert!(IntervalYM::parse("0-13", "yyyy-mm").is_err());
assert!(IntervalYM::parse("-178000000-1", "yyyy-mm").is_err());
assert!(IntervalYM::parse("-178000001-0", "yyyy-mm").is_err());
assert!(IntervalYM::parse("11", "dd").is_err());
assert!(IntervalYM::parse("11", "hh24").is_err());
assert!(IntervalYM::parse("11", "mi").is_err());
assert!(IntervalYM::parse("11", "ss").is_err());
assert_eq!(
IntervalYM::parse("xxxx", "yy-mm").err().unwrap(),
Error::ParseError("the interval is invalid".to_string())
)
// todo invalid fields
} | rust_cleaned_test_functions.jsonl/51034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20541,
62,
1600,
368,
341,
286,
2060,
10714,
10297,
10256,
63787,
486,
73956,
11,
40584,
63787,
486,
1539,
5673,
62,
1600,
7,
15,
11,
220,
15,
568,
15454,
1423,
286,
2060,
10714,
33673,
310,
405... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resources_trait() {
let ast = ResourceKeyValues(keys! {
normal_field_1: 10,
normal_field_2: "abc",
array_field[1]: 1,
array_field[2]: 2,
sub_resource.sub_field: 3,
sub_array_field[0].sub_field: 4,
sub_array_field[5].sub_field: 5
});
let resource = ResourceTest::new(ast).unwrap();
assert_eq!(resource.normal_field_1, 10);
assert_eq!(resource.normal_field_2, String::from("abc"));
assert_eq!(resource.array_field, [0,1,2]);
assert_eq!(resource.sub_resource.sub_field, 3);
assert_eq!(resource.sub_array_field.get(0).unwrap().sub_field, 4);
assert_eq!(resource.sub_array_field.get(5).unwrap().sub_field, 5);
} | rust_cleaned_test_functions.jsonl/124531 | {
"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,
35569,
78491,
368,
341,
220,
1077,
11763,
284,
11765,
1592,
6227,
36131,
0,
341,
262,
4622,
5013,
62,
16,
25,
220,
16,
15,
345,
262,
4622,
5013,
62,
17,
25,
330,
13683,
756,
262,
1334,
5013,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host() {
let mut core = tokio_core::reactor::Core::new().unwrap();
let handle = core.handle();
let cfg = Config::new()
.add_host(&"localhost".parse().unwrap(),
vec!["127.0.0.1".parse().unwrap()])
.done();
let router = Router::from_config(&cfg, &handle);
let res = core.run(router.resolve_host(&"localhost".parse().unwrap()));
// Then can query cached hosts immediately
assert_eq!(res.unwrap(), IpList::parse_list(&["127.0.0.1"]).unwrap());
} | rust_cleaned_test_functions.jsonl/30204 | {
"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,
12848,
368,
341,
262,
1077,
5206,
6200,
284,
9628,
815,
15467,
486,
2934,
269,
486,
5386,
486,
931,
1005,
15454,
543,
262,
1077,
3705,
284,
6200,
10132,
1428,
262,
1077,
13286,
284,
5532,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_reflect_repeated() {
let mut m = TestTypesRepeated::new();
m.set_int64_field(vec![10, 20]);
let f = m.descriptor().get_field_by_name("int64_field").unwrap();
match f.get_reflect(&m) {
ReflectFieldRef::Repeated(repeated) => {
assert_eq!(2, repeated.len());
assert_eq!(ReflectValueRef::I64(10), repeated.get(0));
assert_eq!(ReflectValueRef::I64(20), repeated.get(1));
},
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/74910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7793,
767,
1288,
41954,
368,
341,
262,
1077,
5206,
296,
284,
3393,
4173,
90989,
486,
931,
543,
262,
296,
980,
4042,
21,
19,
5013,
25592,
20703,
16,
15,
11,
220,
17,
15,
2558,
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... | 2 |
#[test]
fn test_json_read_nested_list() {
let schema = Schema::new(vec![Field::new(
"c1",
DataType::List(Box::new(Field::new(
"item",
DataType::List(Box::new(Field::new("item", DataType::Utf8, true))),
true,
))),
true,
)]);
let decoder = Decoder::new(Arc::new(schema), 1024, None);
let batch = decoder
.next_batch(
&mut vec![
Ok(serde_json::json!({
"c1": [],
})),
Ok(serde_json::json!({
"c1": [["a", "b"], ["c"], ["e", "f"], ["g"], ["h"], ["i"], ["j"], ["k"]],
})),
Ok(serde_json::json!({
"c1": [["foo"], ["bar"]],
})),
]
.into_iter(),
)
.unwrap()
.unwrap();
assert_eq!(batch.num_columns(), 1);
assert_eq!(batch.num_rows(), 3);
} | rust_cleaned_test_functions.jsonl/22618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
6443,
66279,
2019,
368,
341,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
20703,
1877,
486,
931,
1006,
310,
330,
66,
16,
756,
310,
33172,
486,
852,
67758,
486,
931,
57788,
486,
931,
1006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ip2() {
let documents = load_document("../tests/Gossiping_M.1119222660.A.94E.html");
assert_eq!(
parse_ip(&documents).unwrap(),
Ipv4Addr::new(138, 130, 212, 179)
);
} | rust_cleaned_test_functions.jsonl/87159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10385,
17,
368,
341,
286,
1077,
9293,
284,
2795,
26231,
17409,
23841,
15792,
41473,
287,
1245,
13,
16,
16,
16,
24,
17,
17,
17,
21,
21,
15,
875,
13,
24,
19,
36,
2564,
797,
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_serial_file() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let serial_path = guest.tmp_dir.as_path().join("/tmp/serial-output");
#[cfg(target_arch = "x86_64")]
let console_str: &str = "console=ttyS0";
#[cfg(target_arch = "aarch64")]
let console_str: &str = "console=ttyAMA0";
let mut child = GuestCommand::new(&guest)
.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
.args(&[
"--cmdline",
DIRECT_KERNEL_BOOT_CMDLINE
.replace("console=hvc0 ", console_str)
.as_str(),
])
.default_disks()
.default_net()
.args(&[
"--serial",
format!("file={}", serial_path.to_str().unwrap()).as_str(),
])
.capture_output()
.spawn()
.unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot(None).unwrap();
// Test that there is a ttyS0
assert_eq!(
guest
.ssh_command(GREP_SERIAL_IRQ_CMD)
.unwrap()
.trim()
.parse::<u32>()
.unwrap_or_default(),
1
);
guest.ssh_command("sudo shutdown -h now").unwrap();
});
let _ = child.wait_timeout(std::time::Duration::from_secs(20));
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
let r = std::panic::catch_unwind(|| {
// Check that the cloud-hypervisor binary actually terminated
assert!(output.status.success());
// Do this check after shutdown of the VM as an easy way to ensure
// all writes are flushed to disk
let mut f = std::fs::File::open(serial_path).unwrap();
let mut buf = String::new();
f.read_to_string(&mut buf).unwrap();
assert!(buf.contains(CONSOLE_TEST_STRING));
});
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
2458,
368,
341,
286,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
955,
3683,
3237,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_matrix_operations_fractions() {
let mat8 = Mat::new(
2,
2,
vec![
Rational::new_i64(1, 2), Rational::new_i64(1, 3),
Rational::new_i64(1, 4), Rational::new_i64(1, 5)
],
);
let mat9 = Mat::new(
2,
1,
vec![
Rational::new_i64(4, 1),
Rational::new_i64(15, 1),
],
);
let mat10 = Mat::new(
2,
1,
vec![
Rational::new_i64(7, 1),
Rational::new_i64(4, 1),
],
);
assert_eq!(&mat8 * &mat9, mat10);
} | rust_cleaned_test_functions.jsonl/108528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
57345,
761,
956,
5136,
368,
341,
286,
1077,
5517,
23,
284,
6867,
486,
931,
1006,
310,
220,
17,
345,
310,
220,
17,
345,
310,
7486,
90515,
571,
11143,
1663,
486,
931,
5318,
21,
19,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unresolved_module_diagnostic() {
let (analysis, file_id) = single_file("mod foo;");
let diagnostics = analysis.diagnostics(file_id).unwrap();
assert_debug_snapshot_matches!("unresolved_module_diagnostic", &diagnostics);
} | rust_cleaned_test_functions.jsonl/19263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
39747,
10750,
29477,
11953,
368,
341,
262,
1077,
320,
34484,
11,
1034,
842,
8,
284,
3175,
2458,
445,
2593,
15229,
34649,
262,
1077,
49418,
284,
6358,
950,
18938,
4866,
842,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_annotations_order() {
let app = app_from_test_db("books-annotated");
for stor_item in app.stor().values() {
for annotations in stor_item.annotations.windows(2) {
assert!(annotations[0] < annotations[1]);
}
}
} | rust_cleaned_test_functions.jsonl/132896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78896,
7869,
368,
341,
286,
1077,
906,
284,
906,
5673,
4452,
8685,
445,
12110,
12,
3401,
657,
3071,
286,
369,
33689,
5634,
304,
906,
1236,
269,
1005,
3661,
368,
341,
310,
369,
32207,
304,
33689,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transitions_start_with_at_least_two_chars() {
let model =
"0\n\
3\n\
ab 2 3";
match DFAReader::new_from_string(model) {
Err(DFAReaderError::IllformedTransition(line)) => assert!(line == 3),
_ => assert!(false, "IllformedTransition expected."),
}
} | rust_cleaned_test_functions.jsonl/47832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
5930,
4906,
6615,
3752,
88716,
23241,
37418,
368,
341,
286,
1077,
1614,
4035,
310,
330,
15,
1699,
5661,
1797,
220,
18,
1699,
5661,
1797,
668,
220,
17,
220,
18,
876,
286,
2432,
93631,
5062,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_e2e() {
let max_relays = 4;
let dest = TestAddress(String::from(
"/ip6/2607:f8b0:4003:c01::6a/udp/5678#000000000",
));
let routing_info = vec![
TestAddress(String::from(
"QmQV4LdB3jDKEZxB1EGoutUYyRSt8H8oW4B6DoBLB9z6b7",
)),
TestAddress(String::from(
"/ip4/127.0.0.1/udp/1234#0000000000000000000000",
)),
TestAddress(String::from(
"QmPxawpH7ymXENBZcbKpV3NTxMc4fs37gmREn8e9C2kgNe",
)),
TestAddress(String::from(
"/ip4/120.120.0.2/tcp/1222#00000000000000000000",
)),
];
let mut circuit_keypairs = Vec::new();
let mut circuit_pub_keys = Vec::new();
for _ in 0..max_relays {
let secret = x25519_ristretto::EphemeralSecretKey::generate();
circuit_pub_keys.push(secret.to_public());
circuit_keypairs.push(secret);
}
let session_key = x25519_ristretto::EphemeralSecretKey::generate();
let mut payload = [0; 256];
payload[..13].copy_from_slice(b"Hello, Sfynx!");
let (_, mut new_packet) =
Packet::<_, hmac::sha256::Hmac, chacha20::StreamCipher, _, hash::sha256::Hash>::new(
session_key,
circuit_pub_keys,
&routing_info,
dest.clone(),
max_relays,
&payload,
)
.unwrap();
for (keypair, _) in circuit_keypairs
.iter()
.zip(routing_info.into_iter().skip(1))
{
assert_eq!(new_packet.payload.len(), 256);
assert_ne!(
&new_packet.payload, &payload,
"Payload was not successfully ENCRYPTED"
);
let (_, _, packet) = new_packet.peel(keypair).unwrap();
new_packet = packet;
}
let (_, _, final_packet) = new_packet.peel(circuit_keypairs.last().unwrap()).unwrap();
assert!(final_packet.is_last());
assert_eq!(final_packet.payload, payload);
} | rust_cleaned_test_functions.jsonl/51523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
17,
68,
368,
341,
286,
1077,
1932,
13557,
942,
284,
220,
19,
280,
286,
1077,
3201,
284,
3393,
4286,
2242,
486,
1499,
1006,
310,
3521,
573,
21,
14,
17,
21,
15,
22,
55477,
23,
65,
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... | 3 |
#[test]
fn test_empty_password_input() {
let pass = "";
let keyring = Keyring::new("test", "test");
keyring.set_password(pass).unwrap();
let out = keyring.get_password().unwrap();
keyring.delete_password().unwrap();
assert_eq!(pass, out);
} | rust_cleaned_test_functions.jsonl/99045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
10122,
5898,
368,
341,
286,
1077,
1494,
284,
5438,
286,
1077,
1376,
12640,
284,
5309,
12640,
486,
931,
445,
1944,
497,
330,
1944,
797,
286,
1376,
12640,
980,
10122,
39790,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_headers_encoded() {
let mut encoder = Encoder::new();
let headers = vec![
(b"custom-key".to_vec(), b"custom-value".to_vec()),
(b":method".to_vec(), b"GET".to_vec()),
(b":path".to_vec(), b"/some/path".to_vec()),
];
let result = encoder.encode_for_test(headers.iter().map(|h| (&h.0[..], &h.1[..])));
assert!(is_decodable(&result, &headers));
} | rust_cleaned_test_functions.jsonl/121977 | {
"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,
45233,
26719,
73069,
368,
341,
286,
1077,
5206,
23668,
284,
55115,
486,
931,
543,
286,
1077,
7102,
284,
7486,
90515,
310,
320,
65,
1,
9163,
16173,
3263,
983,
13251,
1507,
293,
1,
9163,
19083,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_messages_update_status() {
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE,"true");
let status = CString::new("MS-103").unwrap().into_raw();
let json = CString::new(r#"[{"pairwiseDID":"QSrw8hebcvQxiwBETmAaRs","uids":["mgrmngq"]}]"#).unwrap().into_raw();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_messages_update_status(cb.command_handle,
status,
json,
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
} | rust_cleaned_test_functions.jsonl/111538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23428,
8882,
4773,
368,
341,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
8414,
1335,
1866,
3071,
286,
1077,
2639,
284,
56956,
486,
931,
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_neq_scalar() {
test_generic_scalar::<i32, _>(
vec!["arrow", "parquet", "datafusion", "flight"],
"arrow",
neq_scalar,
vec![false, true, true, true],
)
} | rust_cleaned_test_functions.jsonl/64920 | {
"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,
13925,
80,
41652,
368,
341,
286,
1273,
41232,
41652,
27638,
72,
18,
17,
11,
716,
17055,
310,
7486,
0,
1183,
6044,
497,
330,
1732,
23300,
497,
330,
691,
54565,
497,
330,
38390,
8097,
310,
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_get_last_instruction_count() {
let prog = &[
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
let mut vm = EbpfVm::new(Some(prog)).unwrap();
vm.register_helper(helpers::BPF_TRACE_PRINTK_IDX, helpers::bpf_trace_printf, None).unwrap();
let _ = vm.execute_program(&[], &[], &[]);
println!("count {:?}", vm.get_last_instruction_count());
assert!(vm.get_last_instruction_count() == 1);
} | rust_cleaned_test_functions.jsonl/15527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12195,
54923,
3180,
368,
341,
262,
1077,
29271,
284,
609,
9640,
286,
220,
15,
87,
24,
20,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cli_deploy() {
solana_logger::setup();
let mut pathbuf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
pathbuf.push("tests");
pathbuf.push("fixtures");
pathbuf.push("noop");
pathbuf.set_extension("so");
// Success case
let mut config = CliConfig::default();
config.rpc_client = Some(RpcClient::new_mock("deploy_succeeds".to_string()));
let default_keypair = Keypair::new();
config.signers = vec![&default_keypair];
config.command = CliCommand::Deploy {
program_location: pathbuf.to_str().unwrap().to_string(),
address: None,
};
let result = process_command(&config);
let json: Value = serde_json::from_str(&result.unwrap()).unwrap();
let program_id = json
.as_object()
.unwrap()
.get("programId")
.unwrap()
.as_str()
.unwrap();
assert!(program_id.parse::<Pubkey>().is_ok());
// Failure case
config.command = CliCommand::Deploy {
program_location: "bad/file/location.so".to_string(),
address: None,
};
assert!(process_command(&config).is_err());
} | rust_cleaned_test_functions.jsonl/21456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 612
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
91890,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5206,
1815,
5909,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
4010,
286,
1815,
5909,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_header_type_with_blob() {
let header = [0x62, 0x6C, 0x6F, 0x62, 32u8, 0x31, 0x35, 0x0];
assert_eq!(Object::Blob, get_header_type(&header));
} | rust_cleaned_test_functions.jsonl/108326 | {
"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,
3062,
8757,
1819,
6615,
45908,
368,
341,
286,
1077,
4247,
284,
508,
15,
87,
21,
17,
11,
220,
15,
87,
21,
34,
11,
220,
15,
87,
21,
37,
11,
220,
15,
87,
21,
17,
11,
220,
18,
17,
84,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substitution() {
// Build the initial category
let mut category = CategoryBuilder::<_, _, _, &str>::new()
.object("A", vec![], ())
.object("B", vec![], ())
.morphism("f", "A", "B", vec![], ())
.morphism("id", "A", "A", vec![], ())
.morphism(
"f.id",
"A",
"B",
vec![MorphismTag::Composition {
first: "id",
second: "f",
}],
(),
)
.morphism("m", "A", "B", vec![MorphismTag::Unique], ())
.build();
print_category(&category);
// Make sure the build is correct
assert_eq!(2, category.objects.len());
assert_eq!(4, category.morphisms.len());
assert_eq!(0, category.equalities.len());
// Get rules
let rule_unique = axioms::rule_unique::<&str>().unwrap();
// Apply unique rule
category.apply_rule(&rule_unique, Bindings::new(), |_| (), |_, _| (), |_| ());
print_category(&category);
assert_eq!(2, category.objects.len());
assert_eq!(4, category.morphisms.len());
assert_eq!(2, category.equalities.len());
} | rust_cleaned_test_functions.jsonl/64724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
10446,
368,
341,
262,
442,
7854,
279,
2856,
5582,
198,
262,
1077,
5206,
5582,
284,
10054,
3297,
27638,
6878,
8358,
8358,
609,
495,
6831,
931,
741,
286,
659,
1700,
445,
32,
497,
7486,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_iter() {
let gil = Python::acquire_gil();
let py = gil.python();
let v = vec![1, 2, 3, 4];
let ob = v.to_object(py);
let list = <PyList as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
for (i, item) in list.iter().enumerate() {
assert_eq!((i + 1) as i32, item.extract::<i32>().unwrap());
}
} | rust_cleaned_test_functions.jsonl/16320 | {
"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,
45514,
11723,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_relay_updates_position() -> Result<(), Error> {
let mut exec = fasync::Executor::new_with_fake_time().expect("executor needed");
exec.set_fake_time(fasync::Time::from_nanos(7000));
let (player_client, avrcp_requests, relay_fut) = setup_media_relay()?;
pin_mut!(relay_fut);
assert!(exec.run_until_stalled(&mut relay_fut).is_pending());
let mut controller_requests =
finish_relay_setup(&mut relay_fut, &mut exec, avrcp_requests)?;
let mut watch_info_fut = player_client.watch_info_change();
assert!(exec.run_until_stalled(&mut relay_fut).is_pending());
// Should return to the player the initial data.
let _info_delta = match exec.run_until_stalled(&mut watch_info_fut) {
Poll::Ready(Ok(delta)) => delta,
x => panic!("Expected WatchInfoChange to complete, instead: {:?}", x),
};
// Queueing up another one with no change should just hang.
let mut watch_info_fut = player_client.watch_info_change();
assert!(exec.run_until_stalled(&mut relay_fut).is_pending());
assert!(exec.run_until_stalled(&mut watch_info_fut).is_pending());
exec.set_fake_time(fasync::Time::from_nanos(9000));
controller_requests.control_handle().send_on_notification(
9000,
avrcp::Notification { pos: Some(3051), ..avrcp::Notification::new_empty() },
)?;
assert!(exec.run_until_stalled(&mut relay_fut).is_pending());
// After the notification is handled we should get an ack.
match exec.run_until_stalled(&mut controller_requests.next()) {
Poll::Ready(Some(Ok(avrcp::ControllerRequest::NotifyNotificationHandled {
..
}))) => {}
x => panic!("Expected ack of notification, but got {:?}", x),
};
// The info should have the delta.
let info_delta = match exec.run_until_stalled(&mut watch_info_fut) {
Poll::Ready(Ok(delta)) => delta,
x => panic!("Expected WatchInfoChange to complete, instead: {:?}", x),
};
assert_eq!(
ValidPlayerStatus {
duration: Some(237000_000_000),
player_state: sessions2::PlayerState::Playing,
timeline_function: Some(media::TimelineFunction {
subject_time: 3051_000_000,
reference_time: 9000,
subject_delta: 1,
reference_delta: 1,
}),
repeat_mode: sessions2::RepeatMode::Single,
shuffle_on: false,
content_type: sessions2::ContentType::Audio,
error: None
},
info_delta.player_status.unwrap().try_into().expect("valid player status")
);
Ok(())
} | rust_cleaned_test_functions.jsonl/31042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
6651,
57829,
9661,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
6615,
56881,
3009,
1005,
17119,
445,
80787,
4362,
797,
286,
3883,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decoding_index_op() {
let mut state = State::new();
let pixel = Pixel { r: 101, g: 102, b: 103, a: 104 };
let mut source = Vec::new();
Op::Index((pixel.qoi_hash() % 64) as u8)
.into_bytes(&mut source)
.expect("Failed to write op");
state.cache_insert(pixel);
assert_eq!(
decode_pixel(&mut state, &mut source.as_slice().bytes()),
Ok(pixel)
);
} | rust_cleaned_test_functions.jsonl/69400 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
3700,
3560,
10287,
368,
341,
262,
1077,
5206,
1584,
284,
3234,
486,
931,
543,
262,
1077,
12955,
284,
27469,
314,
435,
25,
220,
16,
15,
16,
11,
342,
25,
220,
16,
15,
17,
11,
293,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_owner() {
setup();
let p = Path::new("/tmp/nexus-fixer/baz");
assert!(touch(p).is_ok());
assert!(set_owner(p).is_ok());
check_owner(
p,
get_uid().expect("failed to read UID"),
get_gid().expect("failed to read GID"),
);
assert!(fs::remove_file(p).is_ok());
} | rust_cleaned_test_functions.jsonl/26859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
29027,
368,
341,
286,
6505,
543,
286,
1077,
281,
284,
7933,
486,
931,
4283,
5173,
9612,
23666,
2220,
39014,
3470,
1370,
797,
286,
2060,
10297,
22020,
1295,
568,
285,
19817,
1423,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_range_int() {
let mut r = rng(101);
for _ in 0..1000 {
let a = r.gen_range(-4711..17);
assert!((-4711..17).contains(&a));
let a: i8 = r.gen_range(-3..42);
assert!((-3..42).contains(&a));
let a: u16 = r.gen_range(10..99);
assert!((10..99).contains(&a));
let a: i32 = r.gen_range(-100..2000);
assert!((-100..2000).contains(&a));
let a: u32 = r.gen_range(12..=24);
assert!((12..=24).contains(&a));
assert_eq!(r.gen_range(0u32..1), 0u32);
assert_eq!(r.gen_range(-12i64..-11), -12i64);
assert_eq!(r.gen_range(3_000_000..3_000_001), 3_000_000);
}
} | rust_cleaned_test_functions.jsonl/10497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
9698,
4042,
368,
341,
286,
1077,
5206,
435,
284,
28422,
7,
16,
15,
16,
317,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
1077,
264,
284,
435,
22822,
9698,
4080,
19,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_value() {
let tmp_dir = TempDir::new().unwrap();
let mut sm = get_tmp_store_manager(&tmp_dir);
let test_client_name = "test_client".to_owned();
let test_key = "test_key".to_owned();
let test_field = Value::Boolval(true);
let mut client_data = HashMap::new();
client_data.insert(test_key.clone(), clone_value(&test_field).unwrap());
sm.store.data.insert(test_client_name.clone(), client_data);
sm.save_store().unwrap();
let fetched_field = sm.get_value(&test_client_name, &test_key);
assert_eq!(fetched_field, Some(&test_field));
} | rust_cleaned_test_functions.jsonl/48845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3142,
368,
341,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
1525,
284,
633,
16125,
14809,
12144,
2099,
5173,
4334,
626,
286,
1077,
1273,
8179,
1269,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_int_lit_pos_exp() {
let d = Decimal::<1>::from_str("+217e3").unwrap();
assert_eq!(d.coeff, 2170000);
} | rust_cleaned_test_functions.jsonl/12020 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4042,
98399,
6479,
14214,
368,
341,
286,
1077,
294,
284,
26728,
27638,
16,
6831,
1499,
2895,
34973,
17,
16,
22,
68,
18,
1827,
15454,
543,
286,
2060,
10714,
10297,
67,
86462,
11,
220,
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 |
#[test]
fn test_piped_to_dev_full() {
use std::fs::OpenOptions;
for &append in &[true, false] {
{
let dev_full = OpenOptions::new()
.write(true)
.append(append)
.open("/dev/full")
.unwrap();
new_ucmd!()
.set_stdout(dev_full)
.fails()
.stderr_contains("No space left on device");
}
}
} | rust_cleaned_test_functions.jsonl/88242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31721,
2346,
10433,
16372,
368,
341,
262,
990,
1460,
486,
3848,
486,
5002,
3798,
401,
262,
369,
609,
5090,
304,
44590,
1866,
11,
895,
60,
341,
286,
341,
310,
1077,
3483,
16372,
284,
5264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query_with_enums() {
let input = include_str!("relay_test_operation/fixtures/test_query_with_enums.graphql");
let expected = include_str!("relay_test_operation/fixtures/test_query_with_enums.expected");
test_fixture(transform_fixture, "test_query_with_enums.graphql", "relay_test_operation/fixtures/test_query_with_enums.expected", input, expected);
} | rust_cleaned_test_functions.jsonl/97302 | {
"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,
5738,
6615,
6205,
6237,
368,
341,
262,
1077,
1946,
284,
2924,
2895,
17223,
90891,
4452,
32565,
94275,
12697,
5738,
6615,
6205,
6237,
10763,
1470,
797,
262,
1077,
3601,
284,
2924,
2895,
17223,
90891,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.