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_wire_size_array() {
let v1: [u32; 4] = [1, 2, 3, 4];
assert_eq!(v1.wire_size(), 4 * 4);
let v2: [u64; 4] = [1, 2, 3, 4];
assert_eq!(v2.wire_size(), 8 * 4);
} | rust_cleaned_test_functions.jsonl/38922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75206,
2368,
3858,
368,
341,
310,
1077,
348,
16,
25,
508,
84,
18,
17,
26,
220,
19,
60,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
310,
2060,
10714,
10297,
85,
16,
1418,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_local_cluster() {
solana_logger::setup();
const NUM_NODES: usize = 1;
let mut config = Config::default();
config.identity = Keypair::new();
config.duration = Duration::from_secs(1);
config.fund_amount = 100_000;
config.threads = 1;
config.transfer_delay = 20;
config.batch_size = 100;
config.chunk_size = 10;
config.account_groups = 1;
let Config {
fund_amount,
batch_size,
account_groups,
..
} = config;
let accounts_in_groups = batch_size * account_groups;
let cluster = LocalCluster::new(&mut ClusterConfig {
node_stakes: vec![100_000; NUM_NODES],
cluster_lamports: 100_000_000_000_000,
validator_configs: vec![ValidatorConfig::default(); NUM_NODES],
native_instruction_processors: [solana_exchange_program!()].to_vec(),
..ClusterConfig::default()
});
let faucet_keypair = Keypair::new();
cluster.transfer(
&cluster.funding_keypair,
&faucet_keypair.pubkey(),
2_000_000_000_000,
);
let (addr_sender, addr_receiver) = channel();
run_local_faucet(faucet_keypair, addr_sender, Some(1_000_000_000_000));
let faucet_addr = addr_receiver.recv_timeout(Duration::from_secs(2)).unwrap();
info!("Connecting to the cluster");
let nodes =
discover_cluster(&cluster.entry_point_info.gossip, NUM_NODES).unwrap_or_else(|err| {
error!("Failed to discover {} nodes: {:?}", NUM_NODES, err);
exit(1);
});
let (client, num_clients) = get_multi_client(&nodes);
info!("clients: {}", num_clients);
assert!(num_clients >= NUM_NODES);
const NUM_SIGNERS: u64 = 2;
airdrop_lamports(
&client,
&faucet_addr,
&config.identity,
fund_amount * (accounts_in_groups + 1) as u64 * NUM_SIGNERS,
);
do_bench_exchange(vec![client], config);
} | rust_cleaned_test_functions.jsonl/51187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 869
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
13564,
28441,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
733,
15943,
92948,
25,
22301,
284,
220,
16,
401,
262,
1077,
5206,
2193,
284,
5532,
486,
2258,
543,
262,
2193,
31455,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_impossible_range() {
let body = r#"{ "range" : { "test_u64" : { "gte" : 10, "lte" : 1 } } }"#;
let mut schema = SchemaBuilder::new();
schema.add_u64_field("test_u64", FAST);
let built = schema.build();
let req = serde_json::from_str::<RangeQuery>(body).unwrap().create_query(&built);
assert_eq!(req.is_err(), false);
} | rust_cleaned_test_functions.jsonl/76134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
17895,
10031,
9698,
368,
341,
286,
1077,
2487,
284,
435,
2,
14129,
330,
9669,
1,
549,
314,
330,
1944,
7300,
21,
19,
1,
549,
314,
330,
55067,
1,
549,
220,
16,
15,
11,
330,
48791,
1,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_connect_packets() {
assert_eq!(
Connect::decode(&mut Bytes::from_static(
b"\x00\x04MQTT\x05\xC0\x00\x3C\x00\x00\x0512345\x00\x04user\x00\x04pass"
)),
Ok(Connect {
clean_start: false,
keep_alive: 60,
client_id: ByteString::from_static("12345"),
last_will: None,
username: Some(ByteString::from_static("user")),
password: Some(Bytes::from_static(&b"pass"[..])),
session_expiry_interval_secs: None,
auth_method: None,
auth_data: None,
request_problem_info: true,
request_response_info: false,
receive_max: None,
topic_alias_max: 0,
user_properties: Vec::new(),
max_packet_size: None,
})
);
assert_eq!(
Connect::decode(&mut Bytes::from_static(
b"\x00\x04MQTT\x05\x14\x00\x3C\x00\x00\x0512345\x00\x00\x05topic\x00\x07message"
)),
Ok(Connect {
clean_start: false,
keep_alive: 60,
client_id: ByteString::from_static("12345"),
last_will: Some(LastWill {
qos: QoS::ExactlyOnce,
retain: false,
topic: ByteString::from_static("topic"),
message: Bytes::from_static(&b"message"[..]),
will_delay_interval_sec: None,
correlation_data: None,
message_expiry_interval: None,
content_type: None,
user_properties: Vec::new(),
is_utf8_payload: None,
response_topic: None,
}),
username: None,
password: None,
session_expiry_interval_secs: None,
auth_method: None,
auth_data: None,
request_problem_info: true,
request_response_info: false,
receive_max: None,
topic_alias_max: 0,
user_properties: Vec::new(),
max_packet_size: None,
})
);
assert_eq!(
Connect::decode(&mut Bytes::from_static(b"\x00\x02MQ00000000000000000000")),
Err(DecodeError::InvalidProtocol),
);
assert_eq!(
Connect::decode(&mut Bytes::from_static(b"\x00\x04MQAA00000000000000000000")),
Err(DecodeError::InvalidProtocol),
);
assert_eq!(
Connect::decode(&mut Bytes::from_static(b"\x00\x04MQTT\x0300000000000000000000")),
Err(DecodeError::UnsupportedProtocolLevel),
);
assert_eq!(
Connect::decode(&mut Bytes::from_static(
b"\x00\x04MQTT\x05\xff00000000000000000000"
)),
Err(DecodeError::ConnectReservedFlagSet)
);
assert_eq!(
ConnectAck::decode(&mut Bytes::from_static(b"\x01\x86\x00")),
Ok(ConnectAck {
session_present: true,
reason_code: ConnectAckReason::BadUserNameOrPassword,
..ConnectAck::default()
})
);
assert_eq!(
ConnectAck::decode(&mut Bytes::from_static(b"\x03\x86\x00")),
Err(DecodeError::ConnAckReservedFlagSet)
);
assert_decode_packet(
b"\x20\x03\x01\x86\x00",
Packet::ConnectAck(Box::new(ConnectAck {
session_present: true,
reason_code: ConnectAckReason::BadUserNameOrPassword,
..ConnectAck::default()
})),
);
assert_decode_packet([0b1110_0000, 0], Packet::Disconnect(Disconnect::default()));
} | rust_cleaned_test_functions.jsonl/19927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
15720,
63569,
368,
341,
286,
2060,
10714,
33673,
310,
13015,
486,
18196,
2099,
6984,
30024,
486,
1499,
25360,
1006,
394,
293,
11934,
87,
15,
15,
3462,
15,
19,
35169,
14903,
3462,
15,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_iter_refresh() {
#[cfg(miri)]
const N: usize = 32;
#[cfg(not(miri))]
const N: usize = 128;
let mut rng = rand::thread_rng();
for n in 0..N {
let mut map = HashMap::new();
for i in 0..n {
assert!(map.insert(i, 2 * i).is_none());
}
let hash_builder = map.hasher().clone();
let mut it = unsafe { map.table.iter() };
assert_eq!(it.len(), n);
let mut i = 0;
let mut left = n;
let mut removed = Vec::new();
loop {
// occasionally remove some elements
if i < n && rng.gen_bool(0.1) {
let hash_value = super::make_insert_hash(&hash_builder, &i);
unsafe {
let e = map.table.find(hash_value, |q| q.0.eq(&i));
if let Some(e) = e {
it.reflect_remove(&e);
let t = map.table.remove(e);
removed.push(t);
left -= 1;
} else {
assert!(removed.contains(&(i, 2 * i)), "{} not in {:?}", i, removed);
let e = map.table.insert(
hash_value,
(i, 2 * i),
super::make_hasher::<usize, _, usize, _>(&hash_builder),
);
it.reflect_insert(&e);
if let Some(p) = removed.iter().position(|e| e == &(i, 2 * i)) {
removed.swap_remove(p);
}
left += 1;
}
}
}
let e = it.next();
if e.is_none() {
break;
}
assert!(i < n);
let t = unsafe { e.unwrap().as_ref() };
assert!(!removed.contains(t));
let (key, value) = t;
assert_eq!(*value, 2 * key);
i += 1;
}
assert!(i <= n);
// just for safety:
assert_eq!(map.table.len(), left);
}
} | rust_cleaned_test_functions.jsonl/26991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
11723,
42076,
368,
341,
286,
11506,
14072,
1255,
20679,
5563,
286,
733,
451,
25,
22301,
284,
220,
18,
17,
280,
286,
11506,
14072,
24772,
1255,
20679,
22297,
286,
733,
451,
25,
22301,
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... | 8 |
#[test]
fn test_multiple_input_files_with_suppressed_headers() {
new_ucmd!()
.arg(FOOBAR_TXT)
.arg(FOOBAR_2_TXT)
.arg("-q")
.run()
.stdout_is_fixture("foobar_multiple_quiet.expected");
} | rust_cleaned_test_functions.jsonl/31133 | {
"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,
45233,
5898,
10931,
6615,
23723,
14318,
26719,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
7,
3788,
20608,
934,
84411,
340,
286,
659,
858,
7,
3788,
20608,
934,
62,
17,
84411,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_macro_expand_limit_width() {
do_limited_resolve(
r#"
macro_rules! foo {
($($ty:ty)*) => { foo!($($ty)*, $($ty)*); }
}
foo!(KABOOM);
"#,
16,
1000,
);
} | rust_cleaned_test_functions.jsonl/18466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58810,
67875,
14763,
7927,
368,
341,
286,
653,
907,
31511,
77291,
1006,
310,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
699,
1881,
25,
1881,
8,
3764,
589,
314,
15229,
0,
699,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop() {
let cmd = RelayCmd::DROP;
assert_eq!(Into::<u8>::into(cmd), 10_u8);
msg(cmd, "", &msg::RelayMsg::Drop);
} | rust_cleaned_test_functions.jsonl/66341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
368,
341,
262,
1077,
5439,
284,
46172,
15613,
486,
46627,
280,
262,
2060,
10714,
10297,
26591,
27638,
84,
23,
6831,
18122,
14160,
701,
220,
16,
15,
7300,
23,
626,
262,
3750,
14160,
11,
73... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_reinit_input_stream_by_unplugging_a_nondefault_input_device() {
test_unplug_a_device_on_an_active_stream(StreamType::INPUT, Scope::Input, false, 500);
} | rust_cleaned_test_functions.jsonl/23860 | {
"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,
1288,
2327,
5898,
12673,
3710,
4907,
500,
35268,
4306,
21637,
2258,
5898,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
29421,
11,
34920,
486,
2505,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_enforce_pass_empty() {
let mut envelope = envelope![];
let mut mock = MockLimiter::default();
let (_, limits) = EnvelopeLimiter::new(|s, q| mock.check(s, q))
.enforce(&mut envelope, &scoping())
.unwrap();
assert!(!limits.is_limited());
assert!(envelope.is_empty());
mock.assert_call(DataCategory::Error, None);
mock.assert_call(DataCategory::Attachment, None);
mock.assert_call(DataCategory::Session, None);
} | rust_cleaned_test_functions.jsonl/101160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
8833,
15464,
15124,
368,
341,
286,
1077,
5206,
34398,
284,
34398,
0,
40901,
286,
1077,
5206,
7860,
284,
14563,
43,
17700,
486,
2258,
543,
286,
1077,
39464,
13388,
8,
284,
2925,
18853,
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_simple_bh() {
#[derive(Clone)]
struct TestWindow {}
impl PedersenWindow for TestWindow {
const WINDOW_SIZE: usize = 63;
const NUM_WINDOWS: usize = 8;
}
let rng = &mut test_rng();
let params =
<BoweHopwoodPedersenCRH<JubJubProjective, TestWindow> as FixedLengthCRH>::setup(rng)
.unwrap();
<BoweHopwoodPedersenCRH<JubJubProjective, TestWindow> as FixedLengthCRH>::evaluate(
¶ms,
&[1, 2, 3],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/5139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
90581,
368,
341,
286,
11506,
27098,
65297,
5563,
286,
2036,
3393,
4267,
5613,
286,
11605,
19318,
87989,
4267,
369,
3393,
4267,
341,
310,
733,
39259,
4098,
25,
22301,
284,
220,
21,
18,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_code_verifier_challenge() {
let code_verifier =
PkceCodeVerifier::new("dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk".to_string());
assert_eq!(
PkceCodeChallenge::from_code_verifier_sha256(&code_verifier).as_str(),
"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
);
} | rust_cleaned_test_functions.jsonl/18580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
26042,
3049,
87406,
368,
341,
1066,
262,
1077,
2038,
26042,
3049,
4035,
286,
393,
74,
346,
2078,
82394,
486,
931,
445,
40955,
73,
723,
29754,
57,
19,
34,
13378,
1448,
33,
24,
17,
42,
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_deterministic_mnemonic() {
let zeros_entropy: [u8; 32] = [0; 32];
let ones_entropy: [u8; 32] = [1; 32];
let zeros_mnemonic = Mnemonic::mnemonic(&zeros_entropy).unwrap();
let other_zeros_mnemonic = Mnemonic::mnemonic(&zeros_entropy).unwrap();
let ones_mnemonic = Mnemonic::mnemonic(&ones_entropy).unwrap();
let zeros_mnemonic_words = zeros_mnemonic.to_string();
let other_zeros_mnemonic_words = other_zeros_mnemonic.to_string();
let ones_mnemonic_words = ones_mnemonic.to_string();
assert_eq!(zeros_mnemonic_words, other_zeros_mnemonic_words);
assert_ne!(zeros_mnemonic_words, ones_mnemonic_words);
} | rust_cleaned_test_functions.jsonl/21412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
16483,
4532,
717,
70775,
368,
341,
262,
1077,
17516,
50374,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
508,
15,
26,
220,
18,
17,
935,
262,
1077,
6174,
50374,
25,
508,
84,
23,
26,
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_next_should_work_in_chains() {
let mut lsys: LSystem = LSystem::new("AB".to_string());
let mut rule: HashMap<char, String> = HashMap::new();
rule.insert('A', "AB".to_string());
rule.insert('B', "A".to_string());
lsys.push(rule);
let next: LSystem = lsys.next().next();
assert_eq!(next.start, "ABAAB");
} | rust_cleaned_test_functions.jsonl/101654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
43378,
11498,
1243,
4138,
1735,
368,
341,
286,
1077,
5206,
326,
7791,
25,
444,
2320,
284,
444,
2320,
486,
931,
445,
1867,
3263,
983,
3904,
1423,
286,
1077,
5206,
5912,
25,
10528,
21919,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inside_triangle() {
let p = Point2::new(-5.645197896412814, 196.2149812486018);
let a = Point2::new(-6.77392, 199.37674);
let b = Point2::new(-5.41912, 194.42925);
let c = Point2::new(-3.972502120793216, 197.33392534246588);
dbg!(p.is_inside_triangle(a, b, c));
} | rust_cleaned_test_functions.jsonl/93217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72860,
70575,
368,
341,
262,
1077,
281,
284,
5126,
17,
486,
931,
4080,
20,
13,
21,
19,
20,
16,
24,
22,
23,
24,
21,
19,
16,
17,
23,
16,
19,
11,
220,
16,
24,
21,
13,
17,
16,
19,
24,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass() {
assert_eq!(to_be_false(&json!(false), &Value::Null, false), None);
assert_eq!(to_be_false(&json!(true), &Value::Null, true), None);
} | rust_cleaned_test_functions.jsonl/96777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
368,
341,
286,
2060,
10714,
10297,
983,
21263,
36015,
2099,
2236,
10297,
3849,
701,
609,
1130,
486,
3280,
11,
895,
701,
2240,
317,
286,
2060,
10714,
10297,
983,
21263,
36015,
2099,
2236,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_slice_args_eval_step_once() {
let mut eval_count = 0;
{
let mut step = || {
eval_count += 1;
-1
};
let arr = array![0, 1, 2, 3, 4];
assert_eq!(arr.slice(s![1..4;step()]), array![3, 2, 1]);
}
assert_eq!(eval_count, 1);
} | rust_cleaned_test_functions.jsonl/92597 | {
"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,
26488,
8384,
21296,
11946,
7630,
368,
341,
262,
1077,
5206,
5603,
3180,
284,
220,
15,
280,
262,
341,
286,
1077,
5206,
3019,
284,
1369,
341,
310,
5603,
3180,
1421,
220,
16,
280,
310,
481,
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... | 2 |
#[test]
fn test_brace_regression() {
let data = [137, 53, 3, 0, 4, 0];
assert_eq!(
parse(&data[..]).unwrap().token_tape,
vec![
BinaryToken::Token(13705),
BinaryToken::Array(2),
BinaryToken::End(1)
]
);
} | rust_cleaned_test_functions.jsonl/109433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17682,
578,
91144,
368,
341,
286,
1077,
821,
284,
508,
16,
18,
22,
11,
220,
20,
18,
11,
220,
18,
11,
220,
15,
11,
220,
19,
11,
220,
15,
935,
286,
2060,
10714,
33673,
310,
4715,
2099,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map() {
use std::collections::HashMap;
let mut map = HashMap::new();
map.insert((true, false), 4);
map.insert((false, false), 123);
assert_eq!(
Ok(map),
from_str(
"{
(true,false,):4,
(false,false,):123,
}"
)
);
} | rust_cleaned_test_functions.jsonl/1662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
368,
341,
262,
990,
1460,
486,
51137,
486,
18497,
401,
262,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
262,
2415,
7030,
1188,
1866,
11,
895,
701,
220,
19,
317,
262,
2415,
7030,
1188,
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_compile() {
let source = std::fs::read_to_string("../tests/output/Main/corefn.json").unwrap();
let externs = std::fs::File::open("../tests/output/Main/externs.cbor").unwrap();
let compiler = Compiler::new();
let thread = gluon::new_vm();
use gluon::import::{add_extern_module};
add_extern_module(&thread, "io", load_io_module);
compiler.compile(source.as_str(), externs, &thread);
} | rust_cleaned_test_functions.jsonl/130379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
368,
341,
262,
1077,
2530,
284,
1460,
486,
3848,
486,
878,
2346,
3904,
17409,
23841,
47016,
65241,
5320,
8822,
4323,
1827,
15454,
543,
262,
1077,
15637,
82,
284,
1460,
486,
3848,
486,
1703,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_emoji_id() {
assert_eq!(
EmojiId::new(123).expect("non zero"),
EmojiId::parse("<:name:123>").unwrap()
);
assert_eq!(
&ParseMentionErrorType::Sigil {
expected: &[":"],
found: Some('@'),
},
EmojiId::parse("<@123>").unwrap_err().kind(),
);
} | rust_cleaned_test_functions.jsonl/3589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62,
37523,
842,
368,
341,
286,
2060,
10714,
33673,
310,
82367,
764,
486,
931,
7,
16,
17,
18,
568,
17119,
445,
6280,
7168,
4461,
310,
82367,
764,
486,
6400,
9639,
25,
606,
25,
16,
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_adjust_lockouts_after_replay_future_tower() {
let mut tower = Tower::new_for_tests(10, 0.9);
tower.vote_state.votes.push_back(Lockout::new(13));
tower.vote_state.votes.push_back(Lockout::new(14));
let vote = Vote::new(vec![14], Hash::default());
tower.last_vote = vote;
tower.initialize_root(12);
let mut slot_history = SlotHistory::default();
slot_history.add(0);
slot_history.add(2);
let tower = tower
.adjust_lockouts_after_replay(2, &slot_history)
.unwrap();
assert_eq!(tower.root(), 12);
assert_eq!(tower.voted_slots(), vec![13, 14]);
assert_eq!(tower.stray_restored_slot, Some(14));
} | rust_cleaned_test_functions.jsonl/61180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
9818,
11672,
19844,
1288,
1363,
59740,
528,
1202,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
15,
11,
220,
15,
13,
24,
317,
286,
21271,
79422,
4387,
3133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unicode() {
assert_eq!(
apply(
r#"
"打包选项"
"#
.trim()
),
Ok(vec![Token::String(span(1, 1, "\"打包选项\""))])
)
} | rust_cleaned_test_functions.jsonl/27561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54662,
368,
341,
286,
2060,
10714,
33673,
310,
3796,
1006,
394,
435,
2,
698,
1,
112401,
109487,
698,
1,
4956,
503,
659,
10666,
741,
310,
2837,
310,
7622,
25592,
20703,
3323,
486,
703,
66092,
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 |
#[test]
fn test_expect_at_least_more() {
let mock = mock("GET", "/hello").expect_at_least(3).create();
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
mock.assert();
} | rust_cleaned_test_functions.jsonl/82432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68918,
3752,
88716,
36664,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
14990,
1827,
17119,
3752,
88716,
7,
18,
568,
3182,
1428,
262,
1681,
445,
3806,
608,
14990,
497,
14498,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lseek64() {
const CONTENTS: &'static [u8] = b"abcdef123456";
let mut tmp = tempfile().unwrap();
tmp.write(CONTENTS).unwrap();
lseek64(tmp.as_raw_fd(), 5, Whence::SeekSet).unwrap();
let mut buf = String::new();
tmp.read_to_string(&mut buf).unwrap();
assert_eq!(b"f123456", buf.as_bytes());
close(tmp.as_raw_fd()).unwrap();
} | rust_cleaned_test_functions.jsonl/4508 | {
"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,
907,
25713,
21,
19,
368,
341,
262,
733,
35768,
50,
25,
30136,
1978,
508,
84,
23,
60,
284,
293,
1,
41202,
16,
17,
18,
19,
20,
21,
876,
262,
1077,
5206,
4174,
284,
54819,
1005,
15454,
543,
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_get_simple_value() {
let s = "john.doe@domain.tld".to_string();
assert_eq!(get_simple_value(s), "john.doe@domain.tld".to_string());
let s = "John Doe <john.doe@domain.tld>".to_string();
assert_eq!(get_simple_value(s), "john.doe@domain.tld".to_string());
let s = "Message-ID: <989bac4f-277b-84a7-5601-8975e35dfba5@davidson.fr>".to_string();
assert_eq!(
get_simple_value(s),
"989bac4f-277b-84a7-5601-8975e35dfba5@davidson.fr".to_string()
);
} | rust_cleaned_test_functions.jsonl/66272 | {
"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,
3062,
30015,
3142,
368,
341,
286,
1077,
274,
284,
330,
47817,
950,
4644,
31,
12204,
734,
507,
3263,
983,
3904,
543,
286,
2060,
10714,
10297,
455,
30015,
3142,
1141,
701,
330,
47817,
950,
4644,
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_jsge_imm() {
test_interpreter_and_jit_asm!(
"
mov32 r0, 0
mov r1, -2
jsge r1, -1, +5
jsge r1, 0, +4
mov32 r0, 1
mov r1, -1
jsge r1, -1, +1
mov32 r0, 2
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1 } },
8
);
} | rust_cleaned_test_functions.jsonl/59022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
709,
71370,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
15,
11,
220,
15,
198,
286,
1974,
435,
16,
11,
481,
17,
198,
286,
6994,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list() {
const TMPDIR_POSTFIX: &str = "wslcmd-list";
// init tmpdir
let tmpdir = init_tmpdir(TMPDIR_POSTFIX).expect("Tmp dir initialize");
let (bin1, _) = copy_tmpbin(&tmpdir, None).expect("Bin initialize");
let dummyfile = tmpdir.join("dummy");
// test linking only
let mut wslcmd_list = WslCmdList::new(&bin1).expect("New WslCmdList");
unit_test_cmdlist(&mut wslcmd_list, &([] as [&str; 0])); // check when no other file
unit_test_mod(&tmpdir, &mut wslcmd_list, "testlink", false, TestKind::Link)
.expect("List test prepare");
unit_test_cmdlist(&mut wslcmd_list, &["testlink"]);
new_dummy_file(&dummyfile); // new dummy file
unit_test_cmdlist(&mut wslcmd_list, &["testlink"]);
// clean tmpdir
clean_tmpdir(TMPDIR_POSTFIX);
} | rust_cleaned_test_functions.jsonl/34192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
368,
341,
286,
733,
66253,
12251,
20506,
39690,
25,
609,
495,
284,
330,
86,
3226,
8710,
9029,
3302,
286,
442,
2930,
4174,
3741,
198,
286,
1077,
4174,
3741,
284,
2930,
16125,
3741,
4140,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_code_with_json_parse_error() {
let mock = mock("POST", "/token")
.match_header("Accept", "application/json")
.match_body("grant_type=authorization_code&code=ccc")
.with_header("authorization", "YWFhOmJiYg==")
.with_header("content-type", "application/json")
.with_body("broken json")
.create();
let client = new_mock_client();
let token = client.exchange_code(AuthorizationCode::new("ccc".to_string()));
mock.assert();
assert!(token.is_err());
match token.err().unwrap() {
RequestTokenError::Parse(json_err) => {
assert_eq!(1, json_err.line());
assert_eq!(1, json_err.column());
assert_eq!(serde_json::error::Category::Syntax, json_err.classify());
}
other => panic!("Unexpected error: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/12776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
4136,
6615,
9455,
21039,
4096,
368,
341,
262,
1077,
7860,
284,
7860,
445,
2946,
497,
3521,
5839,
1138,
286,
659,
6347,
8757,
445,
16646,
497,
330,
5132,
8931,
1138,
286,
659,
6347,
14114,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_render_template() {
let mut context = BTreeMap::new();
context.insert(String::from("var1"), String::from("test"));
context.insert(String::from("var2"), String::from("test2"));
context.insert(String::from("var3"), String::from("test3"));
let template = "{{var1}}test{{var2}}test2{{var3}}test3";
let rendered_string = "testtesttest2test2test3test3";
let test = CreatingConfig::render_config_template(&context, template).unwrap();
// Test if string is rendered correctly
assert_eq!(test, rendered_string);
// Test if an undefined variable leads to an error
let template_with_undefined_var = "{{var4}}test";
let _ = CreatingConfig::render_config_template(&context, template_with_undefined_var);
assert!(
CreatingConfig::render_config_template(&context, template_with_undefined_var).is_err()
);
} | rust_cleaned_test_functions.jsonl/32149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
8693,
368,
341,
286,
1077,
5206,
2266,
284,
425,
6533,
2227,
486,
931,
543,
286,
2266,
7030,
2242,
486,
1499,
445,
947,
16,
3975,
923,
486,
1499,
445,
1944,
4010,
286,
2266,
7030,
2242,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_has_different_types_bool_to_int() {
let deserialized: Value =
serde_json::from_str(r#"{ "a": 1, "b": { "c": 2, "d": 2 } }"#).unwrap();
let v: Value = serde_json::from_str(r#"{ "a": 1, "b": { "c": 2, "d": true } }"#).unwrap();
assert!(check(&v, &deserialized).is_err());
} | rust_cleaned_test_functions.jsonl/52336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
21778,
82741,
9763,
22159,
2346,
4042,
368,
341,
1789,
286,
1077,
939,
67577,
25,
5162,
4035,
310,
61570,
9455,
486,
1499,
2895,
2601,
2,
14129,
330,
64,
788,
220,
16,
11,
330,
65,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq2_squaring() {
use super::fq::FqRepr;
use ff::PrimeField;
let mut a = Fq2 {
c0: Fq::one(),
c1: Fq::one(),
}; // u + 1
a.square();
assert_eq!(
a,
Fq2 {
c0: Fq::zero(),
c1: Fq::from_repr(FqRepr::from(2)).unwrap(),
}
); // 2u
let mut a = Fq2 {
c0: Fq::zero(),
c1: Fq::one(),
}; // u
a.square();
assert_eq!(a, {
let mut neg1 = Fq::one();
neg1.negate();
Fq2 {
c0: neg1,
c1: Fq::zero(),
}
});
} | rust_cleaned_test_functions.jsonl/100947 | {
"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,
761,
80,
17,
643,
446,
3249,
368,
341,
262,
990,
2256,
486,
63919,
486,
37,
80,
693,
649,
280,
262,
990,
25539,
486,
32306,
1877,
401,
262,
1077,
5206,
264,
284,
434,
80,
17,
341,
286,
272,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_version() {
assert!(matches!(
parse_version(b"", Endianness::Little),
Err(ParseError::InvalidKernelVersion { .. })
));
assert!(matches!(
parse_version(b"123", Endianness::Little),
Err(ParseError::InvalidKernelVersion { .. })
));
assert_eq!(
parse_version(&0xFFFF_FFFEu32.to_le_bytes(), Endianness::Little)
.expect("failed to parse magic version"),
KernelVersion::Any
);
assert_eq!(
parse_version(&0xFFFF_FFFEu32.to_be_bytes(), Endianness::Big)
.expect("failed to parse magic version"),
KernelVersion::Any
);
assert_eq!(
parse_version(&1234u32.to_le_bytes(), Endianness::Little)
.expect("failed to parse magic version"),
KernelVersion::Version(1234)
);
} | rust_cleaned_test_functions.jsonl/132920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9438,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
4715,
9438,
1883,
56323,
3972,
72,
82033,
486,
38103,
1326,
310,
15495,
71812,
1454,
486,
7928,
26343,
5637,
314,
5241,
2751,
286,
33351,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_struct_keep_existing_visibility_tuple() {
check_assist(
extract_struct_from_enum_variant,
"enum A { $0One(u32, pub(crate) u32, pub(super) u32, u32) }",
r#"
struct One(u32, pub(crate) u32, pub(super) u32, u32);
enum A { One(One) }"#,
);
} | rust_cleaned_test_functions.jsonl/36303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
15126,
50293,
62630,
71256,
21773,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
330,
9018,
362,
314,
400,
15,
3966,
8154,
18,
17,
11,
6675,
54907,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check() {
let gil = Python::acquire_gil();
let py = gil.python();
let (obj, sub_obj, sub_sub_obj) = _get_subclasses(&py, "time", "12, 30, 15").unwrap();
assert_check_exact!(PyTime_Check, obj);
assert_check_only!(PyTime_Check, sub_obj);
assert_check_only!(PyTime_Check, sub_sub_obj);
} | rust_cleaned_test_functions.jsonl/113012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
7200,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
543,
262,
1077,
320,
2295,
11,
1186,
7328,
11,
1186,
5228,
7328,
8,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_u32_i64() {
binary_cast_test(
DataType::UInt32,
DataType::Int64,
"CAST(#0 AS Int64) Plus #1",
);
binary_cast_test(
DataType::Int64,
DataType::UInt32,
"#0 Plus CAST(#1 AS Int64)",
);
} | rust_cleaned_test_functions.jsonl/16560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
7300,
18,
17,
5318,
21,
19,
368,
341,
286,
7868,
5303,
4452,
1006,
310,
33172,
486,
18777,
18,
17,
345,
310,
33172,
486,
1072,
21,
19,
345,
310,
330,
34163,
32735,
15,
5752,
1333,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_contains() {
Python::with_gil(|py| {
let list = PyList::new(py, &[1, 1, 2, 3, 5, 8]);
assert_eq!(6, list.len());
let bad_needle = 7i32.to_object(py);
assert!(!list.contains(&bad_needle).unwrap());
let good_needle = 8i32.to_object(py);
assert!(list.contains(&good_needle).unwrap());
let type_coerced_needle = 8f32.to_object(py);
assert!(list.contains(&type_coerced_needle).unwrap());
});
} | rust_cleaned_test_functions.jsonl/108648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
63598,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
16,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_sort() {
let mut before: Vec<&str> = vec![
"a", "cat", "mat", "on", "sat", "the", "xxx", "xxxx", "fdadfdsf",
];
let mut d = before.clone();
d.sort_unstable();
for last in 0..before.len() {
partial_sort(&mut before, last, |a, b| a.cmp(b));
assert_eq!(&d[0..last], &before.as_slice()[0..last]);
}
} | rust_cleaned_test_functions.jsonl/6176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
18435,
368,
341,
286,
1077,
5206,
1573,
25,
11312,
52244,
495,
29,
284,
7486,
90515,
310,
330,
64,
497,
330,
4616,
497,
330,
8470,
497,
330,
263,
497,
330,
36468,
497,
330,
1782,
497,
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... | 2 |
#[test]
fn test_copy_chunked() {
let mut source = Vec::<u8>::new();
source.resize(CHUNK_MAX_PAYLOAD_SIZE, 33);
source.extend_from_slice(b"hello world");
let mut dest = Vec::<u8>::new();
copy_chunked(&mut &source[..], &mut dest).unwrap();
let mut dest_expected = Vec::<u8>::new();
dest_expected.extend_from_slice(format!("{:x}\r\n", CHUNK_MAX_PAYLOAD_SIZE).as_bytes());
dest_expected.resize(dest_expected.len() + CHUNK_MAX_PAYLOAD_SIZE, 33);
dest_expected.extend_from_slice(b"\r\n");
dest_expected.extend_from_slice(b"b\r\nhello world\r\n");
dest_expected.extend_from_slice(b"0\r\n\r\n");
assert_eq!(dest, dest_expected);
} | rust_cleaned_test_functions.jsonl/73252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16096,
30539,
291,
368,
341,
262,
1077,
5206,
2530,
284,
11312,
27638,
84,
23,
6831,
931,
543,
262,
2530,
17382,
82934,
31883,
6806,
79493,
4098,
11,
220,
18,
18,
317,
262,
2530,
15831,
5673,
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_from_string_h() {
let d: Duration = DurationString::try_from(String::from("1h")).unwrap().into();
assert_eq!(d, Duration::from_secs(3600));
} | rust_cleaned_test_functions.jsonl/97548 | {
"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,
5673,
3904,
1523,
368,
341,
286,
1077,
294,
25,
21045,
284,
21045,
703,
486,
1539,
5673,
2242,
486,
1499,
445,
16,
71,
15197,
15454,
1005,
18122,
543,
286,
2060,
10714,
10297,
67,
11,
21045,
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 |
#[test]
fn test_orphan_prune() {
let faketime_file = faketime::millis_tempfile(0).expect("create faketime file");
faketime::enable(&faketime_file);
let mut pool = OrphanPool::raw_new(0);
let tx1 = build_tx(vec![(&Byte32::zero(), 0)], 1);
let tx1_hash = tx1.hash();
let tx2 = build_tx(vec![(&tx1_hash, 0)], 1);
let tx2_hash = tx2.hash();
let tx3 = build_tx(vec![(&tx2_hash, 0)], 1);
pool.add_tx(None, MOCK_SIZE, tx2.clone(), tx1.output_pts().into_iter());
faketime::write_millis(&faketime_file, (TTL + 1) * 1000).expect("write millis");
pool.add_tx(None, MOCK_SIZE, tx3.clone(), tx2.output_pts().into_iter());
assert!(!pool.contains(&tx2));
assert!(pool.contains(&tx3));
} | rust_cleaned_test_functions.jsonl/76988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
9943,
5294,
2886,
368,
341,
286,
1077,
282,
585,
4107,
2458,
284,
282,
585,
4107,
486,
25013,
285,
11771,
1192,
7,
15,
568,
17119,
445,
3182,
282,
585,
4107,
1034,
797,
286,
282,
585,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_post_form() {
let server = server! {
request: b"\
POST /form HTTP/1.1\r\n\
content-type: application/x-www-form-urlencoded\r\n\
content-length: 24\r\n\
user-agent: $USERAGENT\r\n\
accept: */*\r\n\
accept-encoding: gzip\r\n\
host: $HOST\r\n\
\r\n\
hello=world&sean=monstar\
",
response: b"\
HTTP/1.1 200 OK\r\n\
Server: post-form\r\n\
Content-Length: 0\r\n\
\r\n\
"
};
let form = &[("hello", "world"), ("sean", "monstar")];
let url = format!("http://{}/form", server.addr());
let res = reqwest::Client::new()
.post(&url)
.form(form)
.send()
.expect("request send");
assert_eq!(res.url().as_str(), &url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/26236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6333,
7915,
368,
341,
262,
1077,
3538,
284,
3538,
0,
341,
286,
1681,
25,
293,
83383,
310,
12869,
608,
627,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
310,
2213,
10604,
25,
3766,
10776,
41242,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_star_network_large_push() {
solana_logger::setup();
let mut network = star_network_create(4002);
let thread_pool = build_gossip_thread_pool();
network_simulator(&thread_pool, &mut network, 0.9);
} | rust_cleaned_test_functions.jsonl/2404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31681,
20966,
45228,
14218,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
1077,
5206,
3922,
284,
6774,
20966,
8657,
7,
19,
15,
15,
17,
317,
262,
1077,
4516,
15709,
284,
1936,
1889,
414... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bytes() {
let data: Vec<u8> = vec![0x03];
let (rest, val) = HeaderIdentOsAbi::from_bytes((&data, 0)).unwrap();
println!("rest: {:?}", rest);
println!("value: {:?}", val);
let expected = HeaderIdentOsAbi::Linux;
assert_eq!(expected, val);
assert_eq!((vec![].as_ref(), 0 as usize), rest);
} | rust_cleaned_test_functions.jsonl/4086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
87,
15,
18,
4821,
286,
1077,
320,
3927,
11,
1044,
8,
284,
12104,
28301,
28867,
5830,
72,
486,
1499,
12524... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_commandline() {
let commandline = unsafe {
let peb = &*Peb::get_ptr();
&(*peb.process_parameters).commandline
};
let commandline_string = commandline
.try_to_string()
.expect("Unable to create string from commandline in PEB.");
assert_eq!(
commandline_string.contains(".exe"),
true,
"The process's command line does not contain .exe, and is probably not read correctly."
);
} | rust_cleaned_test_functions.jsonl/7711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
10811,
1056,
368,
341,
286,
1077,
3210,
1056,
284,
19860,
341,
310,
1077,
1051,
65,
284,
609,
9,
47,
3065,
486,
455,
4348,
1428,
310,
609,
4071,
375,
65,
16988,
18263,
568,
5631,
1056,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rposition() {
let b = [1, 2, 3, 5, 5];
assert_eq!(b.iter().rposition(|&v| v == 9), None);
assert_eq!(b.iter().rposition(|&v| v == 5), Some(4));
assert_eq!(b.iter().rposition(|&v| v == 3), Some(2));
assert_eq!(b.iter().rposition(|&v| v == 0), None);
} | rust_cleaned_test_functions.jsonl/9608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3487,
368,
341,
262,
1077,
293,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
20,
935,
262,
2060,
10714,
10297,
65,
19471,
1005,
81,
3487,
22428,
5,
85,
91,
348,
621,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_short_address() {
let payload =
AddressPayload::from_pubkey_hash(h160!("0xb39bbc0b3673c7d36450bc14cfcdad2d559c6c64"));
let address = Address::new(NetworkType::Mainnet, payload, false);
assert_eq!(
address.to_string(),
"ckb1qyqt8xaupvm8837nv3gtc9x0ekkj64vud3jqfwyw5v"
);
assert_eq!(
address,
Address::from_str("ckb1qyqt8xaupvm8837nv3gtc9x0ekkj64vud3jqfwyw5v").unwrap()
);
let payload =
AddressPayload::from_pubkey_hash(h160!("0xb39bbc0b3673c7d36450bc14cfcdad2d559c6c64"));
let address = Address::new(NetworkType::Mainnet, payload, true);
assert_eq!(
address.to_string(),
"ckb1qyqt8xaupvm8837nv3gtc9x0ekkj64vud3jqfwyw5v"
);
let index = CodeHashIndex::Multisig;
let payload =
AddressPayload::new_short(index, h160!("0x4fb2be2e5d0c1a3b8694f832350a33c1685d477a"));
let address = Address::new(NetworkType::Mainnet, payload, false);
assert_eq!(
address.to_string(),
"ckb1qyq5lv479ewscx3ms620sv34pgeuz6zagaaqklhtgg"
);
assert_eq!(
address,
Address::from_str("ckb1qyq5lv479ewscx3ms620sv34pgeuz6zagaaqklhtgg").unwrap()
);
} | rust_cleaned_test_functions.jsonl/13674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 750
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
6744,
368,
341,
286,
1077,
7729,
4035,
310,
9177,
29683,
486,
1499,
34014,
792,
8950,
3203,
16,
21,
15,
17223,
15,
7929,
18,
24,
84185,
15,
65,
18,
21,
22,
18,
66,
22,
67,
18,
21,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_decrypt_handle() {
let handle = DecryptHandle(RistrettoPoint::default());
let encoded = bincode::serialize(&handle).unwrap();
let decoded: DecryptHandle = bincode::deserialize(&encoded).unwrap();
assert_eq!(handle, decoded);
} | rust_cleaned_test_functions.jsonl/36662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
80764,
10630,
368,
341,
286,
1077,
3705,
284,
89146,
6999,
2785,
380,
2122,
983,
2609,
486,
2258,
5231,
286,
1077,
20498,
284,
9544,
1851,
486,
24166,
2099,
8192,
568,
15454,
543,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_max_thruster_signal() {
assert_eq!(
find_max_thruster_signal(
vec![3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0]
),
SearchResult {
max_thruster_signal: 43210,
phase_settings: vec![4, 3, 2, 1, 0]
}
);
assert_eq!(
find_max_thruster_signal(
vec![3,23,3,24,1002,24,10,24,1002,23,-1,23,101,5,23,23,1,24,23,23,
4,23,99,0,0]
),
SearchResult {
max_thruster_signal: 54321,
phase_settings: vec![0, 1, 2, 3, 4]
}
);
assert_eq!(
find_max_thruster_signal(
vec![3,31,3,32,1002,32,10,32,1001,31,-2,31,1007,31,0,33, 1002,33,7,
33,1,33,31,31,1,32,31,31,4,31,99,0,0,0]
),
SearchResult {
max_thruster_signal: 65210,
phase_settings: vec![1, 0, 4, 3, 2]
}
);
} | rust_cleaned_test_functions.jsonl/43078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
6345,
72071,
4993,
21137,
368,
341,
6948,
10714,
33673,
197,
80603,
6345,
72071,
4993,
21137,
1006,
298,
40213,
20703,
18,
11,
16,
20,
11,
18,
11,
16,
21,
11,
16,
15,
15,
17,
11,
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_show_cursor() {
let mut test = SdlTest::new();
test.console().show_cursor().unwrap();
test.console().show_cursor().unwrap();
test.verify("sdl-empty");
} | rust_cleaned_test_functions.jsonl/15271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15267,
28601,
368,
341,
286,
1077,
5206,
1273,
284,
328,
8736,
2271,
486,
931,
1428,
286,
1273,
47802,
1005,
3445,
28601,
1005,
15454,
543,
286,
1273,
47802,
1005,
3445,
28601,
1005,
15454,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_short_id() {
// minimal struct for testing
struct Foo(u64);
impl Writeable for Foo {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), ser::Error> {
writer.write_u64(self.0)?;
Ok(())
}
}
impl DefaultHashable for Foo {}
let foo = Foo(0);
let expected_hash =
Hash::from_hex("81e47a19e6b29b0a65b9591762ce5143ed30d0261e5d24a3201752506b20f15c")
.unwrap();
assert_eq!(foo.hash(), expected_hash);
let other_hash = Hash::default();
assert_eq!(
foo.short_id(&other_hash, foo.0),
ShortId::from_hex("4cc808b62476").unwrap()
);
let foo = Foo(5);
let expected_hash =
Hash::from_hex("3a42e66e46dd7633b57d1f921780a1ac715e6b93c19ee52ab714178eb3a9f673")
.unwrap();
assert_eq!(foo.hash(), expected_hash);
let other_hash = Hash::default();
assert_eq!(
foo.short_id(&other_hash, foo.0),
ShortId::from_hex("02955a094534").unwrap()
);
let foo = Foo(5);
let expected_hash =
Hash::from_hex("3a42e66e46dd7633b57d1f921780a1ac715e6b93c19ee52ab714178eb3a9f673")
.unwrap();
assert_eq!(foo.hash(), expected_hash);
let other_hash =
Hash::from_hex("81e47a19e6b29b0a65b9591762ce5143ed30d0261e5d24a3201752506b20f15c")
.unwrap();
assert_eq!(
foo.short_id(&other_hash, foo.0),
ShortId::from_hex("3e9cde72a687").unwrap()
);
} | rust_cleaned_test_functions.jsonl/10436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 656
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
842,
368,
341,
197,
197,
322,
17377,
2036,
369,
7497,
24520,
197,
6472,
33428,
8154,
21,
19,
317,
197,
197,
6383,
9645,
480,
369,
33428,
341,
298,
40095,
3270,
86654,
25,
29404,
44784,
72... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check_key_in_region() {
let test_cases = vec![
("", "", "", true, true),
("", "", "6", true, true),
("", "3", "6", false, false),
("4", "3", "6", true, true),
("4", "3", "", true, true),
("2", "3", "6", false, false),
("", "3", "6", false, false),
("", "3", "", false, false),
("6", "3", "6", false, true),
];
for (key, start_key, end_key, is_in_region, is_in_region_inclusive) in test_cases {
let mut region = metapb::Region::new();
region.set_start_key(start_key.as_bytes().to_vec());
region.set_end_key(end_key.as_bytes().to_vec());
let mut result = check_key_in_region(key.as_bytes(), ®ion);
assert_eq!(result.is_ok(), is_in_region);
result = check_key_in_region_inclusive(key.as_bytes(), ®ion);
assert_eq!(result.is_ok(), is_in_region_inclusive)
}
} | rust_cleaned_test_functions.jsonl/44419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
3097,
1243,
20627,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
3489,
497,
7342,
7342,
830,
11,
830,
1326,
310,
3489,
497,
7342,
330,
21,
497,
830,
11,
830,
1326,
310,
3489,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_apply_auth_no_token() -> Result<(), anyhow::Error> {
assert!(
!RequestBuilderWrapper::from_client(&Client::default(), |client| client
.get("https://example.com/some/module.wasm"))
.apply_auth(
&Reference::try_from(HELLO_IMAGE_TAG)?,
RegistryOperation::Pull
)?
.into_request_builder()
.build()?
.headers()
.contains_key("Authorization")
);
Ok(())
} | rust_cleaned_test_functions.jsonl/109366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
14014,
6536,
6458,
368,
1464,
5714,
68843,
88964,
486,
1454,
29,
341,
286,
2060,
33673,
310,
753,
1900,
3297,
11542,
486,
1499,
8179,
2099,
2959,
486,
2258,
1507,
760,
2972,
91,
2943,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skip_markdown_anchors() {
let input = "This is [a test](#lol).";
let links = extract_links(&InputContent::from_string(input, FileType::Markdown), None);
assert_eq!(links, HashSet::new())
} | rust_cleaned_test_functions.jsonl/93888 | {
"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,
44830,
18924,
2923,
62,
70499,
368,
341,
286,
1077,
1946,
284,
330,
1986,
374,
508,
64,
1273,
9533,
2,
59319,
568,
876,
286,
1077,
7746,
284,
8649,
25258,
2099,
2505,
2762,
486,
1499,
3904,
5384... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_canvas_fill_color() {
let canvas = new_canvas();
canvas.set_fill_style_color("rgb(200,0,0)");
let style = canvas.get_fill_style();
match style {
CanvasStyle::String(s) => assert_eq!(s, "#c80000"),
_ => assert!(false, "Expected style to be a string \"#c80000\" was instead {:?}", style),
}
} | rust_cleaned_test_functions.jsonl/104696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47136,
30728,
6714,
368,
341,
286,
1077,
10041,
284,
501,
47136,
1428,
286,
10041,
980,
30728,
15117,
6714,
445,
16509,
7,
17,
15,
15,
11,
15,
11,
15,
20996,
286,
1077,
1707,
284,
10041,
670,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_derive_key_bad_length() {
let password = Password::from_slice(&[0u8; 64]).unwrap();
let salt = Salt::from_slice(&[0u8; 64]).unwrap();
assert!(derive_key(&password, &salt, 100, 0).is_err());
assert!(derive_key(&password, &salt, 100, 1).is_ok());
assert!(derive_key(&password, &salt, 100, usize::max_value()).is_err());
} | rust_cleaned_test_functions.jsonl/34079 | {
"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,
35345,
533,
3097,
34199,
5118,
368,
341,
298,
10217,
3552,
284,
12362,
486,
1499,
26488,
2099,
58,
15,
84,
23,
26,
220,
21,
19,
10697,
15454,
543,
298,
10217,
12021,
284,
27040,
486,
1499,
26488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contains() {
let value_data = Int32Array::from(vec![
Some(0),
Some(1),
Some(2),
Some(3),
Some(4),
Some(5),
Some(6),
None,
Some(7),
])
.data();
let value_offsets = Buffer::from(&[0i64, 3, 6, 6, 9].to_byte_slice());
let list_data_type =
DataType::LargeList(Box::new(Field::new("item", DataType::Int32, true)));
let list_data = ArrayData::builder(list_data_type)
.len(4)
.add_buffer(value_offsets)
.null_count(1)
.add_child_data(value_data)
.null_bit_buffer(Buffer::from([0b00001011]))
.build();
let list_array = LargeListArray::from(list_data);
let nulls = Int32Array::from(vec![None, None, None, None]);
let nulls_result = contains(&nulls, &list_array).unwrap();
assert_eq!(
nulls_result
.as_any()
.downcast_ref::<BooleanArray>()
.unwrap(),
&BooleanArray::from(vec![false, false, false, false]),
);
let values = Int32Array::from(vec![Some(0), Some(0), Some(0), Some(0)]);
let values_result = contains(&values, &list_array).unwrap();
assert_eq!(
values_result
.as_any()
.downcast_ref::<BooleanArray>()
.unwrap(),
&BooleanArray::from(vec![true, false, false, false]),
);
} | rust_cleaned_test_functions.jsonl/3142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 869
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
368,
341,
286,
1077,
897,
1769,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
90515,
310,
4329,
7,
15,
1326,
310,
4329,
7,
16,
1326,
310,
4329,
7,
17,
1326,
310,
4329,
7,
18,
1326,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optflagmulti_short2b() {
let args = vec!["-vv".to_string()];
match Options::new()
.optflagmulti("v", "verbose", "verbosity")
.parse(&args)
{
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 2);
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/52371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
9903,
26268,
16673,
17,
65,
368,
341,
262,
1077,
2827,
284,
7486,
0,
1183,
12,
33075,
3263,
983,
3904,
33800,
262,
2432,
14566,
486,
931,
741,
286,
659,
2912,
9903,
26268,
445,
85,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nipopow_is_better_than_marginally_longer_chain_better_autolykos_v1() {
let m = 30;
let k = 30;
let popow_algos = NipopowAlgos::default();
let short_chain = generate_popowheader_chain(1000, None);
let branch_point = short_chain[short_chain.len() - 1].clone();
let mut long_chain = short_chain.clone();
long_chain.extend(std::iter::once(
generate_popowheader_chain(2, Some(branch_point))[1].clone(),
));
let short_proof = popow_algos.prove(&short_chain, k, m).unwrap();
let long_proof = popow_algos.prove(&long_chain, k, m).unwrap();
assert!(!short_proof.is_better_than(&long_proof).unwrap());
} | rust_cleaned_test_functions.jsonl/133994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
79382,
363,
6892,
880,
21405,
51613,
42644,
745,
17799,
261,
30583,
880,
21405,
32808,
5730,
56678,
2273,
16,
368,
341,
286,
1077,
296,
284,
220,
18,
15,
280,
286,
1077,
595,
284,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_by_threadpool() {
let mut rt = executor::LocalPool::new();
let loader = Loader::new(Batcher::new(10)).cached();
let v1 = loader
.load(3)
.and_then(|v| loader.load_many(vec![v, v + 1, v + 2]));
let v2 = loader
.load(4)
.and_then(|v| loader.load_many(vec![v, v + 1, v + 2]));
assert_eq!(
(vec![300, 310, 320], vec![400, 410, 420]),
rt.run_until(future::try_join(v1, v2)).unwrap(),
);
} | rust_cleaned_test_functions.jsonl/18909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
3710,
10814,
10285,
368,
341,
262,
1077,
5206,
16677,
284,
31558,
486,
7319,
10551,
486,
931,
1428,
262,
1077,
16047,
284,
27811,
486,
931,
5349,
28058,
486,
931,
7,
16,
15,
4579,
32918,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trit_nat_trit(){
let trit: f64 = 1.0;
let nat = trit::to_nat(trit);
let trit_out = nat::to_trit(nat);
assert!(trit-trit_out <= MAX_FLOAT_ROUNDING_DEVIATION);
} | rust_cleaned_test_functions.jsonl/76585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
275,
38169,
3547,
275,
3032,
286,
1077,
489,
275,
25,
282,
21,
19,
284,
220,
16,
13,
15,
280,
286,
1077,
17588,
284,
489,
275,
486,
983,
38169,
7624,
275,
317,
286,
1077,
489,
275,
606... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_with_multiplicity() {
let data = b"test data";
let mut hash1 = RistrettoHash::<Sha512>::default();
let mut hash2 = hash1.clone();
hash1.add(data, 3);
hash2.add(data, 1);
hash2.add(data, 1);
hash2.add(data, 1);
let output1 = hash1.finalize();
let output2 = hash2.finalize();
assert_eq!(output1, output2)
} | rust_cleaned_test_functions.jsonl/30199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
6615,
91802,
24779,
368,
341,
286,
1077,
821,
284,
293,
1,
1944,
821,
3302,
286,
1077,
5206,
5175,
16,
284,
431,
380,
2122,
983,
6370,
27638,
62316,
20,
16,
17,
6831,
2258,
543,
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_get_tx_out_index_by_hash() {
let (tx_out_store, env) = init_tx_out_store();
let tx_outs = get_tx_outs(111);
{
// Push a number of TxOuts to the store.
let mut rw_transaction: RwTransaction = env.begin_rw_txn().unwrap();
for tx_out in &tx_outs {
tx_out_store.push(tx_out, &mut rw_transaction).unwrap();
}
rw_transaction.commit().unwrap();
}
let ro_transaction: RoTransaction = env.begin_ro_txn().unwrap();
assert_eq!(
tx_outs.len() as u64,
tx_out_store.num_tx_outs(&ro_transaction).unwrap()
);
// `get_tx_out_by_index_by_hash` should return the correct index when given a recognized hash.
for (index, tx_out) in tx_outs.iter().enumerate() {
assert_eq!(
index as u64,
tx_out_store
.get_tx_out_index_by_hash(&tx_out.hash(), &ro_transaction)
.unwrap()
);
}
// `get_tx_out_index_by_hash` should return `Error::NotFound` for an unrecognized hash.
let unrecognized_hash: Hash = [0u8; 32];
match tx_out_store.get_tx_out_index_by_hash(&unrecognized_hash, &ro_transaction) {
Ok(index) => panic!(format!("Returned index {:?} for unrecognized hash.", index)),
Err(Error::NotFound) => {
// This is expected.
}
Err(e) => panic!("Unexpected Error {:?}", e),
}
} | rust_cleaned_test_functions.jsonl/88924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
17805,
6068,
3560,
3710,
8950,
368,
341,
286,
1077,
320,
3998,
6068,
14809,
11,
6105,
8,
284,
2930,
17805,
6068,
14809,
543,
286,
1077,
9854,
6068,
82,
284,
633,
17805,
6068,
82,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_display() {
let m = MetricsInner::new();
let exp = "Metrics::Op {
\"hit\": 0,
\"miss\": 0,
\"keys-added\": 0,
\"keys-updated\": 0,
\"keys-evicted\": 0,
\"cost-added\": 0,
\"cost-evicted\": 0,
\"sets-dropped\": 0,
\"sets-rejected\": 0,
\"gets-dropped\": 0,
\"gets-kept\": 0,
\"gets-total\": 0,
\"hit-ratio\": 0.00
}"
.to_string();
assert_eq!(format!("{}", m), exp)
} | rust_cleaned_test_functions.jsonl/10260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
296,
284,
54190,
31597,
486,
931,
543,
286,
1077,
1343,
284,
330,
27328,
486,
7125,
341,
220,
7245,
22492,
11693,
220,
15,
345,
220,
7245,
1831,
11693,
220,
15,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run() {
let r = run(futures::future::ready(42));
assert_eq!(42, r);
let r = run(async move { 43 });
assert_eq!(43, r);
} | rust_cleaned_test_functions.jsonl/28466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
368,
341,
286,
1077,
435,
284,
1598,
955,
74606,
486,
21055,
486,
2307,
7,
19,
17,
1106,
286,
2060,
10714,
10297,
19,
17,
11,
435,
626,
286,
1077,
435,
284,
1598,
18285,
3271,
314,
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 |
#[test]
fn test_remove_dbg_target() {
check_assist_target(
remove_dbg,
"
fn foo(n: usize) {
if let Some(_) = dbg!(n.$0checked_sub(4)) {
// ...
}
}
",
"dbg!(n.checked_sub(4))",
);
} | rust_cleaned_test_functions.jsonl/13608 | {
"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,
18193,
44124,
11123,
368,
341,
286,
1779,
12083,
380,
11123,
1006,
310,
4057,
44124,
345,
310,
6228,
8822,
15229,
1445,
25,
22301,
8,
341,
262,
421,
1077,
4329,
48139,
284,
47904,
10297,
77,
2418,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_vmod_version() -> io::Result<()> {
let config_name = "v.mod";
let config_content = "\
Module {
name: 'starship',
author: 'matchai',
version: '1.2.3'
}";
let project_dir = create_project_dir()?;
fill_config(&project_dir, config_name, Some(config_content))?;
expect_output(&project_dir, Some("v1.2.3"), None);
project_dir.close()
} | rust_cleaned_test_functions.jsonl/100138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
2273,
2593,
9438,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
2193,
1269,
284,
330,
85,
10929,
876,
286,
1077,
2193,
7495,
284,
93317,
3332,
341,
262,
829,
25,
364,
11870,
5270,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skip_serializing_enum() {
let a = 1;
assert_ser_tokens(
&SkipSerializingEnum::Struct { a: &a, _b: 2, c: 3 },
&[
Token::StructVariant {
name: "SkipSerializingEnum",
variant: "Struct",
len: 2,
},
Token::Str("a"),
Token::I8(1),
Token::Str("c"),
Token::I32(3),
Token::StructVariantEnd,
],
);
assert_ser_tokens(
&SkipSerializingEnum::Struct {
a: &a,
_b: 2,
c: 123,
},
&[
Token::StructVariant {
name: "SkipSerializingEnum",
variant: "Struct",
len: 1,
},
Token::Str("a"),
Token::I8(1),
Token::StructVariantEnd,
],
);
assert_ser_tokens(
&SkipSerializingEnum::Tuple(&a, 2, 3),
&[
Token::TupleVariant {
name: "SkipSerializingEnum",
variant: "Tuple",
len: 2,
},
Token::I8(1),
Token::I32(3),
Token::TupleVariantEnd,
],
);
assert_ser_tokens(
&SkipSerializingEnum::Tuple(&a, 2, 123),
&[
Token::TupleVariant {
name: "SkipSerializingEnum",
variant: "Tuple",
len: 1,
},
Token::I8(1),
Token::TupleVariantEnd,
],
);
} | rust_cleaned_test_functions.jsonl/59144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 970
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
25602,
4849,
31054,
368,
341,
262,
1077,
264,
284,
220,
16,
280,
262,
2060,
75861,
28838,
1006,
286,
609,
35134,
5915,
4849,
10766,
486,
9422,
314,
264,
25,
609,
64,
11,
716,
65,
25,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_parent_module() {
check(
r#"
//- /lib.rs
mod foo;
//^^^
//- /foo.rs
$0// empty
"#,
);
} | rust_cleaned_test_functions.jsonl/17763 | {
"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,
77291,
15960,
10750,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
280,
220,
442,
21876,
61,
271,
61463,
608,
7975,
25638,
198,
3,
15,
322,
4287,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mul() {
assert_eq!(_05_05i * _05_05i, _0_1i.unscale(2.0));
assert_eq!(_1_1i * _0_1i, _neg1_1i);
assert_eq!(_0_1i * _0_1i, -_1_0i);
assert_eq!(_0_1i * _0_1i * _0_1i * _0_1i, _1_0i);
for &c in all_consts.iter() {
assert_eq!(c * _1_0i, c);
assert_eq!(_1_0i * c, c);
}
} | rust_cleaned_test_functions.jsonl/108415 | {
"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,
24944,
368,
341,
310,
2060,
10714,
0,
2490,
15,
20,
62,
15,
20,
72,
353,
716,
15,
20,
62,
15,
20,
72,
11,
716,
15,
62,
16,
72,
6307,
12445,
7,
17,
13,
15,
1106,
310,
2060,
10714,
0,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uint8_from_bits_to_bits() {
let mut cs = TestConstraintSystem::<Fr>::new();
let byte_val = 0b01110001;
let byte = UInt8::alloc(cs.ns(|| "alloc value"), || Ok(byte_val)).unwrap();
let bits = byte.into_bits_le();
for (i, bit) in bits.iter().enumerate() {
assert_eq!(bit.get_value().unwrap(), (byte_val >> i) & 1 == 1)
}
} | rust_cleaned_test_functions.jsonl/51695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
23,
5673,
20034,
2346,
20034,
368,
341,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
22560,
6831,
931,
543,
286,
1077,
4922,
6189,
284,
220,
15,
65,
15,
16,
16,
16,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_f32() {
let vec = to_vec(&4000.5f32).unwrap();
assert_eq!(vec, b"\xfa\x45\x7a\x08\x00");
} | rust_cleaned_test_functions.jsonl/110266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
18,
17,
368,
341,
262,
1077,
7486,
284,
311,
13251,
2099,
19,
15,
15,
15,
13,
20,
69,
18,
17,
568,
15454,
543,
262,
2060,
10714,
10297,
4083,
11,
293,
11934,
48890,
3462,
19,
20,
3462,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_object_comparison1() {
fold("!new Date()", "false");
fold("!!new Date()", "true");
fold("new Date() == null", "false");
fold("new Date() == undefined", "false");
fold("new Date() != null", "true");
fold("new Date() != undefined", "true");
fold("null == new Date()", "false");
fold("undefined == new Date()", "false");
fold("null != new Date()", "true");
fold("undefined != new Date()", "true");
} | rust_cleaned_test_functions.jsonl/122163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
90797,
16,
368,
341,
262,
11555,
85166,
931,
2631,
50514,
330,
3849,
797,
262,
11555,
445,
2928,
931,
2631,
50514,
330,
1866,
3071,
262,
11555,
445,
931,
2631,
368,
621,
845,
497,
330,
384... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_adding_bookmark() {
dotenv::dotenv().ok();
let mut pixiv: PixivClient = PixivClient::new().unwrap();
let username = std::env::var("PIXIV_ID").expect("PIXIV_ID isn't set!");
let password = std::env::var("PIXIV_PW").expect("PIXIV_PW isn't set!");
pixiv
.login(&username, &password)
.expect("Failed to log in.");
let request = PixivRequestBuilder::request_adding_bookmark(ILLUST_ID_TEST, Visibility::Public);
println!("request:\n{:?}", request);
let result = pixiv
.execute_with_auth(request)
.expect("Request failed.")
.json::<serde_json::Value>()
.expect("Failed to parse as json.");
println!("result:\n{}", result);
} | rust_cleaned_test_functions.jsonl/30379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
287,
26421,
3987,
368,
341,
262,
91286,
486,
50893,
1005,
562,
1428,
262,
1077,
5206,
31574,
344,
25,
49466,
344,
2959,
284,
49466,
344,
2959,
486,
931,
1005,
15454,
1428,
262,
1077,
5934,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failing_pattern() {
let t = "spaghetti";
let p = LPattern::new("%dddd-%dd-%dd");
let caps = p.apply_to(&t);
assert_eq!(p.is_match(caps, &t), false);
} | rust_cleaned_test_functions.jsonl/81365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14277,
21260,
368,
341,
262,
1077,
259,
284,
330,
2154,
63965,
876,
262,
1077,
281,
284,
444,
15760,
486,
931,
4430,
64100,
11069,
631,
11069,
631,
797,
262,
1077,
18568,
284,
281,
13045,
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 |
#[test]
fn test_convert_float_to_uint() {
assert!(convert_float_to_uint(f64::MIN, u64::MAX, FieldTypeTp::Double).is_err());
assert!(convert_float_to_uint(f64::MAX, u64::MAX, FieldTypeTp::Double).is_err());
let v = convert_float_to_uint(0.1, u64::MAX, FieldTypeTp::Double).unwrap();
assert_eq!(v, 0);
} | rust_cleaned_test_functions.jsonl/75526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
17586,
2346,
15807,
368,
341,
286,
2060,
10297,
14166,
17586,
2346,
15807,
955,
21,
19,
486,
16413,
11,
575,
21,
19,
486,
10586,
11,
84614,
62241,
486,
7378,
568,
285,
9266,
1423,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipe_some_data_with_refs() {
let (reader, writer) = crate::pipe().unwrap();
let mut reader_ref = &reader;
{
let mut writer_ref = &writer;
writer_ref.write_all(b"some stuff").unwrap();
}
drop(writer);
let mut out = String::new();
reader_ref.read_to_string(&mut out).unwrap();
assert_eq!(out, "some stuff");
} | rust_cleaned_test_functions.jsonl/1282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
61855,
1769,
6615,
60638,
368,
341,
16885,
286,
1077,
320,
11149,
11,
6916,
8,
284,
17717,
486,
13768,
1005,
15454,
543,
286,
1077,
5206,
6604,
7793,
284,
609,
11149,
280,
286,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timeout_not_expired_with_long_future() {
Runtime::builder()
.build()
.expect("build runtime failed")
.block_on(async {
assert_eq!(
timeout(Duration::from_secs(2), async {
sleep(Duration::from_secs(1)).await;
1
})
.await
.unwrap(),
1
)
})
} | rust_cleaned_test_functions.jsonl/16037 | {
"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,
20537,
7913,
80221,
6615,
17799,
59740,
368,
341,
286,
10954,
486,
17850,
741,
310,
659,
5834,
741,
310,
659,
17119,
445,
5834,
15592,
4641,
1138,
310,
659,
4574,
4470,
18285,
341,
394,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_struct() {
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
struct Foo {
f1: String,
f2: i32,
f3: Option<i64>,
f4: Option<i128>,
f5: bool
}
let original = Foo {
f1: "hello world".to_owned(),
f2: 1,
f3: Some(2),
f4: None,
f5: true
};
let value = original.serialize(Serializer).unwrap();
let de = Deserializer::new(value);
let decoded: Foo = Deserialize::deserialize(de).unwrap();
assert_eq!(original, decoded);
} | rust_cleaned_test_functions.jsonl/39398 | {
"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,
75861,
450,
15126,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
11091,
11,
33122,
11,
55039,
5563,
262,
2036,
33428,
341,
286,
282,
16,
25,
923,
345,
286,
282,
17,
25,
600,
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_account_commitment() {
let GenesisConfigInfo {
genesis_config,
mint_keypair: alice,
..
} = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let bank0 = bank_forks.read().unwrap().get(0).unwrap().clone();
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
let bob = Keypair::new();
let mut rpc = RpcSolPubSubImpl::default_with_bank_forks(bank_forks.clone());
let exit = Arc::new(AtomicBool::new(false));
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests()));
let subscriptions = RpcSubscriptions::new(
&exit,
bank_forks.clone(),
block_commitment_cache,
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
);
rpc.subscriptions = Arc::new(subscriptions);
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("accountNotification");
rpc.account_subscribe(
session,
subscriber,
bob.pubkey().to_string(),
Some(RpcAccountInfoConfig {
commitment: Some(CommitmentConfig::finalized()),
encoding: None,
data_slice: None,
}),
);
let tx = system_transaction::transfer(&alice, &bob.pubkey(), 100, blockhash);
bank_forks
.write()
.unwrap()
.get(1)
.unwrap()
.process_transaction(&tx)
.unwrap();
let commitment_slots = CommitmentSlots {
slot: 1,
..CommitmentSlots::default()
};
rpc.subscriptions.notify_subscribers(commitment_slots);
let commitment_slots = CommitmentSlots {
slot: 2,
root: 1,
highest_confirmed_slot: 1,
highest_confirmed_root: 1,
};
rpc.subscriptions.notify_subscribers(commitment_slots);
let expected = json!({
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": { "slot": 1 },
"value": {
"owner": system_program::id().to_string(),
"lamports": 100,
"lamportsStr": "100",
"data": "",
"executable": false,
"rentEpoch": 0,
},
},
"subscription": 0,
}
});
let (response, _) = robust_poll_or_panic(receiver);
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
} | rust_cleaned_test_functions.jsonl/4704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
36346,
478,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
25,
70433,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metadata() -> Result<()> {
let message_type = "
message test_schema {
OPTIONAL BINARY string (STRING);
}
";
let parquet_schema = SchemaDescriptor::try_from_message(message_type)?;
let key_value_metadata = vec![
KeyValue::new("foo".to_owned(), Some("bar".to_owned())),
KeyValue::new("baz".to_owned(), None),
];
let converted_arrow_schema =
parquet_to_arrow_schema(&parquet_schema, &Some(key_value_metadata))?;
let mut expected_metadata: HashMap<String, String> = HashMap::new();
expected_metadata.insert("foo".to_owned(), "bar".to_owned());
assert_eq!(converted_arrow_schema.metadata(), &expected_metadata);
Ok(())
} | rust_cleaned_test_functions.jsonl/34429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
368,
1464,
5714,
71698,
341,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
310,
76232,
425,
32593,
220,
914,
320,
16468,
317,
286,
456,
286,
7620,
286,
1077,
1346,
23300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_single_producer_single_receiver() {
init_test_log();
// Tests that the channel can send and receive messages with separate senders and
// receivers on different threads.
let message_count = 200;
let capacity = 32;
let (sender, receiver) = create::<u32>(capacity, 20);
let rx = thread::spawn(move || {
let mut count = 0;
while count < message_count {
match receiver.receive_await_timeout(20) {
Ok(_v) => count += 1,
_ => (),
};
}
});
let tx = thread::spawn(move || {
for i in 0..message_count {
sender.send_await_timeout(i, 20).unwrap();
thread::sleep(Duration::from_millis(1));
}
});
tx.join().unwrap();
rx.join().unwrap();
} | rust_cleaned_test_functions.jsonl/83271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
2540,
28938,
19487,
65691,
368,
341,
286,
2930,
4452,
5224,
1428,
286,
442,
20150,
429,
279,
5496,
646,
3624,
323,
5258,
6605,
448,
8651,
3624,
388,
323,
198,
286,
442,
39906,
389,
2155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_node_field_calls_in_language_without_fields() {
let (parser_name, parser_code) = generate_parser_for_grammar(
r#"
{
"name": "test_grammar_with_no_fields",
"extras": [
{"type": "PATTERN", "value": "\\s+"}
],
"rules": {
"a": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "b"
},
{
"type": "STRING",
"value": "c"
},
{
"type": "STRING",
"value": "d"
}
]
}
}
}
"#,
)
.unwrap();
let mut parser = Parser::new();
let language = get_test_language(&parser_name, &parser_code, None);
parser.set_language(language).unwrap();
let tree = parser.parse("b c d", None).unwrap();
let root_node = tree.root_node();
assert_eq!(root_node.kind(), "a");
assert_eq!(root_node.child_by_field_name("something"), None);
let mut cursor = root_node.walk();
assert_eq!(cursor.field_name(), None);
assert_eq!(cursor.goto_first_child(), true);
assert_eq!(cursor.field_name(), None);
} | rust_cleaned_test_functions.jsonl/99273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 889
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
5013,
45636,
1243,
29021,
39904,
12132,
368,
341,
262,
1077,
320,
9657,
1269,
11,
6729,
4136,
8,
284,
6923,
18517,
5478,
62,
41094,
1006,
286,
435,
2,
698,
286,
341,
310,
330,
606,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_offline_unsubscribe() {
let id = "id1".to_string();
let client_id = ClientId::from(id);
let mut session = Session::new_offline(SessionState::new(client_id));
let unsubscribe = proto::Unsubscribe {
packet_identifier: proto::PacketIdentifier::new(24).unwrap(),
unsubscribe_from: vec!["topic/new".to_string()],
};
let err = session.unsubscribe(&unsubscribe).unwrap_err();
assert_eq!(ErrorKind::SessionOffline, *err.kind());
} | rust_cleaned_test_functions.jsonl/51753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13651,
1056,
4907,
9384,
368,
341,
286,
1077,
877,
284,
330,
307,
16,
3263,
983,
3904,
543,
286,
1077,
2943,
842,
284,
8423,
764,
486,
1499,
3724,
317,
286,
1077,
5206,
3797,
284,
9164,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flac_reader_get_tag_returns_all_matches() {
let flac_reader = claxon::FlacReader::open("testsamples/repeated_vorbis_comment.flac").unwrap();
let mut foo = flac_reader.get_tag("FOO");
assert_eq!(foo.next(), Some("bar"));
assert_eq!(foo.next(), Some("baz"));
assert_eq!(foo.next(), None);
} | rust_cleaned_test_functions.jsonl/39104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
580,
22306,
3062,
9372,
58900,
5705,
38344,
368,
341,
262,
1077,
1320,
580,
22306,
284,
1185,
51836,
486,
3882,
580,
5062,
486,
2508,
445,
23841,
4023,
10758,
41954,
2273,
29886,
285,
17638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stack1() {
test_interpreter_and_jit_asm!(
"
mov r1, 51
stdw [r10-16], 0xab
stdw [r10-8], 0xcd
and r1, 1
lsh r1, 3
mov r2, r10
add r2, r1
ldxdw r0, [r2-16]
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0xcd } },
9
);
} | rust_cleaned_test_functions.jsonl/59030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
16,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
16,
11,
220,
20,
16,
198,
286,
1460,
86,
508,
81,
16,
15,
12,
16,
21,
1125,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_attributes() {
let mut ctx = ScmpFilterContext::new_filter(ScmpAction::KillThread).unwrap();
ctx.set_no_new_privs_bit(false).unwrap();
let ret = ctx.get_no_new_privs_bit().unwrap();
assert!(!ret);
} | rust_cleaned_test_functions.jsonl/66420 | {
"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,
8727,
18240,
368,
341,
286,
1077,
5206,
5635,
284,
2463,
1307,
5632,
1972,
486,
931,
8727,
7,
3326,
1307,
2512,
486,
53734,
6855,
568,
15454,
1428,
286,
5635,
980,
6536,
5921,
24726,
82,
13996,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_established_send_no_ack_send() {
let mut s = socket_established();
s.send_slice(b"abcdef").unwrap();
recv!(s, [TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
}]);
s.send_slice(b"foobar").unwrap();
recv!(s, [TcpRepr {
seq_number: LOCAL_SEQ + 1 + 6,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"foobar"[..],
..RECV_TEMPL
}]);
} | rust_cleaned_test_functions.jsonl/1722 | {
"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,
18583,
5102,
291,
13565,
6536,
48447,
13565,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
274,
5219,
26488,
1883,
1,
41202,
1827,
15454,
543,
286,
27006,
10297,
82,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mime_param_with_empty_quoted_string() {
let mime = Mime::from_str(r#"application/x-custom;param="""#).unwrap();
assert_eq!(mime.get_param("param").unwrap(), "");
} | rust_cleaned_test_functions.jsonl/99136 | {
"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,
83624,
4090,
6615,
15124,
11280,
9253,
3904,
368,
341,
286,
1077,
45270,
284,
82430,
486,
1499,
2895,
2601,
55543,
5132,
10776,
36898,
26,
903,
64265,
2,
568,
15454,
543,
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 |
#[test]
fn test_host_slaac_and_manual_address_prefix_conflict() {
// SLAAC should not overwrite any manually added addresses that use the
// same prefix as a SLAAC generated one.
let config = Ipv6::DUMMY_CONFIG;
let mut ctx = DummyEventDispatcherBuilder::default().build::<DummyEventDispatcher>();
let device =
ctx.state_mut().add_ethernet_device(config.local_mac, Ipv6::MINIMUM_LINK_MTU.into());
crate::device::initialize_device(&mut ctx, device);
let src_mac = config.remote_mac;
let src_ip = src_mac.to_ipv6_link_local().addr().get();
let prefix = Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0]);
let prefix_length = 64;
let manual_addr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let manual_addr = UnicastAddr::new(Ipv6Addr::new(manual_addr)).unwrap();
let manual_addr_sub = AddrSubnet::from_witness(manual_addr, prefix_length).unwrap();
let mut slaac_addr = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0];
slaac_addr[8..].copy_from_slice(&config.local_mac.to_eui64());
let slaac_addr = Ipv6Addr::new(slaac_addr);
let slaac_addr_sub = AddrSubnet::new(slaac_addr, prefix_length).unwrap();
// Manually give the device the expected address with the same prefix.
add_ip_addr_subnet(&mut ctx, device, manual_addr_sub.into_witness()).unwrap();
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
1
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Manual);
assert_eq!(ctx.dispatcher().timer_events().count(), 0);
// Should not get a new IP.
let mut icmpv6_packet_buf = slaac_packet_buf(
src_ip,
config.local_ip.get(),
prefix,
prefix_length,
false,
true,
10000,
9000,
);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
ctx.receive_ndp_packet(
device,
src_ip.try_into().unwrap(),
config.local_ip,
icmpv6_packet.unwrap_ndp(),
);
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
2
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.nth(0)
.unwrap();
// Address state and configuration type should not have changed.
assert_eq!(*entry.addr_sub(), manual_addr_sub);
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Manual);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
// Address state and configuration type should not have changed.
assert_eq!(*entry.addr_sub(), slaac_addr_sub);
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Slaac);
// Address invalidation timers were added.
assert_eq!(ctx.dispatcher().timer_events().count(), 2);
} | rust_cleaned_test_functions.jsonl/82830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1849
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
643,
4260,
580,
8378,
75428,
6744,
13974,
16059,
21242,
368,
341,
286,
442,
16797,
96710,
1265,
537,
32216,
894,
20083,
3694,
14230,
429,
990,
279,
198,
286,
442,
1852,
9252,
438,
264,
1679... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_row_convert_bool() {
// BOOLEAN value does not depend on logical type
let descr = make_column_descr![PhysicalType::BOOLEAN, LogicalType::NONE];
let row = Field::convert_bool(&descr, true);
assert_eq!(row, Field::Bool(true));
let row = Field::convert_bool(&descr, false);
assert_eq!(row, Field::Bool(false));
} | rust_cleaned_test_functions.jsonl/43794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
34910,
22159,
368,
341,
262,
442,
59393,
897,
1558,
537,
6761,
389,
19819,
943,
198,
262,
1077,
56217,
284,
1281,
8744,
64622,
20703,
39253,
929,
486,
72110,
11,
62069,
929,
486,
45425,
4821... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_album_type_convert_from_str() {
let album_type = AlbumType::from_str("album");
assert_eq!(album_type.unwrap(), AlbumType::Album);
let empty_type = AlbumType::from_str("not exist album");
assert_eq!(empty_type.is_err(), true);
} | rust_cleaned_test_functions.jsonl/87163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53241,
1819,
34910,
5673,
2895,
368,
341,
262,
1077,
8017,
1819,
284,
25665,
929,
486,
1499,
2895,
445,
21011,
797,
262,
2060,
10714,
10297,
21011,
1819,
55395,
1507,
25665,
929,
486,
32378,
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_switch_threshold_votes() {
// Init state
let mut vote_simulator = VoteSimulator::new(4);
let node_pubkey = vote_simulator.node_pubkeys[0];
let mut tower = Tower::default();
let forks = tr(0)
/ (tr(1)
/ (tr(2)
// Minor fork 1
/ (tr(10) / (tr(11) / (tr(12) / (tr(13) / (tr(14))))))
/ (tr(43)
/ (tr(44)
// Minor fork 2
/ (tr(45) / (tr(46))))
/ (tr(110)))));
// minor fork 2 at slots 46 + 47
let mut cluster_votes: HashMap<Pubkey, Vec<Slot>> = HashMap::new();
cluster_votes.insert(vote_simulator.node_pubkeys[1], vec![46]);
cluster_votes.insert(vote_simulator.node_pubkeys[2], vec![47]);
vote_simulator.fill_bank_forks(forks, &cluster_votes);
assert!(vote_simulator
.simulate_vote(14, &node_pubkey, &mut tower,)
.is_empty());
// 2/5 > SWITCH_FORK_THRESHOLD of the stake has voted
let votes_to_simulate = (46..=48).collect();
let results = vote_simulator.create_and_vote_new_branch(
45,
48,
&cluster_votes,
&votes_to_simulate,
&node_pubkey,
&mut tower,
);
for slot in 46..=48 {
if slot == 48 {
assert!(results.get(&slot).unwrap().is_empty());
} else {
assert_eq!(
*results.get(&slot).unwrap(),
vec![HeaviestForkFailures::FailedSwitchThreshold(slot)]
);
}
}
} | rust_cleaned_test_functions.jsonl/61121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1038
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21858,
65116,
368,
341,
286,
442,
15690,
1584,
198,
286,
1077,
5206,
6910,
18314,
10511,
284,
34034,
14027,
10511,
486,
931,
7,
19,
317,
286,
1077,
2436,
34014,
792,
284,
6910,
18314,
10511... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_item() {
let gil = Python::acquire_gil();
let py = gil.python();
let v = vec![2, 3, 5, 7];
let ob = v.to_object(py);
let list = <PyList as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
let val = 42i32.to_object(py);
assert_eq!(2, list.get_item(0).extract::<i32>().unwrap());
list.set_item(0, val).unwrap();
assert_eq!(42, list.get_item(0).extract::<i32>().unwrap());
} | rust_cleaned_test_functions.jsonl/16313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
5634,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
284,
7486,
20703,
17,
11,
220,
18,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snapshot_max_total_size() {
let regions: Vec<u64> = (0..20).collect();
let kv_path = Builder::new()
.prefix("test-snapshot-max-total-size-db")
.tempdir()
.unwrap();
let engine = get_test_db_for_regions(&kv_path, None, None, None, None, ®ions).unwrap();
let snapfiles_path = Builder::new()
.prefix("test-snapshot-max-total-size-snapshots")
.tempdir()
.unwrap();
let max_total_size = 10240;
let snap_mgr = SnapManagerBuilder::default()
.max_total_size(max_total_size)
.build::<_, RocksEngine>(snapfiles_path.path().to_str().unwrap(), None);
let snapshot = RocksSnapshot::new(engine.kv.clone());
// Add an oldest snapshot for receiving.
let recv_key = SnapKey::new(100, 100, 100);
let recv_head = {
let mut stat = SnapshotStatistics::new();
let mut snap_data = RaftSnapshotData::default();
let mut s = snap_mgr.get_snapshot_for_building(&recv_key).unwrap();
s.build(
engine.kv.c(),
&snapshot,
&gen_test_region(100, 1, 1),
&mut snap_data,
&mut stat,
)
.unwrap();
snap_data.write_to_bytes().unwrap()
};
let recv_remain = {
let mut data = Vec::with_capacity(1024);
let mut s = snap_mgr.get_snapshot_for_sending(&recv_key).unwrap();
s.read_to_end(&mut data).unwrap();
assert!(snap_mgr.delete_snapshot(&recv_key, s.as_ref(), true));
data
};
let mut s = snap_mgr
.get_snapshot_for_receiving(&recv_key, &recv_head)
.unwrap();
s.write_all(&recv_remain).unwrap();
s.save().unwrap();
for (i, region_id) in regions.into_iter().enumerate() {
let key = SnapKey::new(region_id, 1, 1);
let region = gen_test_region(region_id, 1, 1);
let mut s = snap_mgr.get_snapshot_for_building(&key).unwrap();
let mut snap_data = RaftSnapshotData::default();
let mut stat = SnapshotStatistics::new();
s.build(
&engine.kv.c(),
&snapshot,
®ion,
&mut snap_data,
&mut stat,
)
.unwrap();
// TODO: this size may change in different RocksDB version.
let snap_size = 1658;
let max_snap_count = (max_total_size + snap_size - 1) / snap_size;
// The first snap_size is for region 100.
// That snapshot won't be deleted because it's not for generating.
assert_eq!(
snap_mgr.get_total_snap_size(),
snap_size * cmp::min(max_snap_count, (i + 2) as u64)
);
}
} | rust_cleaned_test_functions.jsonl/39243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53265,
6345,
10784,
2368,
368,
341,
286,
1077,
13604,
25,
11312,
34837,
21,
19,
29,
284,
320,
15,
496,
17,
15,
568,
17384,
543,
286,
1077,
16178,
2638,
284,
20626,
486,
931,
741,
310,
659,
118... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bytewise_carriage_return_should_not_reset_column_count() {
new_ucmd!()
.args(&["-w6", "-b"])
.pipe_in("12345\r123456789abcdef")
.succeeds()
.stdout_is("12345\r\n123456\n789abc\ndef");
} | rust_cleaned_test_functions.jsonl/23319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
26616,
8775,
12511,
43378,
7913,
18983,
8744,
3180,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
21,
497,
6523,
65,
14108,
286,
659,
13768,
1243,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jump_forward() {
let mut masm = MacroAssembler::new();
let lbl = masm.create_label();
masm.jump(lbl);
masm.bind_label(lbl);
assert_emit!(0x14000001; masm);
} | rust_cleaned_test_functions.jsonl/20604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65436,
32121,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
9243,
76,
2520,
6106,
543,
286,
9243,
76,
84122,
70491,
317,
286,
9243,
76,
6090,
6106... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type_unit_header_32_ok() {
let expected_rest = &[1, 2, 3, 4, 5, 6, 7, 8, 9];
let encoding = Encoding {
format: Format::Dwarf32,
version: 4,
address_size: 8,
};
let mut expected_unit = TypeUnitHeader {
header: UnitHeader {
encoding,
unit_length: 0,
debug_abbrev_offset: DebugAbbrevOffset(0x0807_0605),
entries_buf: EndianSlice::new(expected_rest, LittleEndian),
},
offset: DebugTypesOffset(0),
type_signature: DebugTypeSignature(0xdead_beef_dead_beef),
type_offset: UnitOffset(0x7856_3412),
};
let section = Section::with_endian(Endian::Little)
.type_unit(&mut expected_unit)
.append_bytes(expected_rest);
let buf = section.get_contents().unwrap();
let rest = &mut EndianSlice::new(&buf, LittleEndian);
assert_eq!(
parse_type_unit_header(rest, DebugTypesOffset(0)),
Ok(expected_unit)
);
assert_eq!(*rest, EndianSlice::new(expected_rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/102006 | {
"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,
21039,
1819,
14832,
8757,
62,
18,
17,
19817,
368,
341,
286,
1077,
3601,
32231,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bootparams() {
// Test building bootparams from header.
let hdr = DummyHeader::default();
let hdr_addr = GuestAddress(0x1000);
let mut bootparams = BootParams::new(&hdr, hdr_addr);
assert_eq!(bootparams.header, hdr.as_slice());
assert_eq!(bootparams.header_start, hdr_addr);
// Test setting sections.
let sections = vec![DummySection::default(); 2];
let sections_addr = GuestAddress(0x2000);
bootparams.set_sections::<DummySection>(sections.as_slice(), sections_addr);
assert_eq!(
bootparams.sections,
Some(vec![0u8; 2 * size_of::<DummySection>()])
);
assert_eq!(bootparams.sections_start, Some(sections_addr));
// Test overwriting sections.
let sections = vec![DummySection::default(); 3];
let sections_addr = GuestAddress(0x3000);
bootparams.set_sections::<DummySection>(sections.as_slice(), sections_addr);
assert_eq!(
bootparams.sections,
Some(vec![0u8; 3 * size_of::<DummySection>()])
);
assert_eq!(bootparams.sections_start, Some(sections_addr));
// Test appending a new section.
assert_eq!(
bootparams.add_section::<DummySection>(&DummySection::default(), None),
Ok(sections_addr.unchecked_add(3 * size_of::<DummySection>() as u64))
);
assert_eq!(
bootparams.sections,
Some(vec![0u8; 4 * size_of::<DummySection>()])
);
assert_eq!(bootparams.sections_start, Some(sections_addr));
// Test setting modules.
let modules = vec![DummyModule::default(); 2];
let modules_addr = GuestAddress(0x4000);
bootparams.set_modules::<DummyModule>(modules.as_slice(), modules_addr);
assert_eq!(
bootparams.modules,
Some(vec![0u8; 2 * size_of::<DummyModule>()])
);
assert_eq!(bootparams.modules_start, Some(modules_addr));
// Test overwriting modules.
let modules = vec![DummyModule::default(); 3];
let modules_addr = GuestAddress(0x5000);
bootparams.set_modules::<DummyModule>(modules.as_slice(), modules_addr);
assert_eq!(
bootparams.modules,
Some(vec![0u8; 3 * size_of::<DummyModule>()])
);
assert_eq!(bootparams.modules_start, Some(modules_addr));
// Test appending a new module.
assert_eq!(
bootparams.add_module::<DummyModule>(&DummyModule::default(), None),
Ok(modules_addr.unchecked_add(3 * size_of::<DummyModule>() as u64))
);
// Test appending a new module of a different type.
assert_eq!(
bootparams.add_module::<OtherDummyModule>(&OtherDummyModule::default(), None),
Ok(modules_addr.unchecked_add(
3 * size_of::<DummyModule>() as u64 + size_of::<OtherDummyModule>() as u64
))
);
} | rust_cleaned_test_functions.jsonl/74840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
3519,
368,
341,
286,
442,
3393,
4752,
10459,
3519,
504,
4247,
624,
286,
1077,
36615,
284,
50567,
4047,
486,
2258,
543,
286,
1077,
36615,
7387,
284,
26215,
4286,
7,
15,
87,
16,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_lit_max_val_dec2_exceeded() {
let i = i128::MAX / 100 + 1;
let s = format!("{}", i);
let res = Decimal::<2>::from_str(&s);
assert!(res.is_err());
let err = res.unwrap_err();
assert_eq!(err, ParseDecimalError::MaxValueExceeded);
} | rust_cleaned_test_functions.jsonl/12028 | {
"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,
4042,
98399,
6345,
6189,
13783,
17,
2702,
94206,
368,
341,
286,
1077,
600,
284,
600,
16,
17,
23,
486,
10586,
608,
220,
16,
15,
15,
488,
220,
16,
280,
286,
1077,
274,
284,
3561,
79878,
600,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.