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_split_off_empty() {
let orig = "Hello, world!";
let mut split = TinyString::<[u8; 16]>::from(orig);
let empty: TinyString<[u8; 16]> = split.split_off(orig.len());
assert!(empty.is_empty());
} | rust_cleaned_test_functions.jsonl/3628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
13651,
15124,
368,
341,
10217,
2713,
284,
330,
9707,
11,
1879,
26782,
10217,
5206,
6718,
284,
47974,
703,
27638,
58,
84,
23,
26,
220,
16,
21,
60,
6831,
1499,
54837,
317,
10217,
4287,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ready_transactions() {
let (mut smp, peers) =
SharedMempoolNetwork::bootstrap_validator_network(2, 1, None, None, false);
let (peer_a, peer_b) = (peers.get(0).unwrap(), peers.get(1).unwrap());
smp.add_txns(
&peer_a,
vec![TestTransaction::new(1, 0, 1), TestTransaction::new(1, 2, 1)],
);
// first message delivery
smp.send_new_peer_event(peer_a, peer_b, true);
smp.deliver_message(&peer_a, 1, true, true, false);
// add txn1 to Mempool
smp.add_txns(&peer_a, vec![TestTransaction::new(1, 1, 1)]);
// txn1 unlocked txn2. Now all transactions can go through in correct order
let txn = &smp.deliver_message(&peer_a, 1, true, true, false).0;
assert_eq!(txn.get(0).unwrap().sequence_number(), 1);
let txn = &smp.deliver_message(&peer_a, 1, true, true, false).0;
assert_eq!(txn.get(0).unwrap().sequence_number(), 2);
} | rust_cleaned_test_functions.jsonl/54556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35456,
68182,
368,
341,
262,
1077,
320,
6984,
274,
1307,
11,
25029,
8,
4035,
286,
16990,
44,
3262,
1749,
12320,
486,
6281,
64959,
20966,
7,
17,
11,
220,
16,
11,
2240,
11,
2240,
11,
895,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_manually_send_actor()
{
let mut exec = LocalPool::default();
let exec2 = exec.clone();
let program = async move
{
// of spawn_local.
let actor = Sum(5);
let mb = Inbox::new( Some( "Sum".into() ) );
let mut addr = Addr::new( mb.sender() );
exec2.spawn_local( mb.start_fut_local( actor ) ).expect( "spawn actor mailbox" );
addr.send( Add( 10 ) ).await.expect( "Send failed" );
let result = addr.call( Show{} ).await.expect( "Call failed" );
assert_eq!( 15, result );
};
exec.spawn_local( program ).expect( "spawn program" );
exec.run();
} | rust_cleaned_test_functions.jsonl/4308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17062,
1832,
13565,
54818,
741,
515,
10217,
5206,
3883,
220,
284,
8774,
10551,
486,
2258,
543,
10217,
3883,
17,
284,
3883,
15997,
1428,
10217,
2025,
284,
3312,
3271,
198,
197,
515,
2394,
197,
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_fq_sqrt() {
let mut rng = ark_std::test_rng();
assert_eq!(Fq::zero().sqrt().unwrap(), Fq::zero());
for _ in 0..1000 {
let a = Fq::rand(&mut rng);
let nega = -a;
let mut b = a;
b.square_in_place();
let b = b.sqrt().unwrap();
assert!(a == b || nega == b);
}
for _ in 0..1000 {
let a = Fq::rand(&mut rng);
if let Some(mut tmp) = a.sqrt() {
tmp.square_in_place();
assert_eq!(a, tmp);
}
}
} | rust_cleaned_test_functions.jsonl/3550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
92199,
368,
341,
262,
1077,
5206,
28422,
284,
55217,
15656,
486,
1944,
66849,
1428,
262,
2060,
10714,
10297,
37,
80,
486,
14154,
1005,
26888,
1005,
15454,
1507,
434,
80,
486,
14154,
5231,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_col_prune_implicit_join() {
assert_j_plan(
"select t2.c0 from t2, t3 where t2.c1 = t3.c1",
|sql, mut plan| {
col_prune(&mut plan.qry_set, plan.root).unwrap();
print_plan(sql, &plan);
let subq = get_lvl_queries(&plan, 1);
// additional column is requied from t2 for filter
assert_eq!(2, subq[0].out_cols().len());
assert_eq!(1, subq[1].out_cols().len());
},
)
} | rust_cleaned_test_functions.jsonl/27139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10211,
5294,
2886,
62,
30940,
31017,
368,
341,
286,
2060,
5374,
26564,
1006,
310,
330,
1742,
259,
17,
520,
15,
504,
259,
17,
11,
259,
18,
1380,
259,
17,
520,
16,
284,
259,
18,
520,
16,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_big_h() {
if get_effective_gid() != 0 {
assert!(
new_ucmd!()
.arg("-RH")
.arg("bin")
.arg("/proc/self/fd")
.fails()
.stderr_str()
.lines()
.fold(0, |acc, _| acc + 1)
> 1
);
}
} | rust_cleaned_test_functions.jsonl/49277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
1523,
368,
341,
262,
421,
633,
27125,
533,
72893,
368,
961,
220,
15,
341,
286,
2060,
33673,
310,
501,
68887,
2277,
0,
741,
394,
659,
858,
13645,
66973,
1138,
394,
659,
858,
445,
6863,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multihash_error_digest_invalid_size_type2() {
let input = quote! {
#[derive(Clone, Multihash)]
#[mh(alloc_size = U32)]
pub enum Code {
#[mh(code = 0x14, hasher = multihash::Sha2_256, digest = multihash::Sha2Digest<_>)]
Sha2_256,
}
};
let derive_input = syn::parse2(input).unwrap();
let s = Structure::new(&derive_input);
multihash(s);
} | rust_cleaned_test_functions.jsonl/97858 | {
"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,
26290,
6996,
988,
4096,
52994,
31433,
2368,
1819,
17,
368,
341,
286,
1077,
1946,
284,
12641,
0,
341,
1843,
11506,
27098,
65297,
11,
22162,
6996,
988,
5563,
1843,
11506,
51916,
7,
4742,
2368,
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_invalid_bool() {
for i in 2u8..=255 {
let bytes = [i];
assert_eq!(
<bool>::try_from_slice(&bytes).unwrap_err().to_string(),
format!("Invalid bool representation: {}", i)
);
}
} | rust_cleaned_test_functions.jsonl/103713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
22159,
368,
341,
262,
369,
600,
304,
220,
17,
84,
23,
496,
28,
17,
20,
20,
341,
286,
1077,
5820,
284,
508,
72,
935,
286,
2060,
10714,
33673,
310,
366,
2641,
6831,
1539,
5673,
26488,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_line_buffer() {
let mut writer = LineWriter::new(Vec::new());
writer.write(&[0]).unwrap();
assert_eq!(*writer.get_ref(), []);
writer.write(&[1]).unwrap();
assert_eq!(*writer.get_ref(), []);
writer.flush().unwrap();
assert_eq!(*writer.get_ref(), [0, 1]);
writer.write(&[0, b'\n', 1, b'\n', 2]).unwrap();
assert_eq!(*writer.get_ref(), [0, 1, 0, b'\n', 1, b'\n']);
writer.flush().unwrap();
assert_eq!(*writer.get_ref(), [0, 1, 0, b'\n', 1, b'\n', 2]);
writer.write(&[3, b'\n']).unwrap();
assert_eq!(*writer.get_ref(), [0, 1, 0, b'\n', 1, b'\n', 2, 3, b'\n']);
} | rust_cleaned_test_functions.jsonl/12410 | {
"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,
6528,
7776,
368,
341,
286,
1077,
5206,
6916,
284,
7083,
6492,
486,
931,
49923,
486,
931,
1423,
286,
6916,
3836,
2099,
58,
15,
10697,
15454,
543,
286,
2060,
10714,
0,
4071,
18189,
670,
7793,
1507... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_serialize_int() {
let expected = r#"{"id":1,"method":"login","jsonrpc":"2.0","params":null}"#;
let rpc = RpcRequest {
id: JsonId::IntId(1),
method: String::from("login"),
jsonrpc: String::from("2.0"),
params: None,
};
let json_actual = serde_json::to_string(&rpc).unwrap();
let expected_deserialized: RpcRequest = serde_json::from_str(expected).unwrap();
let actual_deserialized: RpcRequest = serde_json::from_str(&json_actual).unwrap();
assert_eq!(expected_deserialized, actual_deserialized);
} | rust_cleaned_test_functions.jsonl/49213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
88686,
4042,
368,
341,
197,
10217,
3601,
284,
435,
55543,
4913,
307,
788,
16,
1335,
4393,
3252,
3673,
2198,
2236,
29414,
3252,
17,
13,
15,
2198,
3519,
788,
2921,
9863,
2,
280,
197,
10217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_introduce_var_in_closure_no_block() {
check_assist_range(
introduce_variable,
"
fn main() {
let lambda = |x: u32| <|>x * 2<|>;
}
",
"
fn main() {
let lambda = |x: u32| { let <|>var_name = x * 2; var_name };
}
",
);
} | rust_cleaned_test_functions.jsonl/5714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
1243,
72823,
6536,
7113,
368,
341,
286,
1779,
12083,
380,
9698,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
1887,
368,
341,
262,
1077,
12459,
284,
760,
87,
25,
575,
18,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request() {
use helix::*;
let req = GetUsersFollowsRequest::builder()
.to_id("23161357".to_string())
.build();
// From twitch docs
let data = br#"
{
"total": 12345,
"data":
[
{
"from_id": "171003792",
"from_login": "iiisutha067iii",
"from_name": "IIIsutha067III",
"to_id": "23161357",
"to_name": "LIRIK",
"to_login": "lirik",
"followed_at": "2017-08-22T22:55:24Z"
},
{
"from_id": "113627897",
"from_login": "birdman616",
"from_name": "Birdman616",
"to_id": "23161357",
"to_name": "LIRIK",
"to_login": "lirik",
"followed_at": "2017-08-22T22:55:04Z"
}
],
"pagination":{
"cursor": "eyJiIjpudWxsLCJhIjoiMTUwMzQ0MTc3NjQyNDQyMjAwMCJ9"
}
}
"#
.to_vec();
let http_response = http::Response::builder().body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/users/follows?to_id=23161357"
);
dbg!(GetUsersFollowsRequest::parse_response(Some(req), &uri, http_response).unwrap());
} | rust_cleaned_test_functions.jsonl/58490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
2126,
7137,
12480,
82,
1900,
486,
17850,
741,
286,
659,
983,
842,
445,
17,
18,
16,
21,
16,
18,
20,
22,
3263,
983,
3904,
239... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_addable() {
test_addable(AccessRights::ADD, true);
test_addable(AccessRights::READ_ADD, true);
test_addable(AccessRights::READ_WRITE, false);
test_addable(AccessRights::ADD_WRITE, true);
test_addable(AccessRights::READ, false);
test_addable(AccessRights::WRITE, false);
test_addable(AccessRights::READ_ADD_WRITE, true);
} | rust_cleaned_test_functions.jsonl/131286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2891,
480,
368,
341,
286,
1273,
2891,
480,
4346,
1322,
81875,
486,
15665,
11,
830,
317,
286,
1273,
2891,
480,
4346,
1322,
81875,
486,
9560,
8581,
11,
830,
317,
286,
1273,
2891,
480,
4346,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_empty_database() {
let dir = TempDir::new("test").unwrap();
let env = Environment::new().open(dir.path()).unwrap();
let db = env.open_db(None).unwrap();
let txn = env.begin_ro_txn().unwrap();
let mut cursor = txn.open_ro_cursor(db).unwrap();
assert_eq!(0, cursor.iter().count());
assert_eq!(0, cursor.iter_start().count());
assert_eq!(0, cursor.iter_from(b"foo").count());
} | rust_cleaned_test_functions.jsonl/15136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
15124,
27341,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
1944,
1827,
15454,
543,
286,
1077,
6105,
284,
11586,
486,
931,
1005,
2508,
14161,
3875,
6011,
15454,
543,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typedef_to_ns() {
let hdr = indoc! {"
#include <cstdint>
namespace A {
template<typename T>
struct C {
T* t;
};
typedef C<char> B;
}
"};
let rs = quote! {};
run_test("", hdr, rs, &["A::B"], &[]);
} | rust_cleaned_test_functions.jsonl/9801 | {
"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,
42111,
4219,
2346,
34728,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
4473,
362,
341,
310,
3811,
16544,
350,
397,
310,
2036,
356,
341,
394,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_invariants() {
test_invariant_non_leaf(|node| node == parent(right_child(node)));
test_invariant_non_leaf(|node| node == parent(left_child(node)));
test_invariant(|node| level(node) == level(parent(node)) - 1);
test_invariant(|node| {
node_from_level_and_pos(level(node), pos_counting_from_left(node)) == node
});
test_invariant(|node| postorder_to_inorder(inorder_to_postorder(node)) == node);
test_invariant_non_leaf(|node| {
pos_counting_from_left(right_child(node)) == pos_counting_from_left(left_child(node)) + 1
});
test_invariant_non_leaf(|node| left_child(node) < node);
test_invariant_non_leaf(|node| node < right_child(node));
test_invariant_non_leaf(|node| {
inorder_to_postorder(left_child(node)) < inorder_to_postorder(node)
});
test_invariant_non_leaf(|node| {
inorder_to_postorder(right_child(node)) < inorder_to_postorder(node)
});
test_invariant_non_leaf(|node| {
inorder_to_postorder(right_child(node)) + 1 == inorder_to_postorder(node)
});
test_invariant_non_leaf(|node| right_child(node) == sibling(left_child(node)));
test_invariant_non_leaf(|node| sibling(right_child(node)) == left_child(node));
test_invariant_non_leaf(|node| right_child(node) == child(node, NodeDirection::Right));
test_invariant_non_leaf(|node| left_child(node) == child(node, NodeDirection::Left));
test_invariant(|node| node == child(parent(node), direction_from_parent(node)));
} | rust_cleaned_test_functions.jsonl/113336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 642
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
1243,
54611,
368,
341,
262,
1273,
1243,
15969,
21637,
38909,
22428,
3509,
91,
2436,
621,
2681,
27704,
17268,
6958,
4945,
262,
1273,
1243,
15969,
21637,
38909,
22428,
3509,
91,
2436,
621,
2681... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_from_str_overflow() {
let mut i8_val: i8 = 127;
assert_eq!("127".parse::<i8>().ok(), Some(i8_val));
assert_eq!("128".parse::<i8>().ok(), None);
i8_val = i8_val.wrapping_add(1);
assert_eq!("-128".parse::<i8>().ok(), Some(i8_val));
assert_eq!("-129".parse::<i8>().ok(), None);
let mut i16_val: i16 = 32_767;
assert_eq!("32767".parse::<i16>().ok(), Some(i16_val));
assert_eq!("32768".parse::<i16>().ok(), None);
i16_val = i16_val.wrapping_add(1);
assert_eq!("-32768".parse::<i16>().ok(), Some(i16_val));
assert_eq!("-32769".parse::<i16>().ok(), None);
let mut i32_val: i32 = 2_147_483_647;
assert_eq!("2147483647".parse::<i32>().ok(), Some(i32_val));
assert_eq!("2147483648".parse::<i32>().ok(), None);
i32_val = i32_val.wrapping_add(1);
assert_eq!("-2147483648".parse::<i32>().ok(), Some(i32_val));
assert_eq!("-2147483649".parse::<i32>().ok(), None);
let mut i64_val: i64 = 9_223_372_036_854_775_807;
assert_eq!("9223372036854775807".parse::<i64>().ok(), Some(i64_val));
assert_eq!("9223372036854775808".parse::<i64>().ok(), None);
i64_val = i64_val.wrapping_add(1);
assert_eq!("-9223372036854775808".parse::<i64>().ok(), Some(i64_val));
assert_eq!("-9223372036854775809".parse::<i64>().ok(), None);
} | rust_cleaned_test_functions.jsonl/109727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
5673,
2895,
79073,
368,
341,
262,
1077,
5206,
600,
23,
6189,
25,
600,
23,
284,
220,
16,
17,
22,
280,
262,
2060,
10714,
17223,
16,
17,
22,
3263,
6400,
27638,
72,
23,
10483,
562,
1507,
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_drawing_owned_as_exclusive_ref_ergonomics() {
let mut surface = Surface::new_raster_n32_premul((16, 16)).unwrap();
// option1:
{
let mut canvas = Canvas::new(ISize::new(16, 16), None).unwrap();
surface.draw(&mut canvas, (5.0, 5.0), None);
surface.draw(&mut canvas, (10.0, 10.0), None);
}
// option2:
// - A canvas from another surface can be drawn to.
{
let mut surface2 = Surface::new_raster_n32_premul((16, 16)).unwrap();
let canvas = surface2.canvas();
surface.draw(canvas, (5.0, 5.0), None);
surface.draw(canvas, (10.0, 10.0), None);
}
} | rust_cleaned_test_functions.jsonl/77685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
1696,
51973,
11898,
2702,
8336,
7793,
62,
2375,
14274,
1211,
368,
972,
262,
1077,
5206,
7329,
284,
26963,
486,
931,
1710,
2300,
1089,
18,
17,
620,
1826,
360,
1188,
16,
21,
11,
220,
16,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix_multiply() {
let m1 = matrix!([1, 2], [3, 4]);
let m2 = matrix!([5, 6], [7, 8]);
let actual = m1.multiply(&m2);
let expect = matrix!([11, 22], [19, 42]);
assert_eq!(actual, expect);
} | rust_cleaned_test_functions.jsonl/22065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
93054,
368,
341,
286,
1077,
296,
16,
284,
6172,
0,
2561,
16,
11,
220,
17,
1125,
508,
18,
11,
220,
19,
2558,
286,
1077,
296,
17,
284,
6172,
0,
2561,
20,
11,
220,
21,
1125,
508,
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_blame_windows_path_dividers() {
let file_path = Path::new("bar\\foo");
let (_td, repo) = repo_init_empty().unwrap();
let root = repo.path().parent().unwrap();
let repo_path: &RepoPath =
&root.as_os_str().to_str().unwrap().into();
std::fs::create_dir(&root.join("bar")).unwrap();
File::create(&root.join(file_path))
.unwrap()
.write_all(b"line 1\n")
.unwrap();
stage_add_file(repo_path, file_path).unwrap();
commit(repo_path, "first commit").unwrap();
assert!(blame_file(&repo_path, "bar\\foo").is_ok());
} | rust_cleaned_test_functions.jsonl/35890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
373,
58220,
2638,
16237,
13269,
368,
341,
197,
10217,
1034,
2638,
284,
7933,
486,
931,
445,
2257,
3422,
7975,
797,
197,
10217,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
15124,
1005,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cred_def_id_parts_for_id_as_unqualified_without_tag_with_schema_as_seq_no_without_tag(
) {
assert_eq!(
_cred_def_id_unqualified_with_schema_as_seq_no_without_tag(),
_cred_def_id_unqualified_with_schema_as_seq_no_without_tag().to_unqualified()
);
} | rust_cleaned_test_functions.jsonl/38082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73475,
7844,
842,
33217,
5478,
842,
11898,
4907,
36335,
39904,
9372,
6615,
25371,
11898,
14486,
6536,
39904,
9372,
1006,
286,
873,
341,
310,
2060,
10714,
33673,
394,
716,
10844,
7844,
842,
4907,
363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 vec: ArrayVec<GenericArray<i32, U41>> = ArrayVec::new();
assert_eq!(vec.len(), 0);
assert_eq!(vec.capacity(), 41);
vec.extend(0..20);
assert_eq!(vec.len(), 20);
assert_eq!(&vec[..5], &[0, 1, 2, 3, 4]);
} | rust_cleaned_test_functions.jsonl/89809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
262,
1077,
5206,
7486,
25,
2910,
10050,
27,
19964,
1857,
21897,
18,
17,
11,
547,
19,
16,
2452,
284,
2910,
10050,
486,
931,
1428,
262,
2060,
10714,
10297,
4083,
19406,
1507,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_field_in_other_file_from_usage() {
check_apply_diagnostic_fix_in_other_file(
r"
//- /main.rs
mod foo;
fn main() {
<|>foo::Foo { bar: 3, baz: false};
}
//- /foo.rs
struct Foo {
bar: i32
}
",
r"
struct Foo {
bar: i32,
pub(crate) baz: bool
}
",
)
} | rust_cleaned_test_functions.jsonl/33996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5013,
1243,
30456,
2458,
5673,
31507,
368,
341,
286,
1779,
36551,
29477,
11953,
36060,
1243,
30456,
2458,
1006,
310,
435,
698,
310,
78406,
608,
3817,
25638,
198,
310,
1463,
15229,
401,
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_write_u64() {
let tests = &[(3u64, "3"), (u64::MAX, &u64::MAX.to_string())];
test_encode_ok(tests);
test_pretty_encode_ok(tests);
} | rust_cleaned_test_functions.jsonl/29813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
7300,
21,
19,
368,
341,
262,
1077,
7032,
284,
609,
9697,
18,
84,
21,
19,
11,
330,
18,
3975,
320,
84,
21,
19,
486,
10586,
11,
609,
84,
21,
19,
486,
10586,
2389,
3904,
2140,
935,
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 |
#[test]
fn test_foreign_interface() {
let gen_code = parse_code(
"test_foreign_interface",
r#"
trait SomeTrait {
fn on_state_changed(&self, item: i32, is_ok: bool);
fn on_state_changed_without_args(&self);
}
foreign_interface!(interface SomeObserver {
self_type SomeTrait;
onStateChanged = SomeTrait::on_state_changed(&self, _: i32, _: bool);
onStateChangedWithoutArgs = SomeObserver::on_state_changed_without_args(&self);
});
foreigner_class!(class ClassWithCallbacks {
self_type Foo;
constructor Foo::default() -> Foo;
method f1(&mut self, cb: Box<SomeTrait>);
});
"#,
&[ForeignLang::Java, ForeignLang::Cpp],
);
let cpp_code = code_for(&gen_code, ForeignLang::Cpp);
println!("cpp_code/c++: {}", cpp_code.foreign_code);
assert!(
cpp_code
.foreign_code
.contains("virtual void onStateChanged(int32_t a_0, bool a_1) = 0;")
);
assert!(
cpp_code
.foreign_code
.contains("virtual void onStateChangedWithoutArgs() = 0;")
);
assert!(cpp_code.foreign_code.contains(
r#"struct C_SomeObserver {
void *opaque;
//! call by Rust side when callback not need anymore
void (*C_SomeObserver_deref)(void *opaque);
void (*onStateChanged)(int32_t a_0, char a_1, void *opaque);
void (*onStateChangedWithoutArgs)(void *opaque);
};"#
));
} | rust_cleaned_test_functions.jsonl/71626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78983,
20546,
368,
341,
262,
1077,
4081,
4136,
284,
4715,
4136,
1006,
286,
330,
1944,
78983,
20546,
756,
286,
435,
2,
698,
29432,
4329,
49257,
341,
262,
5168,
389,
4387,
25213,
2099,
721,
11,
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_insert_nodes() {
let querier = new_valid_db("insert_nodes.db");
let mut nodes = Vec::new();
nodes.push(models::Node {
id: 101,
data: String::from("Test node for insert testing."),
});
nodes.push(models::Node {
id: 102,
data: String::from("Test_Node_Insert_2"),
});
let inserted = querier.insert_nodes(nodes.clone());
assert_eq!(2, inserted);
let node_101 = querier.get_node(101);
let node_102 = querier.get_node(102);
assert_eq!(nodes[0], node_101);
assert_eq!(nodes[1], node_102);
} | rust_cleaned_test_functions.jsonl/107718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
14896,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
4208,
14896,
7076,
797,
286,
1077,
5206,
7798,
284,
11312,
486,
931,
1428,
286,
7798,
2552,
20289,
486,
1955,
341,
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_can_create_onion_service_v3() {
let mut c = run_testing_tor_instance(
&[
"--DisableNetwork", "1",
"--ControlPort", &TOR_TESTING_PORT.to_string(),
]);
block_on_with_env(async move {
let mut s = TcpStream::connect(&format!("127.0.0.1:{}", TOR_TESTING_PORT)).await.unwrap();
let mut utc = UnauthenticatedConn::new(s);
let proto_info = utc.load_protocol_info().await.unwrap();
assert!(proto_info.auth_methods.contains(&TorAuthMethod::Null));
utc.authenticate(&TorAuthData::Null).await.unwrap();
let mut ac = utc.into_authenticated().await;
ac.set_async_event_handler(Some(|_| {
async move { Ok(()) }
}));
let key = crate::onion::TorSecretKeyV3::generate();
ac.add_onion_v3(&key, false, false, false, None, &mut [
(15787, SocketAddr::new(IpAddr::from(Ipv4Addr::new(127,0,0,1)), 15787)),
].iter()).await.unwrap();
// additional actions to check if connection is in corrupted state
ac.take_ownership().await.unwrap();
ac.drop_ownership().await.unwrap();
// delete onion service so it works no more
ac.del_onion(&key.public().get_onion_address().get_address_without_dot_onion()).await.unwrap();
});
} | rust_cleaned_test_functions.jsonl/58486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
8657,
4470,
290,
12267,
2273,
18,
368,
341,
286,
1077,
5206,
272,
284,
1598,
70962,
528,
269,
11904,
1006,
310,
609,
9640,
394,
14482,
25479,
12320,
497,
330,
16,
756,
394,
14482,
3273,
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_struct_postexec() {
let res = StructWithPostExec::parse(INPUT_16);
assert_eq!(
res,
Ok((&INPUT_16[5..], StructWithPostExec { a: 1, b: 18, c: 19 }))
);
let res = TopLevelPostExec::parse(INPUT_16);
assert_eq!(
res,
Ok((
&INPUT_16[6..],
TopLevelPostExec {
a: 1,
b: 0x12,
c: 0x34
}
))
);
} | rust_cleaned_test_functions.jsonl/48210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
6333,
11748,
368,
341,
262,
1077,
592,
284,
16139,
2354,
4133,
10216,
486,
6400,
57911,
62,
16,
21,
317,
262,
2060,
10714,
33673,
286,
592,
345,
286,
7622,
42902,
29421,
62,
16,
21,
58,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_usr2uid() {
assert_eq!(0, usr2uid("root").unwrap());
assert!(usr2uid("88_888_888").is_err());
assert!(usr2uid("auserthatdoesntexist").is_err());
} | rust_cleaned_test_functions.jsonl/26601 | {
"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,
79078,
17,
2423,
368,
341,
286,
2060,
10714,
10297,
15,
11,
43071,
17,
2423,
445,
2888,
1827,
15454,
1423,
286,
2060,
10297,
7063,
17,
2423,
445,
23,
23,
62,
23,
23,
23,
62,
23,
23,
23,
1827... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bos() {
assert_eq!(
parse_bos(&[
// BOS descriptor.
0x05, 0x0F, 0x4C, 0x00, 0x03, // Container ID descriptor.
0x14, 0x10, 0x04, 0x00, 0x2A, 0xF9, 0xF6, 0xC2, 0x98, 0x10, 0x2B, 0x49,
0x8E, 0x64, 0xFF, 0x01, 0x0C, 0x7F, 0x94, 0xE1,
// WebUSB Platform Capability descriptor.
0x18, 0x10, 0x05, 0x00, 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47,
0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65, 0x00, 0x01, 0x42, 0x01,
0x1C, 0x10, 0x05, 0x00, 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C,
0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F, 0x00, 0x00, 0x03, 0x06,
0x00, 0x00, 0x01, 0x00,
]),
Some((0x42, 0x01))
);
} | rust_cleaned_test_functions.jsonl/91366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
880,
436,
368,
341,
262,
2060,
10714,
33673,
414,
4715,
880,
436,
2099,
9640,
286,
442,
425,
3126,
16414,
624,
286,
220,
15,
87,
15,
20,
11,
220,
15,
87,
15,
37,
11,
220,
15,
87,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dbm() {
assert!((power_dbm(&[Complex32::new(2.0, 0.0)], 50.0) - 19.03089987) < 0.0001);
assert!((power_dbm(&[Complex32::new(0.5, 0.0)], 50.0) - 6.989700043) < 0.0001);
assert!((power_dbm(&[Complex32::new(10.0, 0.0)], 50.0) - 33.0102996) < 0.0001);
assert!((power_dbm(&[Complex32::new(0.1, 0.0)], 50.0) - -6.989700043) < 0.0001);
} | rust_cleaned_test_functions.jsonl/24800 | {
"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,
8685,
76,
368,
341,
286,
2060,
0,
1188,
13175,
8685,
76,
2099,
58,
31137,
18,
17,
486,
931,
7,
17,
13,
15,
11,
220,
15,
13,
15,
25035,
220,
20,
15,
13,
15,
8,
481,
220,
16,
24,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_metrics() {
// Error case: initializing metrics with invalid pipe returns error.
let desc = MetricsConfig {
metrics_fifo: PathBuf::from("not_found_file_metrics"),
};
assert!(init_metrics(desc).is_err());
// Initializing metrics with valid pipe is ok.
let metrics_file = TempFile::new().unwrap();
let desc = MetricsConfig {
metrics_fifo: metrics_file.as_path().to_path_buf(),
};
assert!(init_metrics(desc.clone()).is_ok());
assert!(init_metrics(desc).is_err());
} | rust_cleaned_test_functions.jsonl/53209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
37686,
368,
341,
286,
442,
4600,
1142,
25,
57060,
16734,
448,
8318,
13647,
4675,
1465,
624,
286,
1077,
6560,
284,
54190,
2648,
341,
310,
16734,
56590,
25,
7933,
15064,
486,
1499,
445,
1921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decrypt_one_chunk() {
let expected_hash =
hex::decode("916b144867c340614f515c7b0e5415c74832d899c05264ded2a277a6e81d81ff")
.unwrap();
let key_data = get_key_data();
let expected_sender = key_data.alice_public;
let recipient = key_data.bob_private;
let ciphertext = encrypt_one_chunk();
let mut plaintext = Vec::new();
let sender_public = decrypt(
&mut ciphertext.as_slice(),
&mut plaintext,
&recipient,
AsymFileFormat::V1,
)
.unwrap();
let got_hash = hash(plaintext.as_slice());
assert_eq!(expected_hash.as_slice(), &got_hash[..]);
assert_eq!(expected_sender.as_bytes(), sender_public.as_bytes());
} | rust_cleaned_test_functions.jsonl/37918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
11667,
30539,
368,
341,
286,
1077,
3601,
8950,
4035,
310,
12371,
486,
18196,
445,
24,
16,
21,
65,
16,
19,
19,
23,
21,
22,
66,
18,
19,
15,
21,
16,
19,
69,
20,
16,
20,
66,
22,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channel_mode_from_arg() {
let channel_string = None;
assert_matches!(channel_mode_from_arg(channel_string), Ok(bredr::ChannelMode::Basic));
let channel_string = Some("basic".to_string());
assert_matches!(channel_mode_from_arg(channel_string), Ok(bredr::ChannelMode::Basic));
let channel_string = Some("ertm".to_string());
assert_matches!(
channel_mode_from_arg(channel_string),
Ok(bredr::ChannelMode::EnhancedRetransmission)
);
let channel_string = Some("foobar123".to_string());
assert!(channel_mode_from_arg(channel_string).is_err());
} | rust_cleaned_test_functions.jsonl/59092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
7302,
5673,
6057,
368,
341,
286,
1077,
5496,
3904,
284,
2240,
280,
286,
2060,
38344,
10297,
10119,
7302,
5673,
6057,
25923,
3904,
701,
7622,
1883,
1151,
81,
486,
9629,
3636,
486,
15944,
323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slices() {
for &case in crate::test::TEST_CASES {
let input = make_test_input(case);
let (encoded, hash) = encode::encode(&input);
let (outboard, outboard_hash) = encode::outboard(&input);
assert_eq!(hash, outboard_hash);
for &slice_start in crate::test::TEST_CASES {
let expected_start = cmp::min(input.len(), slice_start);
let slice_lens = [0, 1, 2, CHUNK_SIZE - 1, CHUNK_SIZE, CHUNK_SIZE + 1];
for &slice_len in slice_lens.iter() {
println!("\ncase {} start {} len {}", case, slice_start, slice_len);
let expected_end = cmp::min(input.len(), slice_start + slice_len);
let expected_output = &input[expected_start..expected_end];
let mut slice = Vec::new();
let mut extractor = encode::SliceExtractor::new(
Cursor::new(&encoded),
slice_start as u64,
slice_len as u64,
);
extractor.read_to_end(&mut slice).unwrap();
// Make sure the outboard extractor produces the same output.
let mut slice_from_outboard = Vec::new();
let mut extractor = encode::SliceExtractor::new_outboard(
Cursor::new(&input),
Cursor::new(&outboard),
slice_start as u64,
slice_len as u64,
);
extractor.read_to_end(&mut slice_from_outboard).unwrap();
assert_eq!(slice, slice_from_outboard);
let mut output = Vec::new();
let mut reader =
SliceDecoder::new(&*slice, &hash, slice_start as u64, slice_len as u64);
reader.read_to_end(&mut output).unwrap();
assert_eq!(expected_output, &*output);
}
}
}
} | rust_cleaned_test_functions.jsonl/118141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87288,
368,
341,
286,
369,
609,
5638,
304,
17717,
486,
1944,
486,
10033,
28540,
50,
341,
310,
1077,
1946,
284,
1281,
4452,
5898,
59475,
317,
310,
1077,
320,
19329,
11,
5175,
8,
284,
16164,
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... | 7 |
#[test]
fn test_arena_destructors_fail() {
let arena = Arena::new();
// Put some stuff in the arena.
for i in 0..10 {
// Arena allocate something with drop glue to make sure it
// doesn't leak.
arena.alloc(|| { Rc::new(i) });
// things interesting.
arena.alloc(|| { [0u8, 1, 2] });
}
arena.alloc::<Rc<i32>, _>(|| {
panic!();
});
} | rust_cleaned_test_functions.jsonl/44414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
30527,
2259,
91366,
22121,
368,
341,
262,
1077,
24902,
284,
27047,
486,
931,
543,
262,
442,
10224,
1045,
6259,
304,
279,
24902,
624,
262,
369,
600,
304,
220,
15,
496,
16,
15,
341,
286,
442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_package_differing_categories() {
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
let secp_ctx = Secp256k1::new();
let revk_outp = dumb_revk_output!(secp_ctx);
let counterparty_outp = dumb_counterparty_output!(secp_ctx, 0);
let mut revoked_package = PackageTemplate::build_package(txid, 0, revk_outp, 1000, true, 100);
let counterparty_package = PackageTemplate::build_package(txid, 1, counterparty_outp, 1000, true, 100);
revoked_package.merge_package(counterparty_package);
} | rust_cleaned_test_functions.jsonl/35569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26328,
814,
14320,
287,
27542,
368,
341,
197,
10217,
9854,
307,
284,
39850,
307,
486,
1499,
32655,
445,
66,
17,
67,
19,
19,
19,
24,
35834,
23,
67,
17,
21,
16,
19,
15,
23,
24,
23,
631,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_err_routing() {
let router = router_with_routes(&["/hello"]);
assert!(route(&router, Put, "/hello").is_none());
assert!(route(&router, Post, "/hello").is_none());
assert!(route(&router, Options, "/hello").is_none());
assert!(route(&router, Get, "/hell").is_none());
assert!(route(&router, Get, "/hi").is_none());
assert!(route(&router, Get, "/hello/there").is_none());
assert!(route(&router, Get, "/hello/i").is_none());
assert!(route(&router, Get, "/hillo").is_none());
let router = router_with_routes(&["/<a>"]);
assert!(route(&router, Put, "/hello").is_none());
assert!(route(&router, Post, "/hello").is_none());
assert!(route(&router, Options, "/hello").is_none());
assert!(route(&router, Get, "/hello/there").is_none());
assert!(route(&router, Get, "/hello/i").is_none());
let router = router_with_routes(&["/<a>/<b>"]);
assert!(route(&router, Get, "/a/b/c").is_none());
assert!(route(&router, Get, "/a").is_none());
assert!(route(&router, Get, "/a/").is_none());
assert!(route(&router, Get, "/a/b/c/d").is_none());
assert!(route(&router, Put, "/hello/hi").is_none());
assert!(route(&router, Put, "/a/b").is_none());
assert!(route(&router, Put, "/a/b").is_none());
let router = router_with_routes(&["/prefix/<a..>"]);
assert!(route(&router, Get, "/").is_none());
assert!(route(&router, Get, "/prefi/").is_none());
} | rust_cleaned_test_functions.jsonl/25747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
97710,
368,
341,
286,
1077,
9273,
284,
9273,
6615,
64314,
2099,
1183,
14,
14990,
15049,
286,
2060,
10297,
8966,
2099,
9937,
11,
10224,
11,
3521,
14990,
1827,
285,
31488,
1423,
286,
2060,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_type() {
let mut p = Path::default();
assert_eq!(p.fill_type(), PathFillType::Winding);
p.set_fill_type(PathFillType::EvenOdd);
assert_eq!(p.fill_type(), PathFillType::EvenOdd);
assert!(!p.is_inverse_fill_type());
p.toggle_inverse_fill_type();
assert_eq!(p.fill_type(), PathFillType::InverseEvenOdd);
assert!(p.is_inverse_fill_type());
} | rust_cleaned_test_functions.jsonl/55875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
1819,
368,
972,
262,
1077,
5206,
281,
284,
7933,
486,
2258,
1647,
262,
2060,
10714,
10297,
79,
12467,
1819,
1507,
7933,
14449,
929,
486,
54,
3961,
736,
262,
281,
980,
30728,
1819,
33030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_from_file() -> Result<(), Box<dyn Error>> {
let _context = quick_init();
let filename = CString::new("./resources/add.ptx")?;
let module = Module::load_from_file(&filename)?;
drop(module);
Ok(())
} | rust_cleaned_test_functions.jsonl/10 | {
"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,
12411,
5673,
2458,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
716,
2147,
284,
3974,
6137,
1428,
286,
1077,
3899,
284,
56956,
486,
931,
13988,
12745,
19627,
39326,
87,
899,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format_default_single_item_warn_service_alert() {
let mapping = Mapping {
name: "foobar".to_string(),
query: "up{random_label=\"random_value\"}".to_string(),
thresholds: ThresholdPair {
warning: Some(NagiosRange::from("@10").unwrap()),
critical: Some(NagiosRange::from("@10:20").unwrap()),
},
host: "foo".to_string(),
service: Some("bar".to_string()),
interval: Duration::from_secs(60),
last_apply: Instant::now(),
plugin_output: None,
performance_data: PerformanceData::default(),
};
let result =
"[WARNING] PromQL query returned one result within the warning range (5.00 in @0:10)"
.to_string();
assert_eq!(
format_default_single_item(&mapping, 5.0, 1, "WARNING".to_string()),
result
);
} | rust_cleaned_test_functions.jsonl/96132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
9993,
19487,
5634,
55045,
12267,
35717,
368,
341,
286,
1077,
12731,
284,
38446,
341,
310,
829,
25,
330,
50267,
3263,
983,
3904,
3148,
310,
3239,
25,
330,
454,
90,
11463,
6106,
4070,
11463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmac_verify_mac_with_invalid_input() {
let cipher = tink_mac::subtle::AesCmac::new(&get_random_bytes(16), 16).unwrap();
assert!(
cipher.verify_mac(&[], &[0x01]).is_err(),
"expect an error when mac is empty"
);
assert!(
cipher.verify_mac(&[0x01], &[]).is_err(),
"expect an error when data is empty"
);
assert!(cipher.verify_mac(&[], &[]).is_err());
} | rust_cleaned_test_functions.jsonl/77133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
11948,
35638,
22802,
6615,
31433,
5898,
368,
341,
262,
1077,
31088,
284,
90584,
22802,
486,
1966,
11239,
486,
32,
288,
34,
11948,
486,
931,
2099,
455,
22644,
12524,
7,
16,
21,
701,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_response_code() {
let mut url = String::from("http://localhost:8888/callback?code=AQD0yXvFEOvw&state=sN#_=_");
let spotify_oauth = SpotifyOAuth::default()
.state(&generate_random_string(16))
.scope("playlist-read-private playlist-read-collaborative playlist-modify-public playlist-modify-private streaming ugc-image-upload user-follow-modify user-follow-read user-library-read user-library-modify user-read-private user-read-birthdate user-read-email user-top-read user-read-playback-state user-modify-playback-state user-read-currently-playing user-read-recently-played")
.cache_path(PathBuf::from(".spotify_token_cache.json"))
.build();
match spotify_oauth.parse_response_code(&mut url) {
Some(code) => assert_eq!(code, "AQD0yXvFEOvw"),
None => panic!("failed"),
}
} | rust_cleaned_test_functions.jsonl/10103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9655,
4136,
368,
341,
286,
1077,
5206,
2515,
284,
923,
486,
1499,
445,
1254,
1110,
8301,
25,
23,
23,
23,
23,
91527,
30,
1851,
46623,
48,
35,
15,
88,
55,
85,
37,
6760,
34431,
5,
2454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_0137_example_1() {
let nums = vec![2, 2, 3, 2];
let result = 3;
assert_eq!(Solution::single_number(nums), result);
let nums = vec![2, 2, 3, 2];
let result = 3;
assert_eq!(Solution::single_number_v2(nums), result);
} | rust_cleaned_test_functions.jsonl/56050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
16,
18,
22,
39304,
62,
16,
368,
341,
286,
1077,
10307,
284,
7486,
20703,
17,
11,
220,
17,
11,
220,
18,
11,
220,
17,
935,
286,
1077,
1102,
284,
220,
18,
401,
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_config_macros() {
// Testing these macros outside of the config library.
let ffx: Ffx = Default::default();
assert_eq!(ffx, ffx_cmd!());
let env: Result<()> = ffx_env!();
assert!(env.is_err());
} | rust_cleaned_test_functions.jsonl/902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
85904,
368,
341,
286,
442,
26768,
1493,
37714,
4889,
315,
279,
2193,
6733,
624,
286,
1077,
282,
8298,
25,
434,
8298,
284,
7899,
486,
2258,
543,
286,
2060,
10714,
10297,
542,
87,
11,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_network_key_rotation() {
let num_nodes = 4;
let (mut env, op_tool, backend, storage) = launch_swarm_with_op_tool_and_backend(num_nodes, 0);
// Rotate the validator network key
let (txn_ctx, new_network_key) = op_tool
.rotate_validator_network_key(&backend, true)
.unwrap();
assert!(txn_ctx.execution_result.is_none());
// Ensure all nodes have received the transaction
wait_for_transaction_on_all_nodes(
&env,
num_nodes,
txn_ctx.address,
txn_ctx.sequence_number + 1,
);
// Verify that config has been loaded correctly with new key
let validator_account = storage.get::<AccountAddress>(OWNER_ACCOUNT).unwrap().value;
let config_network_key = op_tool
.validator_config(validator_account, &backend)
.unwrap()
.validator_network_address
.find_noise_proto()
.unwrap();
assert_eq!(new_network_key, config_network_key);
// Verify that the validator set info contains the new network key
let info_network_key = op_tool
.validator_set(Some(validator_account), &backend)
.unwrap()[0]
.validator_network_address
.find_noise_proto()
.unwrap();
assert_eq!(new_network_key, info_network_key);
// Restart validator
env.validator_swarm.kill_node(0);
env.validator_swarm.add_node(0).unwrap();
} | rust_cleaned_test_functions.jsonl/64967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
3097,
44813,
368,
341,
262,
1077,
1629,
14896,
284,
220,
19,
280,
262,
1077,
320,
6984,
6105,
11,
1179,
22785,
11,
19163,
11,
5819,
8,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_workflow() {
// Step 1: GET index
// - set-cookie will *not* be in response
// - adds new session state in redis: {"counter": 1}
// - updates session state in redis: {"counter": 2}
// - set-cookie actix-session will be in response with session cookie #2
// invalidation logic
let mut srv = TestServer::new(|| {
HttpService::new(
App::new()
.wrap(
RedisSession::new("127.0.0.1:6379", &[0; 32])
.cookie_name("test-session"),
)
.wrap(middleware::Logger::default())
.service(resource("/").route(get().to(index)))
.service(resource("/do_something").route(post().to(do_something)))
.service(resource("/login").route(post().to(login)))
.service(resource("/logout").route(post().to(logout))),
)
});
// Step 1: GET index
let req_1a = srv.get("/").send();
let mut resp_1 = srv.block_on(req_1a).unwrap();
let cookie_1 = resp_1
.cookies()
.unwrap()
.clone()
.into_iter()
.find(|c| c.name() == "test-session")
.unwrap();
let result_1 = block_on(resp_1.json::<IndexResponse>()).unwrap();
assert_eq!(
result_1,
IndexResponse {
user_id: None,
counter: 0
}
);
// - set-cookie will *not* be in response
let req_2 = srv.get("/").cookie(cookie_1.clone()).send();
let resp_2 = srv.block_on(req_2).unwrap();
let cookie_2 = resp_2
.cookies()
.unwrap()
.clone()
.into_iter()
.find(|c| c.name() == "test-session");
assert_eq!(cookie_2, None);
// - adds new session state in redis: {"counter": 1}
let req_3 = srv.post("/do_something").cookie(cookie_1.clone()).send();
let mut resp_3 = srv.block_on(req_3).unwrap();
let result_3 = block_on(resp_3.json::<IndexResponse>()).unwrap();
assert_eq!(
result_3,
IndexResponse {
user_id: None,
counter: 1
}
);
// - updates session state in redis: {"counter": 2}
let req_4 = srv.post("/do_something").cookie(cookie_1.clone()).send();
let mut resp_4 = srv.block_on(req_4).unwrap();
let result_4 = block_on(resp_4.json::<IndexResponse>()).unwrap();
assert_eq!(
result_4,
IndexResponse {
user_id: None,
counter: 2
}
);
let req_5 = srv
.post("/login")
.cookie(cookie_1.clone())
.send_json(&json!({"user_id": "ferris"}));
let mut resp_5 = srv.block_on(req_5).unwrap();
let cookie_2 = resp_5
.cookies()
.unwrap()
.clone()
.into_iter()
.find(|c| c.name() == "test-session")
.unwrap();
assert_eq!(
true,
cookie_1.value().to_string() != cookie_2.value().to_string()
);
let result_5 = block_on(resp_5.json::<IndexResponse>()).unwrap();
assert_eq!(
result_5,
IndexResponse {
user_id: Some("ferris".into()),
counter: 2
}
);
let req_6 = srv.get("/").cookie(cookie_2.clone()).send();
let mut resp_6 = srv.block_on(req_6).unwrap();
let result_6 = block_on(resp_6.json::<IndexResponse>()).unwrap();
assert_eq!(
result_6,
IndexResponse {
user_id: Some("ferris".into()),
counter: 2
}
);
let req_7 = srv.post("/do_something").cookie(cookie_2.clone()).send();
let mut resp_7 = srv.block_on(req_7).unwrap();
let result_7 = block_on(resp_7.json::<IndexResponse>()).unwrap();
assert_eq!(
result_7,
IndexResponse {
user_id: Some("ferris".into()),
counter: 3
}
);
let req_8 = srv.get("/").cookie(cookie_1.clone()).send();
let mut resp_8 = srv.block_on(req_8).unwrap();
let cookie_3 = resp_8
.cookies()
.unwrap()
.clone()
.into_iter()
.find(|c| c.name() == "test-session")
.unwrap();
let result_8 = block_on(resp_8.json::<IndexResponse>()).unwrap();
assert_eq!(
result_8,
IndexResponse {
user_id: None,
counter: 0
}
);
assert!(cookie_3.value().to_string() != cookie_2.value().to_string());
// - set-cookie actix-session will be in response with session cookie #2
// invalidation logic
let req_9 = srv.post("/logout").cookie(cookie_2.clone()).send();
let resp_9 = srv.block_on(req_9).unwrap();
let cookie_4 = resp_9
.cookies()
.unwrap()
.clone()
.into_iter()
.find(|c| c.name() == "test-session")
.unwrap();
assert!(&time::now().tm_year != &cookie_4.expires().map(|t| t.tm_year).unwrap());
let req_10 = srv.get("/").cookie(cookie_2.clone()).send();
let mut resp_10 = srv.block_on(req_10).unwrap();
let result_10 = block_on(resp_10.json::<IndexResponse>()).unwrap();
assert_eq!(
result_10,
IndexResponse {
user_id: None,
counter: 0
}
);
let cookie_5 = resp_10
.cookies()
.unwrap()
.clone()
.into_iter()
.find(|c| c.name() == "test-session")
.unwrap();
assert!(cookie_5.value().to_string() != cookie_2.value().to_string());
} | rust_cleaned_test_functions.jsonl/39124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86418,
368,
341,
286,
442,
14822,
220,
16,
25,
220,
7890,
1922,
8945,
16885,
286,
442,
256,
481,
738,
87239,
686,
353,
1921,
9,
387,
304,
2033,
79133,
286,
442,
256,
481,
11367,
501,
3797,
158... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extract_struct_carries_over_generics() {
check_assist(
extract_struct_from_enum_variant,
r"enum En<T> { Var { a: T$0 } }",
r#"struct Var<T>{ a: T }
enum En<T> { Var(Var<T>) }"#,
);
} | rust_cleaned_test_functions.jsonl/36293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
15126,
26616,
4019,
15431,
71963,
1211,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
435,
1,
9018,
2925,
3125,
29,
314,
8735,
314,
264,
25,
350,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compression() {
use std::vec::Vec;
let mut rng = rand::thread_rng();
for sz in [600_usize, 1024, 6000, 65000, 650000].iter() {
let cz: usize = LZ4_CompressInplaceBufferSize(*sz);
let mut orig: Vec<u8> = Vec::with_capacity(cz);
unsafe {
orig.set_len(cz);
rng.fill_bytes(&mut orig[..]);
let margin = cz - *sz;
//compress inplace
//maximum compressed size
let bz = LZ4_compressBound(*sz as c_int);
//destination compression bufer
let mut comp: Vec<u8> = Vec::with_capacity(bz as usize);
comp.set_len(bz as usize);
//normal compression
let code = LZ4_compress_default(
orig.as_ptr().add(margin) as *const c_char,
comp.as_mut_ptr() as *mut c_char,
(orig.len() - margin) as i32,
comp.len() as i32,
);
assert!(code >= 0);
assert_eq!(orig.len() - margin, *sz);
let compressed_sz = code as usize;
//compression inplace
let code = LZ4_compress_default(
orig.as_ptr().add(margin) as *const c_char,
orig.as_mut_ptr() as *mut c_char,
(orig.len() - margin) as i32,
orig.len() as i32,
);
assert!(code >= 0);
assert_eq!(&comp[0..compressed_sz], &orig[0..compressed_sz]);
}
}
assert_eq!(1, 1);
} | rust_cleaned_test_functions.jsonl/34955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 987
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
4011,
368,
341,
286,
990,
1460,
486,
4083,
486,
10050,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
1428,
286,
369,
10038,
304,
508,
21,
15,
15,
11306,
551,
11,
220,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_account_update() {
let create = AccountUpdate::Create {
address: Address::default(),
nonce: Nonce(1),
};
let bal_update = AccountUpdate::UpdateBalance {
old_nonce: Nonce(1),
new_nonce: Nonce(2),
balance_update: (TokenId(0), 0u32.into(), 5u32.into()),
};
let delete = AccountUpdate::Delete {
address: Address::default(),
nonce: Nonce(2),
};
{
{
let created_account = Account {
nonce: Nonce(1),
..Default::default()
};
assert_eq!(
Account::apply_update(None, create.clone())
.unwrap()
.get_bits_le(),
created_account.get_bits_le()
);
}
assert!(Account::apply_update(None, bal_update.clone()).is_none());
assert!(Account::apply_update(None, delete.clone()).is_none());
}
{
assert_eq!(
Account::apply_update(Some(Account::default()), create)
.unwrap()
.get_bits_le(),
Account::default().get_bits_le()
);
{
let mut updated_account = Account {
nonce: Nonce(2),
..Default::default()
};
updated_account.set_balance(TokenId(0), 5u32.into());
assert_eq!(
Account::apply_update(Some(Account::default()), bal_update)
.unwrap()
.get_bits_le(),
updated_account.get_bits_le()
);
}
assert!(Account::apply_update(Some(Account::default()), delete).is_none());
}
} | rust_cleaned_test_functions.jsonl/52687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
8882,
368,
341,
286,
1077,
1855,
284,
8615,
4289,
486,
4021,
341,
310,
2621,
25,
9177,
486,
2258,
3148,
310,
39676,
25,
11581,
346,
7,
16,
1326,
286,
3634,
286,
1077,
9642,
8882,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_untagged_enum_with_flattened_integer_key() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Untagged {
Variant {
#[serde(flatten)]
map: BTreeMap<u64, String>,
},
}
assert_tokens(
&Untagged::Variant {
map: {
let mut map = BTreeMap::new();
map.insert(100, "BTreeMap".to_owned());
map
},
},
&[
Token::Map { len: None },
Token::U64(100),
Token::Str("BTreeMap"),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56446 | {
"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,
62,
3850,
96476,
31054,
6615,
5081,
1587,
6758,
31725,
3097,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
11506,
47024,
7,
3850,
96476,
5563,
262,
6675,
7618,
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_invalid_flex_params() {
use float_cmp::approx_eq;
let params = FlexParams::new(0.0, None);
approx_eq!(f64, params.flex, 1.0, ulps = 2);
let params = FlexParams::new(-0.0, None);
approx_eq!(f64, params.flex, 1.0, ulps = 2);
let params = FlexParams::new(-1.0, None);
approx_eq!(f64, params.flex, 1.0, ulps = 2);
} | rust_cleaned_test_functions.jsonl/134389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
761,
2571,
6745,
368,
341,
286,
990,
2224,
35193,
486,
48053,
10714,
280,
286,
1077,
3628,
284,
26141,
4870,
486,
931,
7,
15,
13,
15,
11,
2240,
317,
286,
9848,
10714,
10297,
69,
21,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_score_points() {
let dir = TempDir::new("storage_dir").unwrap();
let distance = Distance::Dot;
let dim = 4;
let storage = open_simple_vector_storage(dir.path(), dim, distance).unwrap();
let mut borrowed_storage = storage.borrow_mut();
let vec0 = vec![1.0, 0.0, 1.0, 1.0];
let vec1 = vec![1.0, 0.0, 1.0, 0.0];
let vec2 = vec![1.0, 1.0, 1.0, 1.0];
let vec3 = vec![1.0, 1.0, 0.0, 1.0];
let vec4 = vec![1.0, 0.0, 0.0, 0.0];
let _id1 = borrowed_storage.put_vector(vec0.clone()).unwrap();
let id2 = borrowed_storage.put_vector(vec1.clone()).unwrap();
let _id3 = borrowed_storage.put_vector(vec2.clone()).unwrap();
let _id4 = borrowed_storage.put_vector(vec3.clone()).unwrap();
let id5 = borrowed_storage.put_vector(vec4.clone()).unwrap();
assert_eq!(id2, 1);
assert_eq!(id5, 4);
let query = vec![0.0, 1.0, 1.1, 1.0];
let closest =
borrowed_storage.score_points(&query, &mut [0, 1, 2, 3, 4].iter().cloned(), 2);
let top_idx = match closest.get(0) {
Some(scored_point) => {
assert_eq!(scored_point.idx, 2);
scored_point.idx
}
None => {
panic!("No close vector found!")
}
};
borrowed_storage.delete(top_idx).unwrap();
let closest =
borrowed_storage.score_points(&query, &mut [0, 1, 2, 3, 4].iter().cloned(), 2);
let raw_scorer = borrowed_storage.raw_scorer(query.clone());
let query_points = vec![0, 1, 2, 3, 4];
let mut query_points1 = query_points.iter().cloned();
let mut query_points2 = query_points.iter().cloned();
let raw_res1 = raw_scorer.score_points(&mut query_points1).collect_vec();
let raw_res2 = raw_scorer.score_points(&mut query_points2).collect_vec();
assert_eq!(raw_res1, raw_res2);
let _top_idx = match closest.get(0) {
Some(scored_point) => {
assert_ne!(scored_point.idx, 2);
assert_eq!(&raw_res1[scored_point.idx as usize], scored_point);
}
None => {
panic!("No close vector found!")
}
};
let all_ids1: Vec<_> = borrowed_storage.iter_ids().collect();
let all_ids2: Vec<_> = borrowed_storage.iter_ids().collect();
assert_eq!(all_ids1, all_ids2);
assert!(!all_ids1.contains(&top_idx))
} | rust_cleaned_test_functions.jsonl/71248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10405,
12928,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
16172,
4334,
1827,
15454,
543,
286,
1077,
6010,
284,
31135,
486,
34207,
280,
286,
1077,
5103,
284,
220,
19,
280,
286,
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... | 3 |
#[test]
fn test_add_time_uninterrupted() {
let mut counter = LostBssCounter::start(TEST_BEACON_PERIOD, TEST_TIMEOUT_BCN_COUNT);
// about to timeout but not yet.
counter.add_time(
zx::Duration::from(TimeUnit(TEST_BEACON_PERIOD)) * TEST_TIMEOUT_BCN_COUNT - 1.nanos(),
);
assert!(!counter.should_deauthenticate());
// any more time will trigger auto deauth
counter.add_time(1.nanos());
assert!(counter.should_deauthenticate());
} | rust_cleaned_test_functions.jsonl/51462 | {
"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,
2891,
3009,
4907,
54805,
291,
368,
341,
286,
1077,
5206,
5546,
284,
27252,
33,
778,
14099,
486,
2468,
50320,
27168,
1706,
711,
43166,
11,
13602,
23412,
1668,
28668,
14672,
317,
286,
442,
911,
311,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_range_panic_int() {
#![allow(clippy::reversed_empty_ranges)]
let mut r = rng(102);
r.gen_range(5..-2);
} | rust_cleaned_test_functions.jsonl/10499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
9698,
620,
31270,
4042,
368,
341,
286,
671,
20703,
7183,
9849,
45749,
486,
265,
43776,
15124,
58748,
5563,
286,
1077,
5206,
435,
284,
28422,
7,
16,
15,
17,
317,
286,
435,
22822,
9698,
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 |
#[test]
fn test_symbol() {
assert_eq!(
apply(
r#"
>>
"#
.trim()
),
Ok(vec![
Token::Symbol(span(1, 1, ">")),
Token::Symbol(span(1, 2, ">"))
])
)
} | rust_cleaned_test_functions.jsonl/27576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21179,
368,
341,
286,
2060,
10714,
33673,
310,
3796,
1006,
394,
435,
2,
698,
39071,
1,
4956,
503,
659,
10666,
741,
310,
2837,
310,
7622,
25592,
90515,
394,
9660,
486,
15090,
66092,
7,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str() {
let format = "csv".parse::<PrintFormat>().unwrap();
assert_eq!(PrintFormat::Csv, format);
let format = "tsv".parse::<PrintFormat>().unwrap();
assert_eq!(PrintFormat::Tsv, format);
let format = "json".parse::<PrintFormat>().unwrap();
assert_eq!(PrintFormat::Json, format);
let format = "ndjson".parse::<PrintFormat>().unwrap();
assert_eq!(PrintFormat::NdJson, format);
let format = "table".parse::<PrintFormat>().unwrap();
assert_eq!(PrintFormat::Table, format);
} | rust_cleaned_test_functions.jsonl/13594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
286,
1077,
3561,
284,
330,
18104,
3263,
6400,
27638,
8994,
4061,
10483,
15454,
543,
286,
2060,
10714,
10297,
8994,
4061,
486,
94826,
11,
3561,
626,
286,
1077,
3561,
284,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_php() {
test_long_term_php_script_with_condition(
env!("CARGO_BIN_EXE_http-server"),
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("php")
.join("test.php"),
|_| {
// wait for server startup.
sleep(Duration::from_secs(3));
runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap()
.block_on(async {
let client = Client::new();
let response = client.get("http://127.0.0.1:9000/").send().await.unwrap();
let content_type = response.headers().get(CONTENT_TYPE).unwrap();
assert_eq!(content_type, "text/plain");
let body = response.text().await.unwrap();
assert_eq!(body, "Hello World\n");
});
},
);
} | rust_cleaned_test_functions.jsonl/38846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78547,
368,
341,
262,
1273,
17799,
17464,
78547,
14660,
6615,
27656,
1006,
286,
6105,
17223,
34,
7581,
46,
55720,
4966,
36,
25888,
26300,
4461,
286,
7933,
486,
931,
16978,
17223,
34,
7581,
46,
251... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_difference() {
fn check_difference(a: &[i32], b: &[i32], expected: &[i32]) {
check(a, b, expected, |x, y, f| x.difference(y).all(f))
}
check_difference(&[], &[], &[]);
check_difference(&[1, 12], &[], &[1, 12]);
check_difference(&[], &[1, 2, 3, 9], &[]);
check_difference(&[1, 3, 5, 9, 11], &[3, 9], &[1, 5, 11]);
check_difference(&[1, 3, 5, 9, 11], &[3, 6, 9], &[1, 5, 11]);
check_difference(&[1, 3, 5, 9, 11], &[0, 1], &[3, 5, 9, 11]);
check_difference(&[1, 3, 5, 9, 11], &[11, 12], &[1, 3, 5, 9]);
check_difference(
&[-5, 11, 22, 33, 40, 42],
&[-12, -5, 14, 23, 34, 38, 39, 50],
&[11, 22, 33, 40, 42],
);
if cfg!(miri) {
// Miri is too slow
return;
}
let large = (0..100).collect::<Vec<_>>();
check_difference(&[], &large, &[]);
check_difference(&[-1], &large, &[-1]);
check_difference(&[0], &large, &[]);
check_difference(&[99], &large, &[]);
check_difference(&[100], &large, &[100]);
check_difference(&[11, 5000, 1, 3, 77, 8924], &large, &[5000, 8924]);
check_difference(&large, &[], &large);
check_difference(&large, &[-1], &large);
check_difference(&large, &[100], &large);
} | rust_cleaned_test_functions.jsonl/12206 | {
"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,
47525,
368,
341,
262,
5168,
1779,
47525,
2877,
25,
44590,
72,
18,
17,
1125,
293,
25,
44590,
72,
18,
17,
1125,
3601,
25,
44590,
72,
18,
17,
2467,
341,
286,
1779,
2877,
11,
293,
11,
3601,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_dataset() {
let input = input_from(&[
(1, vec!['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T']),
(2, vec!['D', 'G']),
(3, vec!['B', 'C', 'M', 'P']),
(4, vec!['F', 'H', 'V', 'W', 'Y']),
(5, vec!['K']),
(8, vec!['J', 'X']),
(10, vec!['Q', 'Z']),
]);
let expected = expected_from(&[
('a', 1),
('b', 3),
('c', 3),
('d', 2),
('e', 1),
('f', 4),
('g', 2),
('h', 4),
('i', 1),
('j', 8),
('k', 5),
('l', 1),
('m', 3),
('n', 1),
('o', 1),
('p', 3),
('q', 10),
('r', 1),
('s', 1),
('t', 1),
('u', 1),
('v', 4),
('w', 4),
('x', 8),
('y', 4),
('z', 10),
]);
assert_eq!(expected, etl::transform(&input));
} | rust_cleaned_test_functions.jsonl/19633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 591
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
18999,
368,
341,
262,
1077,
1946,
284,
1946,
5673,
2099,
9640,
286,
320,
16,
11,
7486,
0,
677,
32,
516,
364,
36,
516,
364,
40,
516,
364,
46,
516,
364,
52,
516,
364,
43,
516,
364,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_proto_metrics() {
let mut writer = Vec::<u8>::new();
let pb_encoder = ProtobufEncoder::new();
let cv = CounterVec::new(
Opts::new("test_counter_vec", "help information"),
&["labelname"],
)
.unwrap();
// Empty metrics
let mfs = cv.collect();
check_metric_family(&mfs[0]).unwrap_err();
pb_encoder.encode(&mfs, &mut writer).unwrap_err();
assert_eq!(writer.len(), 0);
// Add a sub metric
cv.with_label_values(&["foo"]).inc();
let mut mfs = cv.collect();
// Empty name
(&mut mfs[0]).clear_name();
check_metric_family(&mfs[0]).unwrap_err();
pb_encoder.encode(&mfs, &mut writer).unwrap_err();
assert_eq!(writer.len(), 0);
} | rust_cleaned_test_functions.jsonl/134260 | {
"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,
34199,
37689,
37686,
368,
341,
286,
1077,
5206,
6916,
284,
11312,
27638,
84,
23,
6831,
931,
543,
286,
1077,
17310,
39068,
284,
11708,
18464,
19921,
486,
931,
543,
286,
1077,
5544,
284,
19735,
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... | 1 |
#[test]
fn test_children_preduction() {
const NUM_BITS: usize = 32;
let problem = ProblemSubsetSum::random(NUM_BITS); // a lot smaller
assert!(problem.is_legal());
let mut solver = DepthFirstSolver::<MinimalSolution>::new(NUM_BITS);
solver.push(problem.starting_solution());
assert!(!solver.is_empty());
let root = solver.pop().expect("Solver should let us pop SOMETHING #1");
assert!(solver.is_empty());
assert!(problem.solution_is_legal(&root));
assert!(!problem.solution_is_complete(&root));
let children = problem.children_of_solution(&root);
assert!(!children.is_empty());
assert!(children.len() <= 2);
for child in children {
assert!(problem.solution_is_legal(&child));
if !problem.solution_is_complete(&child) {
solver.push(child);
}
}
assert!(!solver.is_empty());
assert!(solver.number_of_solutions() <= 2);
let grandchild = solver.pop().expect("Solver should let us pop SOMETHING #2");
assert!(!solver.is_empty());
assert!(solver.number_of_solutions() <= 1);
assert!(problem.solution_is_legal(&grandchild));
assert!(!problem.solution_is_complete(&grandchild));
assert!(problem.is_legal());
} | rust_cleaned_test_functions.jsonl/13343 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 622
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31206,
10442,
23113,
368,
341,
286,
733,
15943,
32695,
25,
22301,
284,
220,
18,
17,
26,
4710,
1789,
286,
1077,
3491,
284,
22079,
70584,
9190,
486,
11463,
78928,
32695,
1215,
442,
264,
2696,
9155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_classify() {
let nan: f64 = NAN;
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
let zero: f64 = 0.0f64;
let neg_zero: f64 = -0.0;
assert_eq!(nan.classify(), Fp::Nan);
assert_eq!(inf.classify(), Fp::Infinite);
assert_eq!(neg_inf.classify(), Fp::Infinite);
assert_eq!(zero.classify(), Fp::Zero);
assert_eq!(neg_zero.classify(), Fp::Zero);
assert_eq!(1e-307f64.classify(), Fp::Normal);
assert_eq!(1e-308f64.classify(), Fp::Subnormal);
} | rust_cleaned_test_functions.jsonl/7824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
1437,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
92129,
280,
286,
1077,
4132,
25,
282,
21,
19,
284,
1964,
55990,
280,
286,
1077,
4184,
26051,
25,
282,
21,
19,
284,
84065,
91110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filename_error() {
let mut reader = Reader::init("???");
let error = parse(&mut reader).err().unwrap();
assert_eq!(error.inner, ParseError::Filename {});
assert_eq!(error.pos, Pos { line: 1, column: 1 });
// can not absolute
let mut reader = Reader::init("/tmp/data.bin");
let error = parse(&mut reader).err().unwrap();
assert_eq!(error.inner, ParseError::Filename {});
assert_eq!(error.pos, Pos { line: 1, column: 1 });
} | rust_cleaned_test_functions.jsonl/88740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13323,
4096,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
33015,
797,
286,
1077,
1465,
284,
4715,
2099,
6984,
6604,
568,
615,
1005,
15454,
543,
286,
2060,
10714,
10297,
841,
9398,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_helper() {
let source = "hello{{{{raw}}}}good{{night}}{{{{/raw}}}}world";
match Template::compile(source.to_owned()) {
Ok(t) => {
assert_eq!(t.elements.len(), 3);
assert_eq!(t.elements[0], RawString("hello".to_owned()));
assert_eq!(t.elements[2], RawString("world".to_owned()));
match t.elements[1] {
HelperBlock(ref h) => {
assert_eq!(h.name.as_name().unwrap(), "raw".to_owned());
if let Some(ref ht) = h.template {
assert_eq!(ht.elements.len(), 1);
assert_eq!(
*ht.elements.get(0).unwrap(),
RawString("good{{night}}".to_owned())
);
} else {
panic!("helper template not found");
}
}
_ => {
panic!("Unexpected element type");
}
}
}
Err(e) => {
panic!("{}", e);
}
}
} | rust_cleaned_test_functions.jsonl/12006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 696
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
10418,
368,
341,
262,
1077,
2530,
284,
330,
14990,
2979,
2979,
1041,
3417,
3417,
18536,
2979,
9287,
77286,
2979,
14,
1041,
3417,
3417,
14615,
876,
262,
2432,
14355,
486,
20433,
12437,
2389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_override_with_missing_throws() {
err(
"open class A { open fun f() throws {} }
class B: A { override fun f() {} }",
pos(2, 36),
Msg::ThrowsDifference("f".into()),
);
} | rust_cleaned_test_functions.jsonl/75952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48576,
6615,
40447,
5854,
1811,
368,
341,
286,
1848,
1006,
310,
330,
2508,
536,
362,
314,
1787,
2464,
282,
368,
3787,
4687,
456,
1797,
536,
425,
25,
362,
314,
2812,
2464,
282,
368,
4687,
335,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_distance_vector() {
let mut rng = thread_rng();
let n = 10;
let degree = 5;
let mut tries = 0;
loop {
let mut graph = random_graph(n, degree, &mut rng);
if distance_vector(&mut graph).is_some() {
check_distance(&graph, degree);
break;
}
tries += 1;
assert!(tries < 10);
}
} | rust_cleaned_test_functions.jsonl/38911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19464,
12247,
368,
341,
286,
1077,
5206,
28422,
284,
4516,
66849,
543,
286,
1077,
308,
284,
220,
16,
15,
280,
286,
1077,
8381,
284,
220,
20,
280,
286,
1077,
5206,
16297,
284,
220,
15,
280,
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... | 2 |
#[test]
fn test_duration_as_string() {
test_none_with_ctx_and_extra(cast_any_as_string::<Duration>);
let mut ctx = EvalContext::default();
let cs = vec![
(
Duration::parse(&mut ctx, "17:51:04.78", 2).unwrap(),
"17:51:04.78".to_string().into_bytes(),
"17:51:04.78".to_string(),
),
(
Duration::parse(&mut ctx, "-17:51:04.78", 2).unwrap(),
"-17:51:04.78".to_string().into_bytes(),
"-17:51:04.78".to_string(),
),
(
Duration::parse(&mut ctx, "17:51:04.78", 0).unwrap(),
"17:51:05".to_string().into_bytes(),
"17:51:05".to_string(),
),
(
Duration::parse(&mut ctx, "-17:51:04.78", 0).unwrap(),
"-17:51:05".to_string().into_bytes(),
"-17:51:05".to_string(),
),
];
let ref_cs = helper_get_cs_ref(&cs);
test_as_string_helper(
ref_cs,
cast_any_as_string::<Duration>,
"cast_any_as_string::<Duration>",
);
} | rust_cleaned_test_functions.jsonl/1976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 708
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
11898,
3904,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
37248,
11898,
3904,
27638,
12945,
42013,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
1053... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_secchan_offset_to_cbw() {
assert_eq!(
fidl_common::Cbw::Cbw20,
convert_secchan_offset_to_cbw(SecChanOffset::SECONDARY_NONE)
);
assert_eq!(
fidl_common::Cbw::Cbw40,
convert_secchan_offset_to_cbw(SecChanOffset::SECONDARY_ABOVE)
);
assert_eq!(
fidl_common::Cbw::Cbw40Below,
convert_secchan_offset_to_cbw(SecChanOffset::SECONDARY_BELOW)
);
} | rust_cleaned_test_functions.jsonl/12084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
17242,
5658,
6917,
2346,
16450,
86,
368,
341,
286,
2060,
10714,
33673,
310,
32104,
75,
21107,
486,
34,
39824,
486,
34,
39824,
17,
15,
345,
310,
5508,
17242,
5658,
6917,
2346,
16450,
86,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mode() {
test_case(1.0, 0.1, 0.0, |x| x.mode());
test_case(1.0, 1.0, 0.0, |x| x.mode());
test_case(10.0, 10.0, 9.8951925820621439264623017041980483215553841533709, |x| x.mode());
test_case(10.0, 1.0, 0.98951925820621439264623017041980483215553841533709, |x| x.mode());
} | rust_cleaned_test_functions.jsonl/84309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7302,
368,
341,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
15,
13,
16,
11,
220,
15,
13,
15,
11,
760,
87,
91,
856,
22981,
1423,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
16,
13,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_methods() {
check_assist(
add_missing_default_members,
r#"
trait Foo {
type Output;
const CONST: usize = 42;
fn valid(some: u32) -> bool { false }
fn foo(some: u32) -> bool;
}
struct S;
impl Foo for S { <|> }"#,
r#"
trait Foo {
type Output;
const CONST: usize = 42;
fn valid(some: u32) -> bool { false }
fn foo(some: u32) -> bool;
}
struct S;
impl Foo for S {
$0fn valid(some: u32) -> bool { false }
}"#,
)
} | rust_cleaned_test_functions.jsonl/110453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
36084,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
9993,
30397,
345,
310,
435,
2,
698,
29432,
33428,
341,
262,
943,
9258,
401,
262,
733,
29602,
25,
22301,
284,
220,
19,
17,
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_cmd_arg_bad_nesting_brace_open() {
cmd()
.write_stdin("$ cmd arg={{one} two three")
.assert()
.failure()
.stderr(
r#"<stdin>:1:26: error: command argument has unterminated open brace
|
1 | $ cmd arg={{one} two three
| ^
"#,
);
} | rust_cleaned_test_functions.jsonl/120317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
6057,
34199,
1089,
59855,
17682,
578,
11311,
368,
341,
262,
5439,
741,
286,
659,
4934,
15656,
258,
20912,
5439,
1392,
6780,
603,
92,
1378,
2326,
1138,
286,
659,
2207,
741,
286,
659,
28939,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
let mut cv = malloc(16);
*cv.get_mut(3).unwrap() = 8;
*cv.get_mut(4).unwrap() = 9;
assert_eq!(*cv.get(3).unwrap(), 8);
assert_eq!(*cv.get(4).unwrap(), 9);
assert_eq!(cv.len(), 16);
} | rust_cleaned_test_functions.jsonl/41011 | {
"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,
34729,
368,
341,
286,
1077,
5206,
5544,
284,
15731,
7,
16,
21,
626,
286,
353,
13122,
670,
29523,
7,
18,
568,
15454,
368,
284,
220,
23,
280,
286,
353,
13122,
670,
29523,
7,
19,
568,
15454,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_world_symbols_are_case_sensitive() {
let code = r#"
fn foo() {}
struct Foo;
"#;
let symbols = get_symbols_matching(code, "Foo");
let fn_match = symbols.iter().find(|s| s.name() == "foo").map(|s| s.kind());
let struct_match = symbols.iter().find(|s| s.name() == "Foo").map(|s| s.kind());
assert_eq!(fn_match, Some(FN_DEF));
assert_eq!(struct_match, Some(STRUCT_DEF));
} | rust_cleaned_test_functions.jsonl/49930 | {
"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,
31792,
55752,
56855,
19096,
65324,
368,
341,
286,
1077,
2038,
284,
435,
2,
698,
8822,
15229,
368,
10086,
1235,
33428,
280,
286,
5869,
401,
286,
1077,
17738,
284,
633,
55752,
70763,
15842,
11,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator() {
let (mut record, journal) = create_test_journal();
let mut iter = journal.iter();
assert_eq!(
record.set_rdata(RData::A(Ipv4Addr::from_str("127.0.0.1").unwrap())),
&iter.next().unwrap()
);
assert_eq!(
record.set_rdata(RData::A(Ipv4Addr::from_str("127.0.1.1").unwrap())),
&iter.next().unwrap()
);
assert_eq!(None, iter.next());
} | rust_cleaned_test_functions.jsonl/66414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
368,
341,
262,
1077,
320,
6984,
3255,
11,
8322,
8,
284,
1855,
4452,
85075,
1428,
262,
1077,
5206,
5367,
284,
8322,
19471,
1428,
262,
2060,
10714,
33673,
286,
3255,
980,
1710,
691,
2785,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_switch_implies_cfg_test() {
let matches =
&match getopts(["--test".to_string()], optgroups().as_slice()) {
Ok(m) => m,
Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg())
};
let sessopts = build_session_options(matches);
let sess = build_session(sessopts, None);
let cfg = build_configuration(&sess);
assert!((attr::contains_name(cfg.as_slice(), "test")));
} | rust_cleaned_test_functions.jsonl/127230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21007,
550,
18343,
4452,
368,
341,
286,
1077,
9071,
4035,
310,
609,
6347,
633,
10518,
19065,
313,
1944,
3263,
983,
3904,
79558,
3387,
16753,
1005,
300,
26488,
2140,
341,
1060,
7622,
1255,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_append_refcnt() {
Python::with_gil(|py| {
let cnt;
{
let _pool = unsafe { crate::GILPool::new() };
let list = PyList::empty(py);
let none = py.None();
cnt = none.get_refcnt(py);
list.append(none).unwrap();
}
assert_eq!(cnt, py.None().get_refcnt(py));
});
} | rust_cleaned_test_functions.jsonl/108627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7793,
15853,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
13195,
280,
310,
341,
394,
1077,
716,
10285,
284,
19860,
314,
17717,
486,
38,
1715,
10551,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_with_config() {
init!("ledger");
wallet::close_wallet().unwrap();
pool::close().unwrap();
let content = create_config_util(None);
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
// Assert pool was initialized
assert_ne!(get_pool_handle().unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/127527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
6615,
5332,
368,
341,
286,
2930,
17223,
50704,
797,
286,
15085,
486,
5552,
62308,
1005,
15454,
543,
286,
7314,
486,
5552,
1005,
15454,
1428,
286,
1077,
2213,
284,
1855,
5332,
18974,
26717,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union() {
fn check_union(a: &[int], b: &[int],
expected: &[int]) {
check(a, b, expected, |x, y, f| x.union(y).all(f))
}
check_union([], [], []);
check_union([1, 2, 3], [2], [1, 2, 3]);
check_union([2], [1, 2, 3], [1, 2, 3]);
check_union([1, 3, 5, 9, 11, 16, 19, 24],
[-2, 1, 5, 9, 13, 19],
[-2, 1, 3, 5, 9, 11, 13, 16, 19, 24]);
} | rust_cleaned_test_functions.jsonl/66383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
368,
341,
286,
5168,
1779,
51621,
2877,
25,
44590,
396,
1125,
293,
25,
44590,
396,
1259,
8333,
3601,
25,
44590,
396,
2467,
341,
310,
1779,
2877,
11,
293,
11,
3601,
11,
760,
87,
11,
379,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_headline_level() {
assert_eq!(0, headline_level(b"", 0));
assert_eq!(0, headline_level(b" ", 0));
assert_eq!(0, headline_level(b"*", 0));
assert_eq!(0, headline_level(b"a", 0));
assert_eq!(0, headline_level(b" ", 0));
assert_eq!(1, headline_level(b"* ", 0));
assert_eq!(0, headline_level(b"a ", 0));
assert_eq!(0, headline_level(b" *", 0));
assert_eq!(0, headline_level(b"**", 0));
assert_eq!(0, headline_level(b"a*", 0));
assert_eq!(0, headline_level(b" a", 0));
assert_eq!(0, headline_level(b"*a", 0));
assert_eq!(0, headline_level(b"aa", 0));
assert_eq!(0, headline_level(b" ", 0));
assert_eq!(1, headline_level(b"* ", 0));
assert_eq!(0, headline_level(b"a ", 0));
assert_eq!(0, headline_level(b" * ", 0));
assert_eq!(2, headline_level(b"** ", 0));
assert_eq!(0, headline_level(b"a* ", 0));
assert_eq!(0, headline_level(b" a ", 0));
assert_eq!(0, headline_level(b"*a ", 0));
assert_eq!(0, headline_level(b"aa ", 0));
assert_eq!(0, headline_level(b" *", 0));
assert_eq!(1, headline_level(b"* *", 0));
assert_eq!(0, headline_level(b"a *", 0));
assert_eq!(0, headline_level(b" **", 0));
assert_eq!(0, headline_level(b"***", 0));
assert_eq!(0, headline_level(b"a**", 0));
assert_eq!(0, headline_level(b" a*", 0));
assert_eq!(0, headline_level(b"*a*", 0));
assert_eq!(0, headline_level(b"aa*", 0));
assert_eq!(0, headline_level(b" a", 0));
assert_eq!(1, headline_level(b"* a", 0));
assert_eq!(0, headline_level(b"a a", 0));
assert_eq!(0, headline_level(b" *a", 0));
assert_eq!(0, headline_level(b"**a", 0));
assert_eq!(0, headline_level(b"a*a", 0));
assert_eq!(0, headline_level(b" aa", 0));
assert_eq!(0, headline_level(b"*aa", 0));
assert_eq!(0, headline_level(b"aaa", 0));
assert_eq!(0, headline_level(b"***", 0));
assert_eq!(3, headline_level(b"*** ", 0));
assert_eq!(3, headline_level(b"*** ", 0));
assert_eq!(0, headline_level(b"***a", 0));
assert_eq!(3, headline_level(b"*** a", 0));
assert_eq!(3, headline_level(b"*** aaaaa", 0));
} | rust_cleaned_test_functions.jsonl/129958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13138,
1056,
8274,
368,
341,
286,
2060,
10714,
10297,
15,
11,
31163,
8274,
1883,
56323,
220,
15,
3237,
286,
2060,
10714,
10297,
15,
11,
31163,
8274,
1883,
1,
3670,
220,
15,
1106,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unlock_challenge() -> Result<()> {
let mut buffer = Vec::with_capacity(52);
let mut i = 0;
while i < 4 {
buffer.push(i);
i += 1;
}
LittleEndian::write_u32(&mut buffer[..4], 1);
let product_id_hash: [u8; PRODUCT_ID_HASH_SIZE] = [1; PRODUCT_ID_HASH_SIZE];
let challenge: [u8; CHALLENGE_DATA_SIZE] = [0; CHALLENGE_DATA_SIZE];
product_id_hash.iter().for_each(|b| buffer.push(*b));
challenge.iter().for_each(|b| buffer.push(*b));
let unlock_challenge = UnlockChallenge::new(&buffer.to_vec());
assert_eq!(unlock_challenge.version, 1);
assert_eq!(unlock_challenge.product_id_hash, product_id_hash);
assert_eq!(unlock_challenge.challenge_data, challenge);
Ok(())
} | rust_cleaned_test_functions.jsonl/44720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19465,
87406,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
4147,
284,
11312,
486,
4197,
35603,
7,
20,
17,
317,
286,
1077,
5206,
600,
284,
220,
15,
280,
286,
1393,
600,
366,
220,
19,
341,
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... | 2 |
#[test]
fn test_basic() {
let addr = "10.0.0.2:1234".parse().unwrap();
let f = Client::connect(&addr).and_then(|client| {
client
.push("test", "test", 100)
.and_then(move |_| client.list())
});
match execute(f) {
Ok(x) => assert_eq!(x, vec!["test"]),
Err(e) => panic!(e),
}
} | rust_cleaned_test_functions.jsonl/100203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
262,
1077,
10789,
284,
330,
16,
15,
13,
15,
13,
15,
13,
17,
25,
16,
17,
18,
19,
3263,
6400,
1005,
15454,
543,
262,
1077,
282,
284,
8423,
486,
6459,
2099,
6214,
568,
437,
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... | 2 |
#[test]
fn test_parse_pass() {
let tt = vec![
("FBFBBFFRLR", 44, 5, 357),
("BFFFBBFRRR", 70, 7, 567),
("FFFBBBFRRR", 14, 7, 119),
("BBFFBBFRLL", 102, 4, 820),
];
for (pass, row, seat, id) in tt {
let (got_row, got_col, got_id) = parse_pass(pass);
assert_eq!(row, got_row);
assert_eq!(seat, got_col);
assert_eq!(id, got_id);
}
} | rust_cleaned_test_functions.jsonl/105299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15464,
368,
341,
286,
1077,
17853,
284,
7486,
90515,
310,
3489,
16208,
37,
10098,
1748,
4728,
49,
497,
220,
19,
19,
11,
220,
20,
11,
220,
18,
20,
22,
1326,
310,
3489,
33,
31203,
10098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_split_nested() {
let a = ByteArray::from_slice_unnamed(b"A");
let b = ByteArray::from_slice_unnamed(b"B");
let inner = a.concat(b);
let inner_hash = sha2::Sha256::digest(&inner.data);
let inner_hashed = inner.apply_function(inner_hash.as_ref(), Function::Sha256);
let c = ByteArray::from_slice_unnamed(b"C");
let d = ByteArray::from_slice_unnamed(b"D");
let outer = c.concat(inner_hashed.clone()).concat(d);
{
let (left, right) = outer.clone().split(1).unwrap();
let left_preimage = left.preimage.as_ref().expect("No preimage");
let right_preimage = right.preimage.as_ref().expect("No preimage");
assert_eq!(left.function, Function::Plain);
assert_eq!(left.data.as_ref(), b"C");
assert_eq!(left_preimage.len(), 1);
assert_eq!(left_preimage[0].data.as_ref(), b"C");
assert_eq!(left_preimage[0].preimage, None);
assert_eq!(right.function, Function::Plain);
assert_eq!(
right.data.as_ref(),
[inner_hash.as_slice(), b"D"].concat().as_slice()
);
assert_eq!(right_preimage.len(), 2);
assert_eq!(right_preimage[0].function, Function::Sha256);
assert_eq!(right_preimage[0].data.as_ref(), inner_hash.as_slice());
assert_eq!(right_preimage[1].function, Function::Plain);
assert_eq!(right_preimage[1].data.as_ref(), b"D");
let right_preimage2 = right_preimage[0].preimage.as_ref().expect("No preimage");
assert_eq!(right_preimage2[0].function, Function::Plain);
assert_eq!(right_preimage2[0].data.as_ref(), b"AB");
let right_preimage3 = right_preimage2[0].preimage.as_ref().expect("No preimage");
assert_eq!(right_preimage3[0].function, Function::Plain);
assert_eq!(right_preimage3[0].data.as_ref(), b"A");
assert_eq!(right_preimage3[0].preimage, None);
assert_eq!(right_preimage3[1].function, Function::Plain);
assert_eq!(right_preimage3[1].data.as_ref(), b"B");
assert_eq!(right_preimage3[1].preimage, None);
}
{
let (left, right) = outer.clone().split(3).unwrap();
let left_preimage = left.preimage.as_ref().expect("No preimage");
let right_preimage = right.preimage.as_ref().expect("No preimage");
assert_eq!(left.function, Function::Plain);
assert_eq!(
left.data.as_ref(),
[b"C", &inner_hash[..2]].concat().as_slice()
);
assert_eq!(left_preimage.len(), 2);
assert_eq!(left_preimage[0].function, Function::Plain);
assert_eq!(left_preimage[0].data.as_ref(), b"C");
assert_eq!(left_preimage[0].preimage, None);
assert_eq!(left_preimage[1].function, Function::UnexpectedSplit);
assert_eq!(left_preimage[1].data.as_ref(), &inner_hash[..2]);
assert_eq!(left_preimage[1].preimage, None);
assert_eq!(right.function, Function::Plain);
assert_eq!(
right.data.as_ref(),
[&inner_hash[2..], b"D"].concat().as_slice()
);
assert_eq!(right_preimage[0].data.as_ref(), &inner_hash[2..]);
assert_eq!(right_preimage[0].preimage, None);
assert_eq!(right_preimage[1].data.as_ref(), b"D");
assert_eq!(right_preimage[1].preimage, None);
}
{
let (left, right) = outer.clone().split(33).unwrap();
let left_preimage = left.preimage.as_ref().expect("No preimage");
let right_preimage = right.preimage.as_ref().expect("No preimage");
assert_eq!(left.function, Function::Plain);
assert_eq!(
left.data.as_ref(),
[b"C", inner_hash.as_slice()].concat().as_slice()
);
assert_eq!(left_preimage.len(), 2);
assert_eq!(left_preimage[0].function, Function::Plain);
assert_eq!(left_preimage[0].data.as_ref(), b"C");
assert_eq!(left_preimage[0].preimage, None);
assert_eq!(left_preimage[1].function, Function::Sha256);
assert_eq!(left_preimage[1].data.as_ref(), inner_hash.as_slice());
assert_eq!(&left_preimage[1], &inner_hashed);
assert_eq!(right.function, Function::Plain);
assert_eq!(right.data.as_ref(), b"D");
assert_eq!(right_preimage[0].data.as_ref(), b"D");
assert_eq!(right_preimage[0].preimage, None);
}
} | rust_cleaned_test_functions.jsonl/86777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
66279,
368,
341,
286,
1077,
264,
284,
32920,
486,
1499,
26488,
4907,
30245,
1883,
29133,
797,
286,
1077,
293,
284,
32920,
486,
1499,
26488,
4907,
30245,
1883,
63590,
797,
286,
1077,
9179,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_multi_pass_rest_of_hash_calculation_partial() {
solana_logger::setup();
let mut account_maps = Vec::new();
let key = Pubkey::new(&[11u8; 32]);
let hash = Hash::new(&[1u8; 32]);
let val = CalculateHashIntermediate::new(hash, 88, key);
account_maps.push(val);
let key = Pubkey::new(&[12u8; 32]);
let hash = Hash::new(&[2u8; 32]);
let val = CalculateHashIntermediate::new(hash, 20, key);
account_maps.push(val);
let accounts_hash = AccountsHash::default();
let result = accounts_hash.rest_of_hash_calculation(
for_rest(vec![account_maps[0].clone()]),
&mut HashStats::default(),
false, // not last pass
PreviousPass::default(),
one_range(),
);
assert_eq!(result.0, Hash::default());
assert_eq!(result.1, 0);
let previous_pass = result.2;
assert_eq!(previous_pass.remaining_unhashed, vec![account_maps[0].hash]);
assert_eq!(previous_pass.reduced_hashes.len(), 0);
assert_eq!(previous_pass.lamports, account_maps[0].lamports);
let result = accounts_hash.rest_of_hash_calculation(
for_rest(vec![account_maps[1].clone()]),
&mut HashStats::default(),
false, // not last pass
previous_pass,
one_range(),
);
assert_eq!(result.0, Hash::default());
assert_eq!(result.1, 0);
let previous_pass = result.2;
assert_eq!(
previous_pass.remaining_unhashed,
vec![account_maps[0].hash, account_maps[1].hash]
);
assert_eq!(previous_pass.reduced_hashes.len(), 0);
let total_lamports_expected = account_maps[0].lamports + account_maps[1].lamports;
assert_eq!(previous_pass.lamports, total_lamports_expected);
let result = accounts_hash.rest_of_hash_calculation(
vec![vec![vec![]]],
&mut HashStats::default(),
true,
previous_pass,
one_range(),
);
let previous_pass = result.2;
assert_eq!(previous_pass.remaining_unhashed.len(), 0);
assert_eq!(previous_pass.reduced_hashes.len(), 0);
assert_eq!(previous_pass.lamports, 0);
let expected_hash = AccountsHash::compute_merkle_root(
account_maps
.iter()
.map(|a| (a.pubkey, a.hash))
.collect::<Vec<_>>(),
MERKLE_FANOUT,
);
assert_eq!(
(result.0, result.1),
(expected_hash, total_lamports_expected)
);
} | rust_cleaned_test_functions.jsonl/94716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
25133,
15464,
32231,
3575,
8950,
38241,
2914,
52068,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
5206,
2692,
46512,
284,
11312,
486,
931,
1428,
286,
1077,
1376,
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_message_type() {
if let Ok(ie) = InformationElement::new(0x2, 0){
assert_eq!(ie.information_element_type() as u8, InformationElementType::EBI as u8);
}
else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/86349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
1819,
368,
341,
286,
421,
1077,
7622,
7,
645,
8,
284,
8085,
1691,
486,
931,
7,
15,
87,
17,
11,
220,
15,
1264,
310,
2060,
10714,
10297,
645,
1858,
1627,
7894,
1819,
368,
438,
575,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bad_input() {
assert_cli::Assert::main_binary()
.with_env(assert_cli::Environment::inherit().insert("FDSET_PATH", get_fdset_dir("fdsets")))
.with_args(&["--msgtype=com.example.dog.Dog"])
.stdin(include_str!("samples/bad"))
.fails()
.and()
.stderr()
.contains("protobuf error")
.unwrap();
} | rust_cleaned_test_functions.jsonl/108210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
5898,
368,
341,
262,
2060,
47147,
486,
8534,
486,
3817,
31761,
741,
286,
659,
4197,
15879,
75846,
47147,
486,
12723,
486,
12825,
1005,
4208,
445,
14596,
5884,
7944,
497,
633,
17676,
746,
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_hello_world() {
let tempdir = TempDir::new("hello_word_project").expect("failed to create temp dir");
let outdir = tempdir.path().join("my_project");
let task = Task {
toolchain: "stable".into(),
code: "fn main() {\n println!(\"hello world!\");\n}".into(),
task_type: Type::Run,
backtrace: true,
release: false,
};
let exp_exec_path = outdir.join("target").join("debug").join(BIN_TARGET_NAME);
let result = do_compile_task(&outdir, task, |_| {}).expect("compile task failed");
assert_eq!(result.executable, Some(exp_exec_path));
} | rust_cleaned_test_functions.jsonl/72142 | {
"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,
96724,
31792,
368,
341,
286,
1077,
2730,
3741,
284,
19944,
6184,
486,
931,
445,
14990,
13533,
16352,
1827,
17119,
445,
16091,
311,
1855,
2730,
5419,
797,
286,
1077,
700,
3741,
284,
2730,
3741,
387... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop() {
DROP_COUNT.store(0, SeqCst);
{
let mut map = PolyMap::new();
map.insert(0, Dropper{n: 1});
map.insert(1, Dropper{n: 2});
map.insert(2, Dropper{n: 3});
}
assert_eq!(DROP_COUNT.load(SeqCst), 6);
} | rust_cleaned_test_functions.jsonl/18697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
368,
341,
286,
56942,
14672,
16114,
7,
15,
11,
23744,
34,
267,
626,
286,
341,
310,
1077,
5206,
2415,
284,
18767,
2227,
486,
931,
543,
310,
2415,
7030,
7,
15,
11,
56867,
6922,
91362,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frame_header_reading() {
use crate::frame;
use std::fs;
let mut content = fs::File::open("./decodecorpus_files/z000088.zst").unwrap();
let (frame, _) = frame::read_frame_header(&mut content).unwrap();
frame.check_valid().unwrap();
} | rust_cleaned_test_functions.jsonl/37443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8929,
8757,
81859,
368,
341,
262,
990,
17717,
486,
6763,
280,
262,
990,
1460,
486,
3848,
401,
262,
1077,
5206,
2213,
284,
8619,
486,
1703,
486,
2508,
13988,
18196,
6005,
17820,
10931,
31082,
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_include_dir() {
let strs = vec!["foo", "bar"];
let s = IncludeDirTemplate { strs: &strs };
assert_eq!(
s.call().unwrap(),
"\n INCLUDED-DIR: foo1\n INCLUDED-DIR: bar2"
)
} | rust_cleaned_test_functions.jsonl/108586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
4334,
368,
341,
262,
1077,
57584,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
6332,
262,
1077,
274,
284,
29734,
6184,
7275,
314,
57584,
25,
609,
495,
82,
2605,
262,
2060,
10714,
33673,
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_convert_imports() {
let b = ast::BaseNode::default();
let pkg = parse_package(
r#"package qux
import "path/foo"
import b "path/bar"
"#,
);
let got = test_convert(pkg).unwrap();
let symbols = collect_symbols(&got);
let want = Package {
loc: b.location.clone(),
package: "qux".to_string(),
files: vec![File {
loc: b.location.clone(),
package: Some(PackageClause {
loc: b.location.clone(),
name: Identifier {
loc: b.location.clone(),
name: symbols["qux"].clone(),
},
}),
imports: vec![
ImportDeclaration {
loc: b.location.clone(),
path: StringLit {
loc: b.location.clone(),
value: "path/foo".to_string(),
},
alias: None,
import_symbol: symbols["foo"].clone(),
},
ImportDeclaration {
loc: b.location.clone(),
path: StringLit {
loc: b.location.clone(),
value: "path/bar".to_string(),
},
alias: Some(Identifier {
loc: b.location.clone(),
name: symbols["b"].clone(),
}),
import_symbol: symbols["b"].clone(),
},
],
body: Vec::new(),
}],
};
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/131366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
18434,
82,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
4715,
26328,
1006,
310,
435,
55543,
1722,
922,
87,
198,
310,
1159,
330,
2343,
6055... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_receiving_router_advertisement_validity_check() {
let config = get_dummy_config::<Ipv6Addr>();
let src_mac = [10, 11, 12, 13, 14, 15];
let src_ip = Ipv6Addr::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 10]);
let mut ctx = DummyEventDispatcherBuilder::from_config(config.clone())
.build::<DummyEventDispatcher>();
let device = Some(DeviceId::new_ethernet(0));
let mut icmpv6_packet_buf =
router_advertisement_message(src_ip, config.local_ip, 1, 2, 3, 4, 5);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
receive_ndp_packet(&mut ctx, device, src_ip, config.local_ip, icmpv6_packet);
assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_advertisement"), 0);
let src_ip = Mac::new(src_mac).to_ipv6_link_local().get();
let mut icmpv6_packet_buf =
router_advertisement_message(src_ip, config.local_ip, 1, 2, 3, 4, 5);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
receive_ndp_packet(&mut ctx, device, src_ip, config.local_ip, icmpv6_packet);
assert_eq!(get_counter_val(&mut ctx, "ndp::rx_router_advertisement"), 1);
} | rust_cleaned_test_functions.jsonl/16142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 753
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
46344,
55587,
10027,
44424,
8337,
487,
7200,
368,
341,
286,
1077,
2193,
284,
633,
60321,
5332,
27638,
80656,
21,
13986,
3913,
286,
1077,
2286,
22802,
284,
508,
16,
15,
11,
220,
16,
16,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitrate() {
let mut rfm = setup_rfm(Vec::new(), vec![0, 0, 0]);
rfm.bit_rate(9_600.0).ok().unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=2],
[Registers::BitrateMsb.write(), 0x0d, 0x05]
);
rfm.spi.rx_buffer.clear();
rfm.bit_rate(150_000.0).ok().unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=2],
[Registers::BitrateMsb.write(), 0x00, 0xd5]
);
rfm.spi.rx_buffer.clear();
rfm.bit_rate(32_768.0).ok().unwrap();
assert_eq!(
rfm.spi.rx_buffer[0..=2],
[Registers::BitrateMsb.write(), 0x03, 0xd0]
);
} | rust_cleaned_test_functions.jsonl/3690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
7698,
368,
341,
262,
1077,
5206,
435,
21112,
284,
6505,
1710,
21112,
49923,
486,
931,
1507,
7486,
20703,
15,
11,
220,
15,
11,
220,
15,
10149,
262,
435,
21112,
30099,
9246,
7,
24,
62,
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_serde_ser_integer_types() -> Result<(), Box<EvalAltResult>> {
assert!(to_dynamic(42_i8)?.is::<INT>());
assert!(to_dynamic(42_i16)?.is::<INT>());
assert!(to_dynamic(42_i32)?.is::<INT>());
assert!(to_dynamic(42_i64)?.is::<INT>());
assert!(to_dynamic(42_u8)?.is::<INT>());
assert!(to_dynamic(42_u16)?.is::<INT>());
assert!(to_dynamic(42_u32)?.is::<INT>());
assert!(to_dynamic(42_u64)?.is::<INT>());
Ok(())
} | rust_cleaned_test_functions.jsonl/97325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
75861,
31725,
9763,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
2060,
10297,
983,
45992,
7,
19,
17,
5318,
23,
43507,
285,
27638,
3221,
32872,
262,
2060,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_anyone() {
let groups = parse_groups(
r#"abc
a
b
c
ab
ac
a
a
a
a
b"#,
);
assert_eq!(sum_count(&groups, |g| g.anyone_yes_count()), 11);
} | rust_cleaned_test_functions.jsonl/11442 | {
"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,
37248,
603,
368,
341,
286,
1077,
5203,
284,
4715,
21148,
1006,
310,
435,
55543,
13683,
271,
64,
198,
65,
198,
66,
271,
370,
198,
580,
271,
64,
198,
64,
198,
64,
198,
64,
271,
65,
57676,
345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ref_nonexistent() {
let cache = Cache::with_capacity(100);
let key = Key::Rid(RID(0));
assert!(cache.get_ref(&key).is_none());
} | rust_cleaned_test_functions.jsonl/90045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7793,
21637,
64085,
368,
341,
262,
1077,
6500,
284,
19479,
486,
4197,
35603,
7,
16,
15,
15,
317,
262,
1077,
1376,
284,
5309,
486,
49,
307,
2785,
915,
7,
15,
1106,
262,
2060,
10297,
9360,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_diff_with_merge_conflict_is_not_truncated() {
let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(DIFF_WITH_MERGE_CONFLICT, &config);
// TODO: The + in the first column is being removed.
assert!(strip_ansi_codes(&output).contains("+>>>>>>> Stashed changes"));
assert_eq!(output.lines().count(), 45);
} | rust_cleaned_test_functions.jsonl/70048 | {
"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,
15850,
6615,
20888,
16059,
21242,
6892,
7913,
3547,
38007,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
56703,
286,
1077,
2550,
284,
17590,
4452,
17309,
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_list_index_trait_range_from_panic() {
Python::with_gil(|py| {
let list = PyList::new(py, &[2, 3, 5]);
list[8..].extract::<Vec<i32>>().unwrap();
})
} | rust_cleaned_test_functions.jsonl/108644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3560,
78491,
9698,
5673,
620,
31270,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
17,
11,
220,
18,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone_in_other_thread() {
use crate::Py;
use std::{sync::Arc, thread};
// Some events for synchronizing
static OBJECT_CLONED: Event = Event::new();
let (obj, count, ptr) = Python::with_gil(|py| {
let obj = Arc::new(get_object(py));
let count = obj.get_refcnt(py);
let thread_obj = Arc::clone(&obj);
let t = thread::spawn(move || {
// Cloning without GIL should not update reference count
#[allow(clippy::redundant_clone)]
let _ = Py::clone(&*thread_obj);
OBJECT_CLONED.set();
});
OBJECT_CLONED.wait();
assert_eq!(count, obj.get_refcnt(py));
t.join().unwrap();
let ptr = NonNull::new(obj.as_ptr()).unwrap();
assert!(POOL.pointer_ops.lock().0.contains(&ptr));
assert!(POOL.pointer_ops.lock().1.contains(&ptr));
(obj, count, ptr)
});
Python::with_gil(|py| {
// Acquiring the gil clears the pool
assert!(!POOL.pointer_ops.lock().0.contains(&ptr));
assert!(!POOL.pointer_ops.lock().1.contains(&ptr));
// Overall count is still unchanged
assert_eq!(count, obj.get_refcnt(py));
});
} | rust_cleaned_test_functions.jsonl/50517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 726
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
1243,
30456,
10814,
368,
341,
286,
990,
17717,
486,
13828,
280,
286,
990,
1460,
22964,
12996,
486,
36809,
11,
4516,
2315,
286,
442,
4329,
4357,
369,
14121,
4849,
198,
286,
1099,
39786,
6843... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.