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_slack_user_name() {
let (mut users, _temp) = new_test();
users.insert("some-git-user", "the-slacker").unwrap();
assert_eq!(
Some("the-slacker".into()),
users.slack_user_name("some-git-user")
);
assert_eq!(
Some("@the-slacker".into()),
users.slack_user_mention("some-git-user")
);
assert_eq!(None, users.slack_user_name("some.other.user"));
assert_eq!(None, users.slack_user_mention("some.other.user"));
} | rust_cleaned_test_functions.jsonl/36271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11886,
473,
3317,
1269,
368,
341,
286,
1077,
320,
6984,
3847,
11,
716,
3888,
8,
284,
501,
4452,
1428,
286,
3847,
7030,
445,
14689,
81749,
8694,
497,
330,
1782,
58097,
9683,
1827,
15454,
1428,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_heartbeat_resp() {
let l = default_logger();
let store = new_storage();
store
.wl()
.append(&[empty_entry(1, 1), empty_entry(2, 2), empty_entry(3, 3)])
.unwrap();
let mut sm = new_test_raft(1, vec![1, 2], 5, 1, store, &l);
sm.become_candidate();
sm.become_leader();
let last_index = sm.raft_log.last_index();
sm.raft_log.commit_to(last_index);
// A heartbeat response from a node that is behind; re-send MsgApp
sm.step(new_message(2, 0, MessageType::MsgHeartbeatResponse, 0))
.expect("");
let mut msgs = sm.read_messages();
assert_eq!(msgs.len(), 1);
assert_eq!(msgs[0].get_msg_type(), MessageType::MsgAppend);
// A second heartbeat response generates another MsgApp re-send
sm.step(new_message(2, 0, MessageType::MsgHeartbeatResponse, 0))
.expect("");
msgs = sm.read_messages();
assert_eq!(msgs.len(), 1);
assert_eq!(msgs[0].get_msg_type(), MessageType::MsgAppend);
let mut m = new_message(2, 0, MessageType::MsgAppendResponse, 0);
m.index = msgs[0].index + msgs[0].entries.len() as u64;
sm.step(m).expect("");
// Consume the message sent in response to MsgAppResp
sm.read_messages();
sm.step(new_message(2, 0, MessageType::MsgHeartbeatResponse, 0))
.expect("");
msgs = sm.read_messages();
assert!(msgs.is_empty());
} | rust_cleaned_test_functions.jsonl/19109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
62,
72471,
35160,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
3553,
284,
501,
23310,
543,
262,
3553,
198,
286,
659,
26417,
741,
286,
659,
5090,
2099,
58,
3194,
9078,
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_exec_mode_payload() {
let mut evt: pt_event = unsafe { mem::zeroed() };
evt.type_ = pt_event_type_ptev_exec_mode;
evt.variant.exec_mode = pt_event__bindgen_ty_1__bindgen_ty_8 {
ip: 11,
mode: pt_exec_mode_ptem_32bit
};
let payload: Payload = evt.into();
match payload {
Payload::ExecMode(e) => {
assert_eq!(e.ip(), 11);
assert_eq!(e.mode(), ExecModeType::Bit32);
},
_ => unreachable!("oof")
}
} | rust_cleaned_test_functions.jsonl/81003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
7302,
32813,
368,
341,
286,
1077,
5206,
12358,
25,
10817,
6748,
284,
19860,
314,
1833,
486,
14154,
291,
368,
2605,
286,
12358,
4852,
62,
284,
10817,
6748,
1819,
20124,
5120,
18430,
7302,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ecdsa() {
let pubk = ECPointAffine256 {
x: Bignum256([0x4f33f883, 0xffdc3ff2, 0x836af311, 0x38b3c0c0, 0xe34e8a8d, 0x919b1318, 0x57bc232f, 0x91c89152]),
y: Bignum256([0x375c37c9, 0x8e1e4703, 0xf91b2e47, 0x09788b02, 0x724d2c63, 0x23f98d7a, 0xbc3c93e6, 0x94cee68f]),
};
let pubk_plus_g = ECPointAffine256 {
x: Bignum256([0xffa047e9, 0x8a97f91b, 0x9904be31, 0x3cc60dfb, 0x036b51ff, 0x94b25916, 0xf796d136, 0x19e17ade]),
y: Bignum256([0x086d4036, 0x89cdf37b, 0x66f59ea6, 0x8eb771b3, 0x008da49c, 0x8a63633a, 0xc8705153, 0x7487e759]),
};
let hash = Bignum256([0xa0674d33, 0xfd873996, 0x6eb811f9, 0x124cf236, 0xd0f1f9d1, 0x01239f7e, 0xb86cfa0e, 0x403dee8c]);
let sig_r = Bignum256([0xe99aac39, 0x7c2b237b, 0xb0024f02, 0x19e7c3f9, 0x97fec477, 0xdd847472, 0xd2a547d0, 0x811a6c2b]);
let sig_s = Bignum256([0xb5a1d63c, 0x7393a694, 0x9daa5595, 0xcb2ba405, 0xf7f668a7, 0xb41a7db0, 0xf29c820c, 0xb428639a]);
assert!(ecdsa_secp256r1_verify_sig(&pubk, &pubk_plus_g, &hash, &sig_r, &sig_s));
} | rust_cleaned_test_functions.jsonl/9432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
368,
341,
286,
1077,
6675,
74,
284,
20633,
2609,
25841,
482,
17,
20,
21,
341,
310,
856,
25,
425,
92160,
17,
20,
21,
2561,
15,
87,
19,
69,
18,
18,
69,
23,
23,
18,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hmac_encryption() {
let key = generate_key();
let test_value = Uuid::new_v4().to_string();
let enc_hash = encrypt_and_hmac(&key, &test_value).unwrap();
let decrypted = decrypt_and_verify(&key, &enc_hash).unwrap();
assert_eq!(test_value, decrypted);
} | rust_cleaned_test_functions.jsonl/25003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
11948,
13781,
15597,
368,
341,
286,
1077,
1376,
284,
6923,
3097,
543,
286,
1077,
1273,
3142,
284,
547,
2423,
486,
931,
2273,
19,
1005,
983,
3904,
543,
286,
1077,
3209,
8950,
284,
29625,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cross_product() {
let result = cross(
&Vector3d { x: 1.0, y: 0.0, z: 0.0 },
&Vector3d { x: 0.0, y: 1.0, z: 0.0 },
);
assert_eq!(result, Vector3d { x: 0.0, y: 0.0, z: 1.0 });
} | rust_cleaned_test_functions.jsonl/48843 | {
"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,
35284,
9840,
368,
341,
286,
1077,
1102,
284,
5312,
1006,
310,
609,
3781,
18,
67,
314,
856,
25,
220,
16,
13,
15,
11,
379,
25,
220,
15,
13,
15,
11,
1147,
25,
220,
15,
13,
15,
1153,
310,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_forwarding_reconnect() {
let (mut cluster, client, call_opt, ctx) = setup_cluster();
let leader = cluster.leader_of_region(1).unwrap();
cluster.stop_node(leader.get_store_id());
let mut req = RawGetRequest::default();
req.set_context(ctx.clone());
// Large timeout value to ensure the error is from proxy instead of client.
let timer = std::time::Instant::now();
let timeout = Duration::from_secs(5);
let res = client.raw_get_opt(&req, call_opt.clone().timeout(timeout));
let elapsed = timer.elapsed();
assert!(elapsed < timeout, "{:?}", elapsed);
match res {
Err(grpcio::Error::RpcFailure(s)) => assert_eq!(s.status, RpcStatusCode::CANCELLED),
_ => panic!("unexpected result {:?}", res),
}
cluster.run_node(leader.get_store_id()).unwrap();
let resp = client.raw_get_opt(&req, call_opt.clone()).unwrap();
assert!(!resp.get_region_error().has_store_not_match(), "{:?}", resp);
} | rust_cleaned_test_functions.jsonl/61708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32121,
287,
1288,
6459,
368,
341,
262,
1077,
320,
6984,
10652,
11,
2943,
11,
1618,
15032,
11,
5635,
8,
284,
6505,
28441,
543,
262,
1077,
7653,
284,
10652,
30502,
998,
3575,
20627,
7,
16,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_static_bytes() {
assert_eq!(Binary::from(b"test".as_ref()).len(), 4);
assert_eq!(Binary::from(b"test".as_ref()).as_ref(), b"test");
assert_eq!(Binary::from_slice(b"test".as_ref()).len(), 4);
assert_eq!(Binary::from_slice(b"test".as_ref()).as_ref(), b"test");
} | rust_cleaned_test_functions.jsonl/88997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
12524,
368,
341,
286,
2060,
10714,
10297,
21338,
486,
1499,
1883,
1,
1944,
3263,
300,
7793,
6011,
2892,
1507,
220,
19,
317,
286,
2060,
10714,
10297,
21338,
486,
1499,
1883,
1,
1944,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_custom_charset_format0() {
let n_glyphs = 2;
let data_format0 = [0, 0xAA, 0xBB];
let mut ctxt = ReadScope::new(&data_format0).ctxt();
let format0_charset = ctxt.read_dep::<CustomCharset<'_>>(n_glyphs).unwrap();
match format0_charset {
CustomCharset::Format0 { glyphs } => {
assert_eq!(glyphs.iter().collect_vec(), vec![0xAABB])
}
_ => panic!("expected CustomCharset::Format0 got something else"),
}
} | rust_cleaned_test_functions.jsonl/85337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
15875,
65883,
8955,
15,
368,
341,
286,
1077,
308,
88703,
82,
284,
220,
17,
280,
286,
1077,
821,
8955,
15,
284,
508,
15,
11,
220,
15,
60051,
11,
220,
15,
80197,
935,
286,
1077,
5206,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_station_vertices() {
let station = stations::hauptbahnhof();
let mut buffer = Vec::new();
station.fill_vertice_buffer(&mut buffer);
assert_relative_eq!(*buffer, [-1385.0, -1812.0])
} | rust_cleaned_test_functions.jsonl/76560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44798,
37720,
368,
341,
286,
1077,
8056,
284,
17337,
486,
71,
51898,
68143,
16719,
1055,
543,
286,
1077,
5206,
4147,
284,
11312,
486,
931,
543,
286,
8056,
12467,
54000,
558,
7776,
2099,
6984,
4147... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_numeric_range() {
context!(ctx, dev);
execute_str!(ctx, b"*NUMRANGE? 0.5" => result, response {
assert_eq!(result, Ok(()));
assert_eq!(response, b"0.5\n");
});
execute_str!(ctx, b"*NUMRANGE? MAX" => result, response {
assert_eq!(result, Ok(()));
assert_eq!(response, b"1.0\n");
});
execute_str!(ctx, b"*NUMRANGE? MIN" => result, response {
assert_eq!(result, Ok(()));
assert_eq!(response, b"-1.0\n");
});
execute_str!(ctx, b"*NUMRANGE? 5" => result, _response {
assert_eq!(result, Err(Error::from(ErrorCode::DataOutOfRange)));
});
execute_str!(ctx, b"*NUMRANGE? -5" => result, _response {
assert_eq!(result, Err(Error::from(ErrorCode::DataOutOfRange)));
});
} | rust_cleaned_test_functions.jsonl/82169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29418,
9698,
368,
341,
262,
2266,
10297,
3773,
11,
3483,
317,
262,
9026,
2895,
10297,
3773,
11,
293,
61593,
17488,
49,
11503,
30,
220,
15,
13,
20,
1,
589,
1102,
11,
2033,
341,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commit_style_box_ul() {
_do_test_commit_style_box_ul(&[
"--commit-style",
"blue",
"--commit-decoration-style",
"blue box ul",
]);
} | rust_cleaned_test_functions.jsonl/70061 | {
"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,
36346,
15117,
10194,
61039,
368,
341,
286,
716,
2982,
4452,
36346,
15117,
10194,
61039,
2099,
9640,
310,
14482,
17413,
11297,
756,
310,
330,
12203,
756,
310,
14482,
17413,
30266,
11297,
756,
310,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_call_gather_bytes() {
test_interpreter_and_jit_asm!(
"
mov r1, 1
mov r2, 2
mov r3, 3
mov r4, 4
mov r5, 5
syscall BpfGatherBytes
exit",
[],
(
b"BpfGatherBytes" => syscalls::BpfGatherBytes::call; syscalls::BpfGatherBytes {},
),
{ |_vm, res: Result| { res.unwrap() == 0x0102030405 } },
7
);
} | rust_cleaned_test_functions.jsonl/59049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
1889,
1856,
12524,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
16,
11,
220,
16,
198,
286,
1974,
435,
17,
11,
220,
17,
198,
286,
1974,
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_wait_context() {
let m = Arc::new(AtomicUsize::new(0));
let cnt = Arc::clone(&m);
System::run(move || {
let addr = ContextWait { cnt }.start();
addr.do_send(Ping);
addr.do_send(Ping);
addr.do_send(Ping);
})
.unwrap();
assert_eq!(m.load(Ordering::Relaxed), 1);
} | rust_cleaned_test_functions.jsonl/35705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
8467,
368,
341,
262,
1077,
296,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
13195,
284,
19689,
486,
19982,
2099,
76,
626,
262,
739,
486,
6108,
34081,
136... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zip_map_sideffectful() {
let mut xs = [0; 6];
let mut ys = [0; 4];
for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) {}
assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]);
assert_eq!(&ys, &[1, 1, 1, 1]);
let mut xs = [0; 4];
let mut ys = [0; 6];
for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) {}
assert_eq!(&xs, &[1, 1, 1, 1]);
assert_eq!(&ys, &[1, 1, 1, 1, 0, 0]);
} | rust_cleaned_test_functions.jsonl/8964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
5376,
30862,
1705,
1262,
368,
341,
262,
1077,
5206,
11943,
284,
508,
15,
26,
220,
21,
935,
262,
1077,
5206,
31810,
284,
508,
15,
26,
220,
19,
4821,
262,
369,
716,
304,
11943,
19471,
295... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_statsd_client_as_histogrammed_u64() {
let client: Box<dyn Histogrammed<u64>> = Box::new(StatsdClient::from_sink("prefix", NopMetricSink));
client.histogram("some.histogram", 4).unwrap();
} | rust_cleaned_test_functions.jsonl/10620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
68564,
2061,
7300,
21,
19,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
82138,
2061,
34837,
21,
19,
2452,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
51567,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parsing_extra_operand() {
let mut v = ZERO_BOUND_HEADER.to_vec();
v.append(&mut vec![0x00, 0x00, 0x01, 0x00]); // OpNop with word count 1
v.append(&mut vec![0x00, 0x00, 0x02, 0x00]); // OpNop with word count 2
v.append(&mut vec![0x00, 0x00, 0x00, 0x00]); // A bogus operand
let mut c = RetainingConsumer::new();
let p = Parser::new(&v, &mut c);
// The bogus operand to the second OpNop instruction starts at
assert_matches!(p.parse(), Err(State::OperandExceeded(28, 2)));
} | rust_cleaned_test_functions.jsonl/85737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
31858,
69259,
368,
341,
286,
1077,
5206,
348,
284,
54593,
73644,
20330,
2389,
13251,
543,
286,
348,
2057,
2099,
6984,
7486,
20703,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_initn() {
let mut a = vec![11i, 12, 13];
assert_eq!(a.as_slice().initn(0), &[11, 12, 13]);
a = vec![11i, 12, 13];
assert_eq!(a.as_slice().initn(2), &[11]);
} | rust_cleaned_test_functions.jsonl/33132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
77,
368,
341,
286,
1077,
5206,
264,
284,
7486,
20703,
16,
16,
72,
11,
220,
16,
17,
11,
220,
16,
18,
935,
286,
2060,
10714,
10297,
64,
5357,
26488,
1005,
2327,
77,
7,
15,
701,
44590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_header() -> Result<(), Error> {
let test_input = "At
-a
-m
";
let test_buf = BufReader::new(test_input.as_bytes());
let mut test_lines = test_buf.lines().peekable();
Ok(parse_header(&mut test_lines)?.1)
} | rust_cleaned_test_functions.jsonl/46224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8757,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1273,
5898,
284,
330,
1655,
271,
7409,
198,
1448,
198,
876,
286,
1077,
1273,
10363,
284,
69013,
5062,
486,
931,
8623,
5898,
5357,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_partial_write() {
// Set up the logger.
let mut data = iobuffer::IoBuffer::new();
let logger = new_test_logger(data.clone());
let (started_send, started_recv) = mpsc::channel();
let (done_send, done_recv) = mpsc::channel();
// incomplete record.
let _ = thread::spawn(move || {
started_send.send(()).unwrap();
while done_recv.try_recv().is_err() {
debug!(logger, "Some data";
"alfa" => "alpha",
"bravo" => "beta",
"charlie" => "gamma",
"delta" => "delta",
"echo" => "epsilon");
}
});
// Wait until the thread has started.
started_recv.recv().unwrap();
// Now try to read some values. This should not fail with a parse
// error.
let _ = read_json_values(&mut data);
// Tell the daemon thread to stop so as not to leak CPU/memory.
done_send.send(()).unwrap();
} | rust_cleaned_test_functions.jsonl/33776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
9165,
368,
341,
286,
442,
2573,
705,
279,
5925,
624,
286,
1077,
5206,
821,
284,
600,
674,
2040,
486,
42799,
4095,
486,
931,
543,
286,
1077,
5925,
284,
501,
4452,
27413,
2592,
15997,
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... | 3 |
#[test]
fn test_tokenizer_equal() {
let config = TokenizerConfig {
dict_type: DictionaryType::Ipadic,
dict_path: None,
user_dict_path: None,
user_dict_type: UserDictionaryType::Csv,
mode: Mode::Decompose(Penalty::default()),
};
let tokens = test_helper(
LinderaTokenizer::with_config(config)
.unwrap()
.token_stream("すもももももももものうち"),
);
assert_eq!(tokens.len(), 7);
{
let token = &tokens[0];
assert_eq!(token.text, "すもも");
assert_eq!(token.offset_from, 0);
assert_eq!(token.offset_to, 9);
assert_eq!(token.position, 0);
}
{
let token = &tokens[1];
assert_eq!(token.text, "も");
assert_eq!(token.offset_from, 9);
assert_eq!(token.offset_to, 12);
assert_eq!(token.position, 1);
}
{
let token = &tokens[2];
assert_eq!(token.text, "もも");
assert_eq!(token.offset_from, 12);
assert_eq!(token.offset_to, 18);
assert_eq!(token.position, 2);
}
{
let token = &tokens[3];
assert_eq!(token.text, "も");
assert_eq!(token.offset_from, 18);
assert_eq!(token.offset_to, 21);
assert_eq!(token.position, 3);
}
{
let token = &tokens[4];
assert_eq!(token.text, "もも");
assert_eq!(token.offset_from, 21);
assert_eq!(token.offset_to, 27);
assert_eq!(token.position, 4);
}
{
let token = &tokens[5];
assert_eq!(token.text, "の");
assert_eq!(token.offset_from, 27);
assert_eq!(token.offset_to, 30);
assert_eq!(token.position, 5);
}
{
let token = &tokens[6];
assert_eq!(token.text, "うち");
assert_eq!(token.offset_from, 30);
assert_eq!(token.offset_to, 36);
assert_eq!(token.position, 6);
}
} | rust_cleaned_test_functions.jsonl/41386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
3135,
11478,
368,
341,
286,
1077,
2193,
284,
9660,
3135,
2648,
341,
310,
6451,
1819,
25,
10466,
929,
486,
40,
13242,
292,
345,
310,
6451,
2638,
25,
2240,
345,
310,
1196,
5243,
2638,
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_enum_values() {
assert_eq!(BlockType::IntValue.to_isize().unwrap(), ArrayType::Int.to_isize().unwrap());
assert_eq!(BlockType::UintValue.to_isize().unwrap(), ArrayType::Uint.to_isize().unwrap());
assert_eq!(
BlockType::DoubleValue.to_isize().unwrap(),
ArrayType::Double.to_isize().unwrap()
);
} | rust_cleaned_test_functions.jsonl/10365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
9146,
368,
341,
286,
2060,
10714,
10297,
4713,
929,
486,
1072,
1130,
2389,
6892,
551,
1005,
15454,
1507,
2910,
929,
486,
1072,
2389,
6892,
551,
1005,
15454,
1423,
286,
2060,
10714,
10297,
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_entry_get_mut() {
let mut map = squares_map();
// Change the entries to cubes.
for i in range(0, SQUARES_UPPER_LIM) {
match map.entry(i) {
Occupied(mut e) => {
*e.get_mut() = i * i * i;
}
Vacant(_) => panic!("Key not found.")
}
assert_eq!(map.get(&i).unwrap(), &(i * i * i));
}
check_integrity(&map.root);
} | rust_cleaned_test_functions.jsonl/88438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
3062,
29523,
368,
341,
286,
1077,
5206,
2415,
284,
31340,
5376,
1428,
286,
442,
10388,
279,
10695,
311,
54104,
624,
286,
369,
600,
304,
2088,
7,
15,
11,
92282,
50,
91703,
2351,
1791,
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... | 3 |
#[test]
fn test_reader() {
let reader = Reader::new(FASTQ_FILE);
let records: Vec<io::Result<Record>> = reader.records().collect();
assert!(records.len() == 1);
for res in records {
let record = res.ok().unwrap();
assert_eq!(record.check(), Ok(()));
assert_eq!(record.id(), Some("id"));
assert_eq!(record.desc(), Some("desc"));
assert_eq!(record.seq(), b"ACCGTAGGCTGA");
assert_eq!(record.qual(), b"IIIIIIJJJJJJ");
}
} | rust_cleaned_test_functions.jsonl/28242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
368,
341,
286,
1077,
6604,
284,
25166,
486,
931,
7,
59206,
48,
8087,
317,
286,
1077,
7424,
25,
11312,
27,
815,
486,
2077,
27,
6471,
2452,
284,
6604,
64516,
1005,
17384,
543,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nested_attrs() {
let mut buf = [0; 64];
// write IFLA_XDP with 2 nested attrs
let mut attrs = NestedAttrs::new(&mut buf, IFLA_XDP);
attrs.write_attr(IFLA_XDP_FD as u16, 42u32).unwrap();
attrs
.write_attr(IFLA_XDP_EXPECTED_FD as u16, 24u32)
.unwrap();
let len = attrs.finish().unwrap() as u16;
let nla_len = (NLA_HDR_LEN * 3 + mem::size_of::<u32>() * 2) as u16;
assert_eq!(len, nla_len);
// read IFLA_XDP
let attr = unsafe { ptr::read_unaligned(buf.as_ptr() as *const nlattr) };
assert_eq!(attr.nla_type, NLA_F_NESTED as u16 | IFLA_XDP);
assert_eq!(attr.nla_len, nla_len);
// read IFLA_XDP_FD + fd
let attr = unsafe { ptr::read_unaligned(buf[NLA_HDR_LEN..].as_ptr() as *const nlattr) };
assert_eq!(attr.nla_type, IFLA_XDP_FD as u16);
assert_eq!(attr.nla_len, (NLA_HDR_LEN + mem::size_of::<u32>()) as u16);
let fd = unsafe { ptr::read_unaligned(buf[NLA_HDR_LEN * 2..].as_ptr() as *const u32) };
assert_eq!(fd, 42);
// read IFLA_XDP_EXPECTED_FD + fd
let attr = unsafe {
ptr::read_unaligned(
buf[NLA_HDR_LEN * 2 + mem::size_of::<u32>()..].as_ptr() as *const nlattr
)
};
assert_eq!(attr.nla_type, IFLA_XDP_EXPECTED_FD as u16);
assert_eq!(attr.nla_len, (NLA_HDR_LEN + mem::size_of::<u32>()) as u16);
let fd = unsafe {
ptr::read_unaligned(
buf[NLA_HDR_LEN * 3 + mem::size_of::<u32>()..].as_ptr() as *const u32
)
};
assert_eq!(fd, 24);
} | rust_cleaned_test_functions.jsonl/133247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 945
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
39578,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
26,
220,
21,
19,
4821,
286,
442,
3270,
358,
6126,
32,
6859,
10298,
448,
220,
17,
24034,
16204,
198,
286,
1077,
5206,
16204,
284,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_uint_overflow() {
let data = &[0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01];
let _uint = DecodedUInt::read(&mut Cursor::new(data), data.len())
.expect_err("This should have failed due to overflow.");
} | rust_cleaned_test_functions.jsonl/30846 | {
"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,
6443,
15807,
79073,
368,
341,
286,
1077,
821,
284,
44590,
15,
87,
15,
16,
11,
220,
15,
87,
17,
18,
11,
220,
15,
87,
19,
20,
11,
220,
15,
87,
21,
22,
11,
220,
15,
87,
23,
24,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_activate_device() {
let mut d = TestDevices::default();
let core_a = MockDeviceId(1);
let core_b = MockDeviceId(2);
let a = d.add_device(10);
let b = d.add_active_device(core_b, 20).unwrap();
assert_eq!(d.activate_device(1000, |_| core_a).unwrap_err(), ToggleError::NotFound);
assert_eq!(d.activate_device(b, |_| core_b).unwrap_err(), ToggleError::NoChange);
let info = d.activate_device(a, |_| core_a).expect("can activate device");
assert_eq!(info.info, 10);
assert_eq!(info.core_id.unwrap(), core_a);
// both a and b should be active now:
assert!(d.inactive_devices.is_empty());
} | rust_cleaned_test_functions.jsonl/19846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67894,
9204,
368,
341,
286,
1077,
5206,
294,
284,
3393,
40835,
486,
2258,
543,
286,
1077,
6200,
4306,
284,
14563,
6985,
764,
7,
16,
317,
286,
1077,
6200,
880,
284,
14563,
6985,
764,
7,
17,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_concurrent_frontend_and_backend_changes() {
let actor: ActorID = "cb55260e9d7e457886a4fc73fd949202".try_into().unwrap();
let local1 = UncompressedChange {
actor_id: actor.clone(),
seq: 1,
time: 0,
deps: Vec::new(),
message: None,
hash: None,
start_op: 1,
operations: vec![Op {
action: protocol::OpType::Set("magpie".into()),
obj: ObjectID::Root,
key: "bird".into(),
insert: false,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let local2 = UncompressedChange {
actor_id: actor.clone(),
seq: 2,
start_op: 2,
time: 0,
deps: Vec::new(),
message: None,
hash: None,
operations: vec![Op {
action: protocol::OpType::Set("jay".into()),
obj: ObjectID::Root,
key: "bird".into(),
insert: false,
pred: vec![actor.op_id_at(1)],
}],
extra_bytes: Vec::new(),
};
let remote_actor: ActorID = "6d48a01318644eed90455d2cb68ac657".try_into().unwrap();
let remote1 = UncompressedChange {
actor_id: remote_actor.clone(),
seq: 1,
start_op: 1,
time: 0,
deps: Vec::new(),
message: None,
hash: None,
operations: vec![Op {
action: protocol::OpType::Set("goldfish".into()),
obj: ObjectID::Root,
key: "fish".into(),
pred: Vec::new(),
insert: false,
}],
extra_bytes: Vec::new(),
}
.try_into()
.unwrap();
let mut expected_change1 = UncompressedChange {
actor_id: actor.clone(),
seq: 1,
start_op: 1,
time: 0,
message: None,
hash: None,
deps: Vec::new(),
operations: vec![Op {
action: protocol::OpType::Set("magpie".into()),
obj: ObjectID::Root,
key: "bird".into(),
pred: Vec::new(),
insert: false,
}],
extra_bytes: Vec::new(),
};
let mut expected_change2 = UncompressedChange {
actor_id: remote_actor,
seq: 1,
start_op: 1,
time: 0,
message: None,
hash: None,
deps: Vec::new(),
operations: vec![Op {
action: protocol::OpType::Set("goldfish".into()),
key: "fish".into(),
obj: ObjectID::Root,
pred: Vec::new(),
insert: false,
}],
extra_bytes: Vec::new(),
};
let mut expected_change3 = UncompressedChange {
actor_id: actor.clone(),
seq: 2,
start_op: 2,
time: 0,
message: None,
hash: None,
deps: Vec::new(),
operations: vec![Op {
action: protocol::OpType::Set("jay".into()),
obj: ObjectID::Root,
key: "bird".into(),
pred: vec![actor.op_id_at(1)],
insert: false,
}],
extra_bytes: Vec::new(),
};
let mut backend = Backend::init();
backend.apply_local_change(local1).unwrap();
let backend_after_first = backend.clone();
let changes1 = backend_after_first.get_changes(&[]);
let change01 = changes1.get(0).unwrap();
backend.apply_changes(vec![remote1]).unwrap();
let backend_after_second = backend.clone();
let changes2 = backend_after_second.get_changes(&[change01.hash]);
let change12 = *changes2.get(0).unwrap();
backend.apply_local_change(local2).unwrap();
let changes3 = backend.get_changes(&[change01.hash, change12.hash]);
let change23 = changes3.get(0).unwrap();
expected_change1.time = change01.time;
expected_change2.time = change12.time;
expected_change3.time = change23.time;
expected_change3.deps = vec![change01.hash];
assert_eq!(change01, &&expected_change1.try_into().unwrap());
assert_eq!(change12, &expected_change2.try_into().unwrap());
assert_changes_equal(change23.decode(), expected_change3.clone());
assert_eq!(change23, &&expected_change3.try_into().unwrap());
} | rust_cleaned_test_functions.jsonl/22977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2045
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
3382,
3231,
93833,
8378,
40011,
47526,
368,
341,
262,
1077,
12089,
25,
24718,
915,
284,
330,
7221,
20,
20,
17,
21,
15,
68,
24,
67,
22,
68,
19,
20,
22,
23,
23,
21,
64,
19,
8316,
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... | 3 |
#[test]
fn test_simple_manager_serialize_deserialize() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let logger: test_utils::TestLogger;
let fee_estimator: test_utils::TestFeeEstimator;
let persister: test_utils::TestPersister;
let new_chain_monitor: test_utils::TestChainMonitor;
let nodes_0_deserialized: ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>;
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let (our_payment_preimage, _, _) = route_payment(&nodes[0], &[&nodes[1]], 1000000);
let (_, our_payment_hash, _) = route_payment(&nodes[0], &[&nodes[1]], 1000000);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
let nodes_0_serialized = nodes[0].node.encode();
let mut chan_0_monitor_serialized = test_utils::TestVecWriter(Vec::new());
nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap().iter().next().unwrap().1.write(&mut chan_0_monitor_serialized).unwrap();
logger = test_utils::TestLogger::new();
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
persister = test_utils::TestPersister::new();
let keys_manager = &chanmon_cfgs[0].keys_manager;
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister, keys_manager);
nodes[0].chain_monitor = &new_chain_monitor;
let mut chan_0_monitor_read = &chan_0_monitor_serialized.0[..];
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingSigner>)>::read(
&mut chan_0_monitor_read, keys_manager).unwrap();
assert!(chan_0_monitor_read.is_empty());
let mut nodes_0_read = &nodes_0_serialized[..];
let (_, nodes_0_deserialized_tmp) = {
let mut channel_monitors = HashMap::new();
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
default_config: UserConfig::default(),
keys_manager,
fee_estimator: &fee_estimator,
chain_monitor: nodes[0].chain_monitor,
tx_broadcaster: nodes[0].tx_broadcaster.clone(),
logger: &logger,
channel_monitors,
}).unwrap()
};
nodes_0_deserialized = nodes_0_deserialized_tmp;
assert!(nodes_0_read.is_empty());
assert!(nodes[0].chain_monitor.watch_channel(chan_0_monitor.get_funding_txo().0, chan_0_monitor).is_ok());
nodes[0].node = &nodes_0_deserialized;
check_added_monitors!(nodes[0], 1);
reconnect_nodes(&nodes[0], &nodes[1], (false, false), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (false, false));
fail_payment(&nodes[0], &[&nodes[1]], our_payment_hash);
claim_payment(&nodes[0], &[&nodes[1]], our_payment_preimage);
} | rust_cleaned_test_functions.jsonl/16897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
12144,
88686,
15768,
9050,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343,
82,
7,
17,
11,
609,
5658... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_node_read_index_to_old_leader() {
let l = default_logger();
let r1 = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l);
let r2 = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage(), &l);
let r3 = new_test_raft(3, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut nt = Network::new(vec![Some(r1), Some(r2), Some(r3)], &l);
// elect r1 as leader
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
let mut test_entries = Entry::default();
test_entries.data = b"testdata".to_vec();
let _ = nt.peers.get_mut(&2).unwrap().step(new_message_with_entries(
2,
2,
MessageType::MsgReadIndex,
vec![test_entries.clone()],
));
assert_eq!(nt.peers[&2].msgs.len(), 1);
let read_index_msg1 =
new_message_with_entries(2, 1, MessageType::MsgReadIndex, vec![test_entries.clone()]);
assert_eq!(read_index_msg1, nt.peers[&2].msgs[0]);
let _ = nt.peers.get_mut(&3).unwrap().step(new_message_with_entries(
3,
3,
MessageType::MsgReadIndex,
vec![test_entries.clone()],
));
assert_eq!(nt.peers[&3].msgs.len(), 1);
let read_index_msg2 =
new_message_with_entries(3, 1, MessageType::MsgReadIndex, vec![test_entries.clone()]);
assert_eq!(nt.peers[&3].msgs[0], read_index_msg2);
// now elect r3 as leader
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
let _ = nt.peers.get_mut(&1).unwrap().step(read_index_msg1);
let _ = nt.peers.get_mut(&1).unwrap().step(read_index_msg2);
assert_eq!(nt.peers[&1].msgs.len(), 2);
assert_eq!(
nt.peers[&1].msgs[0],
new_message_with_entries(2, 3, MessageType::MsgReadIndex, vec![test_entries.clone()])
);
assert_eq!(
nt.peers[&1].msgs[1],
new_message_with_entries(3, 3, MessageType::MsgReadIndex, vec![test_entries])
);
} | rust_cleaned_test_functions.jsonl/33964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
6443,
3560,
2346,
21108,
79991,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
435,
16,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_candles() {
delay();
let client: Public<Sync> = Public::new(SANDBOX_URL);
let end = Utc::now();
let candles = client
.get_candles("BTC-USD", None, Some(end), Granularity::M1)
.unwrap();
assert!(candles[0].0 > candles[1].0);
} | rust_cleaned_test_functions.jsonl/50635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
666,
20125,
368,
341,
262,
7626,
543,
262,
1077,
2943,
25,
3066,
27,
12154,
29,
284,
3066,
486,
931,
3759,
1093,
3506,
60155,
8000,
317,
262,
1077,
835,
284,
547,
10413,
486,
3328,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_app() {
let json = br#"
{"response":{
"server":"prod",
"protocol":"3.0"
}}"#;
assert!(parse_json_response(json).is_err());
} | rust_cleaned_test_functions.jsonl/14140 | {
"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,
40447,
8191,
368,
341,
262,
1077,
2951,
284,
1411,
2,
698,
4913,
2322,
12602,
330,
4030,
3252,
19748,
756,
330,
17014,
3252,
18,
13,
15,
698,
23386,
2,
280,
262,
2060,
10297,
6400,
9455,
9655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nonce_must_be_advanceable() {
let (genesis_config, _mint_keypair) = create_genesis_config(100_000_000);
let mut bank = Bank::new_for_tests(&genesis_config);
bank.feature_set = Arc::new(FeatureSet::all_enabled());
let bank = Arc::new(bank);
let nonce_keypair = Keypair::new();
let nonce_authority = nonce_keypair.pubkey();
let durable_nonce =
DurableNonce::from_blockhash(&bank.last_blockhash(), true /* separate domains */);
let nonce_account = AccountSharedData::new_data(
42_424_242,
&nonce::state::Versions::new_current(nonce::State::Initialized(
nonce::state::Data::new(nonce_authority, durable_nonce, 5000),
)),
&system_program::id(),
)
.unwrap();
bank.store_account(&nonce_keypair.pubkey(), &nonce_account);
let ix =
system_instruction::advance_nonce_account(&nonce_keypair.pubkey(), &nonce_authority);
let message = Message::new(&[ix], Some(&nonce_keypair.pubkey()));
let tx = Transaction::new(&[&nonce_keypair], message, *durable_nonce.as_hash());
assert_eq!(
bank.process_transaction(&tx),
Err(TransactionError::BlockhashNotFound)
);
} | rust_cleaned_test_functions.jsonl/28925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 603
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
717,
590,
21263,
98093,
480,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poa_normal_update() {
// deploy contract
let mut context = Context::default();
let poa_bin: Bytes = Loader::default().load_binary("poa.strip");
let poa_out_point = context.deploy_cell(poa_bin);
let always_success_out_point = context.deploy_cell(ALWAYS_SUCCESS.clone());
// prepare scripts
let poa_owner_script1 = context
.build_script(&always_success_out_point, random_32bytes())
.expect("build script");
let poa_owner_script2 = context
.build_script(&always_success_out_point, random_32bytes())
.expect("build script");
let simple_lock_script = context
.build_script(&always_success_out_point, random_32bytes())
.expect("build script");
let poa_data_type_id_args = random_32bytes();
let poa_setup_type_id_args = random_32bytes();
let poa_data_type_id_script = Script::new_builder()
.code_hash(h256!("0x545950455f4944").pack())
.hash_type(ScriptHashType::Type.into())
.args(poa_data_type_id_args.pack())
.build();
let poa_setup_type_id_script = Script::new_builder()
.code_hash(h256!("0x545950455f4944").pack())
.hash_type(ScriptHashType::Type.into())
.args(poa_setup_type_id_args.pack())
.build();
let poa_lock_data = {
let mut buffer = BytesMut::new();
buffer.extend_from_slice(&poa_setup_type_id_args);
buffer.extend_from_slice(&poa_data_type_id_args);
buffer.freeze()
};
let poa_lock_script = context
.build_script(&poa_out_point, poa_lock_data)
.expect("build script");
let poa_script_dep = CellDep::new_builder()
.out_point(poa_out_point.clone())
.build();
let always_success_script_dep = CellDep::new_builder()
.out_point(always_success_out_point.clone())
.build();
// prepare cells
let poa_setup_out_point = context.create_cell(
CellOutput::new_builder()
.capacity(1000u64.pack())
.lock(simple_lock_script.clone())
.type_(
ScriptOpt::new_builder()
.set(Some(poa_setup_type_id_script.clone()))
.build(),
)
.build(),
serialize_poa_setup(&PoASetup {
identity_size: 32,
round_interval_uses_seconds: true,
identities: vec![
poa_owner_script1.calc_script_hash().as_bytes(),
poa_owner_script2.calc_script_hash().as_bytes(),
],
aggregator_change_threshold: 2,
round_intervals: 90,
subblocks_per_round: 1,
}),
);
let poa_setup_dep = CellDep::new_builder()
.out_point(poa_setup_out_point.clone())
.build();
let owner_input_out_point = context.create_cell(
CellOutput::new_builder()
.capacity(500u64.pack())
.lock(poa_owner_script2.clone())
.build(),
Bytes::new(),
);
let owner_input = CellInput::new_builder()
.previous_output(owner_input_out_point)
.build();
let poa_input_out_point = context.create_cell(
CellOutput::new_builder()
.capacity(1000u64.pack())
.lock(poa_lock_script.clone())
.build(),
Bytes::from_static(b"old"),
);
let poa_input = CellInput::new_builder()
.previous_output(poa_input_out_point)
.since(0x400000000000044cu64.pack())
.build();
let poa_data_input_out_point = context.create_cell(
CellOutput::new_builder()
.capacity(1000u64.pack())
.lock(simple_lock_script.clone())
.type_(
ScriptOpt::new_builder()
.set(Some(poa_data_type_id_script.clone()))
.build(),
)
.build(),
serialize_poa_data(&PoAData {
round_initial_subtime: 1000,
subblock_subtime: 1000,
aggregator_index: 0,
subblock_index: 0,
}),
);
let poa_data_input = CellInput::new_builder()
.previous_output(poa_data_input_out_point)
.build();
let outputs = vec![
CellOutput::new_builder()
.capacity(1000u64.pack())
.lock(poa_lock_script.clone())
.build(),
CellOutput::new_builder()
.capacity(1000u64.pack())
.lock(simple_lock_script.clone())
.type_(
ScriptOpt::new_builder()
.set(Some(poa_data_type_id_script.clone()))
.build(),
)
.build(),
];
let outputs_data = vec![
Bytes::from_static(b"new"),
serialize_poa_data(&PoAData {
round_initial_subtime: 1100,
subblock_subtime: 1100,
aggregator_index: 1,
subblock_index: 0,
}),
];
// build transaction
let tx = TransactionBuilder::default()
.input(poa_input)
.input(poa_data_input)
.input(owner_input)
.outputs(outputs)
.outputs_data(outputs_data.pack())
.cell_dep(poa_setup_dep)
.cell_dep(poa_script_dep)
.cell_dep(always_success_script_dep)
.build();
let tx = context.complete_tx(tx);
// run
let cycles = context
.verify_tx(&tx, MAX_CYCLES)
.expect("pass verification");
println!("consume cycles: {}", cycles);
// dump raw test tx files
let setup = RunningSetup {
is_lock_script: true,
is_output: false,
script_index: 0,
native_binaries: HashMap::default(),
};
write_native_setup(
"poa_normal_update",
"poa_sim",
&tx,
&context,
&setup,
0,
true,
);
} | rust_cleaned_test_functions.jsonl/22880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2917
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
19533,
13973,
8882,
368,
341,
262,
442,
10517,
5116,
198,
262,
1077,
5206,
2266,
284,
9608,
486,
2258,
543,
262,
1077,
3193,
64,
21816,
25,
30024,
284,
27811,
486,
2258,
1005,
1078,
31761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parquet_globbing() -> Result<()> {
// for side effects
init_files();
let _guard = SINGLE_LOCK.lock().unwrap();
let glob = "../../examples/aggregate_multiple_files_in_chunks/datasets/*.parquet";
let df = LazyFrame::scan_parquet(
glob.into(),
ScanArgsParquet {
n_rows: None,
cache: true,
parallel: true,
rechunk: false,
},
)?
.collect()?;
assert_eq!(df.shape(), (54, 4));
let cal = df.column("calories")?;
assert_eq!(cal.get(0), AnyValue::Int64(45));
assert_eq!(cal.get(53), AnyValue::Int64(194));
Ok(())
} | rust_cleaned_test_functions.jsonl/74079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22654,
23300,
95133,
7132,
368,
1464,
5714,
71698,
341,
262,
442,
369,
3108,
6239,
198,
262,
2930,
10931,
543,
262,
1077,
716,
26098,
284,
66759,
27661,
21003,
1005,
15454,
543,
262,
1077,
13206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encode_packets() {
let b = GetElementAttributesResponse {
title: Some(String::from(
"Lorem ipsum dolor sit amet,\
consectetur adipiscing elit. Nunc eget elit cursus ipsum \
fermentum viverra id vitae lorem. Cras luctus elementum \
metus vel volutpat. Vestibulum ante ipsum primis in \
faucibus orci luctus et ultrices posuere cubilia \
Curae; Praesent efficitur velit sed metus luctus",
)),
artist_name: Some(String::from(
"elit euismod. \
Sed ex mauris, convallis a augue ac, hendrerit \
blandit mauris. Integer porttitor velit et posuere pharetra. \
Nullam ultricies justo sit amet lorem laoreet, id porta elit \
gravida. Suspendisse sed lectus eu lacus efficitur finibus. \
Sed egestas pretium urna eu pellentesque. In fringilla nisl dolor, \
sit amet luctus purus sagittis et. Mauris diam turpis, luctus et pretium nec, \
aliquam sed odio. Nulla finibus, orci a lacinia sagittis,\
urna elit ultricies dolor, et condimentum magna mi vitae sapien. \
Suspendisse potenti. Vestibulum ante ipsum primis in faucibus orci \
luctus et ultrices posuere cubilia Curae",
)),
album_name: Some(String::from(
"Mauris in ante ultrices, vehicula lorem non, sagittis metus.\
Nam facilisis volutpat quam. Suspendisse sem ipsum, blandit ut faucibus vitae,\
facilisis quis massa. Aliquam sagittis, orci sed dignissim vulputate, odio neque \
tempor dui, vel feugiat metus massa id urna. Nam at risus sem.\
Duis commodo suscipit metus, at placerat elit suscipit eget. Suspendisse interdum \
id metus vitae porta. Ut cursus viverra imperdiet. Aliquam erat volutpat. \
Curabitur vehicula mauris nec ex sollicitudin rhoncus. Integer ipsum libero, \
porta id velit et, egestas facilisis tellus.",
)),
genre: Some(String::from(
"Mauris in ante ultrices, vehicula lorem non, sagittis metus.\
Nam facilisis volutpat quam. Suspendisse sem ipsum, blandit ut faucibus vitae,\
facilisis quis massa. Aliquam sagittis, orci sed dignissim vulputate, odio neque \
tempor dui, vel feugiat metus massa id urna. Nam at risus sem.\
Duis commodo suscipit metus, at placerat elit suscipit eget. Suspendisse interdum \
id metus vitae porta. Ut cursus viverra imperdiet. Aliquam erat volutpat. \
Curabitur vehicula mauris nec ex sollicitudin rhoncus. Integer ipsum libero, \
porta id velit et, egestas facilisis tellus.",
)),
..GetElementAttributesResponse::default()
};
let packets = b.encode_packets().expect("unable to encode packets for event");
println!(
"count: {}, len of 0: {}, packets: {:x?}",
packets.len(),
packets[0].len(),
packets
);
assert!(packets.len() > 2);
// each packet should be the get element attributes PDU type
assert_eq!(packets[0][0], 0x20);
assert_eq!(packets[1][0], 0x20);
assert_eq!(packets[0][1], 0b01); // first packet should be a start packet.
assert_eq!(packets[1][1], 0b10); // second packet should be a continue packet.
assert_eq!(packets[packets.len() - 1][1], 0b11); // last packet should be a stop packet.
for p in packets {
assert!(p.len() <= 512);
}
} | rust_cleaned_test_functions.jsonl/93007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1888
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
63569,
368,
341,
286,
1077,
293,
284,
2126,
1691,
10516,
2582,
341,
310,
2265,
25,
4329,
2242,
486,
1499,
1006,
394,
330,
32783,
26342,
23655,
2444,
27212,
42871,
338,
35140,
57924,
30060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ensure_parachain_running_or_error_liquidated_fails() {
run_test(|| {
ext::security::ensure_parachain_status_running::<Test>
.mock_safe(|| MockResult::Return(Err(Error::ParachainNotRunning)));
assert_err!(
Redeem::ensure_parachain_running_or_error_liquidated(),
Error::ParachainNotRunning
);
ext::security::ensure_parachain_status_has_only_specific_errors::<Test>
.mock_safe(|_| MockResult::Return(Err(Error::Invalid)));
assert_err!(
Redeem::ensure_parachain_running_or_error_liquidated(),
Error::Invalid
);
})
} | rust_cleaned_test_functions.jsonl/26914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
27289,
22654,
610,
466,
37333,
8734,
4096,
62,
53637,
657,
761,
6209,
368,
341,
262,
1598,
4452,
79453,
341,
286,
1303,
486,
17039,
486,
27289,
22654,
610,
466,
4773,
37333,
27638,
2271,
397,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stdin_negative_23_line() {
new_ucmd!()
.args(&["-n", "-23"])
.pipe_in_fixture(INPUT)
.run()
.stdout_is_fixture("lorem_ipsum_1_line.expected");
} | rust_cleaned_test_functions.jsonl/32756 | {
"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,
15656,
258,
53865,
62,
17,
18,
6528,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
77,
497,
6523,
17,
18,
14108,
286,
659,
13768,
1243,
74409,
57911,
340,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bare() {
assert_leaf! {
parsers [ bare ]
"hello" -> 0..5 { Bare }
}
assert_leaf! {
parsers [ bare ]
"chrome.exe" -> 0..10 { Bare }
}
assert_leaf! {
parsers [ bare ]
r"C:\windows\system.dll" -> 0..21 { Bare }
}
assert_leaf! {
parsers [ bare ]
r"C:\Code\-testing\my_tests.js" -> 0..28 { Bare }
}
} | rust_cleaned_test_functions.jsonl/46720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
546,
368,
341,
286,
2060,
38909,
0,
341,
310,
87073,
508,
12461,
5133,
310,
330,
14990,
1,
1464,
220,
15,
496,
20,
314,
60792,
456,
286,
555,
286,
2060,
38909,
0,
341,
310,
87073,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seed_compute_once() {
let seed_compute = SeedHashCompute::default();
let hash = [241, 175, 44, 134, 39, 121, 245, 239, 228, 236, 43, 160, 195, 152, 46, 7, 199, 5, 253, 147, 241, 206, 98, 43, 3, 104, 17, 40, 192, 79, 106, 162];
assert_eq!(seed_compute.hash_block_number(486382), hash);
} | rust_cleaned_test_functions.jsonl/19646 | {
"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,
33809,
57028,
7630,
368,
341,
197,
10217,
10320,
57028,
284,
35822,
6370,
46254,
486,
2258,
543,
197,
10217,
5175,
284,
508,
17,
19,
16,
11,
220,
16,
22,
20,
11,
220,
19,
19,
11,
220,
16,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_machine_request_builder_defaults() {
let request = TimeMachineRequestBuilder::new(
API_KEY, LAT, LONG, TIME
).build();
let expected_url = Url::parse(&format!(
"{base}/{key}/{lat:.16},{long:.16},{time}?",
base = FORECAST_URL,
key = API_KEY,
lat = LAT,
long = LONG,
time = TIME
)).unwrap();
let expected = TimeMachineRequest::new(
API_KEY,
LAT,
LONG,
TIME,
expected_url,
Vec::new(),
None,
None
);
assert_eq!(expected.api_key, request.api_key);
assert_eq!(expected.latitude, request.latitude);
assert_eq!(expected.longitude, request.longitude);
assert_eq!(expected.time, request.time);
assert_eq!(expected.exclude, request.exclude);
assert_eq!(expected.lang, request.lang);
assert_eq!(expected.units, request.units);
assert_eq!(expected.url, request.url);
assert_eq!(expected, request);
} | rust_cleaned_test_functions.jsonl/24717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 574
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
38695,
7893,
28532,
42290,
368,
341,
286,
1077,
1681,
284,
4120,
21605,
1900,
3297,
486,
931,
1006,
310,
5333,
6600,
11,
53187,
11,
33942,
11,
22236,
198,
286,
7457,
5834,
1428,
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_config_initialize_contains_duplicates_fails() {
solana_logger::setup();
let config_address = Pubkey::new_unique();
let signer0_pubkey = Pubkey::new_unique();
let signer0_account = AccountSharedData::new(0, 0, &Pubkey::new_unique());
let keys = vec![
(config_address, false),
(signer0_pubkey, true),
(signer0_pubkey, true),
];
let (config_keypair, config_account) = create_config_account(keys.clone());
let config_pubkey = config_keypair.pubkey();
let my_config = MyConfig::new(42);
// Attempt initialization with duplicate signer inputs
let instruction = config_instruction::store(&config_pubkey, true, keys, &my_config);
process_instruction(
&instruction.data,
vec![
(config_pubkey, config_account),
(signer0_pubkey, signer0_account),
],
vec![
AccountMeta {
pubkey: config_pubkey,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: signer0_pubkey,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: signer0_pubkey,
is_signer: true,
is_writable: false,
},
],
Err(InstructionError::InvalidArgument),
);
} | rust_cleaned_test_functions.jsonl/74379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 866
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
40889,
63598,
75051,
761,
6209,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2193,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
70039,
15,
34014,
792,
284,
22611,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_new_id() {
let (bytes, handles) =
TestInterfaceEvent::NewId { arg: NEW_ID_VALUE }.into_message(SENDER_ID).unwrap().take();
assert!(handles.is_empty());
assert_eq!(bytes, message_bytes!(SENDER_ID, 5 /* opcode */, NEW_ID_VALUE));
} | rust_cleaned_test_functions.jsonl/55801 | {
"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,
88686,
5921,
842,
368,
341,
286,
1077,
320,
9651,
11,
13469,
8,
4035,
310,
3393,
5051,
1556,
486,
3564,
764,
314,
1392,
25,
16165,
3450,
7476,
16908,
18122,
6462,
51048,
35689,
3450,
568,
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_build_call() {
let context = Context::create();
let module = context.create_module("sum");
let builder = context.create_builder();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[], false);
let function = module.add_function("get_pi", fn_type, None);
let basic_block = context.append_basic_block(&function, "entry");
builder.position_at_end(&basic_block);
let pi = f32_type.const_float(::std::f64::consts::PI);
builder.build_return(Some(&pi));
let function2 = module.add_function("wrapper", fn_type, None);
let basic_block2 = context.append_basic_block(&function2, "entry");
builder.position_at_end(&basic_block2);
let pi2_call_site = builder.build_call(function, &[], "get_pi");
assert!(!pi2_call_site.is_tail_call());
pi2_call_site.set_tail_call(true);
assert!(pi2_call_site.is_tail_call());
let pi2 = pi2_call_site.try_as_basic_value().left().unwrap();
builder.build_return(Some(&pi2));
assert!(module.verify().is_ok());
// Test using function `PointerValue`
let void_type = context.void_type();
let fn_type2 = void_type.fn_type(&[], false);
let function3 = module.add_function("call_fn", fn_type2, None);
let basic_block3 = context.append_basic_block(&function3, "entry");
let fn_ptr = function3.as_global_value().as_pointer_value();
let fn_ptr_type = fn_ptr.get_type();
builder.position_at_end(&basic_block3);
let alloca = builder.build_alloca(fn_ptr_type, "alloca");
builder.build_store(alloca, fn_ptr);
let load = builder.build_load(alloca, "load").into_pointer_value();
builder.build_call(load, &[], "call");
builder.build_return(None);
assert!(module.verify().is_ok());
} | rust_cleaned_test_functions.jsonl/39110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
13429,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
1242,
797,
262,
1077,
7363,
284,
2266,
2520,
28532,
1428,
262,
1077,
282,
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_from_environment_format() {
std::env::set_var("TIME_STYLE", "+%F");
assert_eq!(
Some(DateFlag::Formatted("%F".into())),
DateFlag::from_environment()
);
} | rust_cleaned_test_functions.jsonl/1315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
51774,
8955,
368,
341,
286,
1460,
486,
3160,
486,
746,
4612,
445,
18129,
41775,
497,
6630,
4,
37,
797,
286,
2060,
10714,
33673,
310,
4329,
19987,
12135,
486,
43500,
4430,
37,
3263,
18122,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transform() {
let mut transform = Transform::new("12345678");
transform.advance();
assert_eq!(transform.signal(), "48226158");
transform.advance();
assert_eq!(transform.signal(), "34040438");
transform.advance();
assert_eq!(transform.signal(), "03415518");
transform.advance();
assert_eq!(transform.signal(), "01029498");
assert_eq!(
first_eight_after_100_phases("80871224585914546619083218645595"),
String::from("24176176")
);
assert_eq!(
first_eight_after_100_phases("19617804207202209144916044189917"),
String::from("73745418")
);
assert_eq!(
first_eight_after_100_phases("69317163492948606335995924319873"),
String::from("52432133")
);
} | rust_cleaned_test_functions.jsonl/95568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
368,
341,
286,
1077,
5206,
5165,
284,
15226,
486,
931,
445,
16,
17,
18,
19,
20,
21,
22,
23,
797,
286,
5165,
80889,
543,
286,
2060,
10714,
10297,
4701,
50453,
1507,
330,
19,
23,
17,
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_escape_string() {
assert_eq!(escape_string(""), "");
assert_eq!(escape_string("no escaping here"), "no escaping here");
assert_eq!(escape_string(r#"'"\"#), r#"'\"\\"#);
} | rust_cleaned_test_functions.jsonl/26709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21832,
3904,
368,
341,
286,
2060,
10714,
10297,
12998,
3904,
86076,
14498,
286,
2060,
10714,
10297,
12998,
3904,
445,
2152,
52654,
1588,
3975,
330,
2152,
52654,
1588,
797,
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 |
#[test]
fn test_wildcard() {
quick_test(
"SELECT * from person",
"Projection: #id, #first_name, #last_name, #age, #state, #salary, #birth_date\
\n TableScan: person projection=None",
);
} | rust_cleaned_test_functions.jsonl/15371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
695,
4951,
368,
341,
286,
3974,
4452,
1006,
310,
330,
4858,
353,
504,
1697,
756,
310,
330,
46321,
25,
671,
307,
11,
671,
3896,
1269,
11,
671,
4259,
1269,
11,
671,
424,
11,
671,
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,
1... | 1 |
#[test]
fn test_append() {
assert_eq!(
append("key", "value", None, None),
"append key 0 0 5\r\nvalue\r\n"
);
} | rust_cleaned_test_functions.jsonl/26811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
368,
341,
286,
2060,
10714,
33673,
310,
8737,
445,
792,
497,
330,
957,
497,
2240,
11,
2240,
1326,
310,
330,
5090,
1376,
220,
15,
220,
15,
220,
20,
12016,
1699,
957,
12016,
1699,
698,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_poh_recorder_tick_sent_after_min() {
let ledger_path = get_tmp_ledger_path!();
{
let blocktree =
Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger");
let GenesisBlockInfo { genesis_block, .. } = create_genesis_block(2);
let bank = Arc::new(Bank::new(&genesis_block));
let prev_hash = bank.last_blockhash();
let (mut poh_recorder, entry_receiver) = PohRecorder::new(
0,
prev_hash,
0,
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blocktree),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
);
let working_bank = WorkingBank {
bank: bank.clone(),
min_tick_height: 2,
max_tick_height: 3,
};
poh_recorder.set_working_bank(working_bank);
poh_recorder.tick();
poh_recorder.tick();
//tick height equal to min_tick_height
//no tick has been sent
assert_eq!(poh_recorder.tick_cache.last().unwrap().1, 2);
assert!(entry_receiver.try_recv().is_err());
// all ticks are sent after height > min
poh_recorder.tick();
assert_eq!(poh_recorder.tick_height, 3);
assert_eq!(poh_recorder.tick_cache.len(), 0);
let (bank_, e) = entry_receiver.recv().expect("recv 1");
assert_eq!(e.len(), 3);
assert_eq!(bank_.slot(), bank.slot());
assert!(poh_recorder.working_bank.is_none());
}
Blocktree::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/31719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 983
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
7080,
1358,
43612,
24115,
19844,
7260,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
9344,
4035,
394,
8362,
9344,
486,
2508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_macro() {
let array1 = [1u8; 32];
let array2 = [2u8; 16];
let array3 = [3u8; 8];
let bytes = to_bytes![array1, array2, array3].unwrap();
assert_eq!(bytes.len(), 56);
let mut actual_bytes = Vec::new();
actual_bytes.extend_from_slice(&array1);
actual_bytes.extend_from_slice(&array2);
actual_bytes.extend_from_slice(&array3);
assert_eq!(bytes, actual_bytes);
} | rust_cleaned_test_functions.jsonl/64714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58810,
368,
341,
286,
1077,
1334,
16,
284,
508,
16,
84,
23,
26,
220,
18,
17,
935,
286,
1077,
1334,
17,
284,
508,
17,
84,
23,
26,
220,
16,
21,
935,
286,
1077,
1334,
18,
284,
508,
18,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_result_backoff() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
// Create an IfaceManagerService
let test_values = test_setup(&mut exec);
let (mut iface_manager, _stream) = create_iface_manager_with_client(&test_values, true);
// Scans will be initiated to perform network selection if clients become disconnected.
let mut disconnected_clients = HashSet::<u16>::new();
// Create a timer to periodically check to ensure that all client interfaces are connected.
let mut reconnect_monitor_interval: i64 = 1;
let mut connectivity_monitor_timer =
fasync::Interval::new(zx::Duration::from_seconds(reconnect_monitor_interval));
// Simulate multiple failed scan attempts and ensure that the timer interval backs off as
// expected.
let expected_wait_times =
vec![2, 4, 8, MAX_AUTO_CONNECT_RETRY_SECONDS, MAX_AUTO_CONNECT_RETRY_SECONDS];
for i in 0..5 {
{
let fut = handle_network_selection_results(
None,
&mut iface_manager,
&mut disconnected_clients,
&mut reconnect_monitor_interval,
&mut connectivity_monitor_timer,
);
pin_mut!(fut);
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(()));
}
assert_eq!(reconnect_monitor_interval, expected_wait_times[i]);
}
} | rust_cleaned_test_functions.jsonl/62736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
5287,
3895,
1847,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
442,
4230,
458,
1416,
578,
2043,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_0092_example_1() {
let head = linked![1, 2, 3, 4, 5];
let left = 2;
let right = 4;
let result = linked![1, 4, 3, 2, 5];
assert_eq!(Solution::reverse_between(head, left, right), result);
} | rust_cleaned_test_functions.jsonl/5690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
24,
17,
39304,
62,
16,
368,
341,
286,
1077,
1968,
284,
10592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
2115,
284,
220,
17,
280,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clear() {
let mut cache = LruCache::new(2);
cache.insert(1, 10);
cache.insert(2, 20);
cache.clear();
assert!(cache.get_mut(&1).is_none());
assert!(cache.get_mut(&2).is_none());
assert_eq!(format!("{:?}", cache), "{}");
} | rust_cleaned_test_functions.jsonl/36850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
368,
341,
286,
1077,
5206,
6500,
284,
444,
2672,
8233,
486,
931,
7,
17,
317,
286,
6500,
7030,
7,
16,
11,
220,
16,
15,
317,
286,
6500,
7030,
7,
17,
11,
220,
17,
15,
317,
286,
6500,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ln_pdf() {
let ln_pdf = |arg: f64| move |x: FisherSnedecor| x.ln_pdf(arg);
test_almost(0.1, 0.1, 0.0234154207226588982471f64.ln(), 1e-15, ln_pdf(1.0));
test_almost(1.0, 0.1, 0.0396064560910663979961f64.ln(), 1e-15, ln_pdf(1.0));
test_almost(10.0, 0.1, 0.0418440630400545297349f64.ln(), 1e-13, ln_pdf(1.0));
test_almost(0.1, 1.0, 0.0396064560910663979961f64.ln(), 1e-15, ln_pdf(1.0));
test_almost(1.0, 1.0, 0.1591549430918953357689f64.ln(), 1e-15, ln_pdf(1.0));
test_almost(10.0, 1.0, 0.230361989229138647108f64.ln(), 1e-15, ln_pdf(1.0));
test_case(0.1, 0.1, 0.00221546909694001013517f64.ln(), ln_pdf(10.0));
test_almost(1.0, 0.1, 0.00369960370387922619592f64.ln(), 1e-15, ln_pdf(10.0));
test_almost(10.0, 0.1, 0.00390179721174142927402f64.ln(), 1e-13, ln_pdf(10.0));
test_almost(0.1, 1.0, 0.00319864073359931548273f64.ln(), 1e-15, ln_pdf(10.0));
test_almost(1.0, 1.0, 0.009150765837179460915678f64.ln(), 1e-15, ln_pdf(10.0));
test_case(10.0, 1.0, 0.0116493859171442148446f64.ln(), ln_pdf(10.0));
test_almost(0.1, 10.0, 0.00305087016058573989694f64.ln(), 1e-13, ln_pdf(10.0));
test_case(1.0, 10.0, 0.00271897749113479577864f64.ln(), ln_pdf(10.0));
test_almost(10.0, 10.0, 2.4289227234060500084E-4f64.ln(), 1e-14, ln_pdf(10.0));
} | rust_cleaned_test_functions.jsonl/42690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 808
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60401,
39948,
368,
341,
286,
1077,
29390,
39948,
284,
760,
858,
25,
282,
21,
19,
91,
3271,
760,
87,
25,
35504,
50,
18694,
757,
269,
91,
856,
918,
77,
39948,
9404,
317,
286,
1273,
94418,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_buf() {
assert_eq!(
PathBufWrp::get_pathbuf("/test/.tt").map(|t| t.0),
Err(UriSegmentError::BadStart('.'))
);
assert_eq!(
PathBufWrp::get_pathbuf("/test/*tt").map(|t| t.0),
Err(UriSegmentError::BadStart('*'))
);
assert_eq!(
PathBufWrp::get_pathbuf("/test/tt:").map(|t| t.0),
Err(UriSegmentError::BadEnd(':'))
);
assert_eq!(
PathBufWrp::get_pathbuf("/test/tt<").map(|t| t.0),
Err(UriSegmentError::BadEnd('<'))
);
assert_eq!(
PathBufWrp::get_pathbuf("/test/tt>").map(|t| t.0),
Err(UriSegmentError::BadEnd('>'))
);
assert_eq!(
PathBufWrp::get_pathbuf("/seg1/seg2/").unwrap().0,
PathBuf::from_iter(vec!["seg1", "seg2"])
);
assert_eq!(
PathBufWrp::get_pathbuf("/seg1/../seg2/").unwrap().0,
PathBuf::from_iter(vec!["seg2"])
);
} | rust_cleaned_test_functions.jsonl/35504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
10363,
368,
341,
286,
2060,
10714,
33673,
310,
7933,
15064,
54,
22252,
486,
455,
2638,
5909,
4283,
1944,
11930,
5566,
1827,
2186,
22428,
83,
91,
259,
13,
15,
1326,
310,
15495,
52252,
21086,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3_mask() {
let mut a = Vec3::zero();
a.set_x(1.0);
a.set_y(1.0);
a.set_z(1.0);
assert!(!a.cmpeq(Vec3::zero()).any());
assert!(a.cmpeq(Vec3::splat(1.0)).all());
} | rust_cleaned_test_functions.jsonl/126299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
9999,
368,
341,
262,
1077,
5206,
264,
284,
11312,
18,
486,
14154,
543,
262,
264,
980,
3212,
7,
16,
13,
15,
317,
262,
264,
980,
4178,
7,
16,
13,
15,
317,
262,
264,
980,
6415,
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_set_operator_and_add_new_validator() {
let num_nodes = 3;
let (env, op_tool, _, _) = launch_swarm_with_op_tool_and_backend(num_nodes, 0);
// Create new validator and validator operator keys and accounts
let (validator_key, validator_account) = create_new_test_account();
let (operator_key, operator_account) = create_new_test_account();
// Write the validator key to a file and create the validator account
let validator_key_path = write_key_to_file(
&validator_key.public_key(),
&env,
write_key_to_file_hex_format,
);
let libra_backend = load_libra_root_storage(&env.validator_swarm, 0);
let val_human_name = "new_validator";
let (txn_ctx, _) = op_tool
.create_validator(
val_human_name,
validator_key_path.to_str().unwrap(),
&libra_backend,
false,
)
.unwrap();
assert_eq!(VMStatusView::Executed, txn_ctx.execution_result.unwrap());
// Write the operator key to a file and create the operator account
let operator_key_path = write_key_to_file(
&operator_key.public_key(),
&env,
write_key_to_file_lcs_format,
);
let op_human_name = "new_operator";
let (txn_ctx, _) = op_tool
.create_validator_operator(
op_human_name,
operator_key_path.to_str().unwrap(),
&libra_backend,
true,
)
.unwrap();
// Wait for transaction execution
let mut client = env.get_validator_client(0, None);
client
.wait_for_transaction(txn_ctx.address, txn_ctx.sequence_number + 1)
.unwrap();
// Verify that the transaction was executed
let txn_ctx = op_tool
.validate_transaction(txn_ctx.address, txn_ctx.sequence_number)
.unwrap();
assert_eq!(VMStatusView::Executed, txn_ctx.execution_result.unwrap());
// Overwrite the keys in storage to execute the command from the new validator's perspective
let backend = load_backend_storage(&env.validator_swarm, 0);
let mut storage: Storage = (&backend).try_into().unwrap();
storage.set(OWNER_ACCOUNT, validator_account).unwrap();
storage
.import_private_key(OWNER_KEY, validator_key)
.unwrap();
// Verify no validator operator
let libra_json_rpc = get_json_rpc_libra_interface(&env.validator_swarm, 0);
let account_state = libra_json_rpc
.retrieve_account_state(validator_account)
.unwrap();
let val_config_resource = account_state
.get_validator_config_resource()
.unwrap()
.unwrap();
assert!(val_config_resource.delegated_account.is_none());
assert!(val_config_resource.validator_config.is_none());
// Set the validator operator
let txn_ctx = op_tool
.set_validator_operator(op_human_name, operator_account, &backend, true)
.unwrap();
assert!(txn_ctx.execution_result.is_none());
// Wait for transaction execution
client
.wait_for_transaction(txn_ctx.address, txn_ctx.sequence_number + 1)
.unwrap();
// Verify the operator has been set correctly
let account_state = libra_json_rpc
.retrieve_account_state(validator_account)
.unwrap();
let val_config_resource = account_state
.get_validator_config_resource()
.unwrap()
.unwrap();
assert_eq!(
operator_account,
val_config_resource.delegated_account.unwrap()
);
assert!(val_config_resource.validator_config.is_none());
// Overwrite the keys in storage to execute the command from the new operator's perspective
storage.set(OPERATOR_ACCOUNT, operator_account).unwrap();
storage
.import_private_key(OPERATOR_KEY, operator_key)
.unwrap();
// Set the validator config
let network_address = Some(NetworkAddress::from_str("/ip4/10.0.0.16/tcp/80").unwrap());
let txn_ctx = op_tool
.set_validator_config(
network_address.clone(),
network_address,
&backend,
true,
false,
)
.unwrap();
assert!(txn_ctx.execution_result.is_none());
// Wait for transaction execution
client
.wait_for_transaction(txn_ctx.address, txn_ctx.sequence_number + 1)
.unwrap();
// Check the validator set size
let validator_set_infos = op_tool.validator_set(None, &backend).unwrap();
assert_eq!(num_nodes, validator_set_infos.len());
assert!(validator_set_infos
.iter()
.find(|info| info.account_address == validator_account)
.is_none());
// Add the validator to the validator set
let txn_ctx = op_tool
.add_validator(validator_account, &libra_backend, true)
.unwrap();
// Wait for transaction execution
client
.wait_for_transaction(txn_ctx.address, txn_ctx.sequence_number + 1)
.unwrap();
// Verify that the transaction wasn't executed
let txn_ctx = op_tool
.validate_transaction(txn_ctx.address, txn_ctx.sequence_number)
.unwrap();
assert_eq!(VMStatusView::Executed, txn_ctx.execution_result.unwrap());
// Check the new validator has been added to the set
let validator_set_infos = op_tool.validator_set(None, &backend).unwrap();
assert_eq!(num_nodes + 1, validator_set_infos.len());
let validator_info = validator_set_infos
.iter()
.find(|info| info.account_address == validator_account)
.unwrap();
assert_eq!(validator_account, validator_info.account_address);
assert_eq!(val_human_name, validator_info.name);
// Try and add the same validator again and watch it fail
let txn_ctx = op_tool
.add_validator(validator_account, &libra_backend, false)
.unwrap();
assert_ne!(VMStatusView::Executed, txn_ctx.execution_result.unwrap());
} | rust_cleaned_test_functions.jsonl/64962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
40594,
8378,
2891,
5921,
64959,
368,
341,
262,
1077,
1629,
14896,
284,
220,
18,
280,
262,
1077,
320,
3160,
11,
1179,
22785,
11,
8358,
27439,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_leader_transfer_with_check_quorum() {
let l = default_logger();
let mut nt = Network::new(vec![None, None, None], &l);
for i in 1..4 {
let r = &mut nt.peers.get_mut(&i).unwrap();
r.check_quorum = true;
let election_timeout = r.election_timeout();
r.set_randomized_election_timeout(election_timeout + i as usize);
}
let b_election_timeout = nt.peers[&2].election_timeout();
nt.peers
.get_mut(&2)
.unwrap()
.set_randomized_election_timeout(b_election_timeout + 1);
// Letting peer 2 electionElapsed reach to timeout so that it can vote for peer 1
for _ in 0..b_election_timeout {
nt.peers.get_mut(&2).unwrap().tick();
}
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
assert_eq!(nt.peers[&1].leader_id, 1);
// Transfer leadership to 2.
nt.send(vec![new_message(2, 1, MessageType::MsgTransferLeader, 0)]);
check_leader_transfer_state(&nt.peers[&1], StateRole::Follower, 2);
nt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
nt.send(vec![new_message(1, 2, MessageType::MsgTransferLeader, 0)]);
check_leader_transfer_state(&nt.peers[&1], StateRole::Leader, 1);
} | rust_cleaned_test_functions.jsonl/19159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
35403,
6615,
7200,
11280,
33006,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
31412,
284,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
11,
2240,
1125,
609,
75,
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... | 3 |
#[test]
fn test_file() {
rsix::fs::accessat(
&rsix::fs::cwd(),
"Cargo.toml",
rsix::fs::Access::READ_OK,
rsix::fs::AtFlags::empty(),
)
.unwrap();
assert_eq!(
rsix::fs::openat(
&rsix::fs::cwd(),
"Cagro.motl",
rsix::fs::OFlags::RDONLY,
rsix::fs::Mode::empty(),
)
.unwrap_err(),
rsix::io::Error::NOENT
);
let file = rsix::fs::openat(
&rsix::fs::cwd(),
"Cargo.toml",
rsix::fs::OFlags::RDONLY,
rsix::fs::Mode::empty(),
)
.unwrap();
assert_eq!(
rsix::fs::openat(
&file,
"Cargo.toml",
rsix::fs::OFlags::RDONLY,
rsix::fs::Mode::empty(),
)
.unwrap_err(),
rsix::io::Error::NOTDIR
);
#[cfg(not(any(
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
)))]
rsix::fs::fadvise(&file, 0, 10, rsix::fs::Advice::Normal).unwrap();
assert_eq!(
rsix::fs::fcntl_getfd(&file).unwrap(),
rsix::fs::FdFlags::empty()
);
assert_eq!(
rsix::fs::fcntl_getfl(&file).unwrap(),
rsix::fs::OFlags::empty()
);
let stat = rsix::fs::fstat(&file).unwrap();
assert!(stat.st_size > 0);
assert!(stat.st_blocks > 0);
#[cfg(not(any(target_os = "netbsd", target_os = "wasi")))]
// not implemented in libc for netbsd yet
{
let statfs = rsix::fs::fstatfs(&file).unwrap();
assert!(statfs.f_blocks > 0);
}
assert_eq!(rsix::io::is_read_write(&file).unwrap(), (true, false));
assert_ne!(rsix::io::ioctl_fionread(&file).unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/38296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
368,
341,
262,
10036,
941,
486,
3848,
486,
5211,
266,
1006,
286,
609,
5428,
941,
486,
3848,
486,
32165,
3148,
286,
330,
98228,
73494,
75,
756,
286,
10036,
941,
486,
3848,
486,
6054,
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_mmap_region_new() {
assert!(MmapRegion::new(0).is_err());
let size = 4096;
let r = MmapRegion::new(4096).unwrap();
assert_eq!(r.size(), size);
assert!(r.file_offset().is_none());
assert_eq!(r.prot(), libc::PROT_READ | libc::PROT_WRITE);
assert_eq!(
r.flags(),
libc::MAP_ANONYMOUS | libc::MAP_NORESERVE | libc::MAP_PRIVATE
);
} | rust_cleaned_test_functions.jsonl/37 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
2186,
20627,
5921,
368,
341,
286,
2060,
10297,
44,
2186,
14091,
486,
931,
7,
15,
568,
285,
9266,
5231,
286,
1077,
1379,
284,
220,
19,
15,
24,
21,
401,
286,
1077,
435,
284,
386,
2186,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_from_impl_struct_variant() {
check_assist(
generate_from_impl_for_enum,
r#"
//- minicore: from
enum A { $0One { x: u32 } }
"#,
r#"
enum A { One { x: u32 } }
impl From<u32> for A {
fn from(x: u32) -> Self {
Self::One { x }
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/4572 | {
"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,
2891,
5673,
21007,
15126,
46112,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6923,
5673,
21007,
5478,
31054,
345,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
504,
198,
9018,
362,
314,
400,
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_gen_with_serde() -> io::Result<()> {
let cake_entity = setup().get(0).unwrap().clone();
assert_eq!(cake_entity.get_table_name_snake_case(), "cake");
// Compact code blocks
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/compact_with_serde/cake_none.rs").into(),
WithSerde::None,
),
Box::new(EntityWriter::gen_compact_code_blocks),
)?;
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/compact_with_serde/cake_serialize.rs").into(),
WithSerde::Serialize,
),
Box::new(EntityWriter::gen_compact_code_blocks),
)?;
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/compact_with_serde/cake_deserialize.rs").into(),
WithSerde::Deserialize,
),
Box::new(EntityWriter::gen_compact_code_blocks),
)?;
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/compact_with_serde/cake_both.rs").into(),
WithSerde::Both,
),
Box::new(EntityWriter::gen_compact_code_blocks),
)?;
// Expanded code blocks
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/expanded_with_serde/cake_none.rs").into(),
WithSerde::None,
),
Box::new(EntityWriter::gen_expanded_code_blocks),
)?;
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/expanded_with_serde/cake_serialize.rs").into(),
WithSerde::Serialize,
),
Box::new(EntityWriter::gen_expanded_code_blocks),
)?;
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/expanded_with_serde/cake_deserialize.rs").into(),
WithSerde::Deserialize,
),
Box::new(EntityWriter::gen_expanded_code_blocks),
)?;
assert_serde_variant_results(
&cake_entity,
&(
include_str!("../../tests/expanded_with_serde/cake_both.rs").into(),
WithSerde::Both,
),
Box::new(EntityWriter::gen_expanded_code_blocks),
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/76352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
6615,
75861,
450,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
19145,
19169,
284,
6505,
1005,
455,
7,
15,
568,
15454,
1005,
19982,
1428,
286,
2060,
10714,
10297,
47384,
19169,
670,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_to_log_level_filter() {
assert_eq!(LogLevelFilter::Error, LogLevel::Error.to_log_level_filter());
assert_eq!(LogLevelFilter::Trace, LogLevel::Trace.to_log_level_filter());
} | rust_cleaned_test_functions.jsonl/73936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
5224,
8274,
8727,
368,
341,
260,
2060,
10714,
10297,
72676,
5632,
486,
1454,
11,
63321,
486,
1454,
2389,
5224,
8274,
8727,
1423,
260,
2060,
10714,
10297,
72676,
5632,
486,
6550,
11,
63321,
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 |
#[test]
fn test_underscore_not_greedily() {
parse_macro(
r#"
macro_rules! q {
($($a:ident)* _) => {0};
}
"#,
)
.assert_expand_items(r#"q![a b c d _]"#, r#"0"#);
parse_macro(
r#"
macro_rules! q {
($($a:expr => $b:ident)* _ => $c:expr) => {0};
}
"#,
)
.assert_expand_items(r#"q![a => b c => d _ => ou]"#, r#"0"#);
} | rust_cleaned_test_functions.jsonl/28750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
53933,
7913,
1889,
28516,
1541,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
32606,
21407,
0,
2804,
341,
262,
1711,
699,
64,
25,
1713,
4806,
27439,
589,
314,
15,
2440,
532,
57676,
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_gpg_config() -> Result<()> {
let args = Args::default();
let config = GpgConfig::new(&args)?;
config.check_gpgme_version(GPGME_REQUIRED_VERSION);
Ok(())
} | rust_cleaned_test_functions.jsonl/71424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
3517,
5332,
368,
1464,
5714,
71698,
341,
197,
10217,
2827,
284,
17693,
486,
2258,
543,
197,
10217,
2193,
284,
479,
3517,
2648,
486,
931,
2099,
2116,
40007,
197,
25873,
9093,
1889,
3517,
2660... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rpc_get_tx_count() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let genesis = create_genesis_config(10);
let bank = Arc::new(Bank::new(&genesis.genesis_config));
// Add 4 transactions
bank.transfer(1, &genesis.mint_keypair, &bob_pubkey)
.unwrap();
bank.transfer(2, &genesis.mint_keypair, &bob_pubkey)
.unwrap();
bank.transfer(3, &genesis.mint_keypair, &bob_pubkey)
.unwrap();
bank.transfer(4, &genesis.mint_keypair, &bob_pubkey)
.unwrap();
let meta = JsonRpcRequestProcessor::new_from_bank(&bank);
let mut io = MetaIoHandler::default();
io.extend_with(rpc_minimal::MinimalImpl.to_delegate());
let req = r#"{"jsonrpc":"2.0","id":1,"method":"getTransactionCount"}"#;
let res = io.handle_request_sync(req, meta);
let expected = r#"{"jsonrpc":"2.0","result":4,"id":1}"#;
let expected: Response =
serde_json::from_str(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/3021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
17805,
3180,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
59366,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
317,
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_read_write_padded() {
let len = 1016; // Use a multiple of 254.
let data = vec![255u8; len];
let mut padded = Vec::new();
let mut reader = Fr32Reader::new(Cursor::new(&data));
reader
.read_to_end(&mut padded)
.expect("in-memory read failed");
assert_eq!(
padded.len(),
FR32_PADDING_MAP.transform_byte_offset(len, true)
);
let mut unpadded = Vec::new();
let unpadded_written =
write_unpadded(&padded, &mut unpadded, 0, len).expect("un-padded write failed");
assert_eq!(unpadded_written, len);
assert_eq!(data, unpadded);
assert_eq!(padded.into_boxed_slice(), bit_vec_padding(data));
} | rust_cleaned_test_functions.jsonl/75457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
620,
16828,
368,
341,
286,
1077,
2422,
284,
220,
16,
15,
16,
21,
26,
442,
5443,
264,
5248,
315,
220,
17,
20,
19,
624,
286,
1077,
821,
284,
7486,
20703,
17,
20,
20,
84,
23,
26,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_counts() -> io::Result<()> {
let counts: Counts = vec![
(String::from("AADAT"), 302),
(String::from("CLN3"), 37),
(String::from("PAK4"), 145),
]
.into_iter()
.collect();
let ids = vec![
String::from("AADAT"),
String::from("CLN3"),
String::from("NEO1"),
String::from("PAK4"),
];
let mut writer = Writer::new(Vec::new());
writer.write_counts(&ids, &counts)?;
let actual = writer.get_ref();
let expected = b"\
AADAT\t302
CLN3\t37
NEO1\t0
PAK4\t145
";
assert_eq!(&actual[..], &expected[..]);
Ok(())
} | rust_cleaned_test_functions.jsonl/112570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
25977,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
14579,
25,
85659,
284,
7486,
90515,
310,
320,
703,
486,
1499,
445,
81380,
828,
3975,
220,
18,
15,
17,
1326,
310,
320,
703,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_closure() {
// Ensuring presence of this closure doesn't break other things
let hdr = indoc! {"
#include <functional>
#include <cstdint>
inline bool take_closure(std::function<bool(const uint32_t number)> fn) {
return fn(5);
}
inline uint32_t get_a() {
return 3;
}
"};
let rs = quote! {
assert_eq!(ffi::get_a(), 3);
};
run_test("", hdr, rs, &["get_a"], &[]);
} | rust_cleaned_test_functions.jsonl/9908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72823,
368,
341,
262,
442,
57868,
1677,
9362,
315,
419,
21955,
3171,
944,
1438,
1008,
2513,
198,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
49228,
397,
262,
671,
997,
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_module_path_env_override_bad_segments() {
use std::path::PathBuf;
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
d.push("tests/modules");
let tremor_path = format!("{}:snot:badger:/horse", d.display());
let empty: Vec<String> = vec![];
let mp = load_(&tremor_path);
assert_ne!(empty, mp.mounts);
assert_eq!(1, mp.mounts.len());
assert_eq!(format!("{}", d.display()).to_string(), mp.mounts[0]);
} | rust_cleaned_test_functions.jsonl/81652 | {
"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,
10750,
2638,
15879,
48576,
34199,
55735,
368,
341,
286,
990,
1460,
486,
2343,
486,
1820,
15064,
280,
286,
1077,
5206,
294,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rust_reference() {
let hdr = indoc! {"
#include <cstdint>
struct RustType;
inline uint32_t take_rust_reference(const RustType&) {
return 4;
}
"};
let rs = quote! {
let foo = RustType(3);
assert_eq!(ffi::take_rust_reference(&foo), 4);
};
run_test_ex(
"",
hdr,
rs,
quote! {
generate!("take_rust_reference")
extern_rust_type!(RustType)
},
None,
None,
Some(quote! {
pub struct RustType(i32);
}),
);
} | rust_cleaned_test_functions.jsonl/9931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
25433,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
96975,
1339,
262,
2036,
33789,
929,
280,
262,
7381,
2622,
18,
17,
528,
1896,
1710,
590,
25433,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_trait_compilation() {
let mut m = Matrix::new_identity();
let _x = m.get(AffineMember::ScaleX);
m.set(AffineMember::ScaleX, 1.0);
} | rust_cleaned_test_functions.jsonl/1095 | {
"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,
3062,
2602,
78491,
18177,
13455,
368,
972,
262,
1077,
5206,
296,
284,
11631,
486,
931,
46244,
1647,
262,
1077,
716,
87,
284,
296,
670,
4346,
542,
482,
9366,
486,
6947,
55,
736,
262,
296,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_middle_edits() {
let needle = b"ANNGTTCNGNT";
let haystack = b"ACGACTAGTTATAAAAATTCNACTCCANTTAGCTCCCTACTTTCCGAGAG";
check_test(needle, haystack, 5);
} | rust_cleaned_test_functions.jsonl/83260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62580,
32370,
1199,
368,
341,
286,
1077,
30309,
284,
293,
1,
1093,
6140,
51,
7749,
6140,
6408,
876,
286,
1077,
88447,
284,
293,
1,
1706,
38,
6823,
1890,
14903,
4485,
50107,
828,
7749,
45,
6823,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_static_mod() {
struct Id;
type Mod = StaticMod32<Id>;
Mod::set(1_000_000_007);
assert_eq!(Mod::get(), 1_000_000_007);
Mod::set(998_244_353);
assert_eq!(Mod::get(), 998_244_353);
} | rust_cleaned_test_functions.jsonl/38823 | {
"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,
25360,
7480,
368,
972,
394,
2036,
5223,
463,
394,
943,
5650,
284,
23105,
4459,
18,
17,
27,
764,
84109,
394,
5650,
486,
746,
7,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
22,
736,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_entry_tx_random_execution_no_error() {
// entropy multiplier should be big enough to provide sufficient entropy
// but small enough to not take too much time while executing the test.
let entropy_multiplier: usize = 25;
let initial_lamports = 100;
// number of accounts need to be in multiple of 4 for correct
// execution of the test.
let num_accounts = entropy_multiplier * 4;
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config((num_accounts + 1) as u64 * initial_lamports);
let bank = Arc::new(Bank::new_for_tests(&genesis_config));
let mut keypairs: Vec<Keypair> = vec![];
for _ in 0..num_accounts {
let keypair = Keypair::new();
let create_account_tx = system_transaction::transfer(
&mint_keypair,
&keypair.pubkey(),
0,
bank.last_blockhash(),
);
assert_eq!(bank.process_transaction(&create_account_tx), Ok(()));
assert_matches!(
bank.transfer(initial_lamports, &mint_keypair, &keypair.pubkey()),
Ok(_)
);
keypairs.push(keypair);
}
let mut tx_vector: Vec<Transaction> = vec![];
for i in (0..num_accounts).step_by(4) {
tx_vector.append(&mut vec![
system_transaction::transfer(
&keypairs[i + 1],
&keypairs[i].pubkey(),
initial_lamports,
bank.last_blockhash(),
),
system_transaction::transfer(
&keypairs[i + 3],
&keypairs[i + 2].pubkey(),
initial_lamports,
bank.last_blockhash(),
),
]);
}
// Transfer lamports to each other
let entry = next_entry(&bank.last_blockhash(), 1, tx_vector);
assert_eq!(
process_entries_for_tests(&bank, vec![entry], true, None, None),
Ok(())
);
bank.squash();
// Even number keypair should have balance of 2 * initial_lamports and
// consistent.
for (i, keypair) in keypairs.iter().enumerate() {
if i % 2 == 0 {
assert_eq!(bank.get_balance(&keypair.pubkey()), 2 * initial_lamports);
} else {
assert_eq!(bank.get_balance(&keypair.pubkey()), 0);
}
}
} | rust_cleaned_test_functions.jsonl/46814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
9078,
17805,
22644,
60948,
6536,
4096,
368,
341,
286,
442,
47502,
30559,
1265,
387,
2409,
3322,
311,
3410,
14016,
47502,
198,
286,
442,
714,
2613,
3322,
311,
537,
1896,
2238,
1753,
882,
139... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_white_spaces() {
assert_eq!(js_parser_rs::parse(" ".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("\u{a0}".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("\u{b}".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("\u{c}".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("\t".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("; ".chars()), Ok(vec![TokenType::Semicolon]));
assert_eq!(js_parser_rs::parse(",".chars()), Ok(vec![TokenType::Comma]));
} | rust_cleaned_test_functions.jsonl/61518 | {
"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,
44431,
67883,
368,
341,
262,
2060,
10714,
10297,
2519,
18517,
47115,
486,
6400,
445,
5933,
19255,
11858,
7622,
25592,
0,
1294,
1106,
262,
2060,
10714,
10297,
2519,
18517,
47115,
486,
6400,
4921,
84,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_squaring() {
let mut a = Fq(FqRepr([
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0xffffffffffffffff,
0x19ffffffffffffff,
]));
assert!(a.is_valid());
a.square();
assert_eq!(
a,
Fq::from_repr(FqRepr([
0x1cfb28fe7dfbbb86,
0x24cbe1731577a59,
0xcce1d4edc120e66e,
0xdc05c659b4e15b27,
0x79361e5a802c6a23,
0x24bcbe5d51b9a6f
]))
.unwrap()
);
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
for _ in 0..1000000 {
let a = Fq::random(&mut rng);
let mut tmp = a;
tmp.square();
let mut tmp2 = a;
tmp2.mul_assign(&a);
assert_eq!(tmp, tmp2);
}
} | rust_cleaned_test_functions.jsonl/2327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
643,
446,
3249,
368,
341,
286,
1077,
5206,
264,
284,
434,
80,
7832,
80,
693,
649,
8956,
310,
220,
15,
41798,
53697,
345,
310,
220,
15,
41798,
53697,
345,
310,
220,
15,
41798,
53697,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_commit_style_colored_input_color_is_stripped_under_normal() {
let config = integration_test_utils::make_config_from_args(&[
"--commit-style",
"normal",
"--commit-decoration-style",
"omit",
]);
let output = integration_test_utils::run_delta(
GIT_DIFF_SINGLE_HUNK_WITH_ANSI_ESCAPE_SEQUENCES,
&config,
);
ansi_test_utils::assert_line_has_no_color(
&output,
0,
"commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e",
);
} | rust_cleaned_test_functions.jsonl/70055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
15117,
10211,
3018,
5898,
6714,
6892,
1261,
461,
6924,
58228,
13973,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
9640,
310,
14482,
17413,
11297,
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_function_call_in_function_call() {
assert_expression!(
"CheckProperty(LookupName(\"age\"), Confirm(1))",
Expression::func(
"CheckProperty",
vec![
Expression::func("LookupName", vec!["age".as_lit_expr(1, 32)]).at_rc(1, 21),
Expression::func("Confirm", vec![1.as_lit_expr(1, 48)]).at_rc(1, 40)
]
)
);
} | rust_cleaned_test_functions.jsonl/102648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
13429,
1243,
9174,
13429,
368,
341,
310,
2060,
28068,
33673,
394,
330,
3973,
3052,
4957,
1941,
454,
675,
36014,
424,
2105,
701,
33563,
7,
16,
593,
756,
394,
16378,
486,
2830,
1006,
503,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_first() {
let mut a = vec![];
assert_eq!(a.first(), None);
a = vec![11];
assert_eq!(a.first().unwrap(), &11);
a = vec![11, 12];
assert_eq!(a.first().unwrap(), &11);
} | rust_cleaned_test_functions.jsonl/12848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
368,
341,
262,
1077,
5206,
264,
284,
7486,
0,
15078,
262,
2060,
10714,
10297,
64,
7389,
1507,
2240,
317,
262,
264,
284,
7486,
20703,
16,
16,
935,
262,
2060,
10714,
10297,
64,
7389,
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_file_path_with_no_ext_no_dir() {
let (dir, name, ext) = file_path_name_ext("image");
assert_eq!(dir, None);
assert_eq!(name, "image");
assert_eq!(ext, None);
} | rust_cleaned_test_functions.jsonl/5161 | {
"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,
2458,
2638,
6615,
6536,
9927,
6536,
4334,
368,
341,
286,
1077,
320,
3741,
11,
829,
11,
1303,
8,
284,
1034,
2638,
1269,
9927,
445,
1805,
797,
286,
2060,
10714,
10297,
3741,
11,
2240,
317,
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 |
#[test]
fn test_handles() {
let mut context = create_ctx_without_session();
let (_capabs, _more) = context
.get_capability(CapabilityType::Handles, 0, 80)
.unwrap();
} | rust_cleaned_test_functions.jsonl/49679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68017,
368,
341,
286,
1077,
5206,
2266,
284,
1855,
15147,
39904,
12316,
1428,
286,
1077,
5453,
11346,
3435,
11,
716,
6384,
8,
284,
2266,
198,
310,
659,
455,
89686,
3025,
391,
2897,
929,
486,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sbc_media_codec_info() {
// Mandatory A2DP Sink support case.
let sbc_media_codec_info: SbcCodecInfo = SbcCodecInfo::new(
SbcSamplingFrequency::MANDATORY_SNK,
SbcChannelMode::MANDATORY_SNK,
SbcBlockCount::MANDATORY_SNK,
SbcSubBands::MANDATORY_SNK,
SbcAllocation::MANDATORY_SNK,
2,
250,
)
.expect("Couldn't create sbc media codec info.");
let res = sbc_media_codec_info.to_bytes();
assert_eq!(vec![0x3F, 0xFF, 2, 250], res);
let sbc_media_codec_info: SbcCodecInfo = SbcCodecInfo::new(
SbcSamplingFrequency::FREQ44100HZ,
SbcChannelMode::MONO | SbcChannelMode::DUAL_CHANNEL,
SbcBlockCount::MANDATORY_SRC,
SbcSubBands::MANDATORY_SRC,
SbcAllocation::MANDATORY_SRC,
2,
250,
)
.expect("Couldn't create sbc media codec info.");
let res = sbc_media_codec_info.to_bytes();
assert_eq!(vec![0x2C, 0xF5, 2, 250], res);
// No supported codec information
let sbc_codec_info: SbcCodecInfo = SbcCodecInfo::new(
SbcSamplingFrequency::empty(),
SbcChannelMode::empty(),
SbcBlockCount::empty(),
SbcSubBands::empty(),
SbcAllocation::empty(),
2,
250,
)
.expect("Couldn't create sbc media codec info.");
let res = sbc_codec_info.to_bytes();
assert_eq!(vec![0x00, 0x00, 2, 250], res);
// All codec field values are supported
let sbc_codec_info: SbcCodecInfo = SbcCodecInfo::new(
SbcSamplingFrequency::all(),
SbcChannelMode::all(),
SbcBlockCount::all(),
SbcSubBands::all(),
SbcAllocation::all(),
SbcCodecInfo::BITPOOL_MIN, // Smallest bitpool value.
SbcCodecInfo::BITPOOL_MAX, // Largest bitpool value.
)
.expect("Couldn't create sbc media codec info.");
let res = sbc_codec_info.to_bytes();
assert_eq!(vec![0xFF, 0xFF, 2, 250], res);
// Out of range bitpool value
let sbc_codec_info = SbcCodecInfo::new(
SbcSamplingFrequency::all(),
SbcChannelMode::all(),
SbcBlockCount::all(),
SbcSubBands::all(),
SbcAllocation::all(),
20,
252, // Too large.
);
assert!(sbc_codec_info.is_err());
// Out of range bitpool value
let sbc_codec_info = SbcCodecInfo::new(
SbcSamplingFrequency::all(),
SbcChannelMode::all(),
SbcBlockCount::all(),
SbcSubBands::all(),
SbcAllocation::all(),
0, // Too small
240,
);
assert!(sbc_codec_info.is_err());
// Invalid bitpool value
let sbc_codec_info = SbcCodecInfo::new(
SbcSamplingFrequency::all(),
SbcChannelMode::all(),
SbcBlockCount::all(),
SbcSubBands::all(),
SbcAllocation::all(),
100,
50,
);
assert!(sbc_codec_info.is_err());
} | rust_cleaned_test_functions.jsonl/26228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1765
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
8904,
29173,
51084,
3109,
368,
341,
286,
442,
70782,
362,
17,
10298,
56451,
1824,
1142,
624,
286,
1077,
7898,
66,
29173,
51084,
3109,
25,
328,
8904,
36913,
1731,
284,
328,
8904,
36913,
1731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let a = Affine::new(
FieldElement::from(u256h!(
"01ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca"
)),
FieldElement::from(u256h!(
"005668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"
)),
);
let b = Affine::new(
FieldElement::from(u256h!(
"00f24921907180cd42c9d2d4f9490a7bc19ac987242e80ac09a8ac2bcf0445de"
)),
FieldElement::from(u256h!(
"018a7a2ab4e795405f924de277b0e723d90eac55f2a470d8532113d735bdedd4"
)),
);
let c = Affine::new(
FieldElement::from(u256h!(
"0457342950d2475d9e83a4de8beb3c0850181342ea04690d804b37aa907b735f"
)),
FieldElement::from(u256h!(
"00011bd6102b929632ce605b5ae1c9c6c1b8cba2f83aa0c5a6d1247318871137"
)),
);
assert_eq!(a + b, c);
} | rust_cleaned_test_functions.jsonl/42019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
1077,
264,
284,
9748,
482,
486,
931,
1006,
310,
8601,
1691,
486,
1499,
8154,
17,
20,
21,
71,
33673,
394,
330,
15,
16,
823,
16,
20,
66,
16,
23,
20,
24,
24,
24,
22,
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_ident_pat_loc() {
check_location(r"fn my_fn(m$0) {}", ImmediateLocation::IdentPat);
check_location(r"fn my_fn() { let m$0 }", ImmediateLocation::IdentPat);
check_location(r"fn my_fn(&m$0) {}", ImmediateLocation::IdentPat);
check_location(r"fn my_fn() { let &m$0 }", ImmediateLocation::IdentPat);
} | rust_cleaned_test_functions.jsonl/24641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38399,
55824,
13400,
368,
341,
286,
1779,
13126,
2601,
1,
8822,
847,
15246,
1255,
3,
15,
8,
24689,
80310,
4707,
486,
28301,
27106,
317,
286,
1779,
13126,
2601,
1,
8822,
847,
15246,
368,
314,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duration_as_duration() {
test_none_with_extra(cast_duration_as_duration);
let cs = vec![
("11:30:45.123456", 6, 0, "11:30:45"),
("11:30:45.123456", 6, 1, "11:30:45.1"),
("11:30:45.123456", 6, 2, "11:30:45.12"),
("11:30:45.123456", 6, 3, "11:30:45.123"),
("11:30:45.123456", 6, 4, "11:30:45.1235"),
("11:30:45.123456", 6, 5, "11:30:45.12346"),
("11:30:45.123456", 6, 6, "11:30:45.123456"),
];
for (input, input_fsp, output_fsp, expect) in cs {
let rft = FieldTypeConfig {
decimal: output_fsp as isize,
..FieldTypeConfig::default()
}
.into();
let extra = make_extra(&rft);
let mut ctx = EvalContext::default();
let dur = Duration::parse(&mut ctx, input, input_fsp).unwrap();
let expect = Duration::parse(&mut ctx, expect, output_fsp).unwrap();
let r = cast_duration_as_duration(&extra, Some(&dur));
let result_str = r.as_ref().map(|x| x.map(|x| x.to_string()));
let log = format!(
"input: {}, input_fsp: {}, output_fsp: {}, expect: {}, output: {:?}",
input, input_fsp, output_fsp, expect, result_str
);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
11898,
25454,
368,
341,
286,
1273,
31488,
6615,
31858,
1337,
559,
25454,
11898,
25454,
626,
286,
1077,
10532,
284,
7486,
90515,
310,
3489,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_matched_error() {
let mut ps = ParseStream {
content: "Hello World".to_string(),
cursor: 1,
};
let err = ps.matched("[A-Z]+").unwrap_err();
assert_eq!(ps.cursor, 1);
assert_eq!(err.cursor, 1);
assert_eq!(err.message, "unable to match `[A-Z]+`".to_string());
} | rust_cleaned_test_functions.jsonl/41147 | {
"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,
93900,
4096,
368,
341,
286,
1077,
5206,
4726,
284,
14775,
3027,
341,
310,
2213,
25,
330,
9707,
4337,
3263,
983,
3904,
3148,
310,
8128,
25,
220,
16,
345,
286,
3634,
286,
1077,
1848,
284,
4726,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_der_bool() {
let empty = &b""[..];
let b_true = DerObject::from_obj(BerObjectContent::Boolean(true));
let b_false = DerObject::from_obj(BerObjectContent::Boolean(false));
assert_eq!(parse_der_bool(&[0x01, 0x01, 0x00]), Ok((empty, b_false)));
assert_eq!(parse_der_bool(&[0x01, 0x01, 0xff]), Ok((empty, b_true)));
assert_eq!(
parse_der_bool(&[0x01, 0x01, 0x7f]),
Err(Err::Error(BerError::DerConstraintFailed))
);
} | rust_cleaned_test_functions.jsonl/45859 | {
"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,
35345,
22159,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
293,
16082,
284,
12741,
1190,
486,
1499,
7328,
5349,
261,
1190,
2762,
486,
6890,
3715,
1106,
262,
1077,
293,
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_emit_testl_reg_reg() {
assert_emit!(0x85, 0xc0; emit_testl_reg_reg(RAX, RAX));
assert_emit!(0x85, 0xc6; emit_testl_reg_reg(RAX, RSI));
assert_emit!(0x41, 0x85, 0xc7; emit_testl_reg_reg(RAX, R15));
} | rust_cleaned_test_functions.jsonl/85422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
4452,
75,
4920,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
23,
20,
11,
220,
15,
8148,
15,
26,
16691,
4452,
75,
4920,
4920,
2785,
2954,
11,
431,
2954,
1106,
286,
2060,
69082,
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_next_for_all_sectors() {
let (format, d64) = get_fresh_d64();
for track in format.first_track..=format.last_track {
for sector in 0..format.tracks[track as usize].sectors {
let location = Location(track, sector);
let bam = d64.bam().unwrap();
let bam = bam.borrow();
let next = format.next_free_block(&bam, Some(location)).unwrap();
println!("next({}) -> {}", location, next);
}
}
} | rust_cleaned_test_functions.jsonl/9177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
5478,
5705,
3453,
12532,
368,
341,
286,
1077,
320,
2243,
11,
294,
21,
19,
8,
284,
633,
761,
2488,
814,
21,
19,
543,
286,
369,
3754,
304,
3561,
7389,
28545,
496,
28,
2243,
9110,
28545,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rotation_between_vectors_point() {
let point = 3_f64 * Point2::new(0_f64, 1_f64);
let vector1 = 5_f64 * Vector2::unit_y();
let vector2 = 12_f64 * Vector2::unit_x();
let rotation = Rotation2::rotation_between(&vector1, &vector2);
let expected = 3_f64 * Point2::new(1_f64, 0_f64);
let result = rotation.rotate_point(&point);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70475 | {
"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,
44813,
48302,
49158,
6085,
368,
341,
286,
1077,
1459,
284,
220,
18,
761,
21,
19,
353,
5126,
17,
486,
931,
7,
15,
761,
21,
19,
11,
220,
16,
761,
21,
19,
317,
286,
1077,
4621,
16,
284,
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_parse_bingo_card() {
assert_eq!(
BingoCard {
grid: ndarray::arr2(&[[1, 2], [3, 4]])
},
parse_bingo_card(&["1 2", " 3 4 "])
)
} | rust_cleaned_test_functions.jsonl/133043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
880,
27908,
16888,
368,
341,
262,
2060,
10714,
33673,
286,
92048,
5770,
341,
310,
5827,
25,
66883,
486,
1118,
17,
2099,
15505,
16,
11,
220,
17,
1125,
508,
18,
11,
220,
19,
26731,
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... | 1 |
#[test]
fn test_server_reset_client_side_encoder_stream() {
let (mut hconn, mut peer_conn) = connect();
peer_conn
.stream_reset_send(CLIENT_SIDE_ENCODER_STREAM_ID, Error::HttpNoError.code())
.unwrap();
let out = peer_conn.process(None, now());
hconn.process(out.dgram(), now());
assert_closed(&mut hconn, &Error::HttpClosedCriticalStream);
} | rust_cleaned_test_functions.jsonl/52196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
18983,
8179,
30862,
39068,
12673,
368,
341,
286,
1077,
320,
6984,
305,
5148,
11,
5206,
14397,
17241,
8,
284,
4564,
543,
286,
14397,
17241,
198,
310,
659,
4027,
18983,
13565,
52991,
10757,
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_expr_to_sql_operators() {
let pred = DeletePredicate {
range: TimestampRange::new(1, 2),
exprs: vec![
DeleteExpr {
column: String::from("col1"),
op: Op::Eq,
scalar: Scalar::I64(1),
},
DeleteExpr {
column: String::from("col2"),
op: Op::Ne,
scalar: Scalar::I64(2),
},
],
};
assert_eq!(&pred.expr_sql_string(), r#""col1"=1 AND "col2"!=2"#);
} | rust_cleaned_test_functions.jsonl/49503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
2346,
18063,
25634,
2973,
368,
341,
286,
1077,
4162,
284,
10428,
36329,
341,
310,
2088,
25,
32758,
6046,
486,
931,
7,
16,
11,
220,
17,
1326,
310,
15169,
82,
25,
7486,
90515,
394,
10428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_class_bounds() {
ok("class Foo
class A<T: Foo>
fun f() -> A<Foo> { return nil; }");
ok("open class Foo
class Bar: Foo
class A<T: Foo>
fun f() -> A<Bar> { return nil; }");
err(
"class Foo
class Bar
class A<T: Foo>
fun f() -> A<Bar> { return nil; }",
pos(4, 24),
Msg::ClassBoundNotSatisfied("Bar".into(), "Foo".into()),
);
err(
"class Foo
fun f<T: Foo>() {}
fun t() { f::<int>(); }",
pos(3, 23),
Msg::ClassBoundNotSatisfied("int".into(), "Foo".into()),
);
} | rust_cleaned_test_functions.jsonl/106636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
4790,
36878,
368,
341,
286,
5394,
445,
1040,
33428,
198,
310,
536,
362,
3125,
25,
33428,
397,
310,
2464,
282,
368,
1464,
362,
30499,
2624,
29,
314,
470,
2092,
26,
335,
3071,
286,
5394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_perspective_positive() {
let quad = BoundedQuadratic::new(2.5, 5., 1., -5., 6.);
let perspective = quad.perspective(2.);
assert_eq!(perspective.lower, 5.);
assert_eq!(perspective.upper, 10.);
assert_eq!(perspective.a, 0.5);
assert_eq!(perspective.b, -5.);
assert_eq!(perspective.c, 12.);
} | rust_cleaned_test_functions.jsonl/19874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
85091,
54160,
368,
341,
286,
1077,
27082,
284,
425,
13082,
2183,
88678,
486,
931,
7,
17,
13,
20,
11,
220,
20,
2572,
220,
16,
2572,
481,
20,
2572,
220,
21,
58957,
286,
1077,
13057,
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_subscribe() {
let id = "id1".to_string();
let client_id = ClientId::from(id.clone());
let connect1 = transient_connect(id);
let handle1 = connection_handle();
let req1 = ConnReq::new(client_id, connect1, handle1);
let mut session = Session::new_transient(req1);
let subscribe = proto::Subscribe {
packet_identifier: proto::PacketIdentifier::new(23).unwrap(),
subscribe_to: vec![proto::SubscribeTo {
topic_filter: "topic/new".to_string(),
qos: proto::QoS::AtMostOnce,
}],
};
let (suback, subscriptions) = session.subscribe(subscribe).unwrap();
assert_eq!(
proto::PacketIdentifier::new(23).unwrap(),
suback.packet_identifier
);
match session {
Session::Transient(ref connected) => {
assert_eq!(1, connected.state.subscriptions.len());
assert_eq!(
proto::QoS::AtMostOnce,
*connected.state.subscriptions["topic/new"].max_qos()
);
}
_ => panic!("not transient"),
}
assert_eq!(1, subscriptions.len());
let subscribe = proto::Subscribe {
packet_identifier: proto::PacketIdentifier::new(1).unwrap(),
subscribe_to: vec![proto::SubscribeTo {
topic_filter: "topic/new".to_string(),
qos: proto::QoS::AtLeastOnce,
}],
};
session.subscribe(subscribe).unwrap();
match session {
Session::Transient(ref connected) => {
assert_eq!(1, connected.state.subscriptions.len());
assert_eq!(
proto::QoS::AtLeastOnce,
*connected.state.subscriptions["topic/new"].max_qos()
);
}
_ => panic!("not transient"),
}
} | rust_cleaned_test_functions.jsonl/51750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1013
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88935,
368,
341,
286,
1077,
877,
284,
330,
307,
16,
3263,
983,
3904,
543,
286,
1077,
2943,
842,
284,
8423,
764,
486,
1499,
3724,
15997,
1423,
286,
1077,
4564,
16,
284,
40558,
15720,
3724,
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... | 3 |
#[test]
fn test_half() {
let vec = to_vec(&42.5f32).unwrap();
assert_eq!(vec, b"\xF9\x51\x50");
assert_eq!(from_slice::<f32>(&vec[..]).unwrap(), 42.5f32);
} | rust_cleaned_test_functions.jsonl/110274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40626,
368,
341,
262,
1077,
7486,
284,
311,
13251,
2099,
19,
17,
13,
20,
69,
18,
17,
568,
15454,
543,
262,
2060,
10714,
10297,
4083,
11,
293,
11934,
9770,
24,
3462,
20,
16,
3462,
20,
15,
797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_equal_after_deserialisation() {
let nonce = vec![1,2,3,4,5];
let salt = _get_test_salt();
let header = Header::new(1, "TEST_ENCRYPTION_METHOD", &nonce, salt);
let serialised_header = header.serialise().unwrap();
let deserialised_header = Header::deserialise(&serialised_header).unwrap();
assert_eq!(header.version, deserialised_header.version);
assert_eq!(header.time, deserialised_header.time);
assert_eq!(header.encryption_method, deserialised_header.encryption_method);
assert_eq!(header.nonce, deserialised_header.nonce);
assert_eq!(header.salt, deserialised_header.salt);
} | rust_cleaned_test_functions.jsonl/106123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
11478,
19844,
15768,
2848,
7923,
368,
341,
286,
1077,
39676,
284,
7486,
20703,
16,
11,
17,
11,
18,
11,
19,
11,
20,
935,
286,
1077,
12021,
284,
716,
455,
4452,
92280,
543,
286,
1077,
4247... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.