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_header_with_human_readable_binary() {
let options = Options {
block_size: BlockSize::HumanReadableBinary,
..Default::default()
};
assert_eq!(
Header::get_headers(&options),
vec!(
"Filesystem",
"Size",
"Used",
"Available",
"Use%",
"Mounted on"
)
);
} | rust_cleaned_test_functions.jsonl/110416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
6615,
86247,
91232,
31761,
368,
341,
286,
1077,
2606,
284,
14566,
341,
310,
2504,
2368,
25,
8362,
1695,
486,
33975,
57938,
21338,
345,
310,
5241,
3675,
486,
2258,
741,
286,
2605,
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_classify_duplicate_id() {
let test_batch = Batch::test();
let test_entry = Entry::from_email(&Email::from_str(TEST_DIF_PROD).unwrap()).unwrap();
assert_eq!(
test_batch.classify(&test_entry),
EntryClass::NewProduct(12345)
)
} | rust_cleaned_test_functions.jsonl/68298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
1437,
70434,
842,
368,
341,
286,
1077,
1273,
14534,
284,
33904,
486,
1944,
543,
286,
1077,
1273,
9078,
284,
15788,
486,
1499,
9172,
2099,
4781,
486,
1499,
2895,
50320,
1557,
2773,
89799,
568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_quorum() {
fn unsafe_quorum_fn_1(_: usize) -> usize {
1
}
fn unsafe_quorum_fn_2(_: usize) -> usize {
100
}
fn safe_quorum_fn_3(voters_len: usize) -> usize {
(voters_len + 1) / 2 + 1
}
#[allow(clippy::type_complexity)]
let cases: Vec<(fn(usize) -> usize, usize)> = vec![
(unsafe_quorum_fn_1, 3),
(unsafe_quorum_fn_2, 5),
(safe_quorum_fn_3, 4),
];
for (f, expect_quorum) in cases {
let mut peers = Vec::new();
for i in 1..=5 {
let l = default_logger();
let storage = new_storage();
let raft = new_test_raft_with_quorum_fn(i, vec![1, 2, 3, 4, 5], 10, 1, storage, f, &l);
peers.push(Some(raft));
}
let mut network = Network::new(peers, &default_logger());
for isolated in ((5 - expect_quorum)..=expect_quorum).rev() {
network.recover();
for id in 2..(2 + isolated) {
network.isolate(id as u64);
}
network.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
if 5 - isolated == expect_quorum {
assert_eq!(network.peers[&1].state, StateRole::Leader);
break;
}
assert_eq!(network.peers[&1].state, StateRole::Candidate);
}
let old_committed = network.peers[&1].raft_log.committed;
for isolated in ((5 - expect_quorum)..=expect_quorum).rev() {
network.recover();
for id in 2..(2 + isolated) {
network.isolate(id as u64);
}
network.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
if 5 - isolated == expect_quorum {
assert!(network.peers[&1].raft_log.committed > old_committed);
break;
}
assert!(network.peers[&1].raft_log.committed == old_committed);
}
for isolated in ((5 - expect_quorum)..=expect_quorum).rev() {
network.recover();
network.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
for id in 2..(2 + isolated) {
network.isolate(id as u64);
}
// Peer 1 can keep its leadership in the first check quorum.
network.send(vec![new_message(1, 1, MessageType::MsgCheckQuorum, 0)]);
assert_eq!(network.peers[&1].state, StateRole::Leader);
network.send(vec![new_message(1, 1, MessageType::MsgBeat, 0)]);
network.send(vec![new_message(1, 1, MessageType::MsgCheckQuorum, 0)]);
if 5 - isolated == expect_quorum {
assert_eq!(network.peers[&1].state, StateRole::Leader);
break;
}
assert_eq!(network.peers[&1].state, StateRole::Follower);
}
}
} | rust_cleaned_test_functions.jsonl/89131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
11280,
33006,
368,
341,
262,
5168,
19860,
11280,
33006,
15246,
62,
16,
73834,
22301,
8,
1464,
22301,
341,
286,
220,
16,
198,
262,
555,
262,
5168,
19860,
11280,
33006,
15246,
62,
17,
73834,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_struct_fields_shorthand_ty_mismatch() {
check_fix(
r#"
struct S { a: &'static str, b: i32 }
fn f() {
let a = "hello";
let b = 1usize;
S {
$0
};
}
"#,
r#"
struct S { a: &'static str, b: i32 }
fn f() {
let a = "hello";
let b = 1usize;
S {
a,
b: todo!(),
};
}
"#,
);
} | rust_cleaned_test_functions.jsonl/15156 | {
"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,
30728,
15126,
12132,
3712,
61679,
53171,
717,
24976,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
1235,
328,
314,
264,
25,
30136,
1978,
607,
11,
293,
25,
600,
18,
17,
555,
8822,
282,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solid_regex_line() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-s", "-g", "[AB]", "sed", "s/./@/"])
.write_stdin("ABC\nDFE\nBCC\nCCA\n")
.assert()
.stdout("@BC\nDFE\n@CC\n@CA\n");
} | rust_cleaned_test_functions.jsonl/7893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5192,
41832,
6528,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
2099,
1183,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sqrt() {
{
assert_eq!(Scalar::zero().sqrt().unwrap(), Scalar::zero());
}
let mut square = Scalar([
0x46cd_85a5_f273_077e,
0x1d30_c47d_d68f_c735,
0x77f6_56f6_0bec_a0eb,
0x494a_a01b_df32_468d,
]);
let mut none_count = 0;
for _ in 0..100 {
let square_root = square.sqrt();
if square_root.is_none().unwrap_u8() == 1 {
none_count += 1;
} else {
assert_eq!(square_root.unwrap() * square_root.unwrap(), square);
}
square -= Scalar::one();
}
assert_eq!(49, none_count);
} | rust_cleaned_test_functions.jsonl/62035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92199,
368,
341,
262,
341,
286,
2060,
10714,
10297,
20639,
486,
14154,
1005,
26888,
1005,
15454,
1507,
35176,
486,
14154,
1423,
262,
555,
262,
1077,
5206,
9334,
284,
35176,
8956,
286,
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... | 3 |
#[test]
fn test_op_parse_threebyte() {
// Doesn't matter for this test.
let encoding = encoding4();
// but rather specially in their own function.
let inputs = [
(
constants::DW_OP_const2u,
23,
Operation::UnsignedConstant { value: 23 },
),
(
constants::DW_OP_const2s,
(-23i16) as u16,
Operation::SignedConstant { value: -23 },
),
(
constants::DW_OP_call2,
1138,
Operation::Call {
offset: DieReference::UnitRef(UnitOffset(1138)),
},
),
(
constants::DW_OP_bra,
(-23i16) as u16,
Operation::Bra { target: -23 },
),
(
constants::DW_OP_skip,
(-23i16) as u16,
Operation::Skip { target: -23 },
),
];
for item in inputs.iter() {
let (opcode, arg, ref result) = *item;
check_op_parse(|s| s.D8(opcode.0).L16(arg), result, encoding);
}
} | rust_cleaned_test_functions.jsonl/45748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 738
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
21039,
50016,
3782,
368,
341,
286,
442,
48832,
944,
4925,
369,
419,
1273,
624,
286,
1077,
11170,
284,
11170,
19,
1428,
1789,
286,
442,
714,
4751,
34326,
304,
862,
1828,
729,
624,
286,
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... | 2 |
#[test]
fn test_empty_builder() {
let mut b = new_test_builder();
let block = b.finish();
assert_eq!(&[0, 0, 0, 0, FILTER_BASE_LG as u8], block);
let r = new_test_reader(Vec::from(block));
assert_eq!(r.key_may_match(0, &Slice::from("foo")), true);
assert_eq!(r.key_may_match(10000, &Slice::from("foo")), true);
} | rust_cleaned_test_functions.jsonl/106960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
28532,
368,
341,
286,
1077,
5206,
293,
284,
501,
4452,
28532,
543,
286,
1077,
2504,
284,
293,
40086,
543,
286,
2060,
10714,
0,
2099,
58,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_count() {
let gil = Python::acquire_gil();
let py = gil.python();
let v : Vec<i32> = vec![1, 1, 2, 3, 5, 8];
let seq = v.to_py_object(py).into_object().cast_into::<PySequence>(py).unwrap();
assert_eq!(2, seq.count(py, 1i32).unwrap());
assert_eq!(1, seq.count(py, 2i32).unwrap());
assert_eq!(1, seq.count(py, 3i32).unwrap());
assert_eq!(1, seq.count(py, 5i32).unwrap());
assert_eq!(1, seq.count(py, 8i32).unwrap());
assert_eq!(0, seq.count(py, 42i32).unwrap());
} | rust_cleaned_test_functions.jsonl/22530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
3180,
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,
549,
11312,
21897,
18,
17,
29,
284,
7486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_ready() {
assert_eq!("(empty)", format!("{:?}", Ready::empty()));
assert_eq!("Readable", format!("{:?}", Ready::readable()));
assert_eq!("Writable", format!("{:?}", Ready::writable()));
} | rust_cleaned_test_functions.jsonl/132735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
35456,
368,
341,
262,
2060,
10714,
17223,
7,
3194,
11583,
3561,
88928,
25,
52652,
30982,
486,
3194,
7392,
262,
2060,
10714,
17223,
57938,
497,
3561,
88928,
25,
52652,
30982,
486,
878,
480,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_try_panic_message_unit_struct() {
struct Juju;
match thread::spawn(move|| {
panic!(Juju)
}).join() {
Err(ref e) if e.is::<Juju>() => {}
Err(_) | Ok(()) => panic!()
}
} | rust_cleaned_test_functions.jsonl/8571 | {
"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,
53283,
620,
31270,
6462,
14832,
15126,
368,
341,
286,
2036,
21671,
8613,
401,
286,
2432,
4516,
486,
46087,
34081,
8484,
341,
310,
21975,
10297,
62604,
8613,
340,
286,
8533,
5987,
368,
341,
310,
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... | 4 |
#[test]
fn test_parsing_with_a_timeout_and_a_reset() {
let mut parser = Parser::new();
parser.set_language(get_language("json")).unwrap();
parser.set_timeout_micros(5);
let tree = parser.parse(
"[\"ok\", 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]",
None,
);
assert!(tree.is_none());
// it does not see the changes to the beginning of the source code.
parser.set_timeout_micros(0);
let tree = parser.parse(
"[null, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]",
None,
).unwrap();
assert_eq!(
tree.root_node()
.named_child(0)
.unwrap()
.named_child(0)
.unwrap()
.kind(),
"string"
);
parser.set_timeout_micros(5);
let tree = parser.parse(
"[\"ok\", 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]",
None,
);
assert!(tree.is_none());
// that it sees the changes to the beginning of the source code.
parser.set_timeout_micros(0);
parser.reset();
let tree = parser.parse(
"[null, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]",
None,
).unwrap();
assert_eq!(
tree.root_node()
.named_child(0)
.unwrap()
.named_child(0)
.unwrap()
.kind(),
"null"
);
} | rust_cleaned_test_functions.jsonl/15871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 863
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
6615,
4306,
20537,
8378,
4306,
18983,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,
5433,
29021,
445,
2236,
15197,
15454,
1428,
262,
6729,
980,
205... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syn_received_rst() {
let mut s = socket_syn_received();
recv!(s, [TcpRepr {
control: TcpControl::Syn,
seq_number: LOCAL_SEQ,
ack_number: Some(REMOTE_SEQ + 1),
max_seg_size: Some(BASE_MSS),
..RECV_TEMPL
}]);
send!(s, TcpRepr {
control: TcpControl::Rst,
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ),
..SEND_TEMPL
});
assert_eq!(s.state, State::Listen);
assert_eq!(s.local_endpoint, IpEndpoint::new(IpAddress::Unspecified, LOCAL_END.port));
assert_eq!(s.remote_endpoint, IpEndpoint::default());
} | rust_cleaned_test_functions.jsonl/1707 | {
"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,
51393,
40783,
1710,
267,
368,
341,
286,
1077,
5206,
274,
284,
7575,
51393,
40783,
543,
286,
27006,
10297,
82,
11,
508,
77536,
693,
649,
341,
310,
2524,
25,
64876,
3273,
486,
37134,
345,
310,
129... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
for (header_list, expected) in extract_test_data() {
let map: HashMap<String, String> = header_list
.into_iter()
.map(|(k, v)| (k.to_string(), v.to_string()))
.collect();
let propagator = DatadogPropagator::default();
let context = propagator.extract(&map);
assert_eq!(context.remote_span_context(), Some(&expected));
}
} | rust_cleaned_test_functions.jsonl/107310 | {
"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,
39123,
368,
341,
310,
369,
320,
2708,
2019,
11,
3601,
8,
304,
8649,
4452,
1769,
368,
341,
394,
1077,
2415,
25,
10528,
3464,
11,
923,
29,
284,
4247,
2019,
198,
503,
659,
18122,
11723,
741,
503,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_map_parser() {
let input: &[u8] = &[100, 101, 102, 103, 104][..];
assert_parse!(
map_parser(take(4usize), take(2usize))(input),
Ok((&[104][..], &[100, 101][..]))
);
} | rust_cleaned_test_functions.jsonl/120441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
18517,
368,
341,
262,
1077,
1946,
25,
44590,
84,
23,
60,
284,
44590,
16,
15,
15,
11,
220,
16,
15,
16,
11,
220,
16,
15,
17,
11,
220,
16,
15,
18,
11,
220,
16,
15,
19,
1457,
496,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_import_refs_empty_git_repo() {
let test_data = GitRepoData::create();
let heads_before = test_data.repo.view().heads().clone();
let mut tx = test_data.repo.start_transaction("test");
git::import_refs(tx.mut_repo(), &test_data.git_repo).unwrap();
tx.mut_repo()
.rebase_descendants(&test_data.settings)
.unwrap();
let repo = tx.commit();
assert_eq!(*repo.view().heads(), heads_before);
assert_eq!(repo.view().branches().len(), 0);
assert_eq!(repo.view().tags().len(), 0);
assert_eq!(repo.view().git_refs().len(), 0);
assert_eq!(repo.view().git_head(), None);
} | rust_cleaned_test_functions.jsonl/96056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
60638,
15124,
68801,
37784,
368,
341,
262,
1077,
1273,
1769,
284,
21120,
25243,
1043,
486,
3182,
543,
262,
1077,
14629,
23708,
284,
1273,
1769,
46169,
3792,
1005,
35810,
1005,
19982,
543,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_motherboard_daughterboard() {
let input = vec![0x0, 0x1, 0x0, 0x10];
assert_eq!(
parse(&input),
Ok(Data {
motherboard: 1,
daughterboard: Some(0x10),
})
);
} | rust_cleaned_test_functions.jsonl/63580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
717,
1575,
2482,
47070,
7340,
2482,
368,
341,
286,
1077,
1946,
284,
7486,
20703,
15,
87,
15,
11,
220,
15,
87,
16,
11,
220,
15,
87,
15,
11,
220,
15,
87,
16,
15,
935,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_bh() {
#[derive(Clone)]
struct TestWindow {}
impl Window for TestWindow {
const WINDOW_SIZE: usize = 63;
const NUM_WINDOWS: usize = 8;
}
let rng = &mut test_rng();
let params = <CRH<EdwardsParameters, TestWindow> as FixedLengthCRH>::setup(rng).unwrap();
let _ =
<CRH<EdwardsParameters, TestWindow> as FixedLengthCRH>::evaluate(¶ms, &[1, 2, 3])
.unwrap();
} | rust_cleaned_test_functions.jsonl/60256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
90581,
368,
341,
286,
11506,
27098,
65297,
5563,
286,
2036,
3393,
4267,
5613,
286,
11605,
13642,
369,
3393,
4267,
341,
310,
733,
39259,
4098,
25,
22301,
284,
220,
21,
18,
280,
310,
733,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_upgrade_to_self_binary() {
local_test_e(|runtime| async move {
let mut universal_canister = set_up_universal_canister(&runtime).await;
push_message_to_stable(&universal_canister).await;
// We can read it back
assert_eq!(
try_to_read_message_from_stable(&universal_canister).await,
Ok(MSG.to_vec())
);
// Upgrade to same binary
universal_canister
.upgrade_to_self_binary(Vec::new())
.await
.unwrap();
// The message should still be there
assert_eq!(
try_to_read_message_from_stable(&universal_canister).await,
Ok(MSG.to_vec())
);
universal_canister
.reinstall_with_self_binary(Vec::new())
.await
.unwrap();
assert_matches!(
try_to_read_message_from_stable(&universal_canister).await,
Err(err_msg) if err_msg.contains("stable memory out of bounds"));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/116089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67794,
2346,
25637,
31761,
368,
341,
262,
2205,
4452,
2204,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
5206,
20178,
27421,
1571,
284,
738,
8237,
4907,
33952,
27421,
1571,
2099,
22255,
568,
11421,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tt_with_composite_without_space() {
// Test macro input without any spaces
// See https://github.com/rust-analyzer/rust-analyzer/issues/6692
check(
r#"
macro_rules! m { ($ op:tt, $j:path) => ( ok!(); ) }
m!(==,Foo::Bool)
"#,
expect![[r#"
macro_rules! m { ($ op:tt, $j:path) => ( ok!(); ) }
ok!();
"#]],
);
} | rust_cleaned_test_functions.jsonl/85243 | {
"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,
66740,
6615,
2965,
13607,
39904,
14663,
368,
341,
262,
442,
3393,
18072,
1946,
2041,
894,
12621,
198,
262,
442,
3496,
3703,
1110,
5204,
905,
7382,
590,
18883,
27165,
7382,
590,
18883,
27165,
38745,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_get_item() {
Python::with_gil(|py| {
let v: Vec<i32> = vec![1, 1, 2, 3, 5, 8];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert_eq!(1, seq.get_item(0).unwrap().extract::<i32>().unwrap());
assert_eq!(1, seq.get_item(1).unwrap().extract::<i32>().unwrap());
assert_eq!(2, seq.get_item(2).unwrap().extract::<i32>().unwrap());
assert_eq!(3, seq.get_item(3).unwrap().extract::<i32>().unwrap());
assert_eq!(5, seq.get_item(4).unwrap().extract::<i32>().unwrap());
assert_eq!(8, seq.get_item(5).unwrap().extract::<i32>().unwrap());
assert!(seq.get_item(10).is_err());
});
} | rust_cleaned_test_functions.jsonl/70306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
3062,
5634,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486,
20703,
16,
11,
220,
16,
11,
220,
17,
11,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_numeric_unique_ints2() {
for numeric_unique_sort_param in &["-nu"] {
let input = "9\n9\n8\n1\n";
new_ucmd!()
.arg(numeric_unique_sort_param)
.pipe_in(input)
.succeeds()
.stdout_only("1\n8\n9\n");
}
} | rust_cleaned_test_functions.jsonl/82968 | {
"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,
29418,
21218,
4042,
82,
17,
368,
341,
262,
369,
24064,
21218,
18435,
4090,
304,
609,
1183,
12,
8933,
1341,
341,
286,
1077,
1946,
284,
330,
24,
1699,
24,
1699,
23,
1699,
16,
1699,
876,
286,
501... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_server_isolated_follower_leader_does_not_change() {
let mut cluster = new_server_cluster(0, 5);
test_isolated_follower_leader_does_not_change(&mut cluster);
} | rust_cleaned_test_functions.jsonl/86919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
6892,
80519,
761,
29034,
79991,
96374,
7913,
15947,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
20,
317,
262,
1273,
6892,
80519,
761,
29034,
79991,
96374,
7913... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_two_neuron_disagree_identical_voting_power_proposal_should_be_rejected() {
check_proposal_status_after_voting_and_after_expiration(
vec![
Neuron {
dissolve_state: LOCKED_MIN_DISSOLVE_DELAY_TO_VOTE,
cached_neuron_stake_e8s: 1,
..Neuron::default()
},
Neuron {
dissolve_state: LOCKED_MIN_DISSOLVE_DELAY_TO_VOTE,
cached_neuron_stake_e8s: 1,
..Neuron::default()
},
],
"Pn",
ProposalStatus::Rejected,
ProposalStatus::Rejected,
);
} | rust_cleaned_test_functions.jsonl/42470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
13925,
36090,
9932,
68100,
38399,
938,
2273,
11519,
20421,
21663,
32556,
43378,
21263,
1288,
28303,
368,
341,
262,
1779,
21663,
32556,
4773,
19844,
2273,
11519,
8378,
19844,
2702,
28479,
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_validate_account_doesnt_exist() {
let (config, key) = config_builder::test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let random_account_addr = account_address::AccountAddress::random();
let program =
encode_transfer_with_metadata_script(lbr_type_tag(), &address, vec![], 100, vec![], vec![]);
let transaction = transaction_test_helpers::get_test_signed_transaction(
random_account_addr,
1,
&key,
key.public_key(),
Some(program),
0,
1, /* max gas price */
LBR_NAME.to_owned(), /* gas currency code */
None,
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(
ret.status().unwrap().major_status,
StatusCode::SENDING_ACCOUNT_DOES_NOT_EXIST
);
} | rust_cleaned_test_functions.jsonl/19614 | {
"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,
42681,
13500,
96374,
406,
35906,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_fields() {
const RESPONSE: &[u8] = b"* 1 FETCH (UID 1 BODY[HEADER.FIELDS (CHAT-VERSION)] {21}\r\nChat-Version: 1.0\r\n\r\n)\r\n";
match parse_response(RESPONSE) {
Ok((_, Response::Fetch(_, _))) => {}
rsp => panic!("unexpected response {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/8548 | {
"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,
8757,
12132,
368,
341,
286,
733,
76173,
25,
44590,
84,
23,
60,
284,
293,
61593,
220,
16,
32316,
320,
6463,
220,
16,
68583,
58,
38098,
991,
33459,
320,
60717,
12,
17636,
7252,
314,
17,
16,
1103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_too_many_args_output() {
new_ucmd!()
.args(&["a", "b", "c"])
.fails()
.stderr_is("basename: extra operand 'c'\nTry 'basename --help' for more information.");
} | rust_cleaned_test_functions.jsonl/82230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
22101,
8384,
7645,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
64,
497,
330,
65,
497,
330,
66,
14108,
286,
659,
59631,
741,
286,
659,
36422,
6892,
445,
42953... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transfer_with_seed() {
paychains_logger::setup();
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
1,
Some(faucet_addr),
SocketAddrSpace::Unspecified,
);
let rpc_client =
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
let default_signer = Keypair::new();
let mut config = CliConfig::recent_for_tests();
config.json_rpc_url = test_validator.rpc_url();
config.signers = vec![&default_signer];
let sender_pubkey = config.signers[0].pubkey();
let recipient_pubkey = Pubkey::new(&[1u8; 32]);
let derived_address_seed = "seed".to_string();
let derived_address_program_id = stake::program::id();
let derived_address = Pubkey::create_with_seed(
&sender_pubkey,
&derived_address_seed,
&derived_address_program_id,
)
.unwrap();
request_and_confirm_airdrop(&rpc_client, &config, &sender_pubkey, pay_to_lamports(1.0))
.unwrap();
request_and_confirm_airdrop(&rpc_client, &config, &derived_address, pay_to_lamports(5.0))
.unwrap();
check_recent_balance(pay_to_lamports(1.0), &rpc_client, &sender_pubkey);
check_recent_balance(pay_to_lamports(5.0), &rpc_client, &derived_address);
check_recent_balance(0, &rpc_client, &recipient_pubkey);
check_ready(&rpc_client);
// Transfer with seed
config.command = CliCommand::Transfer {
amount: SpendAmount::Some(pay_to_lamports(5.0)),
to: recipient_pubkey,
from: 0,
sign_only: false,
dump_transaction_message: false,
allow_unfunded_recipient: true,
no_wait: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
derived_address_seed: Some(derived_address_seed),
derived_address_program_id: Some(derived_address_program_id),
};
process_command(&config).unwrap();
check_recent_balance(pay_to_lamports(1.0) - 1, &rpc_client, &sender_pubkey);
check_recent_balance(pay_to_lamports(5.0), &rpc_client, &recipient_pubkey);
check_recent_balance(0, &rpc_client, &derived_address);
} | rust_cleaned_test_functions.jsonl/71167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1042
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
6615,
33809,
368,
341,
262,
2291,
58358,
27413,
486,
15188,
543,
262,
1077,
28337,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
28337,
34014,
792,
284,
28337,
3097,
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_try_lock() -> io::Result<()> {
let path = "test-try-lock";
let f = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(true)
.open(&path)?;
f.set_len(1024)?;
let mut a = pipeline::Pipeline::new(&path)
.try_lock(Ok(Lock::Exclusive), 0, 1)
.write(0, 1)
.wait(0, 2)
.downgrade()
.write(0, 3)
.wait(0, 4)
.unlock()
.spawn("a")?;
let mut b = pipeline::Pipeline::new(&path)
.wait(0, 1)
.try_lock(Err(Lock::Exclusive), 0, 1)
.try_lock(Err(Lock::Shared), 0, 1)
.write(0, 2)
.wait(0, 3)
.try_lock(Err(Lock::Exclusive), 0, 1)
.try_lock(Ok(Lock::Shared), 0, 1)
.write(0, 4)
.unlock()
.spawn("b")?;
pipeline::interleave(&mut a, &mut b)
} | rust_cleaned_test_functions.jsonl/6700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
9818,
368,
1464,
6399,
486,
2077,
71698,
341,
262,
1077,
1815,
284,
330,
1944,
12,
1539,
41772,
876,
262,
1077,
282,
284,
5264,
3798,
486,
931,
741,
286,
659,
878,
3715,
340,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_stylejson() {
use t_rex_core::core::read_config;
let config = read_config("src/test/example.toml").unwrap();
let service = MvtService::from_config(&config).unwrap();
let json = format!(
"{:#}",
service.get_stylejson("http://127.0.0.1", "osm").unwrap()
);
println!("{}", json);
let expected = r#"
"name": "t-rex",
"sources": {
"osm": {
"type": "vector",
"url": "http://127.0.0.1/osm.json"
}
},
"version": 8
"#;
assert!(json.contains(expected));
let expected = r#"
"layers": [
{
"id": "background_",
"paint": {
"background-color": "rgba(255, 255, 255, 1)"
},
"type": "background"
},
{
"id": "points","#;
assert!(json.contains(expected));
let expected = r##"
"paint": {
"fill-color": "#d8e8c8",
"fill-opacity": 0.5
},"##;
assert!(json.contains(expected));
let expected = r#"
"id": "buildings","#;
assert!(json.contains(expected));
} | rust_cleaned_test_functions.jsonl/20660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15117,
2236,
368,
341,
262,
990,
259,
1288,
87,
15467,
486,
2153,
486,
878,
5332,
401,
262,
1077,
2193,
284,
1349,
5332,
445,
3548,
12697,
65182,
73494,
75,
1827,
15454,
543,
262,
1077,
2473,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fee_rate_governor_derived_adjust() {
solana_logger::setup();
let mut f = FeeRateGovernor::default();
f.target_lamports_per_signature = 100;
f.target_signatures_per_slot = 100;
f = FeeRateGovernor::new_derived(&f, 0);
// Ramp fees up
let mut count = 0;
loop {
let last_lamports_per_signature = f.lamports_per_signature;
f = FeeRateGovernor::new_derived(&f, std::u64::MAX);
info!("[up] f.lamports_per_signature={}", f.lamports_per_signature);
// some maximum target reached
if f.lamports_per_signature == last_lamports_per_signature {
break;
}
// shouldn't take more than 1000 steps to get to minimum
assert!(count < 1000);
count += 1;
}
// Ramp fees down
let mut count = 0;
loop {
let last_lamports_per_signature = f.lamports_per_signature;
f = FeeRateGovernor::new_derived(&f, 0);
info!(
"[down] f.lamports_per_signature={}",
f.lamports_per_signature
);
// some minimum target reached
if f.lamports_per_signature == last_lamports_per_signature {
break;
}
// shouldn't take more than 1000 steps to get to minimum
assert!(count < 1000);
count += 1;
}
// Arrive at target rate
let mut count = 0;
while f.lamports_per_signature != f.target_lamports_per_signature {
f = FeeRateGovernor::new_derived(&f, f.target_signatures_per_slot);
info!(
"[target] f.lamports_per_signature={}",
f.lamports_per_signature
);
// shouldn't take more than 100 steps to get to target
assert!(count < 100);
count += 1;
}
} | rust_cleaned_test_functions.jsonl/14528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 998
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34305,
9246,
1889,
6706,
269,
35345,
2221,
44153,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
5206,
282,
284,
40458,
11564,
77606,
269,
486,
2258,
543,
286,
282,
6539,
907,
309,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rent_complex() {
solana_logger::setup();
let mock_program_id = Pubkey::new(&[2u8; 32]);
let (mut genesis_config, _mint_keypair) = create_genesis_config(10);
let mut keypairs: Vec<Keypair> = Vec::with_capacity(14);
for _i in 0..14 {
keypairs.push(Keypair::new());
}
genesis_config.rent = Rent {
lamports_per_byte_year: 1,
exemption_threshold: 1000.0,
burn_percent: 10,
};
let root_bank = Bank::new(&genesis_config);
// we must ensure lazy rent collection doens't get broken!
root_bank.restore_old_behavior_for_fragile_tests();
let root_bank = Arc::new(root_bank);
let bank = create_child_bank_for_rent_test(&root_bank, &genesis_config, mock_program_id);
assert_eq!(bank.last_blockhash(), genesis_config.hash());
let slots_elapsed: u64 = (0..=bank.epoch)
.map(|epoch| {
bank.rent_collector
.epoch_schedule
.get_slots_in_epoch(epoch + 1)
})
.sum();
let (generic_rent_due_for_system_account, _) = bank.rent_collector.rent.due(
bank.get_minimum_balance_for_rent_exemption(0) - 1,
0,
slots_elapsed as f64 / bank.rent_collector.slots_per_year,
);
store_accounts_for_rent_test(
&bank,
&mut keypairs,
mock_program_id,
generic_rent_due_for_system_account,
);
let magic_rent_number = 131;
let t1 = system_transaction::transfer(
&keypairs[0],
&keypairs[1].pubkey(),
1,
genesis_config.hash(),
);
let t2 = system_transaction::transfer(
&keypairs[2],
&keypairs[3].pubkey(),
1,
genesis_config.hash(),
);
let t3 = system_transaction::transfer(
&keypairs[4],
&keypairs[5].pubkey(),
1,
genesis_config.hash(),
);
let t4 = system_transaction::transfer(
&keypairs[6],
&keypairs[7].pubkey(),
generic_rent_due_for_system_account + 1,
genesis_config.hash(),
);
let t5 = system_transaction::transfer(
&keypairs[8],
&keypairs[9].pubkey(),
929,
genesis_config.hash(),
);
let t6 = create_mock_transaction(
&keypairs[10],
&keypairs[11],
&keypairs[12],
&keypairs[13],
mock_program_id,
genesis_config.hash(),
);
let txs = vec![t6, t5, t1, t2, t3, t4];
let res = bank.process_transactions(txs.iter());
assert_eq!(res.len(), 6);
assert_eq!(res[0], Ok(()));
assert_eq!(res[1], Ok(()));
assert_eq!(res[2], Ok(()));
assert_eq!(res[3], Ok(()));
assert_eq!(res[4], Err(TransactionError::AccountNotFound));
assert_eq!(res[5], Ok(()));
bank.freeze();
let mut rent_collected = 0;
assert_eq!(bank.get_balance(&keypairs[0].pubkey()), 1);
rent_collected += generic_rent_due_for_system_account;
assert_eq!(bank.get_balance(&keypairs[1].pubkey()), 3);
rent_collected += generic_rent_due_for_system_account;
assert_eq!(bank.get_balance(&keypairs[2].pubkey()), 1);
rent_collected += generic_rent_due_for_system_account;
assert_eq!(bank.get_balance(&keypairs[3].pubkey()), 3);
rent_collected += generic_rent_due_for_system_account;
// No rent deducted
assert_eq!(bank.get_balance(&keypairs[4].pubkey()), 10);
assert_eq!(bank.get_balance(&keypairs[5].pubkey()), 10);
assert_eq!(bank.get_balance(&keypairs[6].pubkey()), 23);
rent_collected += generic_rent_due_for_system_account;
assert_eq!(
bank.get_balance(&keypairs[7].pubkey()),
generic_rent_due_for_system_account + 1 - magic_rent_number
);
// Epoch should be updated
// Rent deducted on store side
let account8 = bank.get_account(&keypairs[7].pubkey()).unwrap();
// Epoch should be set correctly.
assert_eq!(account8.rent_epoch(), bank.epoch + 1);
rent_collected += magic_rent_number;
assert_eq!(bank.get_balance(&keypairs[8].pubkey()), 2);
rent_collected += generic_rent_due_for_system_account;
let account10 = bank.get_account(&keypairs[9].pubkey()).unwrap();
assert_eq!(account10.rent_epoch(), bank.epoch + 1);
// account data is blank now
assert_eq!(account10.data().len(), 0);
assert_eq!(account10.lamports(), 929 - magic_rent_number);
rent_collected += magic_rent_number + 10;
assert_eq!(bank.get_balance(&keypairs[10].pubkey()), 3);
rent_collected += generic_rent_due_for_system_account;
assert_eq!(bank.get_balance(&keypairs[11].pubkey()), 4);
rent_collected += generic_rent_due_for_system_account;
assert_eq!(bank.get_balance(&keypairs[12].pubkey()), 2);
rent_collected += generic_rent_due_for_system_account;
// No rent for read-only account
assert_eq!(bank.get_balance(&keypairs[13].pubkey()), 14);
// Bank's collected rent should be sum of rent collected from all accounts
assert_eq!(bank.collected_rent.load(Relaxed), rent_collected);
} | rust_cleaned_test_functions.jsonl/2535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2867
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
41522,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
7860,
25096,
842,
284,
22611,
792,
486,
931,
2099,
58,
17,
84,
23,
26,
220,
18,
17,
10149,
286,
1077,
320,
6984,
593... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_recognize_full() {
let tail: &[u8] = &[0xF0, 0x90, 0x86, 0x92, 0x0d, 0x0a, 0x0d, 0x0a];
let mut full = AsyncBuffer::new(format!("GET /first HTTP/1.1\r\n{}", std::str::from_utf8(tail).unwrap()));
let result = block_on(async { recognize(&mut full).await });
assert!(result.is_ok())
} | rust_cleaned_test_functions.jsonl/48184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
3934,
551,
16372,
368,
341,
220,
1077,
9787,
25,
44590,
84,
23,
60,
284,
44590,
15,
9770,
15,
11,
220,
15,
87,
24,
15,
11,
220,
15,
87,
23,
21,
11,
220,
15,
87,
24,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subslice_offset() {
let a = "kernelsprite";
let b = a.slice(7, a.len());
let c = a.slice(0, a.len() - 6);
assert_eq!(a.subslice_offset(b), 7);
assert_eq!(a.subslice_offset(c), 0);
let string = "a\nb\nc";
let lines: Vec<&str> = string.lines().collect();
assert_eq!(string.subslice_offset(lines[0]), 0);
assert_eq!(string.subslice_offset(lines[1]), 2);
assert_eq!(string.subslice_offset(lines[2]), 4);
} | rust_cleaned_test_functions.jsonl/2454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
24963,
6917,
368,
341,
286,
1077,
264,
284,
330,
74,
42329,
5734,
876,
286,
1077,
293,
284,
264,
14530,
7,
22,
11,
264,
19406,
1423,
286,
1077,
272,
284,
264,
14530,
7,
15,
11,
264,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ref_wind() {
let keys = vec!["foo", "bar", "zen"].mapper(|x| x.to_owned());
let values = vec!["1", "2", "3"].mapper(|x| x.to_owned());
let hash_map = wind(&keys, &values);
println!(">> {:?}", hash_map);
} | rust_cleaned_test_functions.jsonl/57078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
87438,
368,
341,
286,
1077,
6894,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
497,
330,
5679,
5521,
38076,
22428,
87,
91,
856,
2389,
51973,
1423,
286,
1077,
2750,
284,
7486,
0,
1183,
16,
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_parse_bytes_as_value() {
let raw_json: &[u8] = r##"{
"coordinates": "pkg:pypi/rust@0.1.1",
"description": "Ribo-Seq Unit Step Transformation",
"reference": "https://ossindex.sonatype.org/component/pkg:pypi/rust@0.1.1",
"vulnerabilities": [],
"source": "registry+https://github.com/rust-lang/crates.io-index"
}"##.as_bytes();
let value: serde_json::Value =
serde_json::from_slice(raw_json).unwrap();
assert_eq!(value["coordinates"], "pkg:pypi/rust@0.1.1");
assert_eq!(value["description"], "Ribo-Seq Unit Step Transformation");
} | rust_cleaned_test_functions.jsonl/63286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
12524,
11898,
3142,
368,
341,
286,
1077,
7112,
9455,
25,
44590,
84,
23,
60,
284,
435,
565,
1,
515,
310,
330,
34739,
788,
330,
30069,
44389,
80977,
7382,
590,
31,
15,
13,
16,
13,
16,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_good_environment() {
let cwd = env::current_dir().unwrap().to_string_lossy().into_owned();
let xd = BaseDirectories::with_env("", "", &*make_env(vec![
("HOME", format!("{}/test_files/user", cwd)),
("XDG_DATA_HOME", format!("{}/test_files/user/data", cwd)),
("XDG_CONFIG_HOME", format!("{}/test_files/user/config", cwd)),
("XDG_CACHE_HOME", format!("{}/test_files/user/cache", cwd)),
("XDG_DATA_DIRS", format!("{}/test_files/system0/data:{}/test_files/system1/data:{}/test_files/system2/data:{}/test_files/system3/data", cwd, cwd, cwd, cwd)),
("XDG_CONFIG_DIRS", format!("{}/test_files/system0/config:{}/test_files/system1/config:{}/test_files/system2/config:{}/test_files/system3/config", cwd, cwd, cwd, cwd)),
])).unwrap();
assert!(xd.find_data_file("everywhere") != None);
assert!(xd.find_config_file("everywhere") != None);
assert!(xd.find_cache_file("everywhere") != None);
let mut config_files = xd.find_config_files("everywhere");
assert_eq!(config_files.next(),
Some(PathBuf::from(format!("{}/test_files/system2/config/everywhere", cwd))));
assert_eq!(config_files.next(),
Some(PathBuf::from(format!("{}/test_files/system1/config/everywhere", cwd))));
assert_eq!(config_files.next(),
Some(PathBuf::from(format!("{}/test_files/user/config/everywhere", cwd))));
assert_eq!(config_files.next(), None);
let mut data_files = xd.find_data_files("everywhere");
assert_eq!(data_files.next(),
Some(PathBuf::from(format!("{}/test_files/system2/data/everywhere", cwd))));
assert_eq!(data_files.next(),
Some(PathBuf::from(format!("{}/test_files/system1/data/everywhere", cwd))));
assert_eq!(data_files.next(),
Some(PathBuf::from(format!("{}/test_files/user/data/everywhere", cwd))));
assert_eq!(data_files.next(), None);
} | rust_cleaned_test_functions.jsonl/83585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44781,
51774,
368,
341,
262,
1077,
46938,
284,
6105,
486,
3231,
4334,
1005,
15454,
1005,
983,
3904,
11193,
88,
1005,
18122,
51973,
543,
262,
1077,
79052,
284,
5351,
56397,
486,
4197,
15879,
19814,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_value_is_ignored() {
env::set_var("C_A_B", "");
let environment = Environment::new().ignore_empty(true);
assert!(!environment.collect().unwrap().contains_key("c_a_b"));
env::remove_var("C_A_B");
} | rust_cleaned_test_functions.jsonl/22986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
3142,
6892,
62,
58471,
368,
341,
262,
6105,
486,
746,
4612,
445,
34,
1566,
1668,
497,
50970,
262,
1077,
4573,
284,
11586,
486,
931,
1005,
13130,
15124,
3715,
626,
262,
2060,
0,
3471,
2329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_plot_data_to_json() {
let d = PlotData::new(TEST_PLOT, "png", 400, 500, 1.);
println!("{}", d.to_json());
} | rust_cleaned_test_functions.jsonl/33865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24351,
1769,
2346,
9455,
368,
341,
286,
1077,
294,
284,
26033,
1043,
486,
931,
50320,
1088,
15745,
11,
330,
14066,
497,
220,
19,
15,
15,
11,
220,
20,
15,
15,
11,
220,
16,
58957,
286,
13751,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bit() {
let mut b = [0b00000000];
set_bit(&mut b, 0);
assert_eq!([0b00000001], b);
set_bit(&mut b, 2);
assert_eq!([0b00000101], b);
set_bit(&mut b, 5);
assert_eq!([0b00100101], b);
} | rust_cleaned_test_functions.jsonl/6785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
13996,
368,
341,
286,
1077,
5206,
293,
284,
508,
15,
65,
15,
15,
15,
15,
15,
15,
15,
15,
935,
286,
738,
13996,
2099,
6984,
293,
11,
220,
15,
317,
286,
2060,
10714,
0,
2561,
15,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_building_max_weight() {
util::init_test_logger();
global::set_local_chain_type(global::ChainTypes::AutomatedTesting);
global::set_local_accept_fee_base(1);
let keychain: ExtKeychain = Keychain::from_random_seed(false).unwrap();
let db_root = "target/.block_max_weight";
clean_output_dir(db_root.into());
let genesis = genesis_block(&keychain);
let chain = Arc::new(init_chain(db_root, genesis));
let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new()));
// Initialize a new pool with our chain adapter.
let mut pool = init_transaction_pool(
Arc::new(ChainAdapter {
chain: chain.clone(),
}),
verifier_cache,
);
// mine past HF4 to see effect of set_local_accept_fee_base
add_some_blocks(&chain, 4 * 3, &keychain);
let header_1 = chain.get_header_by_height(1).unwrap();
// Provides us with some useful outputs to test with.
let initial_tx = test_transaction_spending_coinbase(
&keychain,
&header_1,
vec![1_000_000, 2_000_000, 3_000_000, 10_000_000],
);
// Mine that initial tx so we can spend it with multiple txs.
add_block(&chain, &[initial_tx], &keychain);
let header = chain.head_header().unwrap();
// Build some dependent txs to add to the txpool.
// We will build a block from a subset of these.
let txs = vec![
test_transaction(
&keychain,
vec![10_000_000],
vec![3_900_000, 1_300_000, 1_200_000, 1_100_000],
),
test_transaction(&keychain, vec![1_000_000], vec![900_000, 10_000]),
test_transaction(&keychain, vec![900_000], vec![800_000, 20_000]),
test_transaction(&keychain, vec![2_000_000], vec![1_970_000]),
test_transaction(&keychain, vec![3_000_000], vec![2_900_000, 30_000]),
test_transaction(&keychain, vec![2_900_000], vec![2_800_000, 40_000]),
];
// Fees and weights of our original txs in insert order.
assert_eq!(
txs.iter().map(|x| x.fee(header.height)).collect::<Vec<_>>(),
[2_500_000, 90_000, 80_000, 30_000, 70_000, 60_000]
);
assert_eq!(
txs.iter().map(|x| x.weight()).collect::<Vec<_>>(),
[88, 46, 46, 25, 46, 46]
);
assert_eq!(
txs.iter()
.map(|x| x.fee_rate(header.height))
.collect::<Vec<_>>(),
[28409, 1956, 1739, 1200, 1521, 1304]
);
// Populate our txpool with the txs.
for tx in txs {
pool.add_to_pool(test_source(), tx, false, &header).unwrap();
}
// Check we added them all to the txpool successfully.
assert_eq!(pool.total_size(), 6);
// // Prepare some "mineable" txs from the txpool.
// // Note: We cannot fit all the txs from the txpool into a block.
let txs = pool.prepare_mineable_transactions().unwrap();
// Fees and weights of the "mineable" txs.
assert_eq!(
txs.iter().map(|x| x.fee(header.height)).collect::<Vec<_>>(),
[2_500_000, 90_000, 80_000, 70_000]
);
assert_eq!(
txs.iter().map(|x| x.weight()).collect::<Vec<_>>(),
[88, 46, 46, 46]
);
assert_eq!(
txs.iter()
.map(|x| x.fee_rate(header.height))
.collect::<Vec<_>>(),
[28409, 1956, 1739, 1521]
);
add_block(&chain, &txs, &keychain);
let block = chain.get_block(&chain.head().unwrap().hash()).unwrap();
assert_eq!(block.inputs().len(), 3);
assert_eq!(block.outputs().len(), 10);
assert_eq!(block.kernels().len(), 5);
// Now reconcile the transaction pool with the new block
// and check the resulting contents of the pool are what we expect.
pool.reconcile_block(&block).unwrap();
// We should still have 2 tx in the pool after accepting the new block.
// This one exceeded the max block weight when building the block so
// remained in the txpool.
assert_eq!(pool.total_size(), 2);
// Cleanup db directory
clean_output_dir(db_root.into());
} | rust_cleaned_test_functions.jsonl/83301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
82397,
6345,
15876,
368,
341,
79138,
486,
2327,
4452,
27413,
543,
18842,
486,
746,
13564,
30583,
1819,
31951,
486,
18837,
4173,
486,
41072,
657,
16451,
317,
18842,
486,
746,
13564,
35728,
3430... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_length() {
use super::{Length};
use std::cmp::{Ordering};
let short = Length("short".to_string());
let longer = Length("longer".to_string());
let equal = Length("equal".to_string());
assert_eq!(short.cmp(&longer), Ordering::Less);
assert_eq!(longer.cmp(&short), Ordering::Greater);
assert_eq!(short.cmp(&equal), Ordering::Equal);
} | rust_cleaned_test_functions.jsonl/85914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5118,
368,
341,
286,
990,
2256,
22964,
4373,
2440,
286,
990,
1460,
486,
7293,
22964,
4431,
287,
2315,
286,
1077,
2805,
284,
17287,
445,
8676,
3263,
983,
3904,
1423,
286,
1077,
5021,
284,
17287,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_index_expression() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
metadata: String::new(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(Box::new(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Index(Box::new(ast::IndexExpr {
base: b.clone(),
array: ast::Expression::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
lbrack: None,
index: ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 3,
}),
rbrack: None,
})),
}))],
eof: None,
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Index(Box::new(IndexExpr {
loc: b.location.clone(),
typ: type_info(),
array: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "a".to_string(),
}),
index: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 3,
}),
})),
})],
}],
};
let got = test_convert(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/30453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
3560,
28068,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1815,
25,
330,
234... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intermediate_lifetime() {
let mut rt = Crepe::new();
rt.extend(&[Input([0, 1, 2, 3]), Input([1, 2, 3, 4])]);
let (res,) = rt.run();
let mut res = res.into_iter().map(|Output(n)| n).collect::<Vec<_>>();
res.sort_unstable();
assert_eq!(res, [0, 1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/128620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
14636,
98827,
368,
341,
262,
1077,
5206,
16677,
284,
7792,
375,
486,
931,
543,
262,
16677,
15831,
2099,
58,
2505,
2561,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
9719,
5571,
2561,
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_nonce_with_seed() {
let TestValidator {
server,
leader_data,
alice,
ledger_path,
..
} = TestValidator::run();
full_battery_tests(leader_data, alice, Some(String::from("seed")), false);
server.close().unwrap();
remove_dir_all(ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/77780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
6615,
33809,
368,
341,
262,
1077,
3393,
14256,
341,
286,
3538,
345,
286,
7653,
1769,
345,
286,
70433,
345,
286,
46933,
2638,
345,
286,
54538,
262,
335,
284,
3393,
14256,
486,
6108,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_switch_manual_int_size_else() {
if let Ok(r) = SwitchManualIntSizeElse::from_file("src/switch_tlv.bin") {
assert_eq!(r.chunks.len(), 4);
assert_eq!(r.chunks[0].code, 17);
assert_eq!(r.chunks[0].body.title, "Stuff");
assert_eq!(r.chunks[0].body.author, "Me");
assert_eq!(r.chunks[1].code, 34);
assert_eq!(r.chunks[1].body.entries, ["AAAA", "BBBB", "CCCC"]);
assert_eq!(r.chunks[2].code, 51);
assert_eq!(r.chunks[2].body.rest, vec!([0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80]));
assert_eq!(r.chunks[3].code, 255);
assert_eq!(r.chunks[3].body.rest, vec!([]));
}
} | rust_cleaned_test_functions.jsonl/61597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
75428,
4042,
2368,
62628,
368,
341,
262,
421,
1077,
7622,
2601,
8,
284,
15586,
52092,
1072,
1695,
22971,
486,
1499,
2458,
445,
3548,
14,
17338,
528,
21827,
29394,
899,
341,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_xz() {
let tdir = TmpDir::new();
tdir.test_rw("test.xz", [CompressType::Xz, CompressType::Xz], false);
} | rust_cleaned_test_functions.jsonl/95082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
89,
368,
341,
197,
10217,
259,
3741,
284,
350,
1307,
6184,
486,
931,
543,
197,
76373,
404,
5958,
49566,
445,
1944,
1993,
89,
497,
508,
1092,
1873,
929,
486,
55,
89,
11,
1198,
1873,
929,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_global_sync() {
// create a GlobalType instance
let result = GlobalType::create(ValType::I32, Mutability::Const);
assert!(result.is_ok());
let global_ty = result.unwrap();
// create a Global instance
let result = Global::create(&global_ty, WasmValue::from_i32(5));
assert!(result.is_ok());
let global = Arc::new(Mutex::new(result.unwrap()));
let global_cloned = Arc::clone(&global);
let handle = thread::spawn(move || {
let result = global_cloned.lock();
assert!(result.is_ok());
let global = result.unwrap();
assert_eq!(global.get_value().to_i32(), 5);
});
handle.join().unwrap()
} | rust_cleaned_test_functions.jsonl/91085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
23008,
368,
341,
286,
442,
1855,
264,
7962,
929,
2867,
198,
286,
1077,
1102,
284,
7962,
929,
486,
3182,
7,
2208,
929,
486,
40,
18,
17,
11,
31228,
2897,
486,
19167,
317,
286,
2060,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_message_signed_keys_len() {
let program_id = Pubkey::default();
let id0 = Pubkey::default();
let ix = Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, false)]);
let message = Message::new(&[ix], None);
assert_eq!(message.header.num_required_signatures, 0);
let ix = Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, true)]);
let message = Message::new(&[ix], Some(&id0));
assert_eq!(message.header.num_required_signatures, 1);
} | rust_cleaned_test_functions.jsonl/55526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
55617,
12631,
6043,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
2258,
543,
286,
1077,
877,
15,
284,
22611,
792,
486,
2258,
543,
286,
1077,
26864,
284,
29051,
486,
931,
6615,
2181... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inflation_start_slot() {
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config_with_leader(42, &solana_sdk::pubkey::new_rand(), 42);
genesis_config
.accounts
.remove(&feature_set::pico_inflation::id())
.unwrap();
genesis_config
.accounts
.remove(&feature_set::full_inflation::id())
.unwrap();
let bank = Bank::new(&genesis_config);
// Advance to slot 1
let mut bank = new_from_parent(&Arc::new(bank));
bank = new_from_parent(&Arc::new(bank));
assert_eq!(bank.get_inflation_start_slot(), 0);
// Request `full_inflation` activation
let pico_inflation_activation_slot = 1;
bank.store_account(
&feature_set::pico_inflation::id(),
&feature::create_account(
&Feature {
activated_at: Some(pico_inflation_activation_slot),
},
42,
),
);
bank.compute_active_feature_set(true);
assert_eq!(
bank.get_inflation_start_slot(),
pico_inflation_activation_slot
);
// Advance to slot 2
bank = new_from_parent(&Arc::new(bank));
let full_inflation_activation_slot = 2;
bank.store_account(
&feature_set::full_inflation::id(),
&feature::create_account(
&Feature {
activated_at: Some(full_inflation_activation_slot),
},
42,
),
);
bank.compute_active_feature_set(true);
assert_eq!(
bank.get_inflation_start_slot(),
full_inflation_activation_slot
);
} | rust_cleaned_test_functions.jsonl/63819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1243,
64149,
4906,
27563,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
11,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
79991,
7,
19,
17,
11,
609,
38198,
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_measure_text_width_osc_hyperlink_non_ascii() {
assert_eq!(measure_text_width("\x1b[38;5;4m\x1b]8;;file:///Users/dan/src/delta/src/ansi/mod.rs\x1b\\src/ansi/modバー.rs\x1b]8;;\x1b\\\x1b[0m"),
measure_text_width("src/ansi/modバー.rs"));
} | rust_cleaned_test_functions.jsonl/49546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48938,
4326,
7927,
62,
23469,
93416,
2080,
21637,
50238,
368,
341,
286,
2060,
10714,
10297,
47799,
4326,
7927,
4921,
87,
16,
65,
58,
18,
23,
26,
20,
26,
19,
76,
3462,
16,
65,
60,
23,
6768,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_histogram_simple_update() {
let (clock, _ctl) = Clock::mock();
let h = AtomicWindowedHistogram::new(Duration::from_secs(5), Duration::from_secs(1), clock);
h.record(1245);
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 1);
let values = snapshot.decompress();
assert_eq!(values.len(), 1);
assert_eq!(values.get(0).unwrap(), &1245);
} | rust_cleaned_test_functions.jsonl/3581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68564,
30015,
8882,
368,
341,
286,
1077,
320,
20666,
11,
716,
12373,
8,
284,
26142,
486,
16712,
543,
286,
1077,
305,
284,
30316,
4267,
291,
77210,
486,
931,
64114,
486,
1499,
68718,
7,
20,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_param_completion_last_param() {
assert_debug_snapshot_matches!(
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/27897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
60164,
12195,
4090,
368,
341,
286,
2060,
15446,
53265,
38344,
33673,
286,
653,
54612,
60164,
1006,
394,
435,
698,
394,
5168,
15229,
4866,
842,
25,
2887,
764,
8,
5613,
394,
5168,
3619,
4866,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_front() {
let mut ring = RingBuf::new();
ring.push_back(10);
ring.push_back(20);
assert_eq!(ring.front(), Some(&10));
ring.pop_front();
assert_eq!(ring.front(), Some(&20));
ring.pop_front();
assert_eq!(ring.front(), None);
} | rust_cleaned_test_functions.jsonl/125117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22926,
368,
341,
286,
1077,
5206,
10058,
284,
21525,
15064,
486,
931,
543,
286,
10058,
2552,
3895,
7,
16,
15,
317,
286,
10058,
2552,
3895,
7,
17,
15,
317,
286,
2060,
10714,
10297,
12640,
23445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_farm_with_same_name_fails() {
ExternalityBuilder::build().execute_with(|| {
create_entity();
create_twin();
create_farm();
let farm_name = "test_farm".as_bytes().to_vec();
let mut pub_ips = Vec::new();
pub_ips.push(super::types::PublicIP {
ip: "1.1.1.0".as_bytes().to_vec(),
gateway: "1.1.1.1".as_bytes().to_vec(),
contract_id: 0,
});
assert_noop!(
TfgridModule::create_farm(Origin::signed(alice()), farm_name, pub_ips),
Error::<TestRuntime>::FarmExists
);
});
} | rust_cleaned_test_functions.jsonl/35365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
761,
2178,
6615,
33574,
1269,
761,
6209,
368,
341,
262,
1374,
4160,
2719,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1855,
19169,
543,
286,
1855,
528,
7526,
543,
286,
1855,
761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_struct_in_enum() {
let input = b"\x00\x00\x00\x02";
let res = U8::parse(input, 0);
assert_eq!(res, Ok((&input[4..], U8::Field1(U8S1 { a: 2 }))));
let res = U8::parse(input, 1);
assert_eq!(res, Ok((&input[4..], U8::Field2(2))));
} | rust_cleaned_test_functions.jsonl/96094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
1243,
31054,
368,
341,
262,
1077,
1946,
284,
293,
11934,
87,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
17,
876,
262,
1077,
592,
284,
547,
23,
486,
6400,
5384,
11,
220,
15,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incorrect_ciphertext_b() {
let mut sealed_b = seal(Keypolicy::MRENCLAVE, b"MRENCLAVE", b"Mr. Enclave");
sealed_b[0] = 0x00;
unseal(Keypolicy::MRENCLAVE, b"MRENCLAVE", &sealed_b);
} | rust_cleaned_test_functions.jsonl/21555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19928,
666,
45043,
880,
368,
341,
286,
1077,
5206,
19046,
880,
284,
25349,
7,
6608,
1082,
8018,
486,
44,
40892,
3140,
9493,
11,
293,
73527,
40892,
3140,
9493,
497,
293,
1,
12275,
13,
2925,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rename_incorrect_case_struct_method() {
check_fix(
r#"
pub struct TestStruct;
impl TestStruct {
pub fn SomeFn$0() -> TestStruct {
TestStruct
}
}
"#,
r#"
pub struct TestStruct;
impl TestStruct {
pub fn some_fn() -> TestStruct {
TestStruct
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/34400 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
1243,
19928,
19096,
15126,
9032,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
9585,
2036,
3393,
9422,
401,
6383,
3393,
9422,
341,
262,
6675,
5168,
4329,
24911,
3,
15,
368,
1464,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_visibility_preserved_by_evaluator() -> anyhow::Result<()> {
// module with ScopeData preserves the visibility of symbols.
let globals = Globals::standard();
let import = Module::new();
import.set("a", Value::new_int(1));
import.set_private("b", Value::new_int(2));
let mut eval = Evaluator::new(&import);
let ast = AstModule::parse("prelude.bzl", "c = 3".to_owned(), &Dialect::Standard).unwrap();
// This mutates the original module named `import`
let _: Value = eval.eval_module(ast, &globals)?;
let frozen_import = import.freeze()?;
let m_uses_public = Module::new();
m_uses_public.import_public_symbols(&frozen_import);
let mut eval = Evaluator::new(&m_uses_public);
let ast = AstModule::parse("code.bzl", "d = a".to_owned(), &Dialect::Standard).unwrap();
let _: Value = eval.eval_module(ast, &globals)?;
let m_uses_private = Module::new();
m_uses_private.import_public_symbols(&frozen_import);
let mut eval = Evaluator::new(&m_uses_private);
let ast = AstModule::parse("code.bzl", "d = b".to_owned(), &Dialect::Standard).unwrap();
let err = eval
.eval_module(ast, &globals)
.expect_err("Evaluation should have failed using a private symbol");
let msg = err.to_string();
let expected_msg = "Variable `b` not found";
assert!(
msg.contains(expected_msg),
"Expected `{}` to be in error message `{}`",
expected_msg,
msg
);
Ok(())
} | rust_cleaned_test_functions.jsonl/92438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
71256,
32116,
2771,
3710,
21296,
45162,
368,
1464,
88964,
486,
2077,
71698,
341,
1066,
262,
442,
4688,
448,
34920,
1043,
74898,
279,
23160,
315,
17738,
382,
262,
1077,
37785,
284,
50176,
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... | 4 |
#[test]
fn test_sign_pkcs1v15() {
let priv_key = get_private_key();
let tests = [[
"Test.\n", "a4f3fa6ea93bcdd0c57be020c1193ecbfd6f200a3d95c409769b029578fa0e336ad9a347600e40d3ae823b8c7e6bad88cc07c1d54c3a1523cbbb6d58efc362ae"
]];
for test in &tests {
let digest = Sha1::digest(test[0].as_bytes()).to_vec();
let expected = hex::decode(test[1]).unwrap();
let out = priv_key
.sign(PaddingScheme::new_pkcs1v15_sign(Some(Hash::SHA1)), &digest)
.unwrap();
assert_ne!(out, digest);
assert_eq!(out, expected);
let seed = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();
let mut rng = StdRng::seed_from_u64(seed.as_secs());
let out2 = priv_key
.sign_blinded(
&mut rng,
PaddingScheme::new_pkcs1v15_sign(Some(Hash::SHA1)),
&digest,
)
.unwrap();
assert_eq!(out2, expected);
}
} | rust_cleaned_test_functions.jsonl/52107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
33321,
4837,
16,
85,
16,
20,
368,
341,
286,
1077,
6095,
3097,
284,
633,
26249,
3097,
1428,
286,
1077,
7032,
284,
4318,
198,
310,
330,
2271,
7110,
77,
497,
330,
64,
19,
69,
18,
3632,
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_csv_with_schema_inference() {
let file = File::open("test/data/uk_cities_with_headers.csv").unwrap();
let builder = ReaderBuilder::new().has_headers(true).infer_schema(None);
let mut csv = builder.build(file).unwrap();
let batch = csv.next().unwrap().unwrap();
assert_eq!(37, batch.num_rows());
assert_eq!(3, batch.num_columns());
// access data from a primitive array
let lat = batch
.column(1)
.as_any()
.downcast_ref::<Float64Array>()
.unwrap();
assert_eq!(57.653484, lat.value(0));
let city = batch
.column(0)
.as_any()
.downcast_ref::<BinaryArray>()
.unwrap();
let city_name: String = String::from_utf8(city.value(13).to_vec()).unwrap();
assert_eq!("Aberdeen, Aberdeen City, UK", city_name);
} | rust_cleaned_test_functions.jsonl/23953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14020,
6615,
25371,
1243,
2202,
368,
341,
286,
1077,
1034,
284,
2887,
486,
2508,
445,
1944,
13167,
14,
3101,
666,
1361,
6615,
26719,
11219,
1827,
15454,
1428,
286,
1077,
7363,
284,
25166,
3297,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_discard_propose_for_same_cfg() {
let mut testkit: TestKit = TestKit::configuration_default();
let cfg_change_height = Height(5);
let new_cfg = {
let mut cfg = testkit.configuration_change_proposal();
cfg.set_actual_from(cfg_change_height);
cfg.set_service_config("dummy", "First cfg change");
cfg.stored_configuration().clone()
};
let (propose_tx, duplicated_propose_tx) = {
let validators = testkit.network().validators();
let propose_tx = new_tx_config_propose(&validators[1], new_cfg.clone());
let duplicated_propose_tx = new_tx_config_propose(&validators[0], new_cfg.clone());
(propose_tx, duplicated_propose_tx)
};
testkit.create_block_with_transactions(txvec![propose_tx.clone(), duplicated_propose_tx]);
let propose_tx = ConfigurationTransactions::from_raw(propose_tx);
let propose_tx = match propose_tx {
ConfigurationTransactions::Propose(t) => t,
_ => panic!("Wrong tx found"),
};
assert_eq!(Some(propose_tx), testkit.find_propose(new_cfg.hash()));
} | rust_cleaned_test_functions.jsonl/106412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
567,
21663,
960,
5478,
33574,
18343,
368,
341,
262,
1077,
5206,
1273,
8226,
25,
3393,
7695,
284,
3393,
7695,
486,
21138,
9993,
1428,
262,
1077,
13286,
15947,
9561,
284,
21432,
7,
20,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_param_completion_nth_param() {
check_magic_completion(
"param_completion_nth_param",
r"
fn foo(file_id: FileId) {}
fn bar(file_id: FileId) {}
fn baz(file<|>, x: i32) {}
",
);
} | rust_cleaned_test_functions.jsonl/23555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
60164,
78342,
4090,
368,
341,
286,
1779,
54612,
60164,
1006,
310,
330,
903,
60164,
78342,
4090,
756,
310,
435,
698,
310,
5168,
15229,
4866,
842,
25,
2887,
764,
8,
5613,
310,
5168,
3619,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trailing_whitespace() {
let headers = make_header!(b"Content-Length: 10 ");
assert_eq!(headers.get::<ContentLength>(), Some(&ContentLength(10)));
} | rust_cleaned_test_functions.jsonl/108096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
14277,
86175,
368,
341,
286,
1077,
7102,
284,
1281,
8757,
10297,
65,
1,
2762,
52493,
25,
220,
16,
15,
256,
7318,
286,
2060,
10714,
10297,
7713,
670,
27638,
2762,
4373,
39019,
4329,
2099,
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 |
#[test]
fn test_random_73k_test_obs_lt_not_a_multiple_ibs() {
new_ucmd!()
.args(&[
"ibs=1031",
"obs=521",
"if=random-5828891cb1230748e146f34223bbd3b5.test",
])
.succeeds()
.stdout_is_fixture_bytes("random-5828891cb1230748e146f34223bbd3b5.test");
} | rust_cleaned_test_functions.jsonl/99866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
62,
22,
18,
74,
4452,
30405,
39164,
7913,
4306,
45233,
62,
54341,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
9640,
310,
330,
54341,
28,
16,
15,
18,
16,
756,
310,
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_with() {
let text = "{{ with foo as bar }}Hello!{{ endwith }}";
let instructions = compile(text).unwrap();
assert_eq!(3, instructions.len());
assert_eq!(
&PushNamedContext(vec![PathStep::Name("foo")], "bar"),
&instructions[0]
);
assert_eq!(&Literal("Hello!"), &instructions[1]);
assert_eq!(&PopContext, &instructions[2]);
} | rust_cleaned_test_functions.jsonl/18177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
368,
972,
286,
1077,
1467,
284,
47219,
448,
15229,
438,
3619,
3869,
9707,
0,
2979,
835,
4197,
3869,
3534,
286,
1077,
11221,
284,
19192,
7235,
568,
15454,
1647,
286,
2060,
10714,
10297,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_copy() {
let mut buf = Vec::new();
buf.copy_slice(&[1, 3, 3, 5]);
assert_eq!(buf, vec![1, 3, 3, 5]);
buf.copy_slice(&[2, 5]);
assert_eq!(buf, vec![1, 3, 3, 5, 2, 5]);
} | rust_cleaned_test_functions.jsonl/30744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
16096,
368,
341,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
286,
6607,
12232,
26488,
2099,
58,
16,
11,
220,
18,
11,
220,
18,
11,
220,
20,
2558,
286,
2060,
10714,
10297,
5909,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ord() {
let x = VecDeque::new();
let mut y = VecDeque::new();
y.push_back(1);
y.push_back(2);
y.push_back(3);
assert!(x < y);
assert!(y > x);
assert!(x <= x);
assert!(x >= x);
} | rust_cleaned_test_functions.jsonl/73716 | {
"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,
67324,
368,
341,
262,
1077,
856,
284,
11312,
73891,
486,
931,
543,
262,
1077,
5206,
379,
284,
11312,
73891,
486,
931,
543,
262,
379,
2552,
3895,
7,
16,
317,
262,
379,
2552,
3895,
7,
17,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cli_program_deploy_no_authority() {
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");
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let test_validator = TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr));
let rpc_client =
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
let mut file = File::open(pathbuf.to_str().unwrap()).unwrap();
let mut program_data = Vec::new();
file.read_to_end(&mut program_data).unwrap();
let max_len = program_data.len();
let minimum_balance_for_programdata = rpc_client
.get_minimum_balance_for_rent_exemption(
UpgradeableLoaderState::programdata_len(max_len).unwrap(),
)
.unwrap();
let minimum_balance_for_program = rpc_client
.get_minimum_balance_for_rent_exemption(UpgradeableLoaderState::program_len().unwrap())
.unwrap();
let upgrade_authority = Keypair::new();
let mut config = CliConfig::recent_for_tests();
let keypair = Keypair::new();
config.json_rpc_url = test_validator.rpc_url();
config.command = CliCommand::Airdrop {
pubkey: None,
lamports: 100 * minimum_balance_for_programdata + minimum_balance_for_program,
};
config.signers = vec![&keypair];
process_command(&config).unwrap();
// Deploy a program
config.signers = vec![&keypair, &upgrade_authority];
config.command = CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some(pathbuf.to_str().unwrap().to_string()),
program_signer_index: None,
program_pubkey: None,
buffer_signer_index: None,
buffer_pubkey: None,
allow_excessive_balance: false,
upgrade_authority_signer_index: 1,
is_final: true,
max_len: None,
});
config.output_format = OutputFormat::JsonCompact;
let response = process_command(&config);
let json: Value = serde_json::from_str(&response.unwrap()).unwrap();
let program_id_str = json
.as_object()
.unwrap()
.get("programId")
.unwrap()
.as_str()
.unwrap();
let program_id = Pubkey::from_str(&program_id_str).unwrap();
// Attempt to upgrade the program
config.signers = vec![&keypair, &upgrade_authority];
config.command = CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some(pathbuf.to_str().unwrap().to_string()),
program_signer_index: None,
program_pubkey: Some(program_id),
buffer_signer_index: None,
buffer_pubkey: None,
allow_excessive_balance: false,
upgrade_authority_signer_index: 1,
is_final: false,
max_len: None,
});
process_command(&config).unwrap_err();
} | rust_cleaned_test_functions.jsonl/29527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
25096,
91890,
6536,
22938,
487,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
5206,
1815,
5909,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nlerp_half() {
let q = Quaternion::from([-0.5, 0.5, 0.5, 0.5]);
let r = Quaternion::from([0.5, 0.5, 0.5, 0.5]);
let expected =
Quaternion::from([0.0, 1.0 / 3f64.sqrt(), 1.0 / 3f64.sqrt(), 1.0 / 3f64.sqrt()]);
assert_ulps_eq!(expected, q.nlerp(r, 0.5));
} | rust_cleaned_test_functions.jsonl/15349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
1536,
79,
40626,
368,
341,
286,
1077,
2804,
284,
24801,
486,
1499,
41197,
15,
13,
20,
11,
220,
15,
13,
20,
11,
220,
15,
13,
20,
11,
220,
15,
13,
20,
2558,
286,
1077,
435,
284,
24801,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_name() -> TestParseResult {
assert_eq!(
super::field_name().parse(".my.field.name:a"),
Ok((".my.field.name".to_string(), "a"))
);
assert_eq!(
super::field_name().parse("my\\ field\\ name:a"),
Ok(("my field name".to_string(), "a"))
);
assert!(super::field_name().parse("my field:a").is_err());
assert_eq!(
super::field_name().parse("\\(1\\+1\\):2"),
Ok(("(1+1)".to_string(), "2"))
);
assert_eq!(
super::field_name().parse("my_field_name:a"),
Ok(("my_field_name".to_string(), "a"))
);
assert!(super::field_name().parse("my_field_name").is_err());
assert!(super::field_name().parse(":a").is_err());
assert!(super::field_name().parse("-my_field:a").is_err());
assert_eq!(
super::field_name().parse("_my_field:a")?,
("_my_field".to_string(), "a")
);
Ok(())
} | rust_cleaned_test_functions.jsonl/64410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
1269,
368,
1464,
3393,
14463,
2077,
341,
286,
2060,
10714,
33673,
310,
2256,
486,
2566,
1269,
1005,
6400,
5680,
2408,
16454,
2644,
43833,
4461,
310,
7622,
7,
5680,
2408,
16454,
2644,
3263,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_endpoint_overrides_valid() {
let options = hashmap! {
"baremetal_endpoint_override".into() => "http://127.0.0.1/baremetal".into(),
"baremetal_introspection_endpoint_override".into() => "http://127.0.0.1:5050/".into(),
"something unrelated".into() => "banana".into(),
};
let cfg = CloudConfig {
options,
..CloudConfig::default()
};
let result = cfg.create_endpoint_overrides().unwrap();
assert_eq!(
result,
hashmap! {
"baremetal".into() => Url::parse("http://127.0.0.1/baremetal").unwrap(),
"baremetal_introspection".into() => Url::parse("http://127.0.0.1:5050/").unwrap(),
"baremetal-introspection".into() => Url::parse("http://127.0.0.1:5050/").unwrap(),
}
);
} | rust_cleaned_test_functions.jsonl/99073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36699,
15431,
18245,
8337,
368,
341,
286,
1077,
2606,
284,
92148,
0,
341,
310,
330,
54102,
54008,
36699,
48576,
3263,
18122,
368,
589,
330,
1254,
1110,
16,
17,
22,
13,
15,
13,
15,
13,
16,
3470... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_large() {
let mut map = BTreeMap::new();
let size = 10000;
assert_eq!(map.len(), 0);
for i in 0..size {
assert_eq!(map.insert(i, 10 * i), None);
assert_eq!(map.len(), i + 1);
}
for i in 0..size {
assert_eq!(map.get(&i).unwrap(), &(i * 10));
}
for i in size..size * 2 {
assert_eq!(map.get(&i), None);
}
for i in 0..size {
assert_eq!(map.insert(i, 100 * i), Some(10 * i));
assert_eq!(map.len(), size);
}
for i in 0..size {
assert_eq!(map.get(&i).unwrap(), &(i * 100));
}
for i in 0..size / 2 {
assert_eq!(map.remove(&(i * 2)), Some(i * 200));
assert_eq!(map.len(), size - i - 1);
}
for i in 0..size / 2 {
assert_eq!(map.get(&(2 * i)), None);
assert_eq!(map.get(&(2 * i + 1)).unwrap(), &(i * 200 + 100));
}
for i in 0..size / 2 {
assert_eq!(map.remove(&(2 * i)), None);
assert_eq!(map.remove(&(2 * i + 1)), Some(i * 200 + 100));
assert_eq!(map.len(), size / 2 - i - 1);
}
} | rust_cleaned_test_functions.jsonl/49375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
45228,
368,
341,
262,
1077,
5206,
2415,
284,
425,
6533,
2227,
486,
931,
543,
262,
1077,
1379,
284,
220,
16,
15,
15,
15,
15,
280,
262,
2060,
10714,
10297,
2186,
19406,
1507,
220,
15,
626... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_get_set_remove_repository() {
run_async_test(async {
ffx_config::set((CONFIG_KEY_REPOSITORIES, ConfigLevel::User), json!({})).await.unwrap();
// Initially the repositoy does not exist.
assert_eq!(get_repository("repo").await.unwrap(), None);
// Add the repository.
let repository = RepositorySpec::Pm { path: "foo/bar/baz".into() };
set_repository("repo", &repository).await.unwrap();
// Make sure we wrote to the config.
assert_eq!(
ffx_config::get::<Value, _>(CONFIG_KEY_REPOSITORIES).await.unwrap(),
json!({
"repo": {
"type": "pm",
"path": "foo/bar/baz",
}
}),
);
// Make sure we can get the repository.
assert_eq!(get_repository("repo").await.unwrap(), Some(repository));
// We can't get unknown repositories.
assert_eq!(get_repository("unknown").await.unwrap(), None);
// We can remove the repository.
remove_repository("repo").await.unwrap();
assert_eq!(
ffx_config::get::<Option<Value>, _>(CONFIG_KEY_REPOSITORIES).await.unwrap(),
None,
);
assert_eq!(get_repository("repo").await.unwrap(), None);
});
} | rust_cleaned_test_functions.jsonl/98264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 774
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2602,
18193,
47301,
368,
341,
286,
1598,
28346,
4452,
18285,
341,
310,
282,
8298,
5332,
486,
746,
1188,
24652,
6600,
2192,
61943,
42737,
11,
5532,
4449,
486,
1474,
701,
2951,
0,
2306,
92,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_p2_1() {
let input = "16
10
15
5
1
11
7
19
6
12
4";
let input = input
.split("\n")
.map(|s| s.parse().unwrap())
.collect::<Vec<u64>>();
let res = part2(&input);
assert_eq!(8, res);
} | rust_cleaned_test_functions.jsonl/54403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
62,
16,
368,
341,
286,
1077,
1946,
284,
330,
16,
21,
198,
16,
15,
198,
16,
20,
198,
20,
198,
16,
198,
16,
16,
198,
22,
198,
16,
24,
198,
21,
198,
16,
17,
198,
19,
3302,
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_insert_get_bytes() {
// Create enough entries to ensure there are at least two shreds created
let num_entries = max_ticks_per_n_shreds(1, None) + 1;
assert!(num_entries > 1);
let (mut shreds, _) = make_slot_entries(0, 0, num_entries);
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let last_shred = shreds.pop().unwrap();
assert!(last_shred.index() > 0);
blockstore
.insert_shreds(vec![last_shred.clone()], None, false)
.unwrap();
let serialized_shred = blockstore
.data_shred_cf
.get_bytes((0, last_shred.index() as u64))
.unwrap()
.unwrap();
let deserialized_shred = Shred::new_from_serialized_shred(serialized_shred).unwrap();
assert_eq!(last_shred, deserialized_shred);
} | rust_cleaned_test_functions.jsonl/9535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
3062,
12524,
368,
341,
286,
442,
4230,
3322,
10695,
311,
5978,
1052,
525,
518,
3245,
1378,
557,
53369,
3465,
198,
286,
1077,
1629,
26092,
284,
1932,
49961,
5678,
1089,
3712,
53369,
7,
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_bad_form_submissions() {
run_test!(|client, _conn| {
let res = client.post("/todo")
.header(ContentType::Form)
.dispatch()
.await;
let mut cookies = res.headers().get("Set-Cookie");
assert_eq!(res.status(), Status::UnprocessableEntity);
assert!(!cookies.any(|value| value.contains("error")));
// Submit a form with an empty description. We look for 'error' in the
// cookies which corresponds to flash message being set as an error.
let res = client.post("/todo")
.header(ContentType::Form)
.body("description=")
.dispatch()
.await;
let mut cookies = res.headers().get("Set-Cookie");
assert!(cookies.any(|value| value.contains("error")));
let res = client.post("/todo")
.header(ContentType::Form)
.body("evil=smile")
.dispatch()
.await;
let mut cookies = res.headers().get("Set-Cookie");
assert_eq!(res.status(), Status::UnprocessableEntity);
assert!(!cookies.any(|value| value.contains("error")));
})
} | rust_cleaned_test_functions.jsonl/115175 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 560
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
7915,
5228,
5176,
368,
341,
262,
1598,
4452,
10297,
91,
2972,
11,
716,
5148,
91,
341,
1789,
286,
1077,
592,
284,
2943,
6542,
4283,
17370,
1138,
310,
659,
2708,
7,
29504,
486,
1838,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lex() {
let mut lexer = Lexer::new("var x uint64 = 100; y := \"str\"");
let (lexemes, errs) = lexer.lex();
assert!(errs.is_empty());
assert_eq!(
lexemes,
&[
Lexeme::new(Token::Var, Pos(1, 1)),
Lexeme::new_with_literal(Token::Identifier, Pos(1, 5), String::from("x")),
Lexeme::new_with_literal(Token::Uint64, Pos(1, 7), String::from("uint64")),
Lexeme::new(Token::Equal, Pos(1, 14)),
Lexeme::new_with_literal(Token::IntLiteral, Pos(1, 16), String::from("100")),
Lexeme::new(Token::Semicolon, Pos(1, 19)),
Lexeme::new_with_literal(Token::Identifier, Pos(1, 21), String::from("y")),
Lexeme::new(Token::ColonEqual, Pos(1, 23)),
Lexeme::new_with_literal(Token::StringLiteral, Pos(1, 26), String::from("str")),
Lexeme::new(Token::Eof, Pos(1, 29)),
]
);
} | rust_cleaned_test_functions.jsonl/103553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
368,
341,
286,
1077,
5206,
53259,
284,
85082,
486,
931,
445,
947,
856,
2622,
21,
19,
284,
220,
16,
15,
15,
26,
379,
1669,
7245,
495,
88385,
286,
1077,
320,
2571,
15660,
11,
70817,
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_gcd_ext() {
fn case(x: i64, y: i64, (d, s, t): (i64, i64, i64)) {
assert_eq!(gcd_ext(x, y), (d, s, t), "{:?}", (x, y));
assert_eq!(s * x + t * y, d);
}
case(3, 7, (1, -2, 1));
case(4, 6, (2, -1, 1));
case(360 * 5 * 5 * 11, 360 * 7 * 7 * 13, (360, -227, 98));
case(4, -6, (2, -1, -1));
case(-9, -12, (3, 1, -1));
} | rust_cleaned_test_functions.jsonl/74031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
4385,
9927,
368,
341,
286,
5168,
1142,
2075,
25,
600,
21,
19,
11,
379,
25,
600,
21,
19,
11,
320,
67,
11,
274,
11,
259,
1648,
320,
72,
21,
19,
11,
600,
21,
19,
11,
600,
21,
19,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cred_offer_returns_json_string_with_cred_offer_json_nested() {
init!("true");
let handle = from_string(::utils::constants::DEFAULT_SERIALIZED_CREDENTIAL).unwrap();
let offer_string = get_credential_offer(handle).unwrap();
let offer_value: serde_json::Value = serde_json::from_str(&offer_string).unwrap();
let _offer_struct: CredentialOffer = serde_json::from_value(offer_value["credential_offer"].clone()).unwrap();
} | rust_cleaned_test_functions.jsonl/125580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
73475,
67814,
58900,
9455,
3904,
6615,
73475,
67814,
9455,
66279,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
504,
3904,
38732,
6031,
486,
15763,
486,
17285,
14844,
88727,
920... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_string() {
assert!(Token::from_str0("'abc'").is_string());
assert!(Token::from_str0("'''abc'''").is_string());
assert!(Token::from_str0("\"abc\"").is_string());
assert!(Token::from_str0("\"\"\"abc\"\"\"").is_string());
} | rust_cleaned_test_functions.jsonl/67670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
3904,
368,
341,
262,
2060,
10297,
3323,
486,
1499,
2895,
15,
45456,
13683,
6,
1827,
285,
3904,
1423,
262,
2060,
10297,
3323,
486,
1499,
2895,
15,
445,
18788,
13683,
18788,
1827,
285,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remote_wallet_info_matches() {
let pubkey = paychains_sdk::pubkey::new_rand();
let info = RemoteWalletInfo {
manufacturer: Manufacturer::Ledger,
model: "Nano S".to_string(),
serial: "0001".to_string(),
host_device_path: "/host/device/path".to_string(),
pubkey,
error: None,
};
let mut test_info = RemoteWalletInfo {
manufacturer: Manufacturer::Unknown,
..RemoteWalletInfo::default()
};
assert!(!info.matches(&test_info));
test_info.manufacturer = Manufacturer::Ledger;
assert!(info.matches(&test_info));
test_info.model = "Other".to_string();
assert!(info.matches(&test_info));
test_info.model = "Nano S".to_string();
assert!(info.matches(&test_info));
test_info.host_device_path = "/host/device/path".to_string();
assert!(info.matches(&test_info));
let another_pubkey = paychains_sdk::pubkey::new_rand();
test_info.pubkey = another_pubkey;
assert!(!info.matches(&test_info));
test_info.pubkey = pubkey;
assert!(info.matches(&test_info));
} | rust_cleaned_test_functions.jsonl/61933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 565
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36425,
62308,
3109,
38344,
368,
341,
286,
1077,
95116,
284,
2291,
58358,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
3546,
284,
20738,
38259,
1731,
341,
310,
13963,
25,
34451,
486,
608... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_message() {
assert_eq!(parse_message(":test!test@test PRIVMSG #test :Hello world!\r\n"),
Privmsg(":test!test@test", "#test", "Hello world!"));
assert_eq!(parse_message("PING :hello world\r\n"), Ping("hello world"));
} | rust_cleaned_test_functions.jsonl/111702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6462,
368,
341,
286,
2060,
10714,
10297,
6400,
6462,
18893,
1944,
0,
1944,
47327,
89345,
19575,
671,
1944,
549,
9707,
1879,
14771,
81,
1699,
4461,
4293,
15438,
3236,
18893,
1944,
0,
1944,
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_super_class_with_superfluous_type_params() {
err(
"
@open class A
class B: A[Int] {}",
pos(3, 22),
SemError::WrongNumberTypeParams(0, 1),
);
} | rust_cleaned_test_functions.jsonl/84189 | {
"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,
38886,
4790,
6615,
38886,
1489,
9193,
1819,
6745,
368,
341,
286,
1848,
1006,
310,
6228,
310,
569,
2508,
536,
362,
198,
310,
536,
425,
25,
362,
36261,
60,
4687,
756,
310,
1133,
7,
18,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lif_manager_remove_inexisting() {
let mut lm = LIFManager::new();
lm.add_lif(
&LIF::new(
3,
LIFType::LAN,
"lan1",
PortId::from(0),
vec![PortId::from(1), PortId::from(2)],
0,
None,
)
.unwrap(),
)
.unwrap();
lm.add_lif(
&LIF::new(3, LIFType::LAN, "lan2", PortId::from(0), vec![PortId::from(3)], 0, None)
.unwrap(),
)
.unwrap();
lm.add_lif(
&LIF::new(3, LIFType::WAN, "wan", PortId::from(0), vec![PortId::from(4)], 0, None)
.unwrap(),
)
.unwrap();
assert_eq!(lm.lifs.len(), 3);
let got = lm.remove_lif(5 as UUID);
assert_eq!(lm.lifs.len(), 3);
assert_eq!(got, None);
} | rust_cleaned_test_functions.jsonl/81919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
333,
12144,
18193,
1243,
36895,
368,
341,
286,
1077,
5206,
40238,
284,
444,
2773,
2043,
486,
931,
543,
286,
40238,
1364,
907,
333,
1006,
310,
609,
43,
2773,
486,
931,
1006,
394,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wait_context() {
let m = Arc::new(AtomicUsize::new(0));
let cnt = Arc::clone(&m);
let sys = System::new();
sys.block_on(async move {
let addr = ContextWait { cnt }.start();
addr.do_send(Ping);
addr.do_send(Ping);
addr.do_send(Ping);
});
sys.run().unwrap();
assert_eq!(m.load(Ordering::Relaxed), 1);
} | rust_cleaned_test_functions.jsonl/56896 | {
"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,
18760,
8467,
368,
341,
262,
1077,
296,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
13195,
284,
19689,
486,
19982,
2099,
76,
626,
262,
1077,
5708,
284,
739,
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_struct() {
init();
#[derive(Deserialize, PartialEq, Debug)]
struct Main {
test: Test,
}
#[derive(Deserialize, PartialEq, Debug)]
#[serde(rename = "test")]
struct Test {
__label__: String,
int: u32,
seq: Vec<String>,
}
let j = r#"test foo {
int 1;
seq a,"b";
}"#;
let expected = Main {
test: Test {
__label__: "foo".to_owned(),
int: 1,
seq: vec!["a".to_owned(), "b".to_owned()],
},
};
assert_eq!(expected, from_str(j).unwrap());
} | rust_cleaned_test_functions.jsonl/31458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
368,
341,
286,
2930,
1428,
286,
11506,
27098,
7,
64465,
11,
55039,
11,
11091,
5563,
286,
2036,
4697,
341,
310,
1273,
25,
3393,
345,
286,
555,
286,
11506,
27098,
7,
64465,
11,
55039,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserializes() {
let data = r#"[1.234, "i", "whatever"]"#;
let e: Entry = serde_json::from_str(data).unwrap();
assert_eq!(
e,
Entry {
time: 1.234,
event_type: EventType::Input,
event_data: "whatever".to_string(),
}
);
} | rust_cleaned_test_functions.jsonl/9026 | {
"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,
15768,
2848,
4756,
368,
341,
286,
1077,
821,
284,
435,
2,
36864,
16,
13,
17,
18,
19,
11,
330,
72,
497,
330,
68286,
1341,
57676,
280,
286,
1077,
384,
25,
15788,
284,
61570,
9455,
486,
1499,
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_emoji_parser() {
let emoji = parse_emoji("<:name:12345>").unwrap();
assert_eq!(emoji.name, "name");
assert_eq!(emoji.id, 12_345);
} | rust_cleaned_test_functions.jsonl/58602 | {
"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,
62,
37523,
18517,
368,
341,
286,
1077,
42365,
284,
4715,
62,
37523,
9639,
25,
606,
25,
16,
17,
18,
19,
20,
61032,
15454,
543,
286,
2060,
10714,
10297,
37523,
2644,
11,
330,
606,
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 |
#[test]
fn test_external_function() -> Result<()> {
// NB: here we test passing the function from one virtual machine instance
// be called.
let function: Function = run(
&["main"],
(),
r#"
fn test() { 42 }
fn main() { test }
"#,
)?;
let output: i64 = run(
&["main"],
(function,),
r#"
fn main(f) { f() }
"#,
)?;
assert_eq!(42, output);
Ok(())
} | rust_cleaned_test_functions.jsonl/87460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47432,
9174,
368,
1464,
5714,
71698,
341,
262,
442,
34979,
25,
1588,
582,
1273,
12299,
279,
729,
504,
825,
4108,
5662,
2867,
7213,
262,
442,
387,
2598,
382,
262,
1077,
729,
25,
5712,
284,
1598,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_consecutive_count() {
assert_eq!(consecutive_count::<u8>(&vec![ ], 9), 0);
assert_eq!(consecutive_count::<u8>(&vec![0x00 ], 9), 1);
assert_eq!(consecutive_count::<u8>(&vec![0x00, 0x00, 0x00, 0x00 ], 9), 4);
assert_eq!(consecutive_count::<u8>(&vec![0x00, 0x00, 0x00, 0x00, 0x01], 9), 4);
assert_eq!(consecutive_count::<u8>(&vec![0x00, 0x00, 0x00, 0x00 ], 3), 3);
assert_eq!(consecutive_count::<u8>(&vec![0x00, 0x00 ], 3), 2);
assert_eq!(consecutive_count::<u8>(&vec![0x00, 0x00, 0x01 ], 3), 2);
} | rust_cleaned_test_functions.jsonl/33170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
85780,
3180,
368,
341,
286,
2060,
10714,
10297,
443,
85780,
3180,
27638,
84,
23,
44784,
4083,
20703,
999,
10654,
220,
24,
701,
220,
15,
317,
286,
2060,
10714,
10297,
443,
85780,
3180,
27638,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fragment_type() {
fn test_fragment_type_helper(fragment_offset: u16, expect_fragment_type: Ipv4FragmentType) {
let mut builder = new_builder();
builder.fragment_offset(fragment_offset);
let mut buf = [0; IPV4_MIN_HDR_LEN]
.into_serializer()
.encapsulate(builder)
.serialize_vec_outer()
.unwrap();
let packet = buf.parse::<Ipv4Packet<_>>().unwrap();
assert_eq!(packet.fragment_type(), expect_fragment_type);
}
test_fragment_type_helper(0x0000, Ipv4FragmentType::InitialFragment);
test_fragment_type_helper(0x0008, Ipv4FragmentType::NonInitialFragment);
} | rust_cleaned_test_functions.jsonl/31691 | {
"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,
43012,
1819,
368,
341,
286,
5168,
1273,
43012,
1819,
10418,
60681,
6917,
25,
575,
16,
21,
11,
1720,
43012,
1819,
25,
358,
30168,
19,
9488,
929,
8,
341,
310,
1077,
5206,
7363,
284,
501,
28532,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_packets() {
solana_logger::setup();
let mut packet_batches = (0..16)
.map(|packets_id| {
let packet_batch = PacketBatch::new(
(0..32)
.map(|packet_id| {
// forwarded; Therefore we need to create real packets here.
let keypair = Keypair::new();
let pubkey = solana_sdk::pubkey::new_rand();
let blockhash = Hash::new_unique();
let transaction =
system_transaction::transfer(&keypair, &pubkey, 1, blockhash);
let mut p = Packet::from_data(None, &transaction).unwrap();
p.meta.port = packets_id << 8 | packet_id;
p
})
.collect_vec(),
);
let valid_indexes = (0..32)
.filter_map(|x| if x % 2 != 0 { Some(x as usize) } else { None })
.collect_vec();
DeserializedPacketBatch::new(packet_batch, valid_indexes, false)
})
.collect_vec();
let result = BankingStage::filter_valid_packets_for_forwarding(packet_batches.iter());
assert_eq!(result.len(), 256);
// packets in a batch are forwarded in arbitrary order; verify the ports match after
// sorting
let expected_ports: Vec<_> = (0..16)
.flat_map(|packets_id| {
(0..16).map(move |packet_id| {
let packet_id = packet_id * 2 + 1;
(packets_id << 8 | packet_id) as u16
})
})
.collect();
let mut forwarded_ports: Vec<_> = result.into_iter().map(|p| p.meta.port).collect();
forwarded_ports.sort_unstable();
assert_eq!(expected_ports, forwarded_ports);
packet_batches[0].forwarded = true;
let result = BankingStage::filter_valid_packets_for_forwarding(packet_batches.iter());
assert_eq!(result.len(), 240);
} | rust_cleaned_test_functions.jsonl/45480 | {
"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,
8727,
8337,
63569,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
5206,
10151,
57755,
284,
320,
15,
496,
16,
21,
340,
310,
659,
2186,
22428,
4748,
1415,
842,
91,
341,
394,
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_remove() {
let mut map = PolyMap::new();
map.insert("a", 0x87654321_u32);
assert_eq!(map.remove("a"), Some(0x87654321_u32));
assert_eq!(map.get::<_, u32>("a"), None);
let b = "foo".to_string();
map.insert("b", b);
assert_eq!(map.get("b"), Some(&"foo".to_string()));
let bb: String = map.remove("b").unwrap();
assert_eq!(bb, "foo");
} | rust_cleaned_test_functions.jsonl/18702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
341,
286,
1077,
5206,
2415,
284,
18767,
2227,
486,
931,
1428,
286,
2415,
7030,
445,
64,
497,
220,
15,
87,
23,
22,
21,
20,
19,
18,
17,
16,
7300,
18,
17,
317,
286,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmd_with_unknown_format() {
let output = launch_command_line(vec![
"-i",
"./tests/data/luxembourg_filtered.osm.pbf",
"-o",
"cosmogony.bad",
]);
assert!(!output.status.success());
assert!(String::from_utf8_lossy(&output.stderr).contains("Unable to detect the file format"));
} | rust_cleaned_test_functions.jsonl/22518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
6615,
57507,
8955,
368,
341,
262,
1077,
2550,
284,
7050,
10811,
6528,
25592,
90515,
286,
6523,
72,
756,
286,
5924,
23841,
13167,
13328,
2200,
55018,
51429,
9291,
76,
556,
13233,
756,
286,
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_ne() {
let v1 = Vec4::new(1.0, 2.0, 3.0, 4.0);
let v2 = Vec4::new(1.0, 2.0, 3.0, 5.0);
assert_ne!(v1, v2);
} | rust_cleaned_test_functions.jsonl/38320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
368,
341,
286,
1077,
348,
16,
284,
11312,
19,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
317,
286,
1077,
348,
17,
284,
11312,
19,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_into_labelled_generic() {
let variant_a = into_labelled_generic(LabelledEnum1::VariantA);
let variant_b = into_labelled_generic(LabelledEnum1::VariantB(42));
let variant_c = into_labelled_generic(LabelledEnum1::VariantC {
x: "test".into(),
y: true,
});
assert_eq!(
variant_a,
Coproduct::inject(field!((V, a, r, i, a, n, t, A), hlist![])),
);
assert_eq!(
variant_b,
Coproduct::inject(field!(
(V, a, r, i, a, n, t, B),
hlist![field!((_, _0), 42i32, "_0")]
)),
);
assert_eq!(
variant_c,
Coproduct::inject(field!(
(V, a, r, i, a, n, t, C),
hlist![field!((x), "test".into()), field!((y), true)]
))
);
} | rust_cleaned_test_functions.jsonl/32228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
45514,
6106,
832,
41232,
368,
341,
262,
1077,
11424,
4306,
284,
1119,
6106,
832,
41232,
56606,
832,
10766,
16,
486,
20746,
32,
317,
262,
1077,
11424,
880,
284,
1119,
6106,
832,
41232,
56606... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_kernel_load_addr() {
let vmm_config = default_vmm_config();
let vmm = mock_vmm(vmm_config);
let mut kern_load = KernelLoaderResult {
kernel_load: GuestAddress(0x0100_0000), // 1 MiB.
kernel_end: 0x0223_B000, // 1 MiB + size of a vmlinux test image.
setup_header: None,
pvh_boot_cap: PvhBootCapability::PvhEntryNotPresent,
};
let actual_kernel_load_addr = vmm.compute_kernel_load_addr(&kern_load).unwrap();
let expected_load_addr = kern_load.kernel_load;
assert_eq!(actual_kernel_load_addr, expected_load_addr);
kern_load.kernel_load = GuestAddress(vmm.guest_memory.last_addr().raw_value() + 1);
assert!(matches!(
vmm.compute_kernel_load_addr(&kern_load),
Err(Error::RipOutOfGuestMemory)
));
// bzImage kernel scenario: happy case
// while parsing the bzImage file.
kern_load.kernel_load = GuestAddress(0x0100_0000); // 1 MiB.
kern_load.setup_header = Some(setup_header {
version: 0x0200,
loadflags: 1,
..Default::default()
});
let expected_load_addr = kern_load.kernel_load.unchecked_add(0x200);
let actual_kernel_load_addr = vmm.compute_kernel_load_addr(&kern_load).unwrap();
assert_eq!(expected_load_addr, actual_kernel_load_addr);
// falls out of guest memory
kern_load.kernel_load = GuestAddress(vmm.guest_memory.last_addr().raw_value() - 511);
assert!(matches!(
vmm.compute_kernel_load_addr(&kern_load),
Err(Error::RipOutOfGuestMemory)
));
} | rust_cleaned_test_functions.jsonl/26850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 840
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
26876,
12411,
7387,
368,
341,
286,
1077,
348,
3821,
5332,
284,
1638,
2273,
3821,
5332,
543,
286,
1077,
348,
3821,
284,
7860,
2273,
3821,
3747,
3821,
5332,
626,
1789,
286,
1077,
5206,
82585,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_telugu() {
assert_eq!(is_telugu('ఁ'), true);
assert_eq!(is_telugu('౿'), true);
assert_eq!(is_telugu('Ж'), false);
} | rust_cleaned_test_functions.jsonl/123610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
67180,
29785,
368,
341,
286,
2060,
10714,
10297,
285,
67180,
29785,
492,
31305,
223,
4567,
830,
317,
286,
2060,
10714,
10297,
285,
67180,
29785,
492,
52798,
123,
4567,
830,
317,
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 |
#[test]
fn test_run_keyword_fsm() {
let expr = String::from("true or false");
match run_keyword_fsm(TokenType::True, "true", &expr, 0) {
Some(tok) => assert_eq!(tok.content, "true"),
None => assert!(false),
}
} | rust_cleaned_test_functions.jsonl/30851 | {
"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,
14007,
45824,
97069,
368,
341,
286,
1077,
15169,
284,
923,
486,
1499,
445,
1866,
476,
895,
797,
286,
2432,
1598,
45824,
97069,
91211,
486,
2514,
11,
330,
1866,
497,
609,
9413,
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... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.