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_same_module_struct_resolution() {
let allocator = Arena::new();
let vm_cache = VMModuleCache::new(&allocator);
let code = String::from(
"
modules:
module M1 {
struct X {}
struct T { i: u64, x: V#Self.X }
}
script:
main() {
return;
}
",
);
let module = parse_modules(code);
let fetcher = FakeFetcher::new(module);
let block_cache = BlockModuleCache::new(&vm_cache, fetcher);
{
let code_key = CodeKey::new(AccountAddress::default(), "M1".to_string());
let module_ref = block_cache.get_loaded_module(&code_key).unwrap().unwrap();
let gas = GasMeter::new(100_000_000);
let struct_x = block_cache
.resolve_struct_def(module_ref, StructDefinitionIndex::new(0), &gas)
.unwrap()
.unwrap()
.unwrap();
let struct_t = block_cache
.resolve_struct_def(module_ref, StructDefinitionIndex::new(1), &gas)
.unwrap()
.unwrap()
.unwrap();
assert_eq!(struct_x, StructDef::new(vec![]));
assert_eq!(
struct_t,
StructDef::new(vec![Type::U64, Type::Struct(StructDef::new(vec![]))]),
);
}
} | rust_cleaned_test_functions.jsonl/127132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 658
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
10750,
15126,
39849,
368,
341,
262,
1077,
43655,
284,
27047,
486,
931,
543,
262,
1077,
10995,
11529,
284,
17792,
3332,
8233,
486,
931,
2099,
57631,
626,
262,
1077,
2038,
284,
923,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_local_timestamp_without_date() {
let c_time = chrono::offset::Utc::now().format("%Y-%m-%d %H:%M:%S").to_string();
assert_eq!(
convert_to_local_timestamp(&c_time, false).unwrap(),
Local::now().format("%H:%M:%S").to_string(),
);
} | rust_cleaned_test_functions.jsonl/10674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
13564,
23073,
39904,
4164,
368,
341,
286,
1077,
272,
3009,
284,
80372,
486,
3176,
486,
97768,
486,
3328,
1005,
2243,
4430,
56,
11069,
76,
11069,
67,
1018,
39,
7533,
44,
7533,
50,
1827,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_step_config() {
let l = default_logger();
// a raft that cannot make progress
let mut r = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
r.become_candidate();
r.become_leader();
let index = r.raft_log.last_index();
let mut m = new_message(1, 1, MessageType::MsgPropose, 0);
let mut e = Entry::default();
e.set_entry_type(EntryType::EntryConfChange);
m.mut_entries().push(e);
r.step(m).expect("");
assert_eq!(r.raft_log.last_index(), index + 1);
} | rust_cleaned_test_functions.jsonl/19145 | {
"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,
11946,
5332,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
442,
264,
52455,
429,
4157,
1281,
5098,
198,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
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_slow() {
let text = b"gccttaacattattacgccta\0";
let pos_correct = vec![
21, 20, 5, 6, 14, 11, 8, 7, 17, 1, 15, 18, 2, 16, 0, 19, 4, 13, 10, 3, 12, 9,
];
assert_eq!(slow(text), pos_correct);
} | rust_cleaned_test_functions.jsonl/51322 | {
"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,
82447,
368,
341,
286,
1077,
1467,
284,
293,
1,
20669,
302,
2565,
580,
1587,
1587,
580,
20669,
77519,
59,
15,
3302,
286,
1077,
1133,
31550,
284,
7486,
90515,
310,
220,
17,
16,
11,
220,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_undo_char() {
let mut test = setup_new_test();
// test deletes a single mistake
test.on_char(get_wrong_char(test.current_char));
assert_eq!(test.done, 1);
assert_eq!(test.mistakes, 1);
test.undo_char();
assert_eq!(test.done, 0);
assert_eq!(test.mistakes, 0);
// test doesn't do anything at the beginning
test.undo_char();
assert_eq!(test.done, 0);
assert_eq!(test.mistakes, 0);
// test deletes extras
while test.current_char != ' ' {
test.on_char(test.current_char);
}
let done = test.done;
test.on_char(get_wrong_char(test.current_char));
assert!(!test.fetch(done - 1).is_empty());
test.undo_char();
assert!(test.fetch(done - 1).is_empty());
} | rust_cleaned_test_functions.jsonl/27499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98940,
9232,
368,
341,
286,
1077,
5206,
1273,
284,
6505,
5921,
4452,
1428,
286,
442,
1273,
54170,
264,
3175,
16523,
198,
286,
1273,
3488,
9232,
5433,
75198,
9232,
8623,
4952,
9232,
1106,
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... | 2 |
#[test]
fn test_name_auction_length() {
assert_eq!(
get_name_auction_length(&String::from("1.chain")).unwrap(),
29760
);
assert_eq!(
get_name_auction_length(&String::from("12345678.chain")).unwrap(),
14880
);
assert_eq!(
get_name_auction_length(&String::from("123456789.chain")).unwrap(),
480
);
assert_eq!(
get_name_auction_length(&String::from("1234567890.chain")).unwrap(),
480
);
assert_eq!(
get_name_auction_length(&String::from("12345467890123.chain")).unwrap(),
0
);
} | rust_cleaned_test_functions.jsonl/82846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
4306,
2654,
5118,
368,
341,
262,
2060,
10714,
33673,
286,
633,
1269,
4306,
2654,
5118,
2099,
703,
486,
1499,
445,
16,
52041,
15197,
15454,
3148,
286,
220,
17,
24,
22,
21,
15,
198,
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_truncating_buffer_serializer() {
// Test truncate front.
let body = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
let ser = BufferSerializer::new_vec_truncate(
Buf::new(body.clone(), ..),
TruncateDirection::DiscardFront,
);
let buf = ser.serialize_mtu_outer(4).unwrap();
let buf: &[u8] = buf.as_ref();
assert_eq!(buf, &[6, 7, 8, 9][..]);
// Test truncate back.
let ser = BufferSerializer::new_vec_truncate(
Buf::new(body.clone(), ..),
TruncateDirection::DiscardBack,
);
let buf = ser.serialize_mtu_outer(7).unwrap();
let buf: &[u8] = buf.as_ref();
assert_eq!(buf, &[0, 1, 2, 3, 4, 5, 6][..]);
let ser = BufferSerializer::new_vec_truncate(
Buf::new(body.clone(), ..),
TruncateDirection::NoTruncating,
);
assert!(ser.serialize_mtu_outer(5).is_err());
let ser = BufferSerializer::new_vec(Buf::new(body.clone(), ..));
assert!(ser.serialize_mtu_outer(5).is_err());
} | rust_cleaned_test_functions.jsonl/83356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
1347,
1095,
7776,
67441,
368,
341,
1789,
286,
442,
3393,
56772,
4065,
624,
23459,
286,
1077,
2487,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_with_kwargs() {
let gil = Python::acquire_gil();
let py = gil.python();
let list = vec![3, 6, 5, 4, 7].to_object(py);
let dict = vec![("reverse", true)].into_py_dict(py);
list.call_method(py, "sort", (), Some(dict)).unwrap();
assert_eq!(list.extract::<Vec<i32>>(py).unwrap(), vec![7, 6, 5, 4, 3]);
} | rust_cleaned_test_functions.jsonl/57476 | {
"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,
13429,
6615,
36235,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
1140,
284,
7486,
20703,
18,
11,
220,
21,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_385() {
assert_eq!(
Solution::deserialize("324".to_string()),
NestedInteger::Int(324)
);
assert_eq!(
Solution::deserialize("[123,[456,[789]]]".to_string()),
NestedInteger::List(vec![
NestedInteger::Int(123),
NestedInteger::List(vec![
NestedInteger::Int(456),
NestedInteger::List(vec![NestedInteger::Int(789)])
])
])
);
} | rust_cleaned_test_functions.jsonl/95 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
18,
23,
20,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
66777,
445,
18,
17,
19,
3263,
983,
3904,
14702,
310,
71742,
3486,
486,
1072,
7,
18,
17,
19,
340,
286,
1439,
286,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_record_type() {
let mut log = new_record_test();
let test = "foo";
log.write(test);
// the record type is in header[6]
log.increment_byte(6, 100);
log.fix_checksum(0, test.len());
log.read();
} | rust_cleaned_test_functions.jsonl/46689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
14192,
1819,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
1077,
1273,
284,
330,
7975,
876,
286,
1487,
3836,
8623,
317,
286,
442,
279,
3255,
943,
374,
304,
4247,
58,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_on() {
let c = MainContext::new();
let mut v = None;
{
let v = &mut v;
let future = futures_util::future::lazy(|_ctx| {
*v = Some(123);
Ok::<i32, ()>(123)
});
let res = c.block_on(future);
assert_eq!(res, Ok(123));
}
assert_eq!(v, Some(123));
} | rust_cleaned_test_functions.jsonl/82049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
4470,
368,
341,
286,
1077,
272,
284,
4697,
1972,
486,
931,
1428,
286,
1077,
5206,
348,
284,
2240,
280,
286,
341,
310,
1077,
348,
284,
609,
6984,
348,
401,
310,
1077,
3853,
284,
36823,
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_vcx_issuer_credential_release() {
init!("true");
let handle = create_default_issuer_credential();
let unknown_handle = handle + 1;
assert_eq!(vcx_issuer_credential_release(unknown_handle), error::INVALID_ISSUER_CREDENTIAL_HANDLE.code_num);
} | rust_cleaned_test_functions.jsonl/66781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
62,
66817,
666,
30320,
24577,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
1855,
9993,
62,
66817,
666,
30320,
543,
286,
1077,
9788,
10630,
284,
3705,
488,
220,
16,
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_tail() {
let (at, mut ucmd) = testing(UTIL_NAME);
let result = ucmd.args(&["-d", ":", "--complement", "-f", "1", INPUT]).run();
assert_eq!(result.stdout, at.read("lists_tail.expected"));
} | rust_cleaned_test_functions.jsonl/77650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35471,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
7497,
7,
36969,
4708,
317,
262,
1077,
1102,
284,
575,
8710,
16365,
2099,
1183,
12,
67,
497,
330,
12147,
14482,
874,
2764,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_emit_simple_binary_op() {
let program = Program::Binary {
op: OpCode::Add as u8,
left: int(73),
right: int(68)
};
let code = emit(&program);
assert_eq!(interpret(&code), Ok(Term::Integer(141)));
} | rust_cleaned_test_functions.jsonl/24917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
30015,
31761,
10287,
368,
341,
262,
1077,
2025,
284,
6687,
486,
21338,
341,
286,
1179,
25,
97779,
486,
2212,
438,
575,
23,
345,
286,
2115,
25,
526,
7,
22,
18,
1326,
286,
1290,
25,
526,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_windows_last() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let c = v.windows(2);
assert_eq!(c.last().unwrap()[1], 5);
let v2: &[i32] = &[0, 1, 2, 3, 4];
let c2 = v2.windows(2);
assert_eq!(c2.last().unwrap()[0], 3);
} | rust_cleaned_test_functions.jsonl/4148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58220,
12195,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
272,
284,
348,
68113,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_unmodified_tree_into_tree_to_blob() -> BitResult<()> {
BitRepo::with_minimal_repo_with_dir(|repo| {
let ours = commit! {
dir < "typechange blob->tree"
};
let theirs = commit! {
dir {
bar < "default bar contents"
}
};
repo.three_way_merge(ours, theirs)?;
assert_eq!(cat!(repo: "dir"), "typechange blob->tree");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
4907,
27162,
11663,
45514,
11663,
2346,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
6615,
4334,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
526... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_kernel_magic() {
let gm = create_guest_mem();
let mut bad_image = make_test_bin();
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
let offset = 0x1;
#[cfg(target_arch = "aarch64")]
let offset = 0x38;
bad_image[offset] = 0x33;
assert_eq!(
Err(Error::InvalidElfMagicNumber),
load_kernel(&gm, &mut Cursor::new(&bad_image), 0)
);
} | rust_cleaned_test_functions.jsonl/88246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
26876,
54612,
368,
341,
286,
1077,
37879,
284,
1855,
62739,
12976,
543,
286,
1077,
5206,
3873,
4954,
284,
1281,
4452,
21816,
543,
286,
11506,
14072,
40268,
8637,
34330,
284,
330,
87,
23,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_submit_dir() {
let mut program = program_def(
"%{SUBMIT_DIR}",
Some("%{SUBMIT_DIR}/out"),
Some("%{SUBMIT_DIR}/err"),
"/submit-dir",
5,
1,
);
replace_placeholders_worker(&mut program);
assert_eq!(program.cwd, Some("/submit-dir".into()));
assert_eq!(program.stdout, StdioDef::File("/submit-dir/out".into()));
assert_eq!(program.stderr, StdioDef::File("/submit-dir/err".into()));
} | rust_cleaned_test_functions.jsonl/107297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
31674,
4334,
368,
341,
286,
1077,
5206,
2025,
284,
2025,
7844,
1006,
310,
5962,
90,
29038,
18330,
8291,
24375,
310,
4329,
4430,
90,
29038,
18330,
8291,
4472,
411,
4461,
310,
4329,
4430,
90,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_write_le_mem() {
let uints = [0, 1, 2, 42, 10_123, 100_123_456, ::u64::MAX];
let mut writer = MemWriter::new();
for i in uints.iter() {
writer.write_le_u64(*i).unwrap();
}
let mut reader = MemReader::new(writer.unwrap());
for i in uints.iter() {
assert!(reader.read_le_u64().unwrap() == *i);
}
} | rust_cleaned_test_functions.jsonl/4835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
11751,
12976,
368,
341,
286,
1077,
2622,
82,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
19,
17,
11,
220,
16,
15,
62,
16,
17,
18,
11,
220,
16,
15,
15,
62,
16,
17,
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... | 3 |
#[test]
fn test_idempotent() {
let blockman = BlockManager::new();
let a = create_block("A", NULL_BLOCK_IDENTIFIER, 0);
let b = create_block("B", "A", 1);
let c = create_block("C", "B", 1);
let d = create_block("D", "C", 1);
blockman
.put(vec![a.clone(), b.clone(), c.clone(), d.clone()])
.unwrap();
{
let _d_ref = blockman.ref_block("D").unwrap();
blockman
.put(vec![a.clone(), b.clone(), c.clone(), d.clone()])
.unwrap();
}
assert!(blockman.unref_block("D").unwrap());
} | rust_cleaned_test_functions.jsonl/10256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
3262,
63532,
368,
341,
286,
1077,
2504,
1515,
284,
8362,
2043,
486,
931,
1428,
286,
1077,
264,
284,
1855,
7113,
445,
32,
497,
1770,
18756,
49554,
11,
220,
15,
317,
286,
1077,
293,
284,
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_issuer_handle_credential_init_message_from_initial_state() {
let _setup = TestModeSetup::init();
let mut issuer_sm = _issuer_sm();
issuer_sm = issuer_sm.handle_message(CredentialIssuanceMessage::CredentialInit(mock_connection())).unwrap();
assert_match!(IssuerState::OfferSent(_), issuer_sm.state);
} | rust_cleaned_test_functions.jsonl/20324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
66817,
10630,
666,
30320,
6137,
6462,
5673,
15809,
4387,
368,
341,
310,
1077,
716,
15188,
284,
3393,
3636,
21821,
486,
2327,
1428,
310,
1077,
5206,
54835,
15874,
284,
716,
66817,
15874,
543,
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_keep_alive_msg() {
let msg_str = r#"{"timestamp":1568284616.24,"peer":"192.0.2.0","peer_asn":"64496","id":"21-192-0-2-0-53776312","host":"rrc00","type":"KEEPALIVE"}
"#;
let _msg: RisMessage = serde_json::from_str(&msg_str).unwrap();
} | rust_cleaned_test_functions.jsonl/94948 | {
"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,
50293,
58850,
6483,
368,
341,
286,
1077,
3750,
2895,
284,
435,
55543,
4913,
13035,
788,
16,
20,
21,
23,
17,
23,
19,
21,
16,
21,
13,
17,
19,
1335,
16537,
3252,
16,
24,
17,
13,
15,
13,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_ended_flatten() {
let u = [0, 1];
let v = [5, 6, 7, 8];
let mut it = u.iter().map(|x| &v[*x..v.len()]).flatten();
assert_eq!(it.next_back().unwrap(), &8);
assert_eq!(it.next().unwrap(), &5);
assert_eq!(it.next_back().unwrap(), &7);
assert_eq!(it.next_back().unwrap(), &6);
assert_eq!(it.next_back().unwrap(), &8);
assert_eq!(it.next().unwrap(), &6);
assert_eq!(it.next_back().unwrap(), &7);
assert_eq!(it.next_back(), None);
assert_eq!(it.next(), None);
assert_eq!(it.next_back(), None);
} | rust_cleaned_test_functions.jsonl/70228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
62,
2883,
5081,
14456,
368,
341,
262,
1077,
575,
284,
508,
15,
11,
220,
16,
935,
262,
1077,
348,
284,
508,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
935,
262,
1077,
5206,
432,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header() {
fn t(input: &str, expect: &str) {
let output = format!("{}", Markdown(input));
assert_eq!(output, expect);
reset_ids(true);
}
t("# Foo bar", "\n<h1 id='foo-bar' class='section-header'>\
<a href='#foo-bar'>Foo bar</a></h1>");
t("## Foo-bar_baz qux", "\n<h2 id='foo-bar_baz-qux' class=\'section-\
header'><a href='#foo-bar_baz-qux'>Foo-bar_baz qux</a></h2>");
t("### **Foo** *bar* baz!?!& -_qux_-%",
"\n<h3 id='foo-bar-baz--_qux_-' class='section-header'>\
<a href='#foo-bar-baz--_qux_-'><strong>Foo</strong> \
<em>bar</em> baz!?!& -_qux_-%</a></h3>");
t("####**Foo?** & \\*bar?!* _`baz`_ ❤ #qux",
"\n<h4 id='foo--bar--baz--qux' class='section-header'>\
<a href='#foo--bar--baz--qux'><strong>Foo?</strong> & *bar?!* \
<em><code>baz</code></em> ❤ #qux</a></h4>");
} | rust_cleaned_test_functions.jsonl/43372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
368,
341,
286,
5168,
259,
5384,
25,
609,
495,
11,
1720,
25,
609,
495,
8,
341,
310,
1077,
2550,
284,
3561,
79878,
73192,
5384,
1106,
310,
2060,
10714,
10297,
3006,
11,
1720,
317,
310,
758... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exit_without_value() {
test_interpreter_and_jit_asm!(
"
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x0 } },
1
);
} | rust_cleaned_test_functions.jsonl/59004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16880,
39904,
3142,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
4869,
756,
286,
10239,
286,
84201,
286,
314,
70886,
7338,
11,
592,
25,
5714,
91,
314,
592,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_the_other_thing() {
//Define the function "add"
//Takes are x and y
modfunc!(replace_add,IDC, add(x: u64, y: u64) => u64 {
x + y
});
//verify add works correctly
assert_eq!(add(5,2),7);
//define a function that is not add
fn totally_not_add(x: u64, y: u64) -> u64 {
return x*x+y;
}
replace_add(totally_not_add);
//add no longer works as expected
assert_eq!(add(5,2),27);
} | rust_cleaned_test_functions.jsonl/121111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16068,
30456,
62,
1596,
368,
1476,
262,
442,
35338,
279,
729,
330,
718,
698,
262,
442,
51,
2050,
525,
856,
323,
379,
198,
262,
1463,
2830,
10297,
8156,
2891,
96758,
34,
11,
912,
2075,
25,
575,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_deserialize() {
let key = Pubkey::new_unique();
let (account1, _account2) = make_two_accounts(&key);
account1.deserialize_data::<String>().unwrap();
} | rust_cleaned_test_functions.jsonl/48199 | {
"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,
13500,
15768,
9050,
368,
341,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
320,
4608,
16,
11,
716,
4608,
17,
8,
284,
1281,
23241,
55665,
2099,
792,
317,
286,
2692,
16,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vote_index_one() {
let keypair = Keypair::new();
let vote = CrdsValue::new_unsigned(CrdsData::Vote(
0,
Vote::new(&keypair.pubkey(), test_tx(), 0),
));
for i in 0..MAX_VOTES {
let votes = vec![&vote];
assert!(CrdsValue::compute_vote_index(i as usize, votes) > 0);
let votes = vec![&vote];
assert!(CrdsValue::compute_vote_index(i as usize, votes) < MAX_VOTES);
}
} | rust_cleaned_test_functions.jsonl/5327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
54360,
3560,
11667,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
6910,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
41412,
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... | 2 |
#[test]
fn test_t09() {
// Flatten arrays
let (r, sioe) = do_execute!(&["-s", "..\"dna\""], super::IN_DAT_09);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(
buff!(sioe, sout),
"[\"c\",\"a\",\"c\",\"g\",\"t\",\"a\",\"t\"]\n",
);
assert_eq!(r.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/118364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
15,
24,
368,
341,
286,
442,
85638,
18386,
198,
286,
1077,
320,
81,
11,
274,
815,
68,
8,
284,
653,
44329,
0,
2099,
1183,
12,
82,
497,
32213,
2105,
92877,
2105,
7914,
2256,
486,
687,
3634... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eh_frame_hdr_indirect_length() {
let section = Section::with_endian(Endian::Little)
.L8(1)
.L8(0x0b)
.L8(0x83)
.L8(0x0b)
.L32(0x12345)
.L32(2);
let section = section.get_contents().unwrap();
let bases = BaseAddresses::default();
let result = EhFrameHdr::new(§ion, LittleEndian).parse(&bases, 8);
assert!(result.is_err());
assert_eq!(result.unwrap_err(), Error::UnsupportedPointerEncoding);
} | rust_cleaned_test_functions.jsonl/9377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
71,
8929,
28238,
9122,
1226,
5118,
368,
341,
286,
1077,
3772,
284,
11113,
486,
4197,
87193,
7,
43231,
486,
38103,
340,
310,
659,
43,
23,
7,
16,
340,
310,
659,
43,
23,
7,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_alogithm_id() {
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha1),
TPM2_ALG_SHA1
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha256),
TPM2_ALG_SHA256
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha384),
TPM2_ALG_SHA384
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha512),
TPM2_ALG_SHA512
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sm3_256),
TPM2_ALG_SM3_256
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha3_256),
TPM2_ALG_SHA3_256
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha3_384),
TPM2_ALG_SHA3_384
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(HashingAlgorithm::Sha3_512),
TPM2_ALG_SHA3_512
);
} | rust_cleaned_test_functions.jsonl/41501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 675
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
31645,
27638,
4239,
44,
17,
8912,
38,
3450,
6831,
18122,
7,
6370,
287,
27847,
486,
62316,
16,
1326,
310,
63644,
17,
8912,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_broker_app_name_job() {
let _ = env_logger::builder().is_test(true).try_init();
assert_eq!(
"node-instance-name-1-job",
create_broker_app_name("instance.name", Some("node"), true, "1-job")
);
} | rust_cleaned_test_functions.jsonl/1224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
880,
45985,
8191,
1269,
20298,
368,
341,
286,
1077,
716,
284,
6105,
27413,
486,
17850,
1005,
285,
4452,
3715,
568,
1539,
6137,
1428,
286,
2060,
10714,
33673,
310,
330,
3509,
73655,
11494,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggregate_signatures_1() {
let sign_1 = Bn256.to_compressed_g1(G1::one()).unwrap();
let sign_2 = Bn256.to_compressed_g1(G1::one()).unwrap();
let signatures = [&sign_1[..], &sign_2[..]];
// Aggregation
let agg_signature = Bn256
.aggregate_signatures(&signatures)
.expect("Signature aggregation should not fail if G1 points are valid.");
// Check
let expected =
hex::decode("02030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd3")
.unwrap();
assert_eq!(agg_signature, expected);
} | rust_cleaned_test_functions.jsonl/65099 | {
"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,
20587,
14240,
11172,
2789,
62,
16,
368,
341,
1789,
286,
1077,
1841,
62,
16,
284,
425,
77,
17,
20,
21,
2389,
2965,
14318,
1889,
16,
6699,
16,
486,
603,
6011,
15454,
543,
286,
1077,
1841,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_block_at_wrong_location() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let mut ledger_db = create_db();
let account_key = AccountKey::random(&mut rng);
// initialize a ledger with 3 blocks.
let n_blocks = 3;
let (blocks, _) = populate_db(&mut ledger_db, n_blocks, 2);
assert_eq!(ledger_db.num_blocks().unwrap(), n_blocks);
let key_images = vec![KeyImage::from(rng.next_u64())];
let tx_out = TxOut::new(
100,
&account_key.default_subaddress(),
&RistrettoPrivate::from_random(&mut rng),
Default::default(),
)
.unwrap();
let outputs = vec![tx_out];
let block_contents = BlockContents::new(key_images, outputs);
// Appending a block to a previously written location should fail.
let mut new_block = Block::new(
BLOCK_VERSION,
&blocks[0].id,
1,
blocks[0].cumulative_txo_count,
&Default::default(),
&block_contents,
);
assert_eq!(
ledger_db.append_block(&new_block, &block_contents, None),
Err(Error::InvalidBlock)
);
// Appending a non-contiguous location should fail.
new_block.index = 3 * n_blocks;
assert_eq!(
ledger_db.append_block(&new_block, &block_contents, None),
Err(Error::InvalidBlock)
);
} | rust_cleaned_test_functions.jsonl/89699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 728
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7113,
3752,
75198,
13126,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
5206,
469... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skewness_with_low_d2() {
let skewness = |x: FisherSnedecor| x.skewness().unwrap();
get_value(0.1, 0.1, skewness);
} | rust_cleaned_test_functions.jsonl/42685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
365,
2090,
6615,
23767,
814,
17,
368,
341,
286,
1077,
40543,
2090,
284,
760,
87,
25,
35504,
50,
18694,
757,
269,
91,
856,
39454,
365,
2090,
1005,
15454,
543,
286,
633,
3142,
7,
15,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_clear_gif_full() {
assert_borders_full!("clear.gif",
Borders {
top: 0,
right: 0,
bottom: 0,
left: 0,
});
} | rust_cleaned_test_functions.jsonl/48478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
1889,
333,
16372,
368,
341,
262,
2060,
880,
7917,
16372,
17223,
7422,
16008,
756,
5108,
80712,
341,
6526,
1909,
25,
220,
15,
345,
6526,
1290,
25,
220,
15,
345,
6526,
5622,
25,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_time_coverage() {
let result = parse_time_coverage("2010", "2020", "P0001-00-00").unwrap();
let expected = (
TimeInstance::from(DateTime::new_utc(2010, 1, 1, 0, 0, 0)),
TimeInstance::from(DateTime::new_utc(2021, 1, 1, 0, 0, 0)),
TimeStep {
granularity: TimeGranularity::Years,
step: 1,
},
);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/121837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3009,
73384,
368,
341,
286,
1077,
1102,
284,
4715,
3009,
73384,
445,
17,
15,
16,
15,
497,
330,
17,
15,
17,
15,
497,
330,
47,
15,
15,
15,
16,
12,
15,
15,
12,
15,
15,
1827,
15454,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_csp_real() {
let json = r#"{
"csp-report": {
"document-uri": "https://sentry.io/sentry/csp/issues/88513416/",
"referrer": "https://sentry.io/sentry/sentry/releases/7329107476ff14cfa19cf013acd8ce47781bb93a/",
"violated-directive": "script-src",
"effective-directive": "script-src",
"original-policy": "default-src *; script-src 'make_csp_snapshot' 'unsafe-eval' 'unsafe-inline' e90d271df3e973c7.global.ssl.fastly.net cdn.ravenjs.com assets.zendesk.com ajax.googleapis.com ssl.google-analytics.com www.googleadservices.com analytics.twitter.com platform.twitter.com *.pingdom.net js.stripe.com api.stripe.com statuspage-production.s3.amazonaws.com s3.amazonaws.com *.google.com www.gstatic.com aui-cdn.atlassian.com *.atlassian.net *.jira.com *.zopim.com; font-src * data:; connect-src * wss://*.zopim.com; style-src 'make_csp_snapshot' 'unsafe-inline' e90d271df3e973c7.global.ssl.fastly.net s3.amazonaws.com aui-cdn.atlassian.com fonts.googleapis.com; img-src * data: blob:; report-uri https://sentry.io/api/54785/csp-report/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=39662eb9734f68e56b7f202260bb706be2f4cee7",
"disposition": "enforce",
"blocked-uri": "http://baddomain.com/test.js?_=1515535030116",
"line-number": 24,
"column-number": 66270,
"source-file": "https://e90d271df3e973c7.global.ssl.fastly.net/_static/f0c7c026a4b2a3d2b287ae2d012c9924/sentry/dist/vendor.js",
"status-code": 0,
"script-sample": ""
}
}"#;
let mut event = Event::default();
Csp::apply_to_event(json.as_bytes(), &mut event).unwrap();
assert_annotated_snapshot!(Annotated::new(event), @r###"
{
"culprit": "script-src",
"logentry": {
"formatted": "Blocked 'script' from 'baddomain.com'"
},
"request": {
"url": "https://sentry.io/sentry/csp/issues/88513416/",
"headers": [
[
"Referer",
"https://sentry.io/sentry/sentry/releases/7329107476ff14cfa19cf013acd8ce47781bb93a/"
]
]
},
"tags": [
[
"effective-directive",
"script-src"
],
[
"blocked-uri",
"http://baddomain.com/test.js?_=1515535030116"
]
],
"csp": {
"effective_directive": "script-src",
"blocked_uri": "http://baddomain.com/test.js?_=1515535030116",
"document_uri": "https://sentry.io/sentry/csp/issues/88513416/",
"original_policy": "default-src *; script-src 'make_csp_snapshot' 'unsafe-eval' 'unsafe-inline' e90d271df3e973c7.global.ssl.fastly.net cdn.ravenjs.com assets.zendesk.com ajax.googleapis.com ssl.google-analytics.com www.googleadservices.com analytics.twitter.com platform.twitter.com *.pingdom.net js.stripe.com api.stripe.com statuspage-production.s3.amazonaws.com s3.amazonaws.com *.google.com www.gstatic.com aui-cdn.atlassian.com *.atlassian.net *.jira.com *.zopim.com; font-src * data:; connect-src * wss://*.zopim.com; style-src 'make_csp_snapshot' 'unsafe-inline' e90d271df3e973c7.global.ssl.fastly.net s3.amazonaws.com aui-cdn.atlassian.com fonts.googleapis.com; img-src * data: blob:; report-uri https://sentry.io/api/54785/csp-report/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=39662eb9734f68e56b7f202260bb706be2f4cee7",
"referrer": "https://sentry.io/sentry/sentry/releases/7329107476ff14cfa19cf013acd8ce47781bb93a/",
"status_code": 0,
"violated_directive": "script-src",
"source_file": "https://e90d271df3e973c7.global.ssl.fastly.net/_static/f0c7c026a4b2a3d2b287ae2d012c9924/sentry/dist/vendor.js",
"line_number": 24,
"column_number": 66270,
"script_sample": "",
"disposition": "enforce"
}
}
"###);
} | rust_cleaned_test_functions.jsonl/4019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2154,
15266,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
310,
330,
66,
2154,
47411,
788,
341,
394,
330,
6062,
87232,
788,
330,
2428,
1110,
82,
4085,
4245,
2687,
4085,
2899,
2154,
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_entry_ref() {
let xs = [
("One".to_owned(), 10),
("Two".to_owned(), 20),
("Three".to_owned(), 30),
("Four".to_owned(), 40),
("Five".to_owned(), 50),
("Six".to_owned(), 60),
];
let mut map: HashMap<_, _> = xs.iter().cloned().collect();
match map.entry_ref("One") {
EntryRef::Vacant(_) => unreachable!(),
EntryRef::Occupied(mut view) => {
assert_eq!(view.get(), &10);
assert_eq!(view.insert(100), 10);
}
}
assert_eq!(map.get("One").unwrap(), &100);
assert_eq!(map.len(), 6);
match map.entry_ref("Two") {
EntryRef::Vacant(_) => unreachable!(),
EntryRef::Occupied(mut view) => {
let v = view.get_mut();
let new_v = (*v) * 10;
*v = new_v;
}
}
assert_eq!(map.get("Two").unwrap(), &200);
assert_eq!(map.len(), 6);
match map.entry_ref("Three") {
EntryRef::Vacant(_) => unreachable!(),
EntryRef::Occupied(view) => {
assert_eq!(view.remove(), 30);
}
}
assert_eq!(map.get("Three"), None);
assert_eq!(map.len(), 5);
match map.entry_ref("Ten") {
EntryRef::Occupied(_) => unreachable!(),
EntryRef::Vacant(view) => {
assert_eq!(*view.insert(1000), 1000);
}
}
assert_eq!(map.get("Ten").unwrap(), &1000);
assert_eq!(map.len(), 6);
} | rust_cleaned_test_functions.jsonl/26970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 948
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
7793,
368,
341,
286,
1077,
11943,
284,
2278,
310,
3489,
3966,
3263,
983,
51973,
1507,
220,
16,
15,
1326,
310,
3489,
11613,
3263,
983,
51973,
1507,
220,
17,
15,
1326,
310,
3489,
19641,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_parse_arguments_pgo() {
assert_eq!(
CompilerArguments::CannotCache("-fprofile-use", None),
parse_arguments_(
stringvec!["-c", "foo.c", "-fprofile-use", "-o", "foo.o"],
false
)
);
assert_eq!(
CompilerArguments::CannotCache("-fprofile-use", None),
parse_arguments_(
stringvec!["-c", "foo.c", "-fprofile-use=file", "-o", "foo.o"],
false
)
);
} | rust_cleaned_test_functions.jsonl/17758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43433,
620,
3346,
368,
341,
286,
2060,
10714,
33673,
310,
45631,
19139,
486,
17444,
8233,
13645,
69,
5365,
24673,
497,
2240,
1326,
310,
4715,
43433,
62,
1006,
394,
914,
4083,
0,
1183,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_stats() {
use engine_test::{kv::KvTestEngine, raft::RaftTestEngine};
use std::sync::Mutex;
use std::time::Instant;
use tikv_util::worker::LazyWorker;
struct RunnerTest {
store_stat: Arc<Mutex<StoreStat>>,
stats_monitor: StatsMonitor<KvTestEngine, RaftTestEngine>,
}
impl RunnerTest {
fn new(
interval: u64,
scheduler: Scheduler<Task<KvTestEngine, RaftTestEngine>>,
store_stat: Arc<Mutex<StoreStat>>,
) -> RunnerTest {
let mut stats_monitor = StatsMonitor::new(Duration::from_secs(interval), scheduler);
if let Err(e) = stats_monitor.start(AutoSplitController::default()) {
error!("failed to start stats collector, error = {:?}", e);
}
RunnerTest {
store_stat,
stats_monitor,
}
}
fn handle_store_infos(
&mut self,
cpu_usages: RecordPairVec,
read_io_rates: RecordPairVec,
write_io_rates: RecordPairVec,
) {
let mut store_stat = self.store_stat.lock().unwrap();
store_stat.store_cpu_usages = cpu_usages;
store_stat.store_read_io_rates = read_io_rates;
store_stat.store_write_io_rates = write_io_rates;
}
}
impl Runnable for RunnerTest {
type Task = Task<KvTestEngine, RaftTestEngine>;
fn run(&mut self, task: Task<KvTestEngine, RaftTestEngine>) {
if let Task::StoreInfos {
cpu_usages,
read_io_rates,
write_io_rates,
} = task
{
self.handle_store_infos(cpu_usages, read_io_rates, write_io_rates)
};
}
fn shutdown(&mut self) {
self.stats_monitor.stop();
}
}
fn sum_record_pairs(pairs: &[pdpb::RecordPair]) -> u64 {
let mut sum = 0;
for record in pairs.iter() {
sum += record.get_value();
}
sum
}
let mut pd_worker = LazyWorker::new("test-pd-worker");
let store_stat = Arc::new(Mutex::new(StoreStat::default()));
let runner = RunnerTest::new(1, pd_worker.scheduler(), Arc::clone(&store_stat));
assert!(pd_worker.start(runner));
let start = Instant::now();
loop {
if (Instant::now() - start).as_secs() > 2 {
break;
}
}
let total_cpu_usages = sum_record_pairs(&store_stat.lock().unwrap().store_cpu_usages);
assert!(total_cpu_usages > 90);
pd_worker.stop();
} | rust_cleaned_test_functions.jsonl/64558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
15381,
368,
341,
286,
990,
4712,
4452,
22964,
43408,
486,
42,
85,
2271,
4571,
11,
52455,
486,
55535,
723,
2271,
4571,
2440,
286,
990,
1460,
486,
12996,
486,
38099,
280,
286,
990,
1460,
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... | 2 |
#[test]
fn test_case_49() {
let key = "bfba2449a607f3cca1c911d3b7d9cb972bcd84b0246189c7820032e031949f1e";
let nonce = "97e8ad5eb5a75cc805900850969de48e";
let expected_output =
"19faebfbb954552fcfbf9b91f271c9397a15c641733c394a9cb731c286c68645";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
19,
24,
368,
341,
310,
1077,
1376,
284,
330,
13233,
4645,
17,
19,
19,
24,
64,
21,
15,
22,
69,
18,
24441,
16,
66,
24,
16,
16,
67,
18,
65,
22,
67,
24,
7221,
24,
22,
17,
91490,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_amounts_to_hr() {
let c = Currency::Btc;
assert_eq!(&c.amount_to_hr_string(1, false), "0.00000001");
assert_eq!(&c.amount_to_hr_string(100, false), "0.00000100");
assert_eq!(&c.amount_to_hr_string(713, false), "0.00000713");
assert_eq!(&c.amount_to_hr_string(100_000, false), "0.00100000");
assert_eq!(&c.amount_to_hr_string(10_000_000, false), "0.10000000");
assert_eq!(&c.amount_to_hr_string(12_345_678, false), "0.12345678");
assert_eq!(&c.amount_to_hr_string(100_000_000, false), "1.00000000");
assert_eq!(&c.amount_to_hr_string(100_200_300, false), "1.00200300");
assert_eq!(&c.amount_to_hr_string(102_030_405, false), "1.02030405");
assert_eq!(&c.amount_to_hr_string(110_000_000, false), "1.10000000");
assert_eq!(&c.amount_to_hr_string(123_456_789, false), "1.23456789");
assert_eq!(&c.amount_to_hr_string(1_000_000_000, false), "10.00000000");
assert_eq!(&c.amount_to_hr_string(1_020_304_050, false), "10.20304050");
assert_eq!(
&c.amount_to_hr_string(10_000_000_000, false),
"100.00000000"
);
assert_eq!(
&c.amount_to_hr_string(10_000_000_001, false),
"100.00000001"
);
assert_eq!(
&c.amount_to_hr_string(10_000_000_010, false),
"100.00000010"
);
assert_eq!(
&c.amount_to_hr_string(10_000_000_100, false),
"100.00000100"
);
assert_eq!(&c.amount_to_hr_string(1, true), "0.00000001");
assert_eq!(&c.amount_to_hr_string(100, true), "0.000001");
assert_eq!(&c.amount_to_hr_string(713, true), "0.00000713");
assert_eq!(&c.amount_to_hr_string(100_000, true), "0.001");
assert_eq!(&c.amount_to_hr_string(10_000_000, true), "0.1");
assert_eq!(&c.amount_to_hr_string(12_345_678, true), "0.12345678");
assert_eq!(&c.amount_to_hr_string(100_000_000, true), "1.0");
assert_eq!(&c.amount_to_hr_string(100_200_300, true), "1.002003");
assert_eq!(&c.amount_to_hr_string(102_030_405, true), "1.02030405");
assert_eq!(&c.amount_to_hr_string(110_000_000, true), "1.1");
assert_eq!(&c.amount_to_hr_string(123_456_789, true), "1.23456789");
assert_eq!(&c.amount_to_hr_string(1_000_000_000, true), "10.0");
assert_eq!(&c.amount_to_hr_string(1_020_304_050, true), "10.2030405");
assert_eq!(&c.amount_to_hr_string(10_000_000_000, true), "100.0");
assert_eq!(&c.amount_to_hr_string(10_000_000_001, true), "100.00000001");
assert_eq!(&c.amount_to_hr_string(10_000_000_010, true), "100.0000001");
assert_eq!(&c.amount_to_hr_string(10_000_000_100, true), "100.000001");
} | rust_cleaned_test_functions.jsonl/51423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13471,
82,
2346,
70138,
368,
341,
197,
10217,
272,
284,
28453,
486,
33,
10413,
280,
197,
6948,
10714,
0,
2099,
66,
25276,
2346,
70138,
3904,
7,
16,
11,
895,
701,
330,
15,
13,
15,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unity_mac_os() {
let mut os = OsContext {
raw_description: "Mac OS X 10.16.0".to_string().into(),
..OsContext::default()
};
normalize_os_context(&mut os);
assert_eq_dbg!(Some("macOS"), os.name.as_str());
assert_eq_dbg!(Some("10.16.0"), os.version.as_str());
assert_eq_dbg!(None, os.build.value());
} | rust_cleaned_test_functions.jsonl/68965 | {
"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,
62,
2439,
22802,
29387,
368,
341,
262,
1077,
5206,
2643,
284,
15433,
1972,
341,
286,
7112,
11448,
25,
330,
19552,
10085,
1599,
220,
16,
15,
13,
16,
21,
13,
15,
3263,
983,
3904,
1005,
18122,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt() {
let cigar = Cigar::from(vec![
Op::new(Kind::Match, 1),
Op::new(Kind::Skip, 13),
Op::new(Kind::SoftClip, 144),
]);
assert_eq!(cigar.to_string(), "1M13N144S");
} | rust_cleaned_test_functions.jsonl/127483 | {
"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,
38128,
368,
341,
286,
1077,
53674,
284,
356,
51284,
486,
1499,
25592,
90515,
310,
10672,
486,
931,
7,
10629,
486,
8331,
11,
220,
16,
1326,
310,
10672,
486,
931,
7,
10629,
486,
35134,
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_simplify_and_false() {
let expr_a = lit(false).and(col("c2"));
let expr_b = col("c2").and(lit(false));
let expected = lit(false);
assert_eq!(simplify(&expr_a), expected);
assert_eq!(simplify(&expr_b), expected);
} | rust_cleaned_test_functions.jsonl/19676 | {
"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,
643,
70206,
8378,
36015,
368,
341,
286,
1077,
15169,
4306,
284,
13020,
3576,
568,
437,
19611,
445,
66,
17,
4010,
286,
1077,
15169,
880,
284,
1375,
445,
66,
17,
1827,
437,
2333,
275,
3576,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_regex_sources() -> Result<(), Box<dyn Error>> {
ore::log::init();
let temp_dir = tempfile::tempdir()?;
let config = util::Config::default();
let (_server, mut client) = util::start_server(config)?;
let regex_path = Path::join(temp_dir.path(), "request.log");
fs::write(
®ex_path,
r#"123.17.127.5 - - [22/Jan/2020 18:59:52] "GET / HTTP/1.1" 200 -
8.15.119.56 - - [22/Jan/2020 18:59:52] "GET /detail/nNZpqxzR HTTP/1.1" 200 -
96.12.83.72 - - [22/Jan/2020 18:59:52] "GET /search/?kw=helper+ins+hennaed HTTP/1.1" 200 -
"#,
)?;
let home_page_row = (
Some("123.17.127.5".into()),
Some("22/Jan/2020 18:59:52".into()),
Some("GET / HTTP/1.1".into()),
None,
None,
Some("200".into()),
);
let detail_page_row = (
Some("8.15.119.56".into()),
Some("22/Jan/2020 18:59:52".into()),
Some("GET /detail/nNZpqxzR HTTP/1.1".into()),
None,
Some("nNZpqxzR".into()),
Some("200".into()),
);
let search_page_row = (
Some("96.12.83.72".into()),
Some("22/Jan/2020 18:59:52".into()),
Some("GET /search/?kw=helper+ins+hennaed HTTP/1.1".into()),
Some("helper+ins+hennaed".into()),
None,
Some("200".into()),
);
client.batch_execute(&*format!(
"CREATE SOURCE regex_source FROM FILE '{}' FORMAT REGEX '{}'",
regex_path.display(),
r#"(?P<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<ts>[^]]+)\] "(?P<path>(?:GET /search/\?kw=(?P<search_kw>[^ ]*) HTTP/\d\.\d)|(?:GET /detail/(?P<product_detail_id>[a-zA-Z0-9]+) HTTP/\d\.\d)|(?:[^"]+))" (?P<code>\d{3}) -"#
))?;
client.batch_execute("CREATE MATERIALIZED VIEW regex AS SELECT * FROM regex_source")?;
thread::sleep(Duration::from_secs(1));
let all_results: Vec<_> = client
.query("SELECT * FROM regex ORDER BY mz_line_no", &[])?
.into_iter()
.map(|r| (r.get(0), r.get(1), r.get(2), r.get(3), r.get(4), r.get(5)))
.collect::<Vec<(
Option<String>,
Option<String>,
Option<String>,
Option<String>,
Option<String>,
Option<String>,
)>>();
assert_eq!(
all_results,
vec![home_page_row, detail_page_row, search_page_row.clone()]
);
let search_only: Vec<_> = client
.query(
"SELECT search_kw FROM regex WHERE search_kw IS NOT NULL",
&[],
)?
.into_iter()
.map(|r| r.get(0))
.collect::<Vec<Option<String>>>();
assert_eq!(search_only, vec![search_page_row.3]);
Ok(())
} | rust_cleaned_test_functions.jsonl/123703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
52896,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
262,
16144,
486,
839,
486,
2327,
1428,
262,
1077,
2730,
4334,
284,
54819,
486,
3888,
3741,
94136,
262,
1077,
2193,
284,
4094,
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... | 6 |
#[test]
fn test_unix_stream_timeout_zero_duration() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
let listener = or_panic!(UnixListener::bind(&socket_path));
let stream = or_panic!(UnixStream::connect(&socket_path));
let result = stream.set_write_timeout(Some(Duration::new(0, 0)));
let err = result.unwrap_err();
assert_eq!(err.kind(), ErrorKind::InvalidInput);
let result = stream.set_read_timeout(Some(Duration::new(0, 0)));
let err = result.unwrap_err();
assert_eq!(err.kind(), ErrorKind::InvalidInput);
drop(listener);
} | rust_cleaned_test_functions.jsonl/98541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80572,
12673,
20537,
19359,
25454,
368,
341,
286,
1077,
5419,
284,
4174,
3741,
543,
286,
1077,
7575,
2638,
284,
5419,
3875,
1005,
5987,
445,
13199,
3071,
286,
1077,
11446,
284,
476,
620,
31270,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_rev_cloned_collect() {
let data = vec![5, 9, 3];
let iterout = vec![3, 5, 9];
let pq = BinaryHeap::from(data);
let v: Vec<_> = pq.iter().rev().cloned().collect();
assert_eq!(v, iterout);
} | rust_cleaned_test_functions.jsonl/62349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
38082,
6794,
19684,
68140,
368,
341,
262,
1077,
821,
284,
7486,
20703,
20,
11,
220,
24,
11,
220,
18,
935,
262,
1077,
5367,
411,
284,
7486,
20703,
18,
11,
220,
20,
11,
220,
24,
935,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_accounts_cow() {
let mut rng = rand::thread_rng();
let mut accounts = new_rand_vote_accounts(&mut rng, 64);
// Add vote accounts.
let mut vote_accounts = VoteAccounts::default();
for (pubkey, (stake, vote_account)) in (&mut accounts).take(1024) {
vote_accounts.insert(pubkey, (stake, vote_account));
}
let vote_accounts_hashmap = Arc::<VoteAccountsHashMap>::from(&vote_accounts);
assert_eq!(vote_accounts_hashmap, vote_accounts.vote_accounts);
assert!(Arc::ptr_eq(
&vote_accounts_hashmap,
&vote_accounts.vote_accounts
));
let (pubkey, (more_stake, vote_account)) =
accounts.find(|(_, (stake, _))| *stake != 0).unwrap();
vote_accounts.insert(pubkey, (more_stake, vote_account.clone()));
assert!(!Arc::ptr_eq(
&vote_accounts_hashmap,
&vote_accounts.vote_accounts
));
assert_ne!(vote_accounts_hashmap, vote_accounts.vote_accounts);
let other = (more_stake, vote_account);
for (pk, value) in vote_accounts.iter() {
if *pk != pubkey {
assert_eq!(value, &vote_accounts_hashmap[pk]);
} else {
assert_eq!(value, &other);
}
}
} | rust_cleaned_test_functions.jsonl/23439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 666
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
55665,
666,
363,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
5206,
9618,
284,
501,
33864,
54360,
55665,
2099,
6984,
28422,
11,
220,
21,
19,
317,
286,
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... | 4 |
#[test]
fn test_vec() {
let supported = SupportedAlgorithms::all();
let array: Vec<u8> = (&supported).into();
let decoded: SupportedAlgorithms = (&array as &[_]).into();
assert_eq!(supported, decoded);
let mut supported = SupportedAlgorithms::new();
supported.set(Algorithm::RSASHA256);
supported.set(Algorithm::ECDSAP256SHA256);
supported.set(Algorithm::ECDSAP384SHA384);
supported.set(Algorithm::ED25519);
let array: Vec<u8> = (&supported).into();
let decoded: SupportedAlgorithms = (&array as &[_]).into();
assert_eq!(supported, decoded);
assert!(!supported.has(Algorithm::RSASHA1));
assert!(!supported.has(Algorithm::RSASHA1NSEC3SHA1));
assert!(supported.has(Algorithm::RSASHA256));
assert!(supported.has(Algorithm::ECDSAP256SHA256));
assert!(supported.has(Algorithm::ECDSAP384SHA384));
assert!(supported.has(Algorithm::ED25519));
} | rust_cleaned_test_functions.jsonl/47075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
368,
341,
262,
1077,
7248,
284,
48980,
2101,
18980,
486,
541,
543,
262,
1077,
1334,
25,
11312,
34837,
23,
29,
284,
15899,
18216,
568,
18122,
543,
262,
1077,
29213,
25,
48980,
2101,
18980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_ConstrainedEntss() {
let mut schemaReplicant = SchemaReplicant::default();
associate_causetId(&mut schemaReplicant, Keyword::namespaced("foo", "bar"), 99);
add_attribute(&mut schemaReplicant, 99, Attribute {
value_type: MinkowskiValueType::Boolean,
..Default::default()
});
let x = ToUpper::from_valid_name("?x");
let y = ToUpper::from_valid_name("?y");
let b: BTreeMap<ToUpper, MinkowskiType> =
vec![(y.clone(), MinkowskiType::Boolean(true))].into_iter().collect();
let inputs = CausetQInputs::with_values(b);
let variables: BTreeSet<ToUpper> = vec![ToUpper::from_valid_name("?y")].into_iter().collect();
let mut cc = ConjoiningGerunds::with_inputs(variables, inputs);
let knownCauset = KnownCauset::for_schemaReplicant(&schemaReplicant);
cc.apply_parsed_TuringString(knownCauset, TuringString {
source: None,
instanton: TuringStringNonValuePlace::ToUpper(x.clone()),
attribute: causetid("foo", "bar"),
value: TuringStringValuePlace::ToUpper(y.clone()),
causetx: TuringStringNonValuePlace::Placeholder,
});
let d0_e = QualifiedAlias::new("Causets00".to_string(), CausetsCausetIndex::Instanton);
let d0_a = QualifiedAlias::new("Causets00".to_string(), CausetsCausetIndex::Attribute);
let d0_v = QualifiedAlias::new("Causets00".to_string(), CausetsCausetIndex::Value);
// ?y has been expanded into `true`.
assert_eq!(cc.wheres, vec![
CausetIndexConstraint::Equals(d0_a, CausetQValue::SolitonId(99)),
CausetIndexConstraint::Equals(d0_v, CausetQValue::MinkowskiType(MinkowskiType::Boolean(true))),
].into());
// There is no Constrained for ?y.
assert!(!cc.CausetIndex_ConstrainedEntss.contains_key(&y));
// ?x is bound to the instanton.
assert_eq!(cc.CausetIndex_ConstrainedEntss.get(&x).unwrap(),
&vec![d0_e.clone()]);
} | rust_cleaned_test_functions.jsonl/32593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 962
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
15100,
57727,
2250,
778,
368,
341,
286,
1077,
5206,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
1428,
286,
21946,
666,
11855,
295,
764,
2099,
6984,
10802,
18327,
35237,
11,
48970... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_network_home_generate_key_file() {
let dir = tempdir().unwrap();
fs::create_dir_all(dir.path().join("localhost/accounts/latest")).unwrap();
let network_home = NetworkHome::new(dir.path().join("localhost").as_path());
network_home.generate_key_file().unwrap();
assert_eq!(
dir.path()
.join("localhost/accounts/latest/dev.key")
.exists(),
true
);
} | rust_cleaned_test_functions.jsonl/39526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
21653,
48851,
3097,
2458,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
8619,
486,
3182,
4334,
5705,
14161,
3875,
1005,
5987,
445,
8301,
83743,
33149,
15197,
15454,
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_recordbatch_iterator() {
let df = df!(
"foo" => &[1, 2, 3, 4, 5]
)
.unwrap();
let mut iter = df.iter_record_batches();
assert_eq!(5, iter.next().unwrap().num_rows());
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/18787 | {
"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,
14192,
14049,
13491,
368,
341,
286,
1077,
6764,
284,
6764,
33673,
310,
330,
7975,
1,
589,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
921,
286,
1727,
286,
659,
15454,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verifying_key_path() {
for rsp in ®ISTERED_SEAL_PROOFS {
rsp.cache_verifying_key_path()
.expect("failed to get verifying key path");
}
} | rust_cleaned_test_functions.jsonl/88714 | {
"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,
26042,
7766,
3097,
2638,
368,
341,
286,
369,
42160,
304,
609,
46302,
1479,
3620,
969,
5756,
46,
8485,
341,
310,
42160,
20087,
26042,
7766,
3097,
2638,
741,
394,
659,
17119,
445,
16091,
311,
633,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_statsd_client_as_gauged_f64() {
let client: Box<dyn Gauged<f64>> = Box::new(StatsdClient::from_sink("prefix", NopMetricSink));
client.gauge("some.gauge", 3.2).unwrap();
} | rust_cleaned_test_functions.jsonl/10618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
1889,
19179,
291,
761,
21,
19,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
18373,
768,
291,
63895,
21,
19,
2452,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
515... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_auth() {
let mut headers = Headers::new();
headers.set(Authorization("foo bar baz".to_owned()));
assert_eq!(headers.to_string(), "Authorization: foo bar baz\r\n".to_owned());
} | rust_cleaned_test_functions.jsonl/31561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
14014,
368,
341,
286,
1077,
5206,
7102,
284,
21426,
486,
931,
543,
286,
7102,
980,
4346,
1553,
2022,
445,
7975,
3619,
50247,
3263,
983,
51973,
7392,
286,
2060,
10714,
10297,
7713,
2389,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_new_record() {
let mut collection = setup_collection();
collection.create().unwrap();
let record = collection.new_record();
assert_eq!(record.data, None);
assert_eq!(record.get_id(), None);
} | rust_cleaned_test_functions.jsonl/63503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
14192,
368,
341,
286,
1077,
5206,
4426,
284,
6505,
25019,
543,
286,
4426,
2520,
1005,
15454,
543,
286,
1077,
3255,
284,
4426,
4618,
14192,
543,
286,
2060,
10714,
10297,
8548,
2196,
11,
2240,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_usage_description_newline_handling() {
let mut opts = Options::new();
opts.optflag(
"k",
"k\u{2013}w\u{2013}",
"The word kiwi is normally spelled with two i's",
);
opts.optflag(
"a",
"apple",
"This description forces a new line.\n Here is a premature\n\
newline",
);
let expected = "Usage: fruits
Options:
-k, --k–w– The word kiwi is normally spelled with two i's
-a, --apple This description forces a new line.
Here is a premature
newline
";
let usage = opts.usage("Usage: fruits");
debug!("expected: <<{}>>", expected);
debug!("generated: <<{}>>", usage);
assert!(usage == expected)
} | rust_cleaned_test_functions.jsonl/52393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31507,
11448,
5921,
1056,
75642,
368,
341,
262,
1077,
5206,
12185,
284,
14566,
486,
931,
543,
262,
12185,
28102,
9903,
1006,
286,
330,
74,
756,
286,
330,
74,
3770,
90,
17,
15,
16,
18,
92,
86,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prune_out_of_bounds() {
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&blockstore_path).unwrap();
blockstore.prune(5);
drop(blockstore);
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/94030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
2886,
6068,
3575,
36878,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
4574,
4314,
2638,
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_cast_range_i8_max() {
assert_eq!(i8::max_value.to_int(), Some(i8::max_value as int));
assert_eq!(i8::max_value.to_i8(), Some(i8::max_value as i8));
assert_eq!(i8::max_value.to_i16(), Some(i8::max_value as i16));
assert_eq!(i8::max_value.to_i32(), Some(i8::max_value as i32));
assert_eq!(i8::max_value.to_i64(), Some(i8::max_value as i64));
assert_eq!(i8::max_value.to_uint(), Some(i8::max_value as uint));
assert_eq!(i8::max_value.to_u8(), Some(i8::max_value as u8));
assert_eq!(i8::max_value.to_u16(), Some(i8::max_value as u16));
assert_eq!(i8::max_value.to_u32(), Some(i8::max_value as u32));
assert_eq!(i8::max_value.to_u64(), Some(i8::max_value as u64));
} | rust_cleaned_test_functions.jsonl/12451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
9698,
5318,
23,
6345,
368,
341,
286,
2060,
10714,
10297,
72,
23,
486,
2810,
3142,
2389,
4042,
1507,
220,
4329,
1956,
23,
486,
2810,
3142,
438,
526,
1106,
286,
2060,
10714,
10297,
72,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_arc() {
assert_ne!(crate::Type::INVALID, MySharedArc::type_());
let b = MySharedArc::from_refcounted(std::sync::Arc::new(MySharedInner {
foo: String::from("abc"),
}));
let v = b.to_value();
let b2 = v.get_some::<MySharedArc>().unwrap();
assert!(std::sync::Arc::ptr_eq(&b.0, &b2.0));
} | rust_cleaned_test_functions.jsonl/49617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
62914,
368,
341,
286,
2060,
13925,
10297,
61711,
486,
929,
486,
46859,
11,
3017,
16997,
36809,
486,
1313,
62,
5231,
286,
1077,
293,
284,
3017,
16997,
36809,
486,
1499,
7793,
1830,
291,
5194,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trusted_insert_shreds() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
// Make shred for slot 1
let (shreds1, _) = make_slot_entries(1, 0, 1);
let last_root = 100;
blockstore.set_roots(std::iter::once(&last_root)).unwrap();
blockstore
.insert_shreds(shreds1[..].to_vec(), None, false)
.unwrap();
assert!(blockstore.get_data_shred(1, 0).unwrap().is_none());
// Insert through trusted path will succeed
blockstore
.insert_shreds(shreds1[..].to_vec(), None, true)
.unwrap();
assert!(blockstore.get_data_shred(1, 0).unwrap().is_some());
} | rust_cleaned_test_functions.jsonl/9555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
27145,
17678,
3712,
53369,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
7,
50704,
2638,
3875... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_btree_ranges_complex() {
let index_schema = IndexSchema::new(vec![
FieldSpec::new(vec![String::from("a")], Value::Int32(0)),
FieldSpec::new(vec![String::from("b")], Value::Int32(0)),
FieldSpec::new(vec![String::from("c")], Value::Int32(0)),
]);
let constraint = &HashMap::from([
(
vec![String::from("a")],
Constraint::Or(
Box::new(Constraint::LessThan(Value::Int32(2))),
Box::new(Constraint::GreaterThan(Value::Int32(8))),
),
),
(
vec![String::from("b")],
Constraint::Or(
Box::new(Constraint::Equals(Value::Int32(5))),
Box::new(Constraint::LessThan(Value::Int32(3))),
),
),
(
vec![String::from("c")],
Constraint::And(
Box::new(Constraint::GreaterThan(Value::Int32(4))),
Box::new(Constraint::LessThan(Value::Int32(9))),
),
),
]);
assert!(are_ranges_equal_unordered(
&index_schema.generate_btree_ranges(constraint),
&vec![
(
Bound::Included(Index::new(vec![
Value::Int32(0).get_min_value(),
Value::Int32(5),
Value::Int32(4),
])),
Bound::Included(Index::new(vec![
Value::Int32(2),
Value::Int32(5),
Value::Int32(9),
]))
),
(
Bound::Included(Index::new(vec![
Value::Int32(0).get_min_value(),
Value::Int32(0).get_min_value(),
Value::Int32(4),
])),
Bound::Included(Index::new(vec![
Value::Int32(2),
Value::Int32(3),
Value::Int32(9),
]))
),
(
Bound::Included(Index::new(vec![
Value::Int32(8),
Value::Int32(5),
Value::Int32(4),
])),
Bound::Included(Index::new(vec![
Value::Int32(0,).get_max_value(),
Value::Int32(5,),
Value::Int32(9,),
]))
),
(
Bound::Included(Index::new(vec![
Value::Int32(8),
Value::Int32(0).get_min_value(),
Value::Int32(4),
])),
Bound::Included(Index::new(vec![
Value::Int32(0).get_max_value(),
Value::Int32(3),
Value::Int32(9),
]))
)
]
));
} | rust_cleaned_test_functions.jsonl/71775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
880,
9344,
58748,
41522,
368,
341,
286,
1077,
1922,
25371,
284,
8008,
8632,
486,
931,
25592,
90515,
310,
8601,
8327,
486,
931,
25592,
20703,
703,
486,
1499,
445,
64,
899,
1125,
5162,
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_load_int_const() {
let mut masm = MacroAssembler::new();
masm.load_int_const(Int32, R0, 0);
assert_emit!(0x52800000; masm);
let mut masm = MacroAssembler::new();
masm.load_int_const(Int32, R0, 0xFFFF);
assert_emit!(0x529FFFE0; masm);
let mut masm = MacroAssembler::new();
masm.load_int_const(Int32, R0, 1i64 << 16);
assert_emit!(0x52a00020; masm);
let mut masm = MacroAssembler::new();
masm.load_int_const(Ptr, R0, 0);
assert_emit!(0xD2800000; masm);
let mut masm = MacroAssembler::new();
masm.load_int_const(Int32, R0, -1);
assert_emit!(0x12800000; masm);
let mut masm = MacroAssembler::new();
masm.load_int_const(Ptr, R0, -1);
assert_emit!(0x92800000; masm);
} | rust_cleaned_test_functions.jsonl/20612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
4042,
13610,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
543,
286,
9243,
76,
5104,
4042,
13610,
24123,
18,
17,
11,
431,
15,
11,
220,
15,
317,
286,
2060,
69082,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_syntax() {
let nonempty = NonEmpty::from((0, vec![1, 2, 3]));
for n in &nonempty {
assert_eq!(*n, *n); // Prove that we're dealing with references.
}
for _ in nonempty {}
} | rust_cleaned_test_functions.jsonl/17875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
78894,
368,
341,
286,
1077,
2477,
3194,
284,
11581,
3522,
486,
1499,
1188,
15,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
14382,
286,
369,
308,
304,
609,
6280,
3194,
341,
310,
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... | 3 |
#[test]
fn test_get_vertex_bytes() {
let vertices = &[
([0., 0., 0.], [1., 1., 1.], [2., 2.]),
([3., 3., 3.], [4., 4., 4.], [5., 5.]),
([6., 6., 6.], [7., 7., 7.], [8., 8.]),
];
let mut positions = Vec::new();
let mut normals = Vec::new();
let mut uvs = Vec::new();
for (position, normal, uv) in vertices.iter() {
positions.push(*position);
normals.push(*normal);
uvs.push(*uv);
}
let mesh = Mesh {
primitive_topology: PrimitiveTopology::TriangleStrip,
attributes: vec![
VertexAttribute::position(positions),
VertexAttribute::normal(normals),
VertexAttribute::uv(uvs),
],
indices: None,
};
let expected_vertices = &[
Vertex {
position: [0., 0., 0.],
normal: [1., 1., 1.],
uv: [2., 2.],
},
Vertex {
position: [3., 3., 3.],
normal: [4., 4., 4.],
uv: [5., 5.],
},
Vertex {
position: [6., 6., 6.],
normal: [7., 7., 7.],
uv: [8., 8.],
},
];
let descriptor = Vertex::as_vertex_buffer_descriptor();
assert_eq!(
mesh.get_vertex_buffer_bytes(descriptor, true).unwrap(),
expected_vertices.as_bytes(),
"buffer bytes are equal"
);
} | rust_cleaned_test_functions.jsonl/54644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 919
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
26611,
12524,
368,
341,
286,
1077,
17228,
284,
609,
9640,
310,
11743,
15,
2572,
220,
15,
2572,
220,
15,
13,
1125,
508,
16,
2572,
220,
16,
2572,
220,
16,
13,
1125,
508,
17,
2572,
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... | 2 |
#[test]
fn test_enum_no_reader_schema() {
let writer_raw_schema = r#"
{
"type": "record",
"name": "test",
"fields": [
{"name": "a", "type": "long", "default": 42},
{"name": "b", "type": "string"},
{
"name": "c",
"type": {
"type": "enum",
"name": "suit",
"symbols": ["diamonds", "spades", "clubs", "hearts"]
},
"default": "spades"
}
]
}
"#;
let writer_schema = Schema::parse_str(writer_raw_schema).unwrap();
let mut writer = Writer::with_codec(&writer_schema, Vec::new(), Codec::Null);
let mut record = Record::new(writer.schema()).unwrap();
record.put("a", 27i64);
record.put("b", "foo");
record.put("c", "clubs");
writer.append(record).unwrap();
let input = writer.into_inner().unwrap();
let mut reader = Reader::new(&input[..]).unwrap();
assert_eq!(
reader.next().unwrap().unwrap(),
Value::Record(vec![
("a".to_string(), Value::Long(27)),
("b".to_string(), Value::String("foo".to_string())),
("c".to_string(), Value::Enum(2, "clubs".to_string())),
])
);
} | rust_cleaned_test_functions.jsonl/77303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 887
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
6536,
22306,
25371,
368,
341,
286,
1077,
6916,
16067,
25371,
284,
435,
2,
698,
310,
341,
394,
330,
1313,
788,
330,
8548,
756,
394,
330,
606,
788,
330,
1944,
756,
394,
330,
9007,
788,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timeout() -> io::Result<()> {
let mut events = Events::new();
let mut sources = Sources::new();
sources.register((), &io::stdin(), interest::READ);
let err = sources
.wait_timeout(&mut events, Duration::from_millis(1))
.unwrap_err();
assert_eq!(sources.len(), 1);
assert_eq!(err.kind(), io::ErrorKind::TimedOut);
assert!(events.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/1041 | {
"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,
20537,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
4357,
284,
17627,
486,
931,
543,
286,
1077,
5206,
8173,
284,
47032,
486,
931,
1428,
286,
8173,
9929,
7,
1507,
609,
815,
486,
51602... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_image_buffer_copy_within_oob() {
let mut image: GrayImage = ImageBuffer::from_raw(4, 4, vec![0u8; 16]).unwrap();
assert!(!image.copy_within(Rect { x: 0, y: 0, width: 5, height: 4 }, 0, 0));
assert!(!image.copy_within(Rect { x: 0, y: 0, width: 4, height: 5 }, 0, 0));
assert!(!image.copy_within(Rect { x: 1, y: 0, width: 4, height: 4 }, 0, 0));
assert!(!image.copy_within(Rect { x: 0, y: 0, width: 4, height: 4 }, 1, 0));
assert!(!image.copy_within(Rect { x: 0, y: 1, width: 4, height: 4 }, 0, 0));
assert!(!image.copy_within(Rect { x: 0, y: 0, width: 4, height: 4 }, 0, 1));
assert!(!image.copy_within(Rect { x: 1, y: 1, width: 4, height: 4 }, 0, 0));
} | rust_cleaned_test_functions.jsonl/25548 | {
"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,
4954,
7776,
16096,
72385,
14179,
674,
368,
341,
286,
1077,
5206,
2168,
25,
23366,
1906,
284,
4654,
4095,
486,
1499,
16067,
7,
19,
11,
220,
19,
11,
7486,
20703,
15,
84,
23,
26,
220,
16,
21,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop() {
let mut data = String::from("ประเทศไทย中华b¢€𤭢");
assert_eq!(data.pop().unwrap(), '𤭢'); // 4 bytes
assert_eq!(data.ap(), '€'); // 3 bytes
assert_eq!(data.po(), '¢'); // 2 bytes
assert_eq!(data.pop), 'b'); // 1 bytes
assert_eq!(data.pop), '华');
assert_eq!(data, "ประเทศไทย中");
} | rust_cleaned_test_functions.jsonl/3167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
368,
341,
262,
1077,
5206,
821,
284,
923,
486,
1499,
445,
130391,
100849,
65,
56394,
15056,
101877,
255,
95,
797,
262,
2060,
10714,
10297,
691,
8288,
1005,
15454,
1507,
364,
101877,
255,
95... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chromatic_scale_with_sharps() {
process_chromatic_case(
"C",
&[
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B",
],
);
} | rust_cleaned_test_functions.jsonl/103939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
98766,
16727,
6615,
3712,
277,
1690,
368,
341,
262,
1882,
4138,
98766,
19096,
1006,
286,
330,
34,
756,
286,
609,
9640,
310,
330,
34,
497,
330,
34,
75915,
330,
35,
497,
330,
35,
75915,
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_full_jitter_backoff() {
let mut backoff = FullJitterBackoff::new(2, 7, 3);
assert!(backoff.next_delay_duration().unwrap() <= Duration::from_millis(2));
assert!(backoff.next_delay_duration().unwrap() <= Duration::from_millis(4));
assert!(backoff.next_delay_duration().unwrap() <= Duration::from_millis(7));
assert_eq!(backoff.next_delay_duration(), None);
} | rust_cleaned_test_functions.jsonl/16664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
5374,
3248,
3895,
1847,
368,
341,
286,
1077,
5206,
1182,
1847,
284,
8627,
41,
3248,
3707,
1847,
486,
931,
7,
17,
11,
220,
22,
11,
220,
18,
317,
286,
2060,
10297,
1419,
1847,
4529,
22198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_features() {
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
[features]
default = ["a"]
a = []
[[test]]
name = "foo"
required-features = ["a"]
"#)
.file("tests/foo.rs", "#[test]\nfn test() {}");
p.build();
assert_that(p.cargo("test"),
execs().with_status(0).with_stderr(format!("\
[COMPILING] foo v0.0.1 ({})
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]", p.url()))
.with_stdout("
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"));
assert_that(p.cargo("test").arg("--no-default-features"),
execs().with_status(0).with_stderr(format!("\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"))
.with_stdout(""));
assert_that(p.cargo("test").arg("--test=foo"),
execs().with_status(0).with_stderr(format!("\
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]"))
.with_stdout("
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
"));
assert_that(p.cargo("test").arg("--test=foo").arg("--no-default-features"),
execs().with_status(101).with_stderr("\
error: target `foo` requires the features: `a`
Consider enabling them by passing e.g. `--features=\"a\"`
"));
} | rust_cleaned_test_functions.jsonl/93339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 796
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
14965,
368,
341,
262,
1077,
281,
284,
2390,
445,
7975,
1138,
286,
659,
1192,
445,
98228,
73494,
75,
497,
435,
2,
698,
310,
508,
4987,
921,
310,
829,
284,
330,
7975,
698,
310,
2319,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_at_signs_file_not_readable() {
let td = tempfile::Builder::new()
.prefix("sccache")
.tempdir()
.unwrap();
let arg = format!("-@{}", td.path().join("foo").display());
// File foo doesn't exist.
assert_eq!(
parse_arguments_(vec![arg]),
CompilerArguments::CannotCache("-@", None)
);
} | rust_cleaned_test_functions.jsonl/18539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
11172,
82,
2458,
7913,
91232,
368,
341,
286,
1077,
17941,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
82,
638,
1777,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rlp_nested_empty_list_encode() {
let mut stream = RlpStream::new_list(2);
stream.append_list(&(Vec::new() as Vec<u32>));
stream.append(&0x28_u32);
assert_eq!(stream.out()[..], hex!("c2c028")[..]);
} | rust_cleaned_test_functions.jsonl/74208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
13545,
66279,
15124,
2019,
11224,
368,
341,
10217,
5206,
4269,
284,
431,
13545,
3027,
486,
931,
2019,
7,
17,
317,
44440,
2057,
2019,
29089,
10050,
486,
931,
368,
438,
11312,
34837,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ancestor_iterator_with_hash() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = setup_forks(ledger_path.path());
// Insert frozen hashes
let mut slot_to_bank_hash = HashMap::new();
for slot in 0..=4 {
let bank_hash = Hash::new_unique();
slot_to_bank_hash.insert(slot, bank_hash);
blockstore.insert_bank_hash(slot, bank_hash, false);
}
// Test correctness
assert!(
AncestorIteratorWithHash::from(AncestorIterator::new(0, &blockstore))
.next()
.is_none()
);
assert_eq!(
AncestorIteratorWithHash::from(AncestorIterator::new(4, &blockstore))
.collect::<Vec<(Slot, Hash)>>(),
vec![(1, slot_to_bank_hash[&1]), (0, slot_to_bank_hash[&0])]
);
assert_eq!(
AncestorIteratorWithHash::from(AncestorIterator::new(3, &blockstore))
.collect::<Vec<(Slot, Hash)>>(),
vec![
(2, slot_to_bank_hash[&2]),
(1, slot_to_bank_hash[&1]),
(0, slot_to_bank_hash[&0])
]
);
} | rust_cleaned_test_functions.jsonl/122485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
66878,
13491,
6615,
8950,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
6505,
761,
73302,
7,
50704,
2638,
3875,
5231,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multiple_packages() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
[dependencies.d1]
path = "d1"
[dependencies.d2]
path = "d2"
[lib]
name = "foo"
doctest = false
"#,
)
.file("src/lib.rs", "")
.file(
"d1/Cargo.toml",
r#"
[package]
name = "d1"
version = "0.0.1"
authors = []
[lib]
name = "d1"
doctest = false
"#,
)
.file("d1/src/lib.rs", "")
.file(
"d2/Cargo.toml",
r#"
[package]
name = "d2"
version = "0.0.1"
authors = []
[lib]
name = "d2"
doctest = false
"#,
)
.file("d2/src/lib.rs", "");
let p = p.build();
p.cargo("test -p d1 -p d2")
.with_stderr_contains("[RUNNING] target/debug/deps/d1-[..][EXE]")
.with_stderr_contains("[RUNNING] target/debug/deps/d2-[..][EXE]")
.with_stdout_contains_n("running 0 tests", 2)
.run();
} | rust_cleaned_test_functions.jsonl/95366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 893
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
41874,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
1722,
921,
310,
829,
284,
330,
7975,
698,
310,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_real_as_json() {
test_none_with_ctx(cast_any_as_json::<Real>);
let cs = vec![
(
f64::from(f32::MAX),
Json::from_f64(f64::from(f32::MAX)).unwrap(),
),
(
f64::from(f32::MIN),
Json::from_f64(f64::from(f32::MIN)).unwrap(),
),
(f64::MAX, Json::from_f64(f64::MAX).unwrap()),
(f64::MIN, Json::from_f64(f64::MIN).unwrap()),
];
for (input, expect) in cs {
let mut ctx = EvalContext::default();
let r = cast_any_as_json::<Real>(&mut ctx, Real::new(input).as_ref().ok());
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/2000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
11898,
9455,
368,
341,
286,
1273,
31488,
6615,
15147,
1337,
559,
37248,
11898,
9455,
27638,
12768,
29,
626,
286,
1077,
10532,
284,
7486,
90515,
310,
2399,
394,
282,
21,
19,
486,
1499,
955,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_count() {
let rocket = super::rocket();
// Count should start at 0.
assert_eq!(get_count(&rocket), 0);
for _ in 0..99 { register_hit(&rocket); }
assert_eq!(get_count(&rocket), 99);
register_hit(&rocket);
assert_eq!(get_count(&rocket), 100);
} | rust_cleaned_test_functions.jsonl/9217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
368,
341,
262,
1077,
24306,
284,
2256,
486,
46790,
1428,
262,
442,
4504,
1265,
1191,
518,
220,
15,
624,
262,
2060,
10714,
10297,
455,
3180,
2099,
46790,
701,
220,
15,
626,
262,
369,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_9() {
assert_eq!(
parse_column_type(&mut Parser::new("smallint(8) unsigned zerofill")),
ColumnType::SmallInt(NumericAttr {
maximum: Some(8),
decimal: None,
unsigned: Some(true),
zero_fill: Some(true),
})
);
} | rust_cleaned_test_functions.jsonl/73838 | {
"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,
62,
24,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
9004,
396,
7,
23,
8,
3774,
76178,
1055,
483,
30154,
310,
9332,
929,
486,
25307,
1072,
8204,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_range_covered() {
let meta = vec![(b"b", b"d"), (b"d", b"e"), (b"e", b"f"), (b"f", b"h")];
let mut region_ranges = BTreeMap::new();
let mut region_peers = HashMap::new();
{
for (i, (start, end)) in meta.into_iter().enumerate() {
let mut region = metapb::Region::new();
let peer = metapb::Peer::new();
region.set_peers(RepeatedField::from_vec(vec![peer]));
region.set_start_key(start.to_vec());
region.set_end_key(end.to_vec());
region_ranges.insert(enc_end_key(®ion), i as u64);
region_peers.insert(i as u64, region);
}
let check_range = |start: &[u8], end: &[u8]| {
is_range_covered(
®ion_ranges,
|id: u64| ®ion_peers[&id],
data_key(start),
data_end_key(end),
)
};
assert!(!check_range(b"a", b"c"));
assert!(check_range(b"b", b"d"));
assert!(check_range(b"b", b"e"));
assert!(check_range(b"e", b"f"));
assert!(check_range(b"b", b"g"));
assert!(check_range(b"e", b"h"));
assert!(!check_range(b"e", b"n"));
assert!(!check_range(b"g", b"n"));
assert!(!check_range(b"o", b"z"));
assert!(!check_range(b"", b""));
}
let meta = vec![(b"b", b"d"), (b"e", b"f"), (b"f", b"h")];
region_ranges.clear();
region_peers.clear();
{
for (i, (start, end)) in meta.into_iter().enumerate() {
let mut region = metapb::Region::new();
let peer = metapb::Peer::new();
region.set_peers(RepeatedField::from_vec(vec![peer]));
region.set_start_key(start.to_vec());
region.set_end_key(end.to_vec());
region_ranges.insert(enc_end_key(®ion), i as u64);
region_peers.insert(i as u64, region);
}
let check_range = |start: &[u8], end: &[u8]| {
is_range_covered(
®ion_ranges,
|id: u64| ®ion_peers[&id],
data_key(start),
data_end_key(end),
)
};
assert!(!check_range(b"a", b"c"));
assert!(check_range(b"b", b"d"));
assert!(!check_range(b"b", b"e"));
assert!(check_range(b"e", b"f"));
assert!(!check_range(b"b", b"g"));
assert!(check_range(b"e", b"g"));
assert!(check_range(b"e", b"h"));
assert!(!check_range(b"e", b"n"));
assert!(!check_range(b"g", b"n"));
assert!(!check_range(b"o", b"z"));
assert!(!check_range(b"", b""));
}
} | rust_cleaned_test_functions.jsonl/86484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
9698,
38087,
291,
368,
341,
286,
1077,
8823,
284,
7486,
0,
9697,
65,
1,
65,
497,
293,
44917,
3975,
320,
65,
44917,
497,
293,
1,
68,
3975,
320,
65,
1,
68,
497,
293,
96171,
3975,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_long() {
match Variant::VInteger(42).plus(Variant::VLong(2)).unwrap() {
Variant::VLong(result) => assert_eq!(result, 44),
_ => panic!("assertion failed"),
}
} | rust_cleaned_test_functions.jsonl/84547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
368,
341,
394,
2432,
39292,
486,
53,
3486,
7,
19,
17,
568,
7138,
12410,
15341,
486,
53,
6583,
7,
17,
4579,
15454,
368,
341,
503,
39292,
486,
53,
6583,
4456,
8,
589,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_ensure_on_channel_followed_by_scheduled_scan() {
let exec = fasync::TestExecutor::new().expect("failed to create an executor");
let mut m = MockObjects::new(&exec);
let mut me = m.make_mlme();
me.make_client_station();
let mut client = me.get_bound_client().expect("client should be present");
client.send_open_auth_frame().expect("error delivering WLAN frame");
assert_eq!(m.fake_device.wlan_queue.len(), 1);
me.on_sme_scan(scan_req());
assert_eq!(me.ctx.device.channel(), MAIN_CHANNEL);
// Verify that triggering scheduled timeout by channel scheduler would switch channel
let (_, timed_event) =
m.time_stream.try_next().unwrap().expect("Should have scheduled a timed event");
me.handle_timed_event(timed_event.id, timed_event.event);
assert_eq!(me.ctx.device.channel().primary, SCAN_CHANNEL_PRIMARY);
} | rust_cleaned_test_functions.jsonl/32101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
27289,
4470,
14571,
43490,
291,
3710,
643,
26644,
28857,
368,
341,
286,
1077,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_self_has_impl_action() {
check_actions(
r#"struct foo where Self$0:;"#,
expect![[r#"
[
Implementation(
FilePosition {
file_id: FileId(
0,
),
offset: 7,
},
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
25637,
21778,
21007,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
55543,
1235,
15229,
1380,
10115,
3,
15,
62973,
2,
345,
310,
1720,
0,
15505,
81,
2,
698,
394,
2278,
503,
30813,
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_character_renderer() -> SimpleResult<()> {
let data = b"\x41\x10\x09".to_vec();
let offset = Offset::Dynamic(Context::new(&data));
let a = H2String::new(3, CharacterReader::ASCII, CharacterFormatter::pretty_str_character())?;
assert_eq!("\"A\\x10\\t\"", a.to_display(offset)?);
let a = H2String::new(3, CharacterReader::ASCII, CharacterFormatter::new_character(
false, // show_single_quotes
CharacterReplacementPolicy::ReplaceEverything,
CharacterUnprintableOption::URLEncode,
))?;
assert_eq!("\"%41%10%09\"", a.to_display(offset)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/102197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40988,
52345,
368,
1464,
8993,
2077,
71698,
341,
286,
1077,
821,
284,
293,
11934,
87,
19,
16,
3462,
16,
15,
3462,
15,
24,
3263,
983,
13251,
543,
286,
1077,
4347,
284,
16861,
486,
21752,
14001,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_server_continues_on_bad_data_udp() {
named_test_harness("example.toml", |port, _, _| {
let mut io_loop = Runtime::new().unwrap();
let addr: SocketAddr = SocketAddr::new(Ipv4Addr::new(127, 0, 0, 1).into(), port);
let stream = UdpClientStream::<TokioUdpSocket>::new(addr);
let (bg, mut client) = ClientFuture::connect(stream);
io_loop.spawn(bg);
query_a(&mut io_loop, &mut client);
let raw_socket = UdpSocket::bind(SocketAddr::new(Ipv4Addr::new(0, 0, 0, 0).into(), 0))
.expect("couldn't bind raw");
raw_socket
.send_to(b"0xDEADBEEF", addr)
.expect("raw send failed");
// just tests that multiple queries work
let addr: SocketAddr = SocketAddr::new(Ipv4Addr::new(127, 0, 0, 1).into(), port);
let stream = UdpClientStream::<TokioUdpSocket>::new(addr);
let (bg, mut client) = ClientFuture::connect(stream);
io_loop.spawn(bg);
query_a(&mut io_loop, &mut client);
})
} | rust_cleaned_test_functions.jsonl/75217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
68948,
1137,
4470,
34199,
1769,
69432,
368,
341,
262,
6941,
4452,
1523,
23518,
445,
8687,
73494,
75,
497,
760,
403,
11,
8358,
85137,
341,
286,
1077,
5206,
6399,
17198,
284,
10954,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_comment() {
assert_eq!(lex("/// \n"), (Token::DocComment, 4));
assert_eq!(lex("///hello\n"), (Token::DocComment, 8));
assert_eq!(lex("/// hello\n"), (Token::DocComment, 9));
} | rust_cleaned_test_functions.jsonl/80515 | {
"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,
18869,
17638,
368,
341,
286,
2060,
10714,
10297,
2571,
445,
2575,
1124,
77,
3975,
320,
3323,
486,
9550,
10677,
11,
220,
19,
1106,
286,
2060,
10714,
10297,
2571,
445,
2575,
14990,
1699,
3975,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_elf() {
test_interpreter_and_jit_elf!(
"tests/elfs/noop.so",
[],
(
b"log" => syscalls::BpfSyscallString::call; syscalls::BpfSyscallString {},
b"log_64" => syscalls::BpfSyscallU64::call; syscalls::BpfSyscallU64 {},
),
{ |_vm, res: Result| { res.unwrap() == 0 } },
11
);
} | rust_cleaned_test_functions.jsonl/59053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
62,
490,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
62,
490,
33673,
286,
330,
23841,
14,
490,
82,
33100,
453,
26476,
756,
286,
10239,
286,
2399,
310,
293,
47012,
1,
589,
5708,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multidimensional_array() {
let datums = vec![
Datum::Int32(1),
Datum::Int32(2),
Datum::Int32(3),
Datum::Int32(4),
Datum::Int32(5),
Datum::Int32(6),
Datum::Int32(7),
Datum::Int32(8),
];
let mut row = Row::default();
row.push_array(
&[
ArrayDimension {
lower_bound: 1,
length: 1,
},
ArrayDimension {
lower_bound: 1,
length: 4,
},
ArrayDimension {
lower_bound: 1,
length: 2,
},
],
&datums,
)
.unwrap();
let array = row.unpack_first().unwrap_array();
assert_eq!(array.elements().into_iter().collect::<Vec<_>>(), datums);
} | rust_cleaned_test_functions.jsonl/56496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 622
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
307,
28221,
3858,
368,
341,
286,
1077,
3258,
6237,
284,
7486,
90515,
310,
68459,
486,
1072,
18,
17,
7,
16,
1326,
310,
68459,
486,
1072,
18,
17,
7,
17,
1326,
310,
68459,
486,
1072,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_has_no_sigs() {
let sig = Signature::default();
let blockhash = hash(Hash::default().as_ref());
let status_cache = BankStatusCache::default();
assert_eq!(
status_cache.get_signature_status(&sig, &blockhash, &HashMap::new()),
None
);
assert_eq!(
status_cache.get_signature_status_slow(&sig, &HashMap::new()),
None
);
} | rust_cleaned_test_functions.jsonl/82705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
21778,
6536,
643,
14462,
368,
341,
286,
1077,
8366,
284,
32232,
486,
2258,
543,
286,
1077,
2504,
8296,
284,
5175,
7,
6370,
486,
2258,
1005,
300,
7793,
1423,
286,
1077,
2639,
11529,
284,
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_du_threshold() {
let scene = TestScenario::new(util_name!());
let threshold = if cfg!(windows) { "7K" } else { "10K" };
scene
.ucmd()
.arg(format!("--threshold={}", threshold))
.succeeds()
.stdout_contains("links")
.stdout_does_not_contain("deeper_dir");
scene
.ucmd()
.arg(format!("--threshold=-{}", threshold))
.succeeds()
.stdout_does_not_contain("links")
.stdout_contains("deeper_dir");
} | rust_cleaned_test_functions.jsonl/23741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
84,
21858,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
1077,
12171,
284,
421,
13286,
10297,
27077,
8,
314,
330,
22,
42,
1,
335,
770,
314,
330,
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... | 2 |
#[test]
fn test_query_matches_with_multiple_on_same_root() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(
language,
"(class_declaration
name: (identifier) @the-class-name
(class_body
(method_definition
name: (property_identifier) @the-method-name)))",
)
.unwrap();
assert_query_matches(
language,
&query,
"
class Person {
// the constructor
constructor(name) { this.name = name; }
// the getter
getFullName() { return this.name; }
}
",
&[
(
0,
vec![
("the-class-name", "Person"),
("the-method-name", "constructor"),
],
),
(
0,
vec![
("the-class-name", "Person"),
("the-method-name", "getFullName"),
],
),
],
);
});
} | rust_cleaned_test_functions.jsonl/25147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 810
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
45233,
4470,
33574,
12993,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
1006,
310,
4128... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_static_provider_custom_time_expiration() {
let start_time = Utc::now();
let result = StaticProvider::new(
"fake-key".to_owned(),
"fake-secret".to_owned(),
None,
Some(10000),
)
.credentials()
.wait();
assert!(result.is_ok());
let finalized = result.unwrap();
let expires_at = finalized.expires_at().unwrap().clone();
assert!(start_time + Duration::minutes(100) < expires_at);
assert!(expires_at < start_time + Duration::minutes(200));
} | rust_cleaned_test_functions.jsonl/83675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
29518,
15875,
3009,
2702,
28479,
368,
341,
286,
1077,
1191,
3009,
284,
547,
10413,
486,
3328,
543,
286,
1077,
1102,
284,
23105,
5179,
486,
931,
1006,
310,
330,
30570,
16173,
3263,
983,
5197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part_b() {
let xss = read_input(InputType::Sample);
for xs in &xss {
println!("{:?}", xs);
}
assert_eq!(1134, part_b(&xss));
} | rust_cleaned_test_functions.jsonl/13194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
880,
368,
341,
286,
1077,
856,
778,
284,
1349,
5898,
29773,
929,
486,
17571,
317,
286,
369,
11943,
304,
609,
87,
778,
341,
310,
13751,
88928,
25,
52652,
11943,
317,
286,
555,
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
] | 2 |
#[test]
fn test_a_big_bitmap() {
let mut bitmap: Bitmap = (1..1_000_000).collect();
let serialized_buffer = bitmap.serialize();
assert_eq!(serialized_buffer.len(), 131_208);
assert!(bitmap.run_optimize());
let serialized_buffer = bitmap.serialize();
assert_eq!(serialized_buffer.len(), 230);
} | rust_cleaned_test_functions.jsonl/103104 | {
"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,
4306,
36386,
41527,
368,
341,
10217,
5206,
19746,
25,
17533,
284,
320,
16,
496,
16,
62,
15,
15,
15,
62,
15,
15,
15,
568,
17384,
543,
10217,
32916,
7776,
284,
19746,
33969,
1428,
11120,
6948,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_sequence_send_fail() {
let port_channel = (PortId::default(), ChannelId::new(0));
let context: Context<Test> = Context::new();
new_test_ext().execute_with(|| {
let result = context.get_next_sequence_send(&port_channel.clone()).unwrap_err().to_string();
assert_eq!(result, ICS04Error::missing_next_send_seq(port_channel).to_string());
})
} | rust_cleaned_test_functions.jsonl/60073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
23735,
13565,
22121,
368,
341,
10217,
2635,
14571,
284,
320,
7084,
764,
486,
2258,
1507,
13434,
764,
486,
931,
7,
15,
1106,
10217,
2266,
25,
9608,
71273,
29,
284,
9608,
486,
931,
1428,
86... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_derive_attrs() {
let tt = mbe::parse_to_token_tree(
r#"
#[allow(unused)]
#[derive(Copy)]
#[derive(Hello)]
struct A {
bar: u32
}
"#,
)
.unwrap()
.0;
let result = format!("{:#?}", remove_derive_attrs(&tt).unwrap());
assert_eq_text!(
&result,
r#"
SUBTREE $
PUNCH # [alone] 0
SUBTREE [] 1
IDENT allow 2
SUBTREE () 3
IDENT unused 4
IDENT struct 15
IDENT A 16
SUBTREE {} 17
IDENT bar 18
PUNCH : [alone] 19
IDENT u32 20
"#
.trim()
);
} | rust_cleaned_test_functions.jsonl/90737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
35345,
533,
39578,
368,
341,
286,
1077,
17853,
284,
296,
1371,
486,
6400,
2346,
6458,
11663,
1006,
310,
435,
2,
698,
262,
11506,
7183,
18364,
2591,
5563,
262,
11506,
27098,
3025,
1266,
5563... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hash_chain() {
let mut blockchain = Blockchain::new();
blockchain.set_check_trans(false);
let genesis_hash = blockchain.tip();
let block1 = generate_random_block(&genesis_hash);
let block2 = generate_random_block(&block1.hash);
let block3 = generate_random_block(&block2.hash);
blockchain.insert(&block1);
blockchain.insert(&block2);
blockchain.insert(&block3);
let hashes = blockchain.hash_chain();
assert_eq!(genesis_hash, hashes[3]);
assert_eq!(block1.hash, hashes[2]);
assert_eq!(block2.hash, hashes[1]);
assert_eq!(block3.hash, hashes[0]);
} | rust_cleaned_test_functions.jsonl/61921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8950,
30583,
368,
341,
286,
1077,
5206,
17944,
284,
42885,
486,
931,
543,
286,
17944,
980,
7200,
7965,
3576,
317,
286,
1077,
59366,
8950,
284,
17944,
78044,
543,
286,
1077,
2504,
16,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_introduce_var_return() {
check_assist_range(
introduce_variable,
"
fn foo() -> u32 {
<|>return 2 + 2<|>;
}
",
"
fn foo() -> u32 {
let <|>var_name = 2 + 2;
return var_name;
}
",
);
} | rust_cleaned_test_functions.jsonl/5718 | {
"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,
4042,
47845,
4612,
12511,
368,
341,
286,
1779,
12083,
380,
9698,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
15229,
368,
1464,
575,
18,
17,
341,
262,
82639,
29,
689,
220,
17,
488,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.