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_deserialize_array() {
let request = TestInterfaceRequest::from_args(
6, /* opcode */
vec![Arg::Array(ARRAY_VALUE.to_vec().into())],
)
.unwrap();
assert_match!(request, TestInterfaceRequest::Array{arg} => assert_eq!(arg.into_vec(), ARRAY_VALUE));
} | rust_cleaned_test_functions.jsonl/55806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
3858,
368,
341,
286,
1077,
1681,
284,
3393,
5051,
1900,
486,
1499,
8384,
1006,
310,
220,
21,
11,
1391,
30028,
735,
310,
7486,
20703,
2735,
486,
1857,
7,
14893,
7476,
2389,
13251,
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_locator() {
let (chain_controller, shared) = start_chain(None);
let num = 200;
let index = [
199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 188, 184, 176, 160, 128, 64,
];
for i in 1..num {
insert_block(&chain_controller, &shared, u128::from(i), i);
}
let synchronizer = gen_synchronizer(chain_controller, shared.clone());
let locator = synchronizer
.shared
.active_chain()
.get_locator(shared.snapshot().tip_header());
let mut expect = Vec::new();
for i in index.iter() {
expect.push(shared.store().get_block_hash(*i).unwrap());
}
//genesis_hash must be the last one
expect.push(shared.genesis_hash());
assert_eq!(expect, locator);
} | rust_cleaned_test_functions.jsonl/95012 | {
"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,
75344,
368,
341,
286,
1077,
320,
8819,
21600,
11,
6094,
8,
284,
1191,
30583,
26717,
626,
286,
1077,
1629,
284,
220,
17,
15,
15,
280,
286,
1077,
1922,
284,
2278,
310,
220,
16,
24,
24,
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... | 3 |
#[test]
fn test_clone_map() {
let mut map: HashMap<Key, Value> = HashMap::new();
let key1 = Key {
key: "a".to_owned(),
key_version: 0,
};
let data = serialize(&"value".to_owned()).expect("serialize");
let value1 = Value {
type_id: "String".to_owned(),
data,
};
let key2 = Key {
key: "a".to_owned(),
key_version: 1,
};
let data = serialize(&1).expect("serialize");
let value2 = Value {
type_id: "i32".to_owned(),
data,
};
map.insert(key1.clone(), value1.clone());
map.insert(key2.clone(), value2.clone());
let new_map = map.clone();
let result = new_map.get(&key1).expect("get value");
assert_eq!(new_map.len(), 1);
assert_eq!(result.clone(), value2);
} | rust_cleaned_test_functions.jsonl/90782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
5376,
368,
341,
286,
1077,
5206,
2415,
25,
10528,
42003,
11,
5162,
29,
284,
10528,
486,
931,
543,
286,
1077,
1376,
16,
284,
5309,
341,
310,
1376,
25,
330,
64,
3263,
983,
51973,
3148,
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_groupby_threaded() {
for slice in &[
vec![1, 2, 3, 4, 4, 4, 2, 1],
vec![1, 2, 3, 4, 4, 4, 2, 1, 1],
vec![1, 2, 3, 4, 4, 4],
] {
let ca = UInt32Chunked::new("", slice);
let split = split_ca(&ca, 4).unwrap();
let mut a = groupby(ca.into_iter()).into_iter().collect::<Vec<_>>();
a.sort();
let keys = split.iter().map(|ca| ca.cont_slice().unwrap()).collect();
let mut b = groupby_threaded_num(keys, 0, split.len() as u64)
.into_iter()
.collect::<Vec<_>>();
b.sort();
assert_eq!(a, b);
}
} | rust_cleaned_test_functions.jsonl/68998 | {
"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,
6288,
1694,
10814,
291,
368,
341,
286,
369,
15983,
304,
609,
9640,
310,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
19,
11,
220,
19,
11,
220,
17,
11,
220,
16,
1259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parsing_proper_del_statement() {
let statement = get_statement!("DEL MY_KEY");
assert_eq!(
statement,
Statement {
stype: StatementType::Del,
key: Some("MY_KEY".to_owned()),
value: None
}
);
} | rust_cleaned_test_functions.jsonl/104585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
2540,
712,
18029,
37404,
368,
341,
310,
1077,
5114,
284,
633,
37404,
17223,
38332,
18224,
6600,
797,
310,
2060,
10714,
33673,
394,
5114,
345,
394,
21756,
341,
503,
357,
499,
25,
21756,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_lines_mod_comments() {
check_join_lines(
r"
fn foo() {
//! Hello<|>
//! world!
}
",
r"
fn foo() {
//! Hello<|> world!
}
",
);
} | rust_cleaned_test_functions.jsonl/79944 | {
"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,
31017,
18323,
7480,
30359,
368,
341,
286,
1779,
31017,
18323,
1006,
310,
435,
698,
8822,
15229,
368,
341,
262,
17664,
21927,
27,
91,
397,
262,
17664,
1879,
4894,
532,
756,
310,
435,
698,
8822,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_region_meta_key() {
let ids = vec![1, 1024, u64::max_value()];
for id in ids {
let prefix = region_meta_prefix(id);
let info_key = region_state_key(id);
assert!(info_key.starts_with(&prefix));
assert_eq!(
decode_region_meta_key(&info_key).unwrap(),
(id, REGION_STATE_SUFFIX)
);
}
// test sort.
let tbls: Vec<(u64, u64, Ordering)> = vec![
(1, 2, Ordering::Less),
(1, 1, Ordering::Equal),
(2, 1, Ordering::Greater),
];
for (lkey, rkey, order) in tbls {
let lhs = region_state_key(lkey);
let rhs = region_state_key(rkey);
assert_eq!(lhs.partial_cmp(&rhs), Some(order));
}
} | rust_cleaned_test_functions.jsonl/44170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
13381,
3097,
368,
341,
286,
1077,
14151,
284,
7486,
20703,
16,
11,
220,
16,
15,
17,
19,
11,
575,
21,
19,
486,
2810,
3142,
33800,
286,
369,
877,
304,
14151,
341,
310,
1077,
9252,
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... | 3 |
#[test]
fn test_warp_timestamp_with_a_vengeance() {
let leader_pubkey = solana_sdk::pubkey::new_rand();
let GenesisConfigInfo {
mut genesis_config,
voting_keypair,
..
} = create_genesis_config_with_leader(5, &leader_pubkey, 3);
genesis_config
.accounts
.remove(&feature_set::warp_timestamp_with_a_vengeance::id())
.unwrap();
test_warp_timestamp_activation(
genesis_config,
voting_keypair,
&feature_set::warp_timestamp_with_a_vengeance::id(),
MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW,
MAX_ALLOWABLE_DRIFT_PERCENTAGE_SLOW_V2,
);
} | rust_cleaned_test_functions.jsonl/28975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
7876,
23073,
6615,
4306,
62,
52205,
681,
368,
341,
286,
1077,
7653,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_renew_retransmit() {
let mut s = socket_bound();
recv!(s, []);
recv!(s, time 500_000, [(IP_SEND, UDP_SEND, DHCP_RENEW)]);
recv!(s, time 749_000, []);
recv!(s, time 750_000, [(IP_SEND, UDP_SEND, DHCP_RENEW)]);
recv!(s, time 874_000, []);
recv!(s, time 875_000, [(IP_SEND, UDP_SEND, DHCP_RENEW)]);
// check it still works
send!(s, time 875_000, (IP_RECV, UDP_RECV, DHCP_ACK));
match &s.state {
ClientState::Renewing(r) => {
// NOW the expiration gets bumped
assert_eq!(r.renew_at, Instant::from_secs(875 + 500));
assert_eq!(r.expires_at, Instant::from_secs(875 + 1000));
}
_ => panic!("Invalid state"),
}
} | rust_cleaned_test_functions.jsonl/90238 | {
"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,
1288,
931,
1288,
1458,
1763,
368,
341,
286,
1077,
5206,
274,
284,
7575,
19447,
1428,
286,
27006,
10297,
82,
11,
42197,
286,
27006,
10297,
82,
11,
882,
220,
20,
15,
15,
62,
15,
15,
15,
11,
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... | 2 |
#[test]
fn test_iter() {
let mut buffer = CircleBuffer::with_capacity(3);
buffer.push(1);
buffer.push(2);
buffer.push(3);
let add1: Vec<i32> = buffer.iter().map(|x| x + 1).collect();
assert_eq!(add1, vec![2, 3, 4]);
buffer.push(4);
buffer.push(5);
let add2: Vec<i32> = buffer.iter().map(|x| x + 2).collect();
assert_eq!(add2, vec![5, 6, 7]);
} | rust_cleaned_test_functions.jsonl/51005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
286,
1077,
5206,
4147,
284,
21224,
4095,
486,
4197,
35603,
7,
18,
317,
286,
4147,
2552,
7,
16,
317,
286,
4147,
2552,
7,
17,
317,
286,
4147,
2552,
7,
18,
317,
286,
1077,
912,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_vars_unset() {
env::set_var("SET_TO_BE_UNSET", "val");
env::remove_var("UNSET_TO_BE_UNSET");
// Check test preconditions
assert_eq!(env::var("SET_TO_BE_UNSET"), Ok("val".to_string()));
assert_eq!(env::var("UNSET_TO_BE_UNSET"), Err(VarError::NotPresent));
crate::with_vars_unset(vec!["SET_TO_BE_UNSET", "UNSET_TO_BE_UNSET"], || {
assert_eq!(env::var("SET_TO_BE_UNSET"), Err(VarError::NotPresent));
assert_eq!(env::var("UNSET_TO_BE_UNSET"), Err(VarError::NotPresent));
});
assert_eq!(env::var("SET_TO_BE_UNSET"), Ok("val".to_string()));
assert_eq!(env::var("UNSET_TO_BE_UNSET"), Err(VarError::NotPresent));
} | rust_cleaned_test_functions.jsonl/49886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
11168,
98109,
368,
341,
286,
6105,
486,
746,
4612,
445,
5884,
8650,
27168,
6735,
5884,
497,
330,
831,
797,
286,
6105,
486,
5399,
4612,
445,
1861,
5884,
8650,
27168,
6735,
5884,
797,
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... | 2 |
#[test]
fn test_object_list_keys() {
let mut object = BTreeMap::new();
object.insert(vec![0i64], ());
object.insert(vec![100i64], ());
object.insert(vec![-1i64], ());
object.insert(vec![-2i64], ());
object.insert(vec![0i64, 0i64], ());
object.insert(vec![0i64, -1i64], ());
let vec = to_vec(&object).unwrap();
assert_eq!(
vec![166, 129, 0, 246, 129, 24, 100, 246, 129, 32, 246, 129, 33, 246, 130, 0, 0, 246, 130, 0, 32, 246],
vec);
let test_object = from_slice(&vec[..]).unwrap();
assert_eq!(object, test_object);
} | rust_cleaned_test_functions.jsonl/110263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
2019,
12631,
368,
341,
262,
1077,
5206,
1633,
284,
425,
6533,
2227,
486,
931,
543,
262,
1633,
7030,
25592,
20703,
15,
72,
21,
19,
1125,
49323,
262,
1633,
7030,
25592,
20703,
16,
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_fib() -> TestResult {
let p = polar();
p.load_str(
r#"fib(0, 1) if cut;
fib(1, 1) if cut;
fib(n, a+b) if fib(n-1, a) and fib(n-2, b);"#,
)?;
qvar(&p, r#"fib(0, x)"#, "x", values![1]);
qvar(&p, r#"fib(1, x)"#, "x", values![1]);
qvar(&p, r#"fib(2, x)"#, "x", values![2]);
qvar(&p, r#"fib(3, x)"#, "x", values![3]);
qvar(&p, r#"fib(4, x)"#, "x", values![5]);
qvar(&p, r#"fib(5, x)"#, "x", values![8]);
Ok(())
} | rust_cleaned_test_functions.jsonl/68157 | {
"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,
761,
579,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
75326,
7,
15,
11,
220,
16,
8,
421,
3931,
280,
1843,
15801,
7,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_serialize_zeroes() {
// Test that UdpPacket::serialize properly zeroes memory before serializing
// the header.
let mut buf_0 = [0; HEADER_BYTES];
let _: Buf<&mut [u8]> = Buf::new(&mut buf_0[..], HEADER_BYTES..)
.encapsulate(UdpPacketBuilder::new(
TEST_SRC_IPV4,
TEST_DST_IPV4,
NonZeroU16::new(1),
NonZeroU16::new(2).unwrap(),
))
.serialize_vec_outer()
.unwrap()
.unwrap_a();
let mut buf_1 = [0xFF; HEADER_BYTES];
let _: Buf<&mut [u8]> = Buf::new(&mut buf_1[..], HEADER_BYTES..)
.encapsulate(UdpPacketBuilder::new(
TEST_SRC_IPV4,
TEST_DST_IPV4,
NonZeroU16::new(1),
NonZeroU16::new(2).unwrap(),
))
.serialize_vec_outer()
.unwrap()
.unwrap_a();
assert_eq!(buf_0, buf_1);
} | rust_cleaned_test_functions.jsonl/112489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
19359,
288,
368,
341,
286,
442,
3393,
429,
547,
9796,
16679,
486,
24166,
10277,
97443,
4938,
1573,
6146,
4849,
198,
286,
442,
279,
4247,
624,
286,
1077,
5206,
6607,
62,
15,
284,
508,
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_relation() {
with_graph(|graph| {
graph.mutate("CREATE (src)-[rel:RelationType { prop: 42 }]->(dst)").unwrap();
let relation: Relation = graph.query("MATCH (src)-[rel]->(dst) RETURN rel").unwrap();
assert_eq!(relation, Relation {
type_name: "RelationType".to_string().into(),
properties: hashmap! {
"prop".to_string().into() => Scalar::Integer(42),
},
});
});
} | rust_cleaned_test_functions.jsonl/73412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46984,
368,
341,
262,
448,
14738,
22428,
4439,
91,
341,
286,
4771,
744,
332,
349,
445,
22599,
320,
3548,
7287,
58,
3748,
25,
33790,
929,
314,
2004,
25,
220,
19,
17,
335,
6294,
7,
15658,
63554,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_types() {
test_roundtrip_flow("number | boolean & string");
test_roundtrip_flow("type A = number");
test_roundtrip_flow("type A = ?number");
test_roundtrip_flow("type A = string");
test_roundtrip_flow("type A = 'foo'");
test_roundtrip_flow("type A = 3");
test_roundtrip_flow("type A = boolean");
test_roundtrip_flow("type A = true | false");
test_roundtrip_flow("type A = symbol");
test_roundtrip_flow("type A = mixed");
test_roundtrip_flow("type A = any");
test_roundtrip_flow("type A = void");
test_roundtrip_flow("type A = number => number");
test_roundtrip_flow("type A = (number, string) => number");
} | rust_cleaned_test_functions.jsonl/102606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9763,
368,
341,
262,
1273,
29896,
32981,
27441,
445,
4082,
760,
2710,
609,
914,
797,
262,
1273,
29896,
32981,
27441,
445,
1313,
362,
284,
1372,
797,
262,
1273,
29896,
32981,
27441,
445,
1313,
362,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_module_7() {
let (_temp_dir, deno_dir) = test_setup();
let specifier = "http_test.ts";
let referrer = add_root!("/Users/rld/src/deno_net/");
let expected_module_name =
add_root!("/Users/rld/src/deno_net/http_test.ts");
let expected_filename = add_root!("/Users/rld/src/deno_net/http_test.ts");
let (module_name, filename) =
deno_dir.resolve_module(specifier, referrer).unwrap();
assert_eq!(module_name, expected_module_name);
assert_eq!(filename, expected_filename);
} | rust_cleaned_test_functions.jsonl/72758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10750,
62,
22,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
97616,
284,
330,
1254,
4452,
21288,
876,
262,
1077,
2053,
30929,
284,
912,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_systemtime_overflow_struct() {
assert_de_tokens_error::<SystemTime>(
&[
Token::Struct {
name: "SystemTime",
len: 2,
},
Token::Str("secs_since_epoch"),
Token::U64(u64::max_value()),
Token::Str("nanos_since_epoch"),
Token::U32(1_000_000_000),
Token::StructEnd,
],
"overflow deserializing SystemTime epoch offset",
);
} | rust_cleaned_test_functions.jsonl/129552 | {
"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,
17687,
1678,
79073,
15126,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
2320,
1462,
17055,
286,
609,
9640,
310,
9660,
486,
9422,
341,
394,
829,
25,
330,
2320,
1462,
756,
394,
2422,
25,
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 |
#[test]
fn test_add_get_meta() {
gst::init().unwrap();
let mut buffer = gst::Buffer::new();
let port = 5000;
let inet_addr = gio::InetAddress::from_string("127.0.0.1");
let expected_addr = &gio::InetSocketAddress::new(&inet_addr, port);
let expected_inet_addr = expected_addr.get_address().unwrap();
{
let meta = NetAddressMeta::add(
buffer.get_mut().unwrap(),
&gio::InetSocketAddress::new(&inet_addr, port),
);
let actual_addr = meta
.get_addr()
.downcast::<gio::InetSocketAddress>()
.unwrap();
assert_eq!(actual_addr.get_port(), expected_addr.get_port());
let actual_inet_addr = actual_addr.get_address().unwrap();
assert!(actual_inet_addr.equal(&expected_inet_addr));
}
{
let meta = buffer.get_meta::<NetAddressMeta>().unwrap();
let actual_addr = meta
.get_addr()
.downcast::<gio::InetSocketAddress>()
.unwrap();
assert_eq!(actual_addr.get_port(), expected_addr.get_port());
let actual_inet_addr = actual_addr.get_address().unwrap();
assert!(actual_inet_addr.equal(&expected_inet_addr));
}
} | rust_cleaned_test_functions.jsonl/112429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 679
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
3062,
13381,
368,
341,
286,
43769,
486,
2327,
1005,
15454,
1428,
286,
1077,
5206,
4147,
284,
43769,
486,
4095,
486,
931,
543,
286,
1077,
2635,
284,
220,
20,
15,
15,
15,
280,
286,
1077,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_managed_directory_gc_while_mmapped() {
let test_path1: &'static Path = Path::new("some_path_for_test");
let tempdir = TempDir::new().unwrap();
let tempdir_path = PathBuf::from(tempdir.path());
let living_files = HashSet::new();
let mmap_directory = MmapDirectory::open(&tempdir_path).unwrap();
let mut managed_directory = ManagedDirectory::wrap(mmap_directory).unwrap();
let mut write = managed_directory.open_write(test_path1).unwrap();
write.write_all(&[0u8, 1u8]).unwrap();
write.terminate().unwrap();
assert!(managed_directory.exists(test_path1));
let _mmap_read = managed_directory.open_read(test_path1).unwrap();
managed_directory.garbage_collect(|| living_files.clone());
if cfg!(target_os = "windows") {
assert!(managed_directory.exists(test_path1));
// unmap should happen here.
drop(_mmap_read);
// The file should still be in the list of managed file and
// eventually be deleted once mmap is released.
managed_directory.garbage_collect(|| living_files);
assert!(!managed_directory.exists(test_path1));
} else {
assert!(!managed_directory.exists(test_path1));
}
} | rust_cleaned_test_functions.jsonl/744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79889,
14846,
49423,
86069,
35599,
5677,
368,
341,
286,
1077,
1273,
2638,
16,
25,
30136,
1978,
7933,
284,
7933,
486,
931,
445,
14689,
2638,
5478,
4452,
3071,
286,
1077,
2730,
3741,
284,
19944,
618... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_correct_value_single() {
let mut map = TypedHandleMap::new();
let handle = map.insert(Foobar(1234));
assert_eq!(map.get(handle).unwrap(), &Foobar(1234));
map.remove(handle).unwrap();
assert_eq!(map.get(handle), None);
let handle = map.as_mut_untyped_map().insert(Foobar(1234));
assert_eq!(
map.get(TypedHandle::from_handle(handle)).unwrap(),
&Foobar(1234)
);
} | rust_cleaned_test_functions.jsonl/15919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
3142,
19487,
368,
341,
286,
1077,
5206,
2415,
284,
50554,
6999,
2227,
486,
931,
543,
286,
1077,
3705,
284,
2415,
7030,
7832,
78,
31393,
7,
16,
17,
18,
19,
1106,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_commit_ts() {
let engine = TestEngineBuilder::new().build().unwrap();
let (k, v) = (b"k", b"v");
// Shortcuts
let ts = TimeStamp::compose;
let uncommitted = |ttl, min_commit_ts| {
move |s| {
if let TxnStatus::Uncommitted { lock, .. } = s {
lock.ttl == ttl && lock.min_commit_ts == min_commit_ts
} else {
false
}
}
};
must_prewrite_put_for_large_txn(&engine, k, v, k, ts(10, 0), 100, 0);
check_txn_status::tests::must_success(
&engine,
k,
ts(10, 0),
ts(20, 0),
ts(20, 0),
true,
false,
false,
uncommitted(100, ts(20, 1)),
);
must_err(&engine, k, ts(10, 0), ts(15, 0));
must_err(&engine, k, ts(10, 0), ts(20, 0));
must_succeed(&engine, k, ts(10, 0), ts(20, 1));
must_prewrite_put_for_large_txn(&engine, k, v, k, ts(30, 0), 100, 0);
check_txn_status::tests::must_success(
&engine,
k,
ts(30, 0),
ts(40, 0),
ts(40, 0),
true,
false,
false,
uncommitted(100, ts(40, 1)),
);
must_succeed(&engine, k, ts(30, 0), ts(50, 0));
must_acquire_pessimistic_lock_for_large_txn(&engine, k, k, ts(60, 0), ts(60, 0), 100);
check_txn_status::tests::must_success(
&engine,
k,
ts(60, 0),
ts(70, 0),
ts(70, 0),
true,
false,
false,
uncommitted(100, ts(70, 1)),
);
must_prewrite_put_impl(
&engine,
k,
v,
k,
&None,
ts(60, 0),
true,
50,
ts(60, 0),
1,
ts(60, 1),
TimeStamp::zero(),
);
must_large_txn_locked(&engine, k, ts(60, 0), 100, ts(70, 1), false);
must_err(&engine, k, ts(60, 0), ts(65, 0));
must_succeed(&engine, k, ts(60, 0), ts(80, 0));
} | rust_cleaned_test_functions.jsonl/47474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
36346,
25023,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
286,
1077,
320,
74,
11,
348,
8,
284,
320,
65,
62911,
497,
293,
1,
85,
3071,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_p2pkh_address_58() {
let addr = Address {
network: Bitcoin,
payload: Payload::PubkeyHash(hex_pubkeyhash!("162c5ea71c0b23f5b9022ef047c4a86470a5b070")),
};
assert_eq!(
addr.script_pubkey(),
hex_script!("76a914162c5ea71c0b23f5b9022ef047c4a86470a5b07088ac")
);
assert_eq!(&addr.to_string(), "132F25rTsvBdp9JzLLBHP5mvGY66i1xdiM");
assert_eq!(addr.address_type(), Some(AddressType::P2pkh));
roundtrips(&addr);
} | rust_cleaned_test_functions.jsonl/59112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
20819,
71,
6744,
62,
20,
23,
368,
341,
286,
1077,
10789,
284,
9177,
341,
310,
3922,
25,
13127,
345,
310,
7729,
25,
52916,
486,
29162,
792,
6370,
44660,
34014,
792,
8296,
17223,
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 |
#[test]
fn test_nfa_builder_missing_finals() {
let nfa = NFABuilder::new()
.add_start(0)
.add_transition('a', 0, 1)
.finalize();
match nfa {
Err(NFAError::MissingFinalStates) => assert!(true),
_ => assert!(false, "MissingFinalStates expected."),
}
} | rust_cleaned_test_functions.jsonl/77588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
3632,
28532,
40447,
20676,
82,
368,
341,
286,
1077,
308,
3632,
284,
44727,
1867,
2511,
486,
931,
741,
310,
659,
718,
4906,
7,
15,
340,
310,
659,
718,
53593,
492,
64,
516,
220,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_import_graph_def() {
let mut g = Graph::new();
let opts = ImportGraphDefOptions::new();
let status = g.import_graph_def(&[], &opts);
assert!(status.is_ok());
} | rust_cleaned_test_functions.jsonl/89522 | {
"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,
18434,
14738,
7844,
368,
341,
286,
1077,
5206,
342,
284,
12165,
486,
931,
543,
286,
1077,
12185,
284,
13213,
11212,
2620,
3798,
486,
931,
543,
1789,
286,
1077,
2639,
284,
342,
34897,
14738,
7844,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unquoted_key() {
let p = Parser::new();
assert_eq!(p.unquoted_key("Un-Quoted_Key").1, Done("", "Un-Quoted_Key"));
} | rust_cleaned_test_functions.jsonl/27419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
63725,
3097,
368,
341,
262,
1077,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
6307,
63725,
3097,
445,
1806,
12,
2183,
9253,
35253,
1827,
16,
11,
27357,
19814,
330,
1806,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_lazy_ternary_predicate_pushdown() -> Result<()> {
let df = df![
"a" => &[10, 1, 2, 3]
]?;
let out = df
.lazy()
.select([when(col("a").eq(lit(10)))
.then(Null {}.lit())
.otherwise(col("a"))])
.drop_nulls(None)
.collect()?;
assert_eq!(
Vec::from(out.get_columns()[0].i32()?),
&[Some(1), Some(2), Some(3)]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
62,
4160,
658,
97474,
14218,
2923,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
286,
330,
64,
1,
589,
44590,
16,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
921,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_duet() {
let program = Program::load(
"snd 1\n\
snd 2\n\
snd p\n\
rcv a\n\
rcv b\n\
rcv c\n\
rcv d\n",
);
assert_eq!(program.run_duet(), [3, 3]);
} | rust_cleaned_test_functions.jsonl/34181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
13807,
368,
341,
262,
1077,
2025,
284,
6687,
486,
1078,
1006,
286,
330,
46395,
220,
16,
1699,
5661,
260,
28612,
220,
17,
1699,
5661,
260,
28612,
281,
1699,
5661,
260,
10192,
85,
264,
1699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scm_rights_single_cmsg_multiple_fds() {
use std::os::unix::net::UnixDatagram;
use std::os::unix::io::{RawFd, AsRawFd};
use std::thread;
use nix::sys::socket::{ControlMessage, ControlMessageOwned, MsgFlags,
sendmsg, recvmsg};
use nix::sys::uio::IoVec;
let (send, receive) = UnixDatagram::pair().unwrap();
let thread = thread::spawn(move || {
let mut buf = [0u8; 8];
let iovec = [IoVec::from_mut_slice(&mut buf)];
let mut space = cmsg_space!([RawFd; 2]);
let msg = recvmsg(
receive.as_raw_fd(),
&iovec,
Some(&mut space),
MsgFlags::empty()
).unwrap();
assert!(!msg.flags.intersects(MsgFlags::MSG_TRUNC | MsgFlags::MSG_CTRUNC));
let mut cmsgs = msg.cmsgs();
match cmsgs.next() {
Some(ControlMessageOwned::ScmRights(fds)) => {
assert_eq!(fds.len(), 2,
"unexpected fd count (expected 2 fds, got {})",
fds.len());
},
_ => panic!(),
}
assert!(cmsgs.next().is_none(), "unexpected control msg");
assert_eq!(msg.bytes, 8);
assert_eq!(iovec[0].as_slice(), [1u8, 2, 3, 4, 5, 6, 7, 8]);
});
let slice = [1u8, 2, 3, 4, 5, 6, 7, 8];
let iov = [IoVec::from_slice(&slice)];
let fds = [libc::STDIN_FILENO, libc::STDOUT_FILENO]; // pass stdin and stdout
let cmsg = [ControlMessage::ScmRights(&fds)];
sendmsg(send.as_raw_fd(), &iov, &cmsg, MsgFlags::empty(), None).unwrap();
thread.join().unwrap();
} | rust_cleaned_test_functions.jsonl/134662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 835
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6226,
98053,
19487,
666,
3236,
45233,
90438,
368,
341,
262,
990,
1460,
486,
436,
486,
56646,
486,
4711,
486,
55832,
45696,
5745,
280,
262,
990,
1460,
486,
436,
486,
56646,
486,
815,
22964,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extra_whitespace() {
assert_eq!(
parse_str("domain example.com.").get_domain(),
Some(String::from("example.com.")).as_ref()
);
assert_eq!(
parse_str("domain example.com. ").get_domain(),
Some(String::from("example.com.")).as_ref()
);
// hard tabs
assert_eq!(
parse_str(" domain example.com. ").get_domain(),
Some(String::from("example.com.")).as_ref()
);
// hard tabs + spaces
assert_eq!(
parse_str(" domain example.com. ").get_domain(),
Some(String::from("example.com.")).as_ref()
);
} | rust_cleaned_test_functions.jsonl/121156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31858,
86175,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
2895,
445,
12204,
981,
3110,
905,
98401,
455,
20111,
3148,
286,
4329,
2242,
486,
1499,
445,
8687,
905,
13,
15197,
300,
7793,
741,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ipv6_icmp_parameter_problem_non_must() {
let mut ctx = DummyEventDispatcherBuilder::from_config(DUMMY_CONFIG_V6)
.build::<DummyEventDispatcher>();
let device = DeviceId::new_ethernet(0);
// Test parsing an IPv6 packet with invalid next header value which
// we SHOULD send an ICMP response for (but we don't since its not a
#[rustfmt::skip]
let bytes: &mut [u8] = &mut [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// Body
1, 2, 3, 4, 5,
][..];
bytes[..4].copy_from_slice(&[0x60, 0x20, 0x00, 0x77][..]);
let payload_len = (bytes.len() - 40) as u16;
NetworkEndian::write_u16(&mut bytes[4..6], payload_len);
bytes[6] = 255; // Invalid Next Header
bytes[7] = 64;
bytes[8..24].copy_from_slice(DUMMY_CONFIG_V6.remote_ip.bytes());
bytes[24..40].copy_from_slice(DUMMY_CONFIG_V6.local_ip.bytes());
let mut buf = Buf::new(bytes, ..);
receive_ip_packet::<_, _, Ipv6>(&mut ctx, device, FrameDestination::Unicast, buf);
assert_eq!(get_counter_val(&mut ctx, "send_icmpv4_parameter_problem"), 0);
assert_eq!(get_counter_val(&mut ctx, "send_icmpv6_parameter_problem"), 0);
assert_eq!(get_counter_val(&mut ctx, "dispatch_receive_ip_packet"), 0);
} | rust_cleaned_test_functions.jsonl/94399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 765
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
21,
32747,
1307,
24899,
60139,
21637,
717,
590,
368,
341,
286,
1077,
5206,
5635,
284,
50567,
1556,
21839,
3297,
486,
1499,
5332,
5432,
58673,
12568,
2334,
21,
340,
310,
659,
5834,
27638,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_error() {
let ite1 = IteratorError::Eof;
assert!(ite1.is_eof());
let ite3 = IteratorError::Error("23333".to_string());
assert!(!ite3.is_eof());
} | rust_cleaned_test_functions.jsonl/73148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
4096,
368,
341,
286,
1077,
432,
68,
16,
284,
23023,
1454,
486,
36,
1055,
280,
286,
2060,
10297,
632,
16,
2079,
90792,
5231,
286,
1077,
432,
68,
18,
284,
23023,
1454,
486,
1454,
445,
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 |
#[test]
fn test_custom_search_path() {
let conn_string = format!(
"postgresql://{}:{}@{}:{}/{}?schema=musti-test",
env::var("TEST_PG_USER").unwrap(),
env::var("TEST_PG_PASSWORD").unwrap(),
env::var("TEST_PG_HOST").unwrap(),
env::var("TEST_PG_PORT").unwrap(),
env::var("TEST_PG_DB").unwrap(),
);
let url = Url::parse(&conn_string).unwrap();
let params = PostgresParams::try_from(url).unwrap();
let pool = r2d2::Pool::try_from(params).unwrap();
let mut conn = pool.get().unwrap();
let result_set = conn.query_raw("SHOW search_path", &[]).unwrap();
let row = result_set.first().unwrap();
assert_eq!(Some("\"musti-test\""), row[0].as_str());
} | rust_cleaned_test_functions.jsonl/87525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
10716,
2638,
368,
341,
286,
1077,
4534,
3904,
284,
3561,
33673,
310,
330,
88470,
1110,
6257,
79411,
31,
6257,
12547,
4472,
6257,
30,
17349,
28,
24812,
72,
16839,
756,
310,
6105,
486,
947,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float() {
assert_eq!(
Float {
value: 1.0,
encoded: "1.0".to_string()
}
.to_string(),
"1.0"
);
assert_eq!(
Float {
value: 1.01,
encoded: "1.01".to_string()
}
.to_string(),
"1.01"
);
assert_eq!(
Float {
value: 1.01,
encoded: "1.010".to_string()
}
.to_string(),
"1.010"
);
assert_eq!(
Float {
value: -1.333,
encoded: "-1.333".to_string()
}
.to_string(),
"-1.333"
);
} | rust_cleaned_test_functions.jsonl/123028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
368,
341,
286,
2060,
10714,
33673,
310,
13001,
341,
394,
897,
25,
220,
16,
13,
15,
345,
394,
20498,
25,
330,
16,
13,
15,
3263,
983,
3904,
741,
310,
456,
310,
659,
983,
3904,
3148,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_make_credential_extensions() {
let cbor_extensions = cbor_map! {
"hmac-secret" => true,
"credProtect" => CredentialProtectionPolicy::UserVerificationRequired,
};
let extensions = MakeCredentialExtensions::try_from(cbor_extensions);
let expected_extensions = MakeCredentialExtensions {
hmac_secret: true,
cred_protect: Some(CredentialProtectionPolicy::UserVerificationRequired),
};
assert_eq!(extensions, Ok(expected_extensions));
} | rust_cleaned_test_functions.jsonl/49008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
28230,
666,
30320,
60498,
368,
341,
286,
1077,
272,
9368,
60498,
284,
272,
9368,
5376,
0,
341,
310,
330,
71,
11948,
68892,
1,
589,
830,
345,
310,
330,
10844,
61547,
1,
589,
93379,
78998,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_increase_dissolve_delay() {
let principal_id = 1;
let fake_driver = fake::FakeDriver::default();
let fixture: GovernanceProto = GovernanceProto {
economics: Some(NetworkEconomics::default()),
neurons: [
(
1,
Neuron {
id: Some(NeuronId { id: 1 }),
controller: Some(principal(principal_id)),
dissolve_state: Some(DissolveState::DissolveDelaySeconds(
MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS,
)),
..Neuron::default()
},
),
(
2,
Neuron {
id: Some(NeuronId { id: 2 }),
controller: Some(principal(principal_id)),
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
DEFAULT_TEST_START_TIMESTAMP_SECONDS
+ MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS,
)),
..Neuron::default()
},
),
(
3,
Neuron {
id: Some(NeuronId { id: 3 }),
controller: Some(principal(principal_id)),
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
DEFAULT_TEST_START_TIMESTAMP_SECONDS - 1,
)),
..Neuron::default()
},
),
]
.to_vec()
.into_iter()
.collect(),
..Default::default()
};
let mut gov = Governance::new(
fixture,
fake_driver.get_fake_env(),
fake_driver.get_fake_ledger(),
);
increase_dissolve_delay(&mut gov, principal_id, 1, 1);
assert_eq!(
gov.get_neuron(&NeuronId { id: 1 }).unwrap().dissolve_state,
Some(DissolveState::DissolveDelaySeconds(
MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS + 1
),)
);
increase_dissolve_delay(
&mut gov,
principal_id,
1,
u32::try_from(MAX_DISSOLVE_DELAY_SECONDS + 1)
.expect("MAX_DISSOLVE_DELAY_SECONDS larger than u32"),
);
assert_eq!(
gov.get_neuron(&NeuronId { id: 1 }).unwrap().dissolve_state,
Some(DissolveState::DissolveDelaySeconds(
MAX_DISSOLVE_DELAY_SECONDS
),)
);
increase_dissolve_delay(&mut gov, principal_id, 2, 1);
assert_eq!(
gov.get_neuron(&NeuronId { id: 2 }).unwrap().dissolve_state,
Some(DissolveState::WhenDissolvedTimestampSeconds(
DEFAULT_TEST_START_TIMESTAMP_SECONDS
+ MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS
+ 1,
))
);
increase_dissolve_delay(
&mut gov,
principal_id,
2,
u32::try_from(MAX_DISSOLVE_DELAY_SECONDS + 1)
.expect("MAX_DISSOLVE_DELAY_SECONDS larger than u32"),
);
assert_eq!(
gov.get_neuron(&NeuronId { id: 2 }).unwrap().dissolve_state,
Some(DissolveState::WhenDissolvedTimestampSeconds(
DEFAULT_TEST_START_TIMESTAMP_SECONDS + MAX_DISSOLVE_DELAY_SECONDS,
))
);
increase_dissolve_delay(
&mut gov,
principal_id,
3,
u32::try_from(MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS)
.expect("MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS larger than u32"),
);
assert_eq!(
gov.get_neuron(&NeuronId { id: 3 }).unwrap().dissolve_state,
Some(DissolveState::DissolveDelaySeconds(
MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS
),)
);
} | rust_cleaned_test_functions.jsonl/1191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73807,
814,
1038,
3948,
22198,
368,
341,
262,
1077,
12435,
842,
284,
220,
16,
280,
262,
1077,
12418,
20602,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
12507,
25,
80589,
31549,
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_connectivity() {
sc_service_test::connectivity(
integration_test_config_with_two_authorities(),
|config| {
let NewFullBase { task_manager, client, network, transaction_pool, .. }
= new_full_base(config,|_, _| ())?;
Ok(sc_service_test::TestNetComponents::new(task_manager, client, network, transaction_pool))
},
|config| {
let (keep_alive, _, client, network, transaction_pool) = new_light_base(config)?;
Ok(sc_service_test::TestNetComponents::new(keep_alive, client, network, transaction_pool))
}
);
} | rust_cleaned_test_functions.jsonl/134128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
1927,
368,
341,
286,
1136,
12267,
4452,
486,
6459,
1927,
1006,
310,
17590,
4452,
5332,
6615,
23241,
22938,
1361,
3148,
310,
760,
1676,
91,
341,
394,
1077,
1532,
9432,
3978,
314,
3383,
12144... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_u24() {
assert_eq!(eval_binary("<< 66051:24 >>"), [1, 2, 3]);
assert_eq!(eval_binary("<< 66051:24/little >>"), [3, 2, 1]);
assert_eq!(eval_binary("<< 66051:24/big >>"), [1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/83842 | {
"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,
7300,
17,
19,
368,
341,
286,
2060,
10714,
10297,
14170,
31761,
445,
2442,
220,
21,
21,
15,
20,
16,
25,
17,
19,
3578,
3975,
508,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extra_rollback() {
let db = CheckpointDb::new(MemoryDB::new());
let handler = db.handler();
handler.checkpoint();
handler.checkpoint();
handler.rollback();
handler.rollback();
handler.rollback();
} | rust_cleaned_test_functions.jsonl/69292 | {
"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,
31858,
62,
33559,
368,
341,
286,
1077,
2927,
284,
4248,
2768,
7994,
486,
931,
3189,
4731,
3506,
486,
931,
1423,
286,
1077,
7013,
284,
2927,
31171,
1428,
286,
7013,
9093,
2768,
543,
286,
7013,
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 |
#[test]
fn test_array (){
let bytes = [0u8; 64];
let data: Data2 = bytes.pread_with(0, LE).unwrap();
println!("data: {:?}", &data);
} | rust_cleaned_test_functions.jsonl/51394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
40653,
262,
1077,
5820,
284,
508,
15,
84,
23,
26,
220,
21,
19,
935,
262,
1077,
821,
25,
2885,
17,
284,
5820,
556,
878,
6615,
7,
15,
11,
11148,
568,
15454,
543,
262,
13751,
17223,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_format_python_named() {
let mut logentry = LogEntry {
message: Annotated::new("hello, %(name)s!".to_string().into()),
params: Annotated::new(Value::Object({
let mut object = Object::new();
object.insert(
"name".to_string(),
Annotated::new(Value::String("world".to_string())),
);
object
})),
..LogEntry::default()
};
normalize_logentry(&mut logentry, &mut Meta::default());
assert_eq_dbg!(logentry.formatted.as_str(), Some("hello, world!"));
} | rust_cleaned_test_functions.jsonl/84675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
55869,
71834,
368,
341,
262,
1077,
5206,
1487,
4085,
284,
2835,
5874,
341,
286,
1943,
25,
1527,
87029,
486,
931,
445,
14990,
11,
21227,
606,
16466,
92993,
983,
3904,
1005,
18122,
14702,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_static_custom_long() {
let a = HeaderName {
inner: Repr::Custom(Custom(ByteStr::from_static(
"longer-than-63--thisheaderislongerthansixtythreecharactersandthushandleddifferent",
))),
};
let b = HeaderName::from_static(
"longer-than-63--thisheaderislongerthansixtythreecharactersandthushandleddifferent",
);
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/3413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
25360,
15875,
17799,
368,
341,
286,
1077,
264,
284,
12104,
675,
341,
310,
9179,
25,
1032,
649,
486,
10268,
3025,
1450,
55823,
2580,
486,
1499,
25360,
1006,
394,
330,
4825,
261,
47654,
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_decode_two_bytes_as_signed_16_bit() {
let mut byte_array = [255, 56].to_vec();
let value: i16 = decode_short(byte_array.pop().unwrap(), byte_array.pop().unwrap());
assert_eq!(value, -200);
} | rust_cleaned_test_functions.jsonl/16123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
23241,
12524,
11898,
55617,
62,
16,
21,
13996,
368,
341,
262,
1077,
5206,
4922,
3858,
284,
508,
17,
20,
20,
11,
220,
20,
21,
936,
983,
13251,
1428,
262,
1077,
897,
25,
600,
16,
21,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_latest_proof_insert() {
let storage = ImplStorage::new(Arc::new(MemoryAdapter::new()));
let block_hash = Hash::digest(get_random_bytes(10));
let proof = mock_proof(block_hash);
exec!(storage.update_latest_proof(proof.clone()));
let proof_2 = exec!(storage.get_latest_proof());
assert_eq!(proof.block_hash, proof_2.block_hash);
} | rust_cleaned_test_functions.jsonl/5470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
64880,
86757,
17678,
368,
341,
262,
1077,
5819,
284,
88092,
5793,
486,
931,
4346,
1287,
486,
931,
3189,
4731,
5940,
486,
931,
25138,
262,
1077,
2504,
8950,
284,
6531,
486,
36339,
5433,
2264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_with_init_boot_request_correct_address_returns_ack() {
let mut req = new_test_request();
req.options.remove(2);
let requested_ip_addr = get_requested_ip_addr(&req).unwrap();
let mut server = new_test_server(|| 42);
server.cache.insert(
req.chaddr,
CachedConfig {
client_addr: requested_ip_addr,
options: vec![],
expiration: std::i64::MAX,
},
);
server.pool.allocate_addr(requested_ip_addr);
let got = server.dispatch(req).unwrap();
let want = new_test_ack();
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/61724 | {
"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,
42991,
6615,
6137,
52062,
7893,
31550,
6744,
58900,
48447,
368,
341,
286,
1077,
5206,
4232,
284,
501,
4452,
7893,
543,
286,
4232,
10912,
4850,
7,
17,
317,
286,
1077,
11223,
10385,
7387,
284,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_string_with_newline() {
let mut reader = Lexer::from_str("\"abc\ndef\"");
assert_tok(&mut reader, TokenKind::StringTail("abc\ndef".into()), 1, 1);
} | rust_cleaned_test_functions.jsonl/101131 | {
"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,
3904,
6615,
5921,
1056,
368,
341,
286,
1077,
5206,
6604,
284,
85082,
486,
1499,
2895,
38915,
13683,
59,
5037,
88385,
286,
2060,
76162,
2099,
6984,
6604,
11,
9660,
10629,
486,
703,
44795,
445,
1368... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_no_final_eol() {
// This test verifies that the parser doesn't choke when the end of a value is also the end of the file.
#[derive(Debug, Eq, PartialEq, Deserialize)]
struct TestWithNoFinalEol {
value1: String,
value2: String
}
let ts: TestWithNoFinalEol = aa::from_bytes(b"value1: Hello,\nvalue2: world!", None).unwrap();
assert_eq!(ts.value1, "Hello,");
assert_eq!(ts.value2, "world!");
} | rust_cleaned_test_functions.jsonl/112409 | {
"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,
6536,
20676,
2204,
337,
368,
341,
197,
322,
1096,
1273,
87856,
429,
279,
6729,
3171,
944,
64036,
979,
279,
835,
315,
264,
897,
374,
1083,
279,
835,
315,
279,
1034,
382,
197,
13353,
27098,
42618,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unsigned() {
// Attempt to create an account without signing the transfer
let new_owner = Pubkey::new(&[9; 32]);
let from = solana_sdk::pubkey::new_rand();
let from_account = AccountSharedData::new_ref(100, 0, &system_program::id());
let owned_key = solana_sdk::pubkey::new_rand();
let owned_account = AccountSharedData::new_ref(0, 0, &Pubkey::default());
let owned_address = owned_key.into();
// Haven't signed from account
let result = create_account(
&KeyedAccount::new(&from, false, &from_account),
&KeyedAccount::new(&owned_key, false, &owned_account),
&owned_address,
50,
2,
&new_owner,
&[owned_key].iter().cloned().collect::<HashSet<_>>(),
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Err(InstructionError::MissingRequiredSignature));
// Haven't signed to account
let owned_account = AccountSharedData::new_ref(0, 0, &Pubkey::default());
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&owned_key, true, &owned_account),
&owned_address,
50,
2,
&new_owner,
&[from].iter().cloned().collect::<HashSet<_>>(),
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Err(InstructionError::MissingRequiredSignature));
let owned_account = AccountSharedData::new_ref(0, 0, &Pubkey::default());
let result = create_account(
&KeyedAccount::new(&from, false, &from_account),
&KeyedAccount::new(&owned_key, false, &owned_account),
&owned_address,
0,
2,
&new_owner,
&[owned_key].iter().cloned().collect::<HashSet<_>>(),
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Ok(()));
} | rust_cleaned_test_functions.jsonl/73044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 972
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
67830,
368,
341,
286,
442,
43517,
311,
1855,
458,
2692,
2041,
15971,
279,
8317,
198,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
17,
2558,
286,
1077,
504... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version() {
let output = include_str!("../test/version.json");
let o: Result<Version, serde_json::error::Error> = serde_json::from_str(output);
assert!(o.is_ok());
} | rust_cleaned_test_functions.jsonl/56074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
368,
341,
286,
1077,
2550,
284,
2924,
2895,
17223,
1244,
1944,
64413,
4323,
797,
286,
1077,
297,
25,
5714,
27,
5637,
11,
61570,
9455,
486,
841,
486,
1454,
29,
284,
61570,
9455,
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 |
#[test]
fn test_doc_index() {
Command::cargo_bin("specdown")
.unwrap()
.arg("--no-colour")
.arg("run")
.arg("--running-dir")
.arg(".specdown")
.arg("docs/index.md")
.assert()
.success();
} | rust_cleaned_test_functions.jsonl/104092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
3560,
368,
341,
262,
7348,
486,
66715,
21816,
445,
9535,
2923,
1138,
286,
659,
15454,
741,
286,
659,
858,
21549,
2152,
19459,
413,
1138,
286,
659,
858,
445,
6108,
1138,
286,
659,
858,
215... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verified_vote_packets_validator_gossip_votes_iterator_wrong_fork() {
let (s, r) = unbounded();
let vote_simulator = VoteSimulator::new(1);
let my_leader_bank = vote_simulator.bank_forks.read().unwrap().root_bank();
let vote_account_key = vote_simulator.vote_pubkeys[0];
// not exist in the SlotHashes sysvar for `my_leader_bank`
for _ in 0..MAX_VOTES_PER_VALIDATOR {
let vote_slot = 0;
let vote_hash = Hash::new_unique();
let vote = Vote::new(vec![vote_slot], vote_hash);
s.send(vec![VerifiedVoteMetadata {
vote_account_key,
vote: VoteTransaction::from(vote),
packet_batch: PacketBatch::default(),
signature: Signature::new_unique(),
}])
.unwrap();
}
// Ingest the votes into the buffer
let mut verified_vote_packets = VerifiedVotePackets(HashMap::new());
verified_vote_packets
.receive_and_process_vote_packets(&r, true)
.unwrap();
// Create tracker for previously sent bank votes
let mut previously_sent_to_bank_votes = HashSet::new();
let mut gossip_votes_iterator = ValidatorGossipVotesIterator::new(
my_leader_bank,
&verified_vote_packets,
&mut previously_sent_to_bank_votes,
);
assert!(gossip_votes_iterator.next().is_none());
} | rust_cleaned_test_functions.jsonl/22008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71871,
54360,
63569,
64959,
1889,
41473,
65116,
13491,
75198,
761,
669,
368,
341,
286,
1077,
320,
82,
11,
435,
8,
284,
650,
65686,
543,
286,
1077,
6910,
18314,
10511,
284,
34034,
14027,
10511,
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... | 2 |
#[test]
fn test_tx_buffering() {
// Test case:
// the TX buf.
{
let mut ctx = CsmTestContext::new_established();
let mut stream = TestStream::new();
stream.write_state = StreamState::WouldBlock;
ctx.set_stream(stream);
// so the data should end up in the TX buffer.
let data = &[1, 2, 3, 4];
ctx.init_data_pkt(data);
ctx.send();
// can write to its backing stream.
assert!(ctx
.conn
.get_polled_evset()
.contains(epoll::Events::EPOLLOUT));
assert_eq!(ctx.conn.tx_buf.len(), data.len());
// Unlock the write stream and notify the connection it can now write its bufferred
// data.
ctx.set_stream(TestStream::new());
ctx.conn.notify(epoll::Events::EPOLLOUT);
assert!(ctx.conn.tx_buf.is_empty());
assert_eq!(ctx.conn.stream.write_buf, data);
}
} | rust_cleaned_test_functions.jsonl/83294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
7776,
287,
368,
341,
286,
442,
3393,
1142,
510,
16885,
286,
442,
256,
279,
17031,
6607,
624,
286,
341,
310,
1077,
5206,
5635,
284,
356,
3563,
2271,
1972,
486,
931,
18583,
5102,
291,
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_purge_exact_dashmap_secondary_index() {
let (key_start, key_end, account_index) = create_dashmap_secondary_index_state();
let index = AccountsIndex::<bool>::default();
run_test_purge_exact_secondary_index(
&index,
&index.spl_token_mint_index,
key_start,
key_end,
&account_index,
);
} | rust_cleaned_test_functions.jsonl/2239 | {
"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,
620,
39823,
71084,
84585,
2186,
77759,
3560,
368,
341,
286,
1077,
320,
792,
4906,
11,
1376,
6213,
11,
2692,
3560,
8,
284,
1855,
84585,
2186,
77759,
3560,
4387,
543,
286,
1077,
1922,
284,
40655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_facet_fuchsia_test_facet_wrong_type() -> Result<(), Error> {
let meta = json!({
"facets": {
"fuchsia.test": []
}
});
let f = test_facet(&meta);
assert!(f.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/120020 | {
"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,
41589,
295,
761,
73391,
4452,
41589,
295,
75198,
1819,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
8823,
284,
2951,
0,
2262,
688,
330,
22185,
1415,
788,
341,
310,
330,
69,
73391,
5958,
788... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stxw() {
test_interpreter_and_jit_asm!(
"
mov32 r2, 0x44332211
stxw [r1+2], r2
ldxw r0, [r1+2]
exit",
[
0xaa, 0xbb, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xdd,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x44332211 } },
4
);
} | rust_cleaned_test_functions.jsonl/58999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
87,
86,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
17,
11,
220,
15,
87,
19,
19,
18,
18,
17,
17,
16,
16,
198,
286,
357,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_composite_or_pattern() {
let mut grok = Grok::empty();
grok.insert_definition("MAC", r"(?:%{CISCOMAC}|%{WINDOWSMAC}|%{COMMONMAC})");
grok.insert_definition("CISCOMAC", r"(?:(?:[A-Fa-f0-9]{4}\.){2}[A-Fa-f0-9]{4})");
grok.insert_definition("WINDOWSMAC", r"(?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})");
grok.insert_definition("COMMONMAC", r"(?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})");
let pattern = grok.compile("%{MAC}", false)
.expect("Error while compiling!");
let matches = pattern
.match_against("5E:FF:56:A2:AF:15")
.expect("No matches found!");
assert_eq!("5E:FF:56:A2:AF:15", matches.get("MAC").unwrap());
assert_eq!(4, matches.len());
let matches = pattern
.match_against("hello! 5E:FF:56:A2:AF:15 what?")
.expect("No matches found!");
assert_eq!("5E:FF:56:A2:AF:15", matches.get("MAC").unwrap());
assert_eq!(true, pattern.match_against("5E:FF").is_none());
} | rust_cleaned_test_functions.jsonl/117568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
13607,
8734,
21260,
368,
341,
286,
1077,
5206,
10487,
74,
284,
17888,
74,
486,
3194,
543,
286,
10487,
74,
7030,
31698,
445,
25788,
497,
435,
29209,
4820,
4,
90,
34,
1637,
8696,
1706,
52398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commit_decommit() {
let (verifier_ek, verifier_dk) = test_keypair().keys();
let (com, r, e) = Paillier::verifier_commit(&verifier_ek);
// 2. prover is playing verifier for zk correct_key protocol to make sure verifier_ek was generated correctly:
let (challenge, verification_aid) = Paillier::challenge(&verifier_ek);
// 3. verifier is proving correct_key
let proof_results = Paillier::prove(&verifier_dk, &challenge);
assert!(proof_results.is_ok());
// 4. prover verifies correct key proof:
let result = Paillier::verify(&proof_results.unwrap(), &verification_aid);
assert!(result.is_ok());
assert!(Paillier::verify_commit(&verifier_ek, &com, &r, &e).is_ok())
} | rust_cleaned_test_functions.jsonl/60721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
2259,
17413,
368,
341,
286,
1077,
320,
423,
3049,
62,
1225,
11,
88737,
814,
74,
8,
284,
1273,
3097,
12670,
1005,
10563,
543,
286,
1077,
320,
874,
11,
435,
11,
384,
8,
284,
15681,
483,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frontmatter_always() {
let tmp_dir = TempDir::new().expect("failed to make tempdir");
let mut exporter = Exporter::new(
PathBuf::from("tests/testdata/input/main-samples/"),
tmp_dir.path().to_path_buf(),
);
exporter.frontmatter_strategy(FrontmatterStrategy::Always);
exporter.run().expect("exporter returned error");
// Note without frontmatter should have empty frontmatter added.
let expected = "---\n---\n\nNote without frontmatter.\n";
let actual = read_to_string(
tmp_dir
.path()
.clone()
.join(PathBuf::from("note-without-frontmatter.md")),
)
.unwrap();
assert_eq!(expected, actual);
// Note with frontmatter should remain untouched.
let expected = "---\nFoo: bar\n---\n\nNote with frontmatter.\n";
let actual = read_to_string(
tmp_dir
.path()
.clone()
.join(PathBuf::from("note-with-frontmatter.md")),
)
.unwrap();
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/116594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22926,
58965,
8418,
2284,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
16091,
311,
1281,
2730,
3741,
797,
262,
1077,
5206,
57378,
284,
22191,
261,
486,
931,
1006,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rules_consistency() {
let various_rules = [
toy_rules(),
Rules::new(RegularCliquesIterator::new(2, 3)),
Rules::new(RegularCliquesIterator::new(5, 4)),
Rules::new_standard(4).unwrap(),
Rules::new_standard(9).unwrap(),
Rules::new_standard(16).unwrap(),
];
for rules in &various_rules {
for clique_id in rules.clique_ids() {
assert_eq!(rules.cells(clique_id).count(), rules.size());
assert_eq!(rules.cells(clique_id).cloned().collect::<Vec<_>>(), &rules[clique_id]);
for &cell_id in &rules[clique_id] {
assert!(rules[cell_id].binary_search(&clique_id).is_ok());
}
}
for cell_id in 0..rules.size() * rules.size() {
let cell_id = CellId(cell_id);
assert_eq!(rules.cliques(cell_id).cloned().collect::<Vec<_>>(), &rules[cell_id]);
for &clique_id in &rules[cell_id] {
assert!(rules[clique_id].binary_search(&cell_id).is_ok());
}
}
}
} | rust_cleaned_test_functions.jsonl/98912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21407,
31971,
47094,
368,
341,
286,
1077,
5257,
21407,
284,
2278,
310,
21357,
21407,
3148,
310,
22847,
486,
931,
7,
30404,
87014,
13968,
11951,
486,
931,
7,
17,
11,
220,
18,
6965,
310,
22847,
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_insert_invalid_block() {
let (shared, chain) = build_chain(2);
let invalid_block = {
let active_chain = shared.active_chain();
let tip_number = active_chain.tip_number();
let tip_hash = active_chain.tip_hash();
let invalid_cellbase =
always_success_cellbase(tip_number, Capacity::zero(), shared.consensus());
let next_block = inherit_block(shared.shared(), &tip_hash)
.transaction(invalid_cellbase)
.build();
Arc::new(next_block)
};
assert!(shared
.insert_new_block(&chain, Arc::clone(&invalid_block))
.is_err(),);
} | rust_cleaned_test_functions.jsonl/109273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
31433,
7113,
368,
341,
262,
1077,
320,
6100,
11,
8781,
8,
284,
1936,
30583,
7,
17,
317,
262,
1077,
8318,
7113,
284,
341,
286,
1077,
4541,
30583,
284,
6094,
13616,
30583,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ikev2_payload_sa() {
let bytes = IKEV2_PAYLOAD_SA;
let expected1 = IkeV2GenericPayload{
hdr: IkeV2PayloadHeader {
next_payload_type: IkePayloadType::KeyExchange,
critical: false,
reserved: 0,
payload_length: 40,
},
payload: &bytes[4..],
};
let (_, res) = parse_ikev2_payload_generic(&bytes).expect("Failed to parse");
assert_eq!(res, expected1);
let attrs1 = &[0x80, 0x0e, 0x00, 0x80];
let expected2 = IkeV2PayloadContent::SA(vec![
IkeV2Proposal {
last: 0,
reserved: 0,
proposal_length: 36,
proposal_num: 1,
protocol_id: ProtocolID::IKE,
spi_size: 0,
num_transforms: 3,
spi: None,
transforms: vec![
IkeV2RawTransform{
last: 3,
reserved1: 0,
transform_length: 12,
transform_type: IkeTransformType::EncryptionAlgorithm,
reserved2: 0,
transform_id: 20,
attributes: Some(attrs1),
},
IkeV2RawTransform{
last: 3,
reserved1: 0,
transform_length: 8,
transform_type: IkeTransformType::PseudoRandomFunction,
reserved2: 0,
transform_id: 5,
attributes: None,
},
IkeV2RawTransform{
last: 0,
reserved1: 0,
transform_length: 8,
transform_type: IkeTransformType::DiffieHellmanGroup,
reserved2: 0,
transform_id: 30,
attributes: None,
},
],
},
]
);
let (rem, res2) = parse_ikev2_payload_sa(res.payload,0).expect("Failed to parse");
assert!(rem.is_empty());
assert_eq!(res2, expected2);
} | rust_cleaned_test_functions.jsonl/114854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2970,
85,
17,
32813,
66443,
368,
341,
262,
1077,
5820,
284,
84364,
53,
17,
79493,
81219,
280,
262,
1077,
3601,
16,
284,
98634,
53,
17,
19964,
29683,
515,
286,
36615,
25,
98634,
53,
17,
296... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_managed_directory() {
let tempdir = TempDir::new().unwrap();
let tempdir_path = PathBuf::from(tempdir.path());
let test_path1: &'static Path = Path::new("some_path_for_test");
let test_path2: &'static Path = Path::new("some_path_for_test_2");
{
let mmap_directory = MmapDirectory::open(&tempdir_path).unwrap();
let mut managed_directory = ManagedDirectory::wrap(mmap_directory).unwrap();
let write_file = managed_directory.open_write(test_path1).unwrap();
write_file.terminate().unwrap();
managed_directory
.atomic_write(test_path2, &[0u8, 1u8])
.unwrap();
assert!(managed_directory.exists(test_path1));
assert!(managed_directory.exists(test_path2));
let living_files: HashSet<PathBuf> =
[test_path1.to_owned()].into_iter().cloned().collect();
managed_directory.garbage_collect(|| living_files);
assert!(managed_directory.exists(test_path1));
assert!(!managed_directory.exists(test_path2));
}
{
let mmap_directory = MmapDirectory::open(&tempdir_path).unwrap();
let mut managed_directory = ManagedDirectory::wrap(mmap_directory).unwrap();
assert!(managed_directory.exists(test_path1));
assert!(!managed_directory.exists(test_path2));
let living_files: HashSet<PathBuf> = HashSet::new();
managed_directory.garbage_collect(|| living_files);
assert!(!managed_directory.exists(test_path1));
assert!(!managed_directory.exists(test_path2));
}
} | rust_cleaned_test_functions.jsonl/743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79889,
14846,
368,
341,
286,
1077,
2730,
3741,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
2730,
3741,
2638,
284,
7933,
15064,
486,
1499,
9758,
3741,
3875,
5231,
286,
1077,
1273,
2638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_stakes_vote_account_disappear_reappear() {
let stakes_cache = StakesCache::new(Stakes {
epoch: 4,
..Stakes::default()
});
let ((vote_pubkey, mut vote_account), (stake_pubkey, stake_account)) =
create_staked_node_accounts(10);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
stakes_cache.check_and_store(&stake_pubkey, &stake_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
vote_account.set_lamports(0);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_none());
}
vote_account.set_lamports(1);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
// Vote account too big
let cache_data = vote_account.data().to_vec();
let mut pushed = vote_account.data().to_vec();
pushed.push(0);
vote_account.set_data(pushed);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_none());
}
// Vote account uninitialized
let default_vote_state = VoteState::default();
let versioned = VoteStateVersions::new_current(default_vote_state);
VoteState::to(&versioned, &mut vote_account).unwrap();
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_none());
}
vote_account.set_data(cache_data);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
} | rust_cleaned_test_functions.jsonl/22037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
2050,
54360,
13500,
9932,
40766,
1288,
40766,
368,
341,
286,
1077,
44425,
11529,
284,
794,
2050,
8233,
486,
931,
7,
623,
2050,
341,
310,
16342,
25,
220,
19,
345,
310,
5241,
623,
2050,
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_parse_invitation_acceptance_details() {
let payload = vec![129, 172, 115, 101, 110, 100, 101, 114, 68, 101, 116, 97, 105, 108, 131, 163, 68, 73, 68, 182, 67, 113, 85, 88, 113, 53, 114, 76, 105, 117, 82, 111, 100, 55, 68, 67, 52, 97, 86, 84, 97, 115, 166, 118, 101, 114, 75, 101, 121, 217, 44, 67, 70, 86, 87, 122, 118, 97, 103, 113, 65, 99, 117, 50, 115, 114, 68, 106, 117, 106, 85, 113, 74, 102, 111, 72, 65, 80, 74, 66, 111, 65, 99, 70, 78, 117, 49, 55, 113, 117, 67, 66, 57, 118, 71, 176, 97, 103, 101, 110, 116, 75, 101, 121, 68, 108, 103, 80, 114, 111, 111, 102, 131, 168, 97, 103, 101, 110, 116, 68, 73, 68, 182, 57, 54, 106, 111, 119, 113, 111, 84, 68, 68, 104, 87, 102, 81, 100, 105, 72, 49, 117, 83, 109, 77, 177, 97, 103, 101, 110, 116, 68, 101, 108, 101, 103, 97, 116, 101, 100, 75, 101, 121, 217, 44, 66, 105, 118, 78, 52, 116, 114, 53, 78, 88, 107, 69, 103, 119, 66, 56, 81, 115, 66, 51, 109, 109, 109, 122, 118, 53, 102, 119, 122, 54, 85, 121, 53, 121, 112, 122, 90, 77, 102, 115, 74, 56, 68, 122, 169, 115, 105, 103, 110, 97, 116, 117, 114, 101, 217, 88, 77, 100, 115, 99, 66, 85, 47, 99, 89, 75, 72, 49, 113, 69, 82, 66, 56, 80, 74, 65, 43, 48, 51, 112, 121, 65, 80, 65, 102, 84, 113, 73, 80, 74, 102, 52, 84, 120, 102, 83, 98, 115, 110, 81, 86, 66, 68, 84, 115, 67, 100, 119, 122, 75, 114, 52, 54, 120, 87, 116, 80, 43, 78, 65, 68, 73, 57, 88, 68, 71, 55, 50, 50, 103, 113, 86, 80, 77, 104, 117, 76, 90, 103, 89, 67, 103, 61, 61];
println!("payload: {:?}", payload);
let response = parse_invitation_acceptance_details(payload).unwrap();
println!("response: {:?}", response);
} | rust_cleaned_test_functions.jsonl/43021 | {
"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,
21039,
19996,
7556,
35728,
681,
13260,
368,
341,
286,
1077,
7729,
284,
7486,
20703,
16,
17,
24,
11,
220,
16,
22,
17,
11,
220,
16,
16,
20,
11,
220,
16,
15,
16,
11,
220,
16,
16,
15,
11,
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_emit_movb_imm_memscaleq() {
assert_emit!(0xC6, 0x04, 0x37, 0x00;
emit_movb_imm_memscaleq(0, RDI, RSI, 0));
assert_emit!(0x41, 0xC6, 0x04, 0x30, 0x00;
emit_movb_imm_memscaleq(0, R8, RSI, 0));
assert_emit!(0x42, 0xC6, 0x04, 0x0F, 0x00;
emit_movb_imm_memscaleq(0, RDI, R9, 0));
} | rust_cleaned_test_functions.jsonl/85513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
55798,
65,
71370,
717,
11852,
2246,
80,
368,
341,
286,
2060,
69082,
10297,
15,
12125,
21,
11,
220,
15,
87,
15,
19,
11,
220,
15,
87,
18,
22,
11,
220,
15,
87,
15,
15,
280,
3824,
16691... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optimize_switch_with_labelled_break() {
test(
concat!(
"function f() {",
" label:",
" switch('x') {",
" case 'x': break label;",
" case 'y': throw f;",
" }",
"}",
),
"function f() { }",
);
test(
concat!(
"function f() {",
" label:",
" switch('x') {",
" case 'x': break label;",
" default: throw f;",
" }",
"}",
),
"function f() { }",
);
} | rust_cleaned_test_functions.jsonl/397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
11853,
27652,
6615,
6106,
832,
39494,
368,
341,
262,
1273,
1006,
286,
33720,
33673,
310,
330,
1688,
282,
368,
314,
756,
310,
330,
220,
2383,
55120,
310,
330,
220,
3398,
492,
87,
863,
314,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let req = Request::new(Method::Get)
.with_path_segs(&["foo"]);
let comments = test_ok(&api(), req);
check_type(&comments, "application", "json");
check_content(&comments, DEFAULT_JSON);
} | rust_cleaned_test_functions.jsonl/125372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
262,
1077,
4232,
284,
6145,
486,
931,
35419,
486,
1949,
340,
286,
659,
4197,
2638,
3453,
5857,
2099,
1183,
7975,
15049,
262,
1077,
6042,
284,
1273,
19817,
2099,
2068,
1507,
4232,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq2_basics() {
assert_eq!(
Fq2 {
c0: Fq::zero(),
c1: Fq::zero(),
},
Fq2::zero()
);
assert_eq!(
Fq2 {
c0: Fq::one(),
c1: Fq::zero(),
},
Fq2::one()
);
assert!(Fq2::zero().is_zero());
assert!(!Fq2::one().is_zero());
assert!(!Fq2 {
c0: Fq::zero(),
c1: Fq::one(),
}
.is_zero());
} | rust_cleaned_test_functions.jsonl/45340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
17,
880,
67981,
368,
341,
262,
2060,
10714,
33673,
286,
434,
80,
17,
341,
310,
272,
15,
25,
434,
80,
486,
14154,
3148,
310,
272,
16,
25,
434,
80,
486,
14154,
3148,
286,
1153,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wal_txs_codec() {
for _ in 0..10 {
let txs = FixedSignedTxs::new(mock_wal_txs());
assert_eq!(
FixedSignedTxs::decode_sync(txs.encode_sync().unwrap()).unwrap(),
txs
);
}
} | rust_cleaned_test_functions.jsonl/122489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
278,
17805,
82,
51084,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
1077,
9854,
82,
284,
20149,
49312,
51,
18561,
486,
931,
30389,
1670,
278,
17805,
82,
1423,
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... | 2 |
#[test]
fn test_trip_reverse() {
let mut trip = Trip::new();
trip.travel(200);
trip.reverse(100);
assert_eq!(100, trip.miles_traveled());
} | rust_cleaned_test_functions.jsonl/44524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63883,
43277,
368,
341,
286,
1077,
5206,
8411,
284,
26754,
486,
931,
543,
286,
8411,
91554,
7,
17,
15,
15,
317,
286,
8411,
32081,
7,
16,
15,
15,
317,
286,
2060,
10714,
10297,
16,
15,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_alignment() {
let instructions = vec![
(3, vec![0xaa, 0, 0, 0, 10, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 30, 0, 0, 0, 31]),
(0, vec![0xaa, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 30, 0, 0, 0, 31]),
];
let expected = Ok((
&[][..],
Instruction::Tableswitch {
default: 10,
low: 20,
high: 21,
offsets: vec![30, 31],
},
));
for (address, instruction) in instructions {
assert_eq!(expected, instruction_parser(&instruction, address));
}
} | rust_cleaned_test_functions.jsonl/62170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51006,
368,
341,
262,
1077,
11221,
284,
7486,
90515,
286,
320,
18,
11,
7486,
20703,
15,
43300,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,
15,
11,
220,
15,
11,
220,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_serialize_bool() {
let inputs = vec![(true, "true"), (false, "false")];
for (src, should_be) in inputs {
let mut buffer = Vec::new();
{
let mut ser = Serializer::new(&mut buffer);
ser.serialize_bool(src).unwrap();
}
let got = String::from_utf8(buffer).unwrap();
assert_eq!(got, should_be);
}
} | rust_cleaned_test_functions.jsonl/107662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
22159,
368,
341,
286,
1077,
11127,
284,
7486,
0,
9697,
1866,
11,
330,
1866,
3975,
320,
3849,
11,
330,
3849,
899,
4821,
286,
369,
320,
3548,
11,
1265,
21263,
8,
304,
11127,
341,
310,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_puts_gets_deletes() {
init_logging();
let bucket_name = format!("test-bucket-{}-{}", "default".to_owned(), get_time().sec);
let test_client = TestS3Client::new(bucket_name.clone());
test_client.create_test_bucket_with_acl(bucket_name.clone(), Some("public-read".to_owned()));
// modify the bucket's CORS properties
if cfg!(not(feature = "disable_minio_unsupported")) {
// Minio support: CORS is not implemented by Minio
test_put_bucket_cors(&test_client.s3, &test_client.bucket_name);
}
// file used for testing puts/gets
let filename = format!("test_file_{}", get_time().sec);
let filename2 = format!("test_file_2_{}", get_time().sec);
// test failure responses on empty bucket
test_get_object_no_such_object(&test_client.s3, &test_client.bucket_name, &filename);
test_put_object_with_filename_and_acl(
&test_client.s3,
&test_client.bucket_name,
&filename,
&"tests/sample-data/no_credentials",
Some("public-read".to_owned()),
);
// PUT a second copy of the object with tighter acls
test_put_object_with_filename(
&test_client.s3,
&test_client.bucket_name,
&filename2,
&"tests/sample-data/no_credentials",
);
// create an anonymous reader to test the acls
let ro_s3client = test_client.create_anonymous_client();
// HEAD the object that was PUT
test_head_object(&ro_s3client, &test_client.bucket_name, &filename);
if cfg!(not(feature = "disable_minio_unsupported")) {
assert!(try_head_object(&ro_s3client, &test_client.bucket_name, &filename2).is_err());
}
test_head_object(&test_client.s3, &test_client.bucket_name, &filename2);
// GET the object
test_get_object(&ro_s3client, &test_client.bucket_name, &filename);
test_get_object_range(&ro_s3client, &test_client.bucket_name, &filename);
// add two objects to test the listing by paging
for i in 1..3 {
test_client.put_test_object(format!("test_object_{}", i));
}
// list items with paging using list object API v1
list_items_in_bucket_paged_v1(&ro_s3client, &test_client.bucket_name);
// list items with paging using list object API v2
if cfg!(not(feature = "disable_ceph_unsupported")) {
// Ceph support: this test depends on the list object v2 API which is not implemented by Ceph
list_items_in_bucket_paged_v2(&ro_s3client, &test_client.bucket_name);
}
// copy the object to change its settings
test_copy_object(&test_client.s3, &test_client.bucket_name, &filename);
test_delete_object(&test_client.s3, &test_client.bucket_name, &filename);
// remove test objects used for pagination tests
for i in 1..3 {
test_client.delete_object(format!("test_object_{}", i));
}
} | rust_cleaned_test_functions.jsonl/112573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88574,
3062,
82,
2259,
13881,
368,
341,
262,
2930,
59982,
1428,
262,
1077,
15621,
1269,
284,
3561,
17223,
1944,
1455,
11152,
12,
6257,
12,
42351,
330,
2258,
3263,
983,
51973,
1507,
633,
3009,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cursor_and_file_has_the_same_behaviour() {
let mut buf: Vec<u8> = Vec::new();
get_test_file("alltypes_plain.parquet")
.read_to_end(&mut buf)
.unwrap();
let cursor = SliceableCursor::new(buf);
let read_from_cursor = SerializedFileReader::new(cursor).unwrap();
let test_file = get_test_file("alltypes_plain.parquet");
let read_from_file = SerializedFileReader::new(test_file).unwrap();
let file_iter = read_from_file.get_row_iter(None).unwrap();
let cursor_iter = read_from_cursor.get_row_iter(None).unwrap();
assert!(file_iter.eq(cursor_iter));
} | rust_cleaned_test_functions.jsonl/27256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28601,
8378,
2458,
21778,
16068,
33574,
43241,
8897,
368,
341,
286,
1077,
5206,
6607,
25,
11312,
34837,
23,
29,
284,
11312,
486,
931,
543,
286,
633,
4452,
2458,
445,
541,
9242,
41015,
33277,
23300... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fn_ptr_raw() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
#[allow(deprecated)]
engine
.register_fn("mul", |x: &mut INT, y: INT| *x *= y)
.register_raw_fn(
"bar",
&[
TypeId::of::<INT>(),
TypeId::of::<FnPtr>(),
TypeId::of::<INT>(),
],
move |context, args| {
let fp = std::mem::take(args[1]).cast::<FnPtr>();
let value = args[2].clone();
let this_ptr = args.get_mut(0).unwrap();
fp.call_dynamic(context, Some(this_ptr), [value])
},
);
assert_eq!(
engine.eval::<INT>(
r#"
fn foo(x) { this += x; }
let x = 41;
x.bar(Fn("foo"), 1);
x
"#
)?,
42
);
assert_eq!(
engine.eval::<INT>(
r#"
fn foo(x, y) { this += x + y; }
let x = 40;
let v = 1;
x.bar(Fn("foo").curry(v), 1);
x
"#
)?,
42
);
assert_eq!(
engine.eval::<INT>(
r#"
private fn foo(x) { this += x; }
let x = 41;
x.bar(Fn("foo"), 1);
x
"#
)?,
42
);
assert_eq!(
engine.eval::<INT>(
r#"
let x = 21;
x.bar(Fn("mul"), 2);
x
"#
)?,
42
);
Ok(())
} | rust_cleaned_test_functions.jsonl/5442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1084
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
4348,
16067,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
5206,
4712,
284,
8200,
486,
931,
1428,
262,
11506,
7183,
12797,
19889,
5563,
262,
4712,
198,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_add_getter() {
let a = Ts {jaf: 4, field_1: 0, field_2: String::from("hello")};
assert_eq!(a.get_field_2(), &String::from("hello"));
} | rust_cleaned_test_functions.jsonl/24668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
3062,
465,
368,
341,
262,
1077,
264,
284,
25076,
314,
73,
2577,
25,
220,
19,
11,
2070,
62,
16,
25,
220,
15,
11,
2070,
62,
17,
25,
923,
486,
1499,
445,
14990,
899,
2440,
262,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_variable_array_variable_len_struct() {
let mut buf = BytesMut::new();
buf.put_u32(2); // 2 structs
buf.put_u32(2); // This struct has 2 values
buf.put_u32(1); // Struct 1
buf.put_u32(2); // Struct 2
buf.put_u32(2); // This struct has 2 values
buf.put_u32(3); // Struct 1
buf.put_u32(4); // Struct 2
buf.put_u32(123); // Remaining buffer
let mut buf = buf.freeze();
let got = buf
.read_variable_array::<VariableSizedStruct>(None)
.unwrap();
assert_eq!(got.len(), 2);
assert_eq!(
got.wire_size(),
4 + // Variable array length prefix
4 + // First struct array length prefix
8 + // First struct data
4 + // Second struct array length prefix
8 // Second struct data
);
assert_eq!(got[0], VariableSizedStruct { a: vec![1, 2] });
assert_eq!(buf.len(), 4);
assert_eq!(buf.as_ref(), &[0, 0, 0, 123]);
} | rust_cleaned_test_functions.jsonl/38923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 625
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14635,
3858,
14635,
6043,
15126,
368,
341,
310,
1077,
5206,
6607,
284,
30024,
51440,
486,
931,
543,
310,
6607,
3597,
7300,
18,
17,
7,
17,
1215,
442,
220,
17,
62845,
271,
310,
6607,
3597,
7300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
assert_eq!(parse_time("10:30:44 +0000"), Ok((10, 30, Some(44), 0, "")));
assert_eq!(parse_time("10:30 EDT"), Ok((10, 30, None, -400, "")));
assert!(parse_time("").is_err());
} | rust_cleaned_test_functions.jsonl/100506 | {
"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,
21039,
3009,
368,
341,
286,
2060,
10714,
10297,
6400,
3009,
445,
16,
15,
25,
18,
15,
25,
19,
19,
488,
15,
15,
15,
15,
3975,
7622,
1188,
16,
15,
11,
220,
18,
15,
11,
4329,
7,
19,
19,
701,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_container_decl() {
let code = String::from("
cont: Integer {
inner: int;
}
");
let mut lexer = Token::lexer(code.as_str());
let parser = Parser::new(code.clone());
let decl_res = parser.parse_container_decl(&mut lexer);
assert!(decl_res.is_ok());
} | rust_cleaned_test_functions.jsonl/43197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15847,
35814,
368,
341,
262,
1077,
2038,
284,
923,
486,
1499,
70576,
286,
683,
25,
4440,
341,
310,
9179,
25,
526,
280,
286,
456,
262,
39887,
262,
1077,
5206,
53259,
284,
9660,
486,
38815,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_macros_conv() {
let mut conv_map = parse(
"macros",
r#"
mod swig_foreign_types_map {
#![swig_foreigner_type="byte"]
#![swig_rust_type="jbyte"]
#![swig_foreigner_type="short"]
#![swig_rust_type="jshort"]
}
#[swig_code = "let {to_var}: {to_var_type} = <{to_var_type}>::swig_from({from_var}, env);"]
trait SwigFrom<T> {
fn swig_from(T, env: *mut JNIEnv) -> Self;
}
impl SwigFrom<u8> for jshort {
fn swig_from(x: u8, _: *mut JNIEnv) -> Self {
x as jshort
}
}
#[allow(unused_macros)]
#[swig_generic_arg = "T"]
#[swig_generic_arg = "E"]
#[swig_from = "Result<T, E>"]
#[swig_to = "T"]
#[swig_code = "let {to_var}: {to_var_type} = jni_unpack_return!({from_var}, env);"]
macro_rules! jni_unpack_return {
($result_value:expr, $default_value:expr, $env:ident) => {
{
let ret = match $result_value {
Ok(x) => x,
Err(msg) => {
jni_throw_exception($env, &msg);
return $default_value;
}
};
ret
}
}
}
"#,
64,
FxHashMap::default(),
)
.unwrap();
conv_map.add_type(str_to_rust_ty("Foo"));
let (_, code) = conv_map
.convert_rust_types(
&str_to_rust_ty("Result<Foo, String>"),
&str_to_rust_ty("Foo"),
"a0",
"jlong",
Span::call_site(),
)
.unwrap();
assert_eq!(
r#" let a0: Foo = jni_unpack_return!(a0, env);
"#,
code
);
let (_, code) = conv_map
.convert_rust_types(
&str_to_rust_ty("Result<u8, &'static str>"),
&str_to_rust_ty("jshort"),
"a0",
"jlong",
Span::call_site(),
)
.unwrap();
assert_eq!(
r#" let a0: u8 = jni_unpack_return!(a0, env);
let a0: jshort = <jshort>::swig_from(a0, env);
"#,
code
);
} | rust_cleaned_test_functions.jsonl/54598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
85904,
22716,
368,
341,
286,
1077,
5206,
5686,
5376,
284,
4715,
1006,
310,
330,
86398,
756,
310,
435,
2,
698,
2593,
2021,
343,
78983,
9763,
5376,
341,
262,
671,
20703,
2280,
343,
35563,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delay_second_test_case() {
let first_line = "R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51";
let second_line = "U98,R91,D20,R16,D67,R40,U7,R15,U6,R7";
assert_eq!(410, get_minimum_signal_delay_intersection(first_line, second_line));
} | rust_cleaned_test_functions.jsonl/45006 | {
"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,
22198,
29644,
4452,
19096,
368,
341,
286,
1077,
1156,
6528,
284,
330,
49,
24,
23,
50481,
19,
22,
23508,
17,
21,
27266,
21,
18,
23508,
18,
18,
50481,
23,
22,
30114,
21,
17,
27266,
17,
15,
235... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_doc_spec_chunk() {
crate::tests::test_write_doc_spec_chunk(
TEST_CHUNK_I16_LZ4.as_ref(),
CompressionType::Lz4(Lz4Compression::default()),
);
} | rust_cleaned_test_functions.jsonl/40667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
18869,
13594,
30539,
368,
341,
286,
17717,
486,
23841,
486,
1944,
9165,
18869,
13594,
30539,
1006,
310,
13602,
70508,
7959,
16,
21,
2351,
57,
19,
5357,
7793,
3148,
310,
66161,
929,
486,
43,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_result() {
let mut results = IpResults::new(Some(false));
results.add_result(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), Utc::now());
assert_eq!(
results.get_latest_ip().unwrap(),
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))
);
} | rust_cleaned_test_functions.jsonl/86294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5287,
368,
341,
286,
1077,
5206,
3059,
284,
35033,
9801,
486,
931,
65405,
3576,
3237,
286,
3059,
1364,
5287,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
16,
17,
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_hsl_cross_fifo_synthesizes() {
let mut uut: CrossWiden<4, 5, 6, 16, 3, 4> = CrossWiden::new(WordOrder::LeastSignificantFirst);
uut.wide_bus.read.connect();
uut.wide_clock.connect();
uut.narrow_bus.write.connect();
uut.narrow_bus.data.connect();
uut.narrow_clock.connect();
uut.connect_all();
let vlog = generate_verilog(&uut);
yosys_validate("hsl_cross_fifo", &vlog).unwrap();
} | rust_cleaned_test_functions.jsonl/118558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
3226,
35284,
56590,
51393,
6375,
4756,
368,
341,
262,
1077,
5206,
575,
332,
25,
11261,
54,
12487,
27,
19,
11,
220,
20,
11,
220,
21,
11,
220,
16,
21,
11,
220,
18,
11,
220,
19,
29,
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_long_redirection_to_current_dir() {
let (at, mut ucmd) = at_and_ucmd!();
// Create a 256-character path to current directory
let dir = path_concat!(".", ..128);
ucmd.arg("-n")
.arg("-m")
.arg(dir)
.run()
.stdout_is(at.root_dir_resolved());
} | rust_cleaned_test_functions.jsonl/37403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
26058,
2866,
2346,
11080,
4334,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
442,
4230,
264,
220,
17,
20,
21,
79225,
1815,
311,
1482,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_age() {
let p: Person = Person::from("Mark,");
assert_eq!(p.name, "John");
assert_eq!(p.age, 30);
} | rust_cleaned_test_functions.jsonl/1614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
32053,
368,
341,
286,
1077,
281,
25,
7357,
284,
7357,
486,
1499,
445,
8949,
88349,
286,
2060,
10714,
10297,
79,
2644,
11,
330,
13079,
797,
286,
2060,
10714,
10297,
79,
30810,
11,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_not() {
assert_eq!(!u7(42), u7(85));
assert_eq!(!u7(0x7F), u7(0));
assert_eq!(!u7(0), u7(0x7F));
assert_eq!(!u7(56), u7(71));
} | rust_cleaned_test_functions.jsonl/112544 | {
"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,
7913,
368,
341,
286,
2060,
10714,
0,
3471,
84,
22,
7,
19,
17,
701,
575,
22,
7,
23,
20,
1106,
286,
2060,
10714,
0,
3471,
84,
22,
7,
15,
87,
22,
37,
701,
575,
22,
7,
15,
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... | 1 |
#[test]
fn test_arg_number() {
let _ = tracing_subscriber::fmt::try_init();
#[derive(PolarClass)]
struct Foo;
impl Foo {
fn three(&self, one: i32, two: i32, three: i32) -> i32 {
one + two + three
}
fn many_method(
&self,
one: i32,
two: i32,
three: i32,
four: i32,
five: i32,
six: i32,
seven: i32,
) -> i32 {
one + two + three + four + five + six + seven
}
fn many_class_method(
one: i32,
two: i32,
three: i32,
four: i32,
five: i32,
six: i32,
seven: i32,
) -> i32 {
one + two + three + four + five + six + seven
}
}
let mut test = OsoTest::new();
test.oso
.register_class(
Foo::get_polar_class_builder()
.add_method("many_method", Foo::three)
.add_method("many_method", Foo::many_method)
.add_class_method("many_class", Foo::many_class_method)
.build(),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/30397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 698
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6057,
5500,
368,
341,
262,
1077,
716,
284,
45415,
5228,
20351,
486,
12501,
486,
1539,
6137,
543,
262,
11506,
27098,
5304,
7417,
1957,
5563,
262,
2036,
33428,
401,
262,
11605,
33428,
341,
286,
5168... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strings_not_equal() {
let text = " {% if 'test' != 'test' %} true {% else %} false {% endif %} ";
assert_template_result!(" false ", text);
} | rust_cleaned_test_functions.jsonl/28130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33500,
7913,
11478,
368,
341,
262,
1077,
1467,
284,
330,
52261,
421,
364,
1944,
6,
961,
364,
1944,
6,
1018,
92,
830,
52261,
770,
1018,
92,
895,
52261,
12330,
1018,
92,
7620,
262,
2060,
8693,
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 |
#[test]
fn test_continue_confirmation_bad_input() {
let (ctx, is, os) = create_normal_test_context("foo\nYes\n");
let result = continue_confirmation(is, os, TEST_CONTINUE_DESCRIPTION).unwrap();
assert!(result);
assert!(ctx.has_default_attributes());
assert_eq!(
format!(
"{}Continue? [Yes/No] Invalid response 'foo'.\n{}Continue? [Yes/No] ",
TEST_CONTINUE_DESCRIPTION, TEST_CONTINUE_DESCRIPTION
),
ctx.write_buffer_as_str().unwrap()
);
} | rust_cleaned_test_functions.jsonl/110994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75297,
37681,
34199,
5898,
368,
341,
262,
1077,
320,
3773,
11,
374,
11,
2643,
8,
284,
1855,
13973,
4452,
8467,
445,
7975,
1699,
9454,
1699,
797,
262,
1077,
1102,
284,
3060,
37681,
9623,
11,
2643... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_nft_configure_not_same_error() {
let (mut context, tx) = create_test_context(
Action::Update(UpdateCase::Claim),
NftError::NFTConfigureNotSame,
);
let tx = context.complete_tx(tx);
// run
let err = context.verify_tx(&tx, MAX_CYCLES).unwrap_err();
let script_cell_index = 0;
assert_error_eq!(
err,
ScriptError::ValidationFailure(NFT_CONFIGURE_NOT_SAME).input_type_script(script_cell_index)
);
} | rust_cleaned_test_functions.jsonl/33588 | {
"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,
8882,
1089,
723,
75887,
7913,
33574,
4096,
368,
341,
262,
1077,
320,
6984,
2266,
11,
9854,
8,
284,
1855,
4452,
8467,
1006,
286,
5586,
486,
4289,
7,
4289,
4207,
486,
45544,
1326,
286,
451,
723,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_uncommented() {
fn check(haystack: &str, needle: &str, expected: Option<usize>) {
assert_eq!(expected, haystack.find_uncommented(needle));
}
check("/*/ */test", "test", Some(6));
check("//test\ntest", "test", Some(7));
check("/* comment only */", "whatever", None);
check(
"/* comment */ some text /* more commentary */ result",
"result",
Some(46),
);
check("sup // sup", "p", Some(2));
check("sup", "x", None);
check(r#"π? /**/ π is nice!"#, r#"π is nice"#, Some(9));
check("/*sup yo? \n sup*/ sup", "p", Some(20));
check("hel/*lohello*/lo", "hello", None);
check("acb", "ab", None);
check(",/*A*/ ", ",", Some(0));
check("abc", "abc", Some(0));
check("/* abc */", "abc", None);
check("/**/abc/* */", "abc", Some(4));
check("\"/* abc */\"", "abc", Some(4));
check("\"/* abc", "abc", Some(4));
} | rust_cleaned_test_functions.jsonl/44604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
4907,
6182,
291,
368,
341,
286,
5168,
1779,
3203,
352,
7693,
25,
609,
495,
11,
30309,
25,
609,
495,
11,
3601,
25,
6959,
90244,
9231,
341,
310,
2060,
10714,
10297,
7325,
11,
88447,
2658,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keeps_track_of_rendered_languages() {
let mut file = NamedTempFile::new().unwrap();
writeln!(file, "``` vim" ).unwrap();
writeln!(file, "```" ).unwrap();
writeln!(file, "" ).unwrap();
writeln!(file, " ignored" ).unwrap();
writeln!(file, "" ).unwrap();
writeln!(file, "```ruby" ).unwrap();
writeln!(file, "```" ).unwrap();
writeln!(file, "" ).unwrap();
writeln!(file, "```" ).unwrap();
writeln!(file, "```" ).unwrap();
writeln!(file, "``` rust").unwrap();
writeln!(file, "```" ).unwrap();
let renderer = Renderer::new(file.path().to_path_buf());
let content = renderer.run().unwrap();
let expected: HashSet<_> =
vec!["vim", "ruby", "rust"].into_iter().map(String::from).collect();
assert_eq!(expected, content.code_languages);
} | rust_cleaned_test_functions.jsonl/95426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45476,
7124,
28545,
3575,
22781,
291,
77576,
368,
341,
262,
1077,
5206,
1034,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
1428,
262,
80947,
10297,
1192,
11,
330,
73594,
36157,
1,
257,
7457,
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_deserialize_with_variant() {
assert_de_tokens(
&WithVariant::Unit,
&[
Token::NewtypeVariant { name: "WithVariant", variant: "Unit" },
Token::I8(0),
],
);
assert_de_tokens(
&WithVariant::Newtype(123),
&[
Token::NewtypeVariant { name: "WithVariant", variant: "Newtype" },
Token::Bool(true),
],
);
assert_de_tokens(
&WithVariant::Tuple("hello".into(), 0),
&[
Token::NewtypeVariant { name: "WithVariant", variant: "Tuple" },
Token::Str("hello;0"),
],
);
assert_de_tokens(
&WithVariant::Struct { f1: "world".into(), f2: 1 },
&[
Token::NewtypeVariant { name: "WithVariant", variant: "Struct" },
Token::Str("world;1"),
],
);
} | rust_cleaned_test_functions.jsonl/58619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
6615,
46112,
368,
341,
262,
2060,
2259,
28838,
1006,
286,
609,
2354,
20746,
486,
4562,
345,
286,
609,
9640,
310,
9660,
486,
3564,
1313,
20746,
314,
829,
25,
330,
2354,
20746,
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... | 1 |
#[test]
fn test_simple() {
let mut buffer = buffer();
buffer.enqueue(6, ()).unwrap().copy_from_slice(b"abcdef");
assert_eq!(buffer.enqueue(16, ()), Err(Error::Exhausted));
assert_eq!(buffer.metadata_ring.len(), 1);
assert_eq!(buffer.dequeue().unwrap().1, &b"abcdef"[..]);
assert_eq!(buffer.dequeue(), Err(Error::Exhausted));
} | rust_cleaned_test_functions.jsonl/101974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
286,
1077,
5206,
4147,
284,
4147,
543,
286,
4147,
47468,
7,
21,
11,
1719,
568,
15454,
1005,
8560,
5673,
26488,
1883,
1,
41202,
797,
286,
2060,
10714,
10297,
7573,
47468,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subtract_outer() {
let x = array![2., 3., 4.];
let y = array![1., 5., 2.];
let z = subtract_outer(&x, &y);
assert_eq!(z, array![[1., -3., 0.], [2., -2., 1.], [3., -1., 2.]]);
} | rust_cleaned_test_functions.jsonl/75000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
2144,
67258,
368,
341,
197,
10217,
856,
284,
1334,
20703,
17,
2572,
220,
18,
2572,
220,
19,
13,
935,
197,
10217,
379,
284,
1334,
20703,
16,
2572,
220,
20,
2572,
220,
17,
13,
935,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_floor_to_pow_of_2() {
let t = [
(1 as usize, 1 as usize),
(2, 2),
(3, 2),
(4, 4),
(5, 4),
(15, 8),
(31, 16),
(33, 32),
(1000, 512),
(1500, 1024),
(2300, 2048),
];
for t in t {
assert_eq!(floor_to_pow_of_2(t.0), t.1);
}
} | rust_cleaned_test_functions.jsonl/6015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60044,
2346,
56183,
3575,
62,
17,
368,
341,
286,
1077,
259,
284,
2278,
310,
320,
16,
438,
22301,
11,
220,
16,
438,
22301,
1326,
310,
320,
17,
11,
220,
17,
1326,
310,
320,
18,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_convert_to_duration() {
let cases = vec![
("2012-12-31 11:30:45.123456", 4, "11:30:45.1235"),
("2012-12-31 11:30:45.123456", 6, "11:30:45.123456"),
("2012-12-31 11:30:45.123456", 0, "11:30:45"),
("2012-12-31 11:30:45.999999", 0, "11:30:46"),
("2017-01-05 08:40:59.575601", 0, "08:41:00"),
("2017-01-05 23:59:59.575601", 0, "00:00:00"),
("0000-00-00 00:00:00", 6, "00:00:00"),
];
for (s, fsp, expect) in cases {
let t = Time::parse_utc_datetime(s, fsp).unwrap();
let du = t.to_duration().unwrap();
let get = du.to_string();
assert_eq!(get, expect);
}
} | rust_cleaned_test_functions.jsonl/58468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
2346,
25454,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
17,
12,
16,
17,
12,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
21,
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... | 2 |
#[test]
fn test_list_builder() {
let values_builder = Int32Array::builder(10);
let mut builder = LargeListPrimitiveChunkedBuilder::new("a", values_builder, 10);
// create a series containing two chunks
let mut s1 = Int32Chunked::new_from_slice("a", &[1, 2, 3]).into_series();
let s2 = Int32Chunked::new_from_slice("b", &[4, 5, 6]).into_series();
s1.append(&s2).unwrap();
builder.append_series(&s1);
builder.append_series(&s2);
let ls = builder.finish();
if let AnyType::LargeList(s) = ls.get_any(0) {
// many chunks are aggregated to one in the ListArray
assert_eq!(s.len(), 6)
} else {
assert!(false)
}
if let AnyType::LargeList(s) = ls.get_any(1) {
assert_eq!(s.len(), 3)
} else {
assert!(false)
}
} | rust_cleaned_test_functions.jsonl/5954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
28532,
368,
341,
286,
1077,
2750,
28532,
284,
1333,
18,
17,
1857,
486,
17850,
7,
16,
15,
317,
286,
1077,
5206,
7363,
284,
20286,
852,
33313,
28304,
291,
3297,
486,
931,
445,
64,
497,
275... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_num_conditional_reversal() {
let mut rng = XorShiftRng::from_seed([0x3dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
{
let mut cs = TestConstraintSystem::<Bls12>::new();
let a = AllocatedNum::alloc(cs.namespace(|| "a"), || Ok(rng.gen())).unwrap();
let b = AllocatedNum::alloc(cs.namespace(|| "b"), || Ok(rng.gen())).unwrap();
let condition = Boolean::constant(false);
let (c, d) = AllocatedNum::conditionally_reverse(&mut cs, &a, &b, &condition).unwrap();
assert!(cs.is_satisfied());
assert_eq!(a.value.unwrap(), c.value.unwrap());
assert_eq!(b.value.unwrap(), d.value.unwrap());
}
{
let mut cs = TestConstraintSystem::<Bls12>::new();
let a = AllocatedNum::alloc(cs.namespace(|| "a"), || Ok(rng.gen())).unwrap();
let b = AllocatedNum::alloc(cs.namespace(|| "b"), || Ok(rng.gen())).unwrap();
let condition = Boolean::constant(true);
let (c, d) = AllocatedNum::conditionally_reverse(&mut cs, &a, &b, &condition).unwrap();
assert!(cs.is_satisfied());
assert_eq!(a.value.unwrap(), d.value.unwrap());
assert_eq!(b.value.unwrap(), c.value.unwrap());
}
} | rust_cleaned_test_functions.jsonl/39690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
24433,
3005,
1288,
3004,
278,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
18,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
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... | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.