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_proc_funcs() {
let _maps = rustix::io::proc_self_maps().unwrap();
let _pagemap = rustix::io::proc_self_pagemap().unwrap();
} | rust_cleaned_test_functions.jsonl/39152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24436,
64124,
368,
341,
262,
1077,
716,
17640,
284,
23071,
941,
486,
815,
486,
15782,
25637,
46512,
1005,
15454,
543,
262,
1077,
716,
79,
14661,
391,
284,
23071,
941,
486,
815,
486,
15782,
25637,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_text_length() {
let text = Text::new("");
assert_eq!(text.len(), 0);
assert!(text.is_empty());
let text = Text::new("hello world");
assert_eq!(text.len(), 11);
assert!(!text.is_empty());
} | rust_cleaned_test_functions.jsonl/100708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
5118,
368,
341,
286,
1077,
1467,
284,
2918,
486,
931,
56141,
286,
2060,
10714,
10297,
1318,
19406,
1507,
220,
15,
317,
286,
2060,
10297,
1318,
2079,
15124,
5231,
286,
1077,
1467,
284,
2918,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rename_all() {
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
enum E {
#[serde(rename_all = "camelCase")]
Serialize {
serialize: bool,
serialize_seq: bool,
},
#[serde(rename_all = "kebab-case")]
SerializeSeq {
serialize: bool,
serialize_seq: bool,
},
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
SerializeMap {
serialize: bool,
serialize_seq: bool,
},
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
struct S {
serialize: bool,
serialize_seq: bool,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "SCREAMING-KEBAB-CASE")]
struct ScreamingKebab {
serialize: bool,
serialize_seq: bool,
}
assert_tokens(
&E::Serialize {
serialize: true,
serialize_seq: true,
},
&[
Token::StructVariant {
name: "E",
variant: "serialize",
len: 2,
},
Token::Str("serialize"),
Token::Bool(true),
Token::Str("serializeSeq"),
Token::Bool(true),
Token::StructVariantEnd,
],
);
assert_tokens(
&E::SerializeSeq {
serialize: true,
serialize_seq: true,
},
&[
Token::StructVariant {
name: "E",
variant: "serialize_seq",
len: 2,
},
Token::Str("serialize"),
Token::Bool(true),
Token::Str("serialize-seq"),
Token::Bool(true),
Token::StructVariantEnd,
],
);
assert_tokens(
&E::SerializeMap {
serialize: true,
serialize_seq: true,
},
&[
Token::StructVariant {
name: "E",
variant: "serialize_map",
len: 2,
},
Token::Str("SERIALIZE"),
Token::Bool(true),
Token::Str("SERIALIZE_SEQ"),
Token::Bool(true),
Token::StructVariantEnd,
],
);
assert_tokens(
&S {
serialize: true,
serialize_seq: true,
},
&[
Token::Struct { name: "S", len: 2 },
Token::Str("Serialize"),
Token::Bool(true),
Token::Str("SerializeSeq"),
Token::Bool(true),
Token::StructEnd,
],
);
assert_tokens(
&ScreamingKebab {
serialize: true,
serialize_seq: true,
},
&[
Token::Struct {
name: "ScreamingKebab",
len: 2,
},
Token::Str("SERIALIZE"),
Token::Bool(true),
Token::Str("SERIALIZE-SEQ"),
Token::Bool(true),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1844
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
5705,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
11091,
11,
55039,
5563,
262,
11506,
47024,
51787,
5705,
284,
330,
72139,
19096,
5422,
262,
7618,
468,
341,
286,
11506,
47024,
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_fx15_set_delay() {
let mut machine = Machine::new(TestContext::new());
machine.register_set(0xA, 4);
machine.test_opcode(0xFA15);
// Should set the delay timer value in VX
assert_eq!(machine.delay_timer, 4);
// Should increment program counter by two
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127972 | {
"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,
62691,
16,
20,
2602,
22198,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
9929,
2602,
7,
15,
14673,
11,
220,
19,
317,
262,
5662,
5958,
71319,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_are_sentences_similar_two_1() {
assert_eq!(
Solution::are_sentences_similar_two(
lc_vec_s!["great","acting","skills"],
lc_vec_s!["fine","drama","talent"],
lc_matrix_s![["great","good"],["fine","good"],["drama","acting"],["skills","talent"]]
),
true
);
} | rust_cleaned_test_functions.jsonl/134561 | {
"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,
56855,
75903,
18314,
3569,
23241,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
546,
75903,
18314,
3569,
23241,
1006,
394,
36213,
13251,
643,
0,
1183,
46891,
2198,
34922,
2198,
53240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_restore() {
let no_restore = r#"
[restore]
enable = false
"#;
let config = ConfigBuilder::new()
.with_log()
.with_api()
.with_pet()
.with_mask()
.with_model()
.with_metrics()
.with_redis()
.with_s3()
.with_custom(no_restore)
.build();
let settings = Settings::load_from_str(&config).unwrap();
assert_eq!(settings.restore.enable, false);
} | rust_cleaned_test_functions.jsonl/19537 | {
"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,
62677,
368,
341,
286,
1077,
902,
62677,
284,
435,
2,
698,
286,
508,
30804,
921,
286,
7283,
284,
895,
198,
286,
5869,
401,
286,
1077,
2193,
284,
5532,
3297,
486,
931,
741,
310,
659,
4197,
5224,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_block_inode_populated_directory_with_long() {
let dir = tempdir();
dir.child("one").touch().unwrap();
dir.child("two").touch().unwrap();
#[cfg(windows)]
let matched = "- one\n\\- two\n$";
#[cfg(unix)]
let matched = "\\d+ +one\n\\d+ +two\n$";
cmd()
.arg("--long")
.arg("--blocks")
.arg("inode,name")
.arg("--ignore-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match(matched).unwrap());
} | rust_cleaned_test_functions.jsonl/630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
7113,
46748,
17061,
7757,
14846,
6615,
17799,
368,
341,
262,
1077,
5419,
284,
2730,
3741,
543,
262,
5419,
17531,
445,
603,
1827,
22020,
1005,
15454,
543,
262,
5419,
17531,
445,
19789,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_body() {
let _ = ::env_logger::try_init();
let multipart = Multipart::with_body(mock_stream(&[]), BOUNDARY);
pin_mut!(multipart);
ready_assert_eq!(|cx| multipart.as_mut().poll_has_next_field(cx), Ok(false));
} | rust_cleaned_test_functions.jsonl/131800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
14114,
368,
341,
286,
1077,
716,
284,
3504,
3160,
27413,
486,
1539,
6137,
543,
286,
1077,
68058,
284,
386,
18204,
486,
4197,
14114,
30389,
12673,
2099,
1294,
701,
425,
13579,
8642,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fr_repr_ordering() {
fn assert_equality(a: FrRepr, b: FrRepr) {
assert_eq!(a, b);
assert!(a.cmp(&b) == ::std::cmp::Ordering::Equal);
}
fn assert_lt(a: FrRepr, b: FrRepr) {
assert!(a < b);
assert!(b > a);
}
assert_equality(FrRepr([9999, 9999, 9999, 9999]), FrRepr([9999, 9999, 9999, 9999]));
assert_equality(FrRepr([9999, 9998, 9999, 9999]), FrRepr([9999, 9998, 9999, 9999]));
assert_equality(FrRepr([9999, 9999, 9999, 9997]), FrRepr([9999, 9999, 9999, 9997]));
assert_lt(FrRepr([9999, 9997, 9999, 9998]), FrRepr([9999, 9997, 9999, 9999]));
assert_lt(FrRepr([9999, 9997, 9998, 9999]), FrRepr([9999, 9997, 9999, 9999]));
assert_lt(FrRepr([9, 9999, 9999, 9997]), FrRepr([9999, 9999, 9999, 9997]));
} | rust_cleaned_test_functions.jsonl/66312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
68535,
7869,
287,
368,
341,
262,
5168,
2060,
2204,
10473,
2877,
25,
2869,
693,
649,
11,
293,
25,
2869,
693,
649,
8,
341,
286,
2060,
10714,
10297,
64,
11,
293,
317,
286,
2060,
10297,
64,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrong_withdraw_capacity() {
let mut case = get_correct_btc_case();
case.capacity_cells.outputs[0].capacity = 1;
case.expect_return_code = Error::CapacityInvalid as i8;
case_runner::run_test(case)
} | rust_cleaned_test_functions.jsonl/31025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75198,
6615,
7633,
35603,
368,
341,
262,
1077,
5206,
1142,
284,
633,
31550,
880,
10413,
19096,
543,
262,
1142,
59168,
37796,
65716,
58,
15,
936,
37387,
284,
220,
16,
280,
262,
1142,
25952,
12511,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 5 |
#[test]
fn test_with_bls12() {
fn naive_multiexp<G: CurveAffine>(
bases: Arc<Vec<G>>,
exponents: Arc<Vec<<G::Scalar as PrimeField>::Repr>>,
) -> G::Projective {
assert_eq!(bases.len(), exponents.len());
let mut acc = G::Projective::zero();
for (base, exp) in bases.iter().zip(exponents.iter()) {
acc.add_assign(&base.mul(*exp));
}
acc
}
use crate::bls::{Bls12, Engine};
use rand;
const SAMPLES: usize = 1 << 14;
let rng = &mut rand::thread_rng();
let v = Arc::new(
(0..SAMPLES)
.map(|_| <Bls12 as ScalarEngine>::Fr::random(rng).into_repr())
.collect::<Vec<_>>(),
);
let g = Arc::new(
(0..SAMPLES)
.map(|_| <Bls12 as Engine>::G1::random(rng).into_affine())
.collect::<Vec<_>>(),
);
let now = std::time::Instant::now();
let naive = naive_multiexp(g.clone(), v.clone());
println!("Naive: {}", now.elapsed().as_millis());
let now = std::time::Instant::now();
let pool = Worker::new();
let fast = multiexp(&pool, (g, 0), FullDensity, v, &mut None)
.wait()
.unwrap();
println!("Fast: {}", now.elapsed().as_millis());
assert_eq!(naive, fast);
} | rust_cleaned_test_functions.jsonl/45398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 629
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
880,
4730,
16,
17,
368,
341,
262,
5168,
49665,
25133,
4580,
59727,
25,
53677,
25841,
482,
17055,
286,
23092,
25,
19689,
50439,
59727,
61340,
286,
505,
2700,
25,
19689,
50439,
2442,
38,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_network_api() {
let runtime = consensus_runtime();
let num_nodes = 5;
let mut receivers: Vec<NetworkReceivers<u64>> = Vec::new();
let mut playground = NetworkPlayground::new(runtime.executor());
let mut nodes = Vec::new();
let (signers, validator_verifier) = random_validator_verifier(num_nodes, None, false);
let peers: Vec<_> = signers.iter().map(|signer| signer.author()).collect();
let validators = Arc::new(validator_verifier);
for peer in &peers {
let (network_reqs_tx, network_reqs_rx) = channel::new_test(8);
let (consensus_tx, consensus_rx) = channel::new_test(8);
let network_sender = ConsensusNetworkSender::new(network_reqs_tx);
let network_events = ConsensusNetworkEvents::new(consensus_rx);
playground.add_node(*peer, consensus_tx, network_reqs_rx);
let (self_sender, self_receiver) = channel::new_test(8);
let node = NetworkSender::new(*peer, network_sender, self_sender, Arc::clone(&validators));
let (task, receiver) =
NetworkTask::new(1, network_events, self_receiver, Arc::clone(&validators));
receivers.push(receiver);
runtime.executor().spawn(task.start());
nodes.push(node);
}
let vote_msg = VoteMsg::new(
Vote::new(
VoteData::new(BlockInfo::random(1), BlockInfo::random(0)),
peers[0],
placeholder_ledger_info(),
&signers[0],
),
test_utils::placeholder_sync_info(),
);
let previous_qc = certificate_for_genesis();
let proposal = ProposalMsg::new(
Block::new_proposal(0, 1, 0, previous_qc.clone(), &signers[0]),
SyncInfo::new(previous_qc.clone(), previous_qc.clone(), None),
);
block_on(async move {
nodes[0]
.send_vote(vote_msg.clone(), peers[2..5].to_vec())
.await;
playground
.wait_for_messages(3, NetworkPlayground::take_all)
.await;
for r in receivers.iter_mut().take(5).skip(2) {
let v = r.votes.next().await.unwrap();
assert_eq!(v, vote_msg);
}
nodes[4].broadcast_proposal(proposal.clone()).await;
playground
.wait_for_messages(4, NetworkPlayground::take_all)
.await;
for r in receivers.iter_mut().take(num_nodes - 1) {
let p = r.proposals.next().await.unwrap();
assert_eq!(p, proposal);
}
});
} | rust_cleaned_test_functions.jsonl/46937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
11697,
368,
341,
262,
1077,
15592,
284,
23869,
33232,
543,
262,
1077,
1629,
14896,
284,
220,
20,
280,
262,
1077,
5206,
39906,
25,
11312,
27,
12320,
693,
346,
1945,
34837,
21,
19,
2452,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_deserialize_with_struct() {
assert_de_tokens(
&DeserializeWithStruct { a: 1, b: 2 },
&[
Token::Struct { name: "DeserializeWithStruct", len: 2 },
Token::Str("a"),
Token::I8(1),
Token::Str("b"),
Token::Bool(false),
Token::StructEnd,
],
);
assert_de_tokens(
&DeserializeWithStruct { a: 1, b: 123 },
&[
Token::Struct { name: "DeserializeWithStruct", len: 2 },
Token::Str("a"),
Token::I8(1),
Token::Str("b"),
Token::Bool(true),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/58620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
6615,
15126,
368,
341,
262,
2060,
2259,
28838,
1006,
286,
609,
64465,
2354,
9422,
314,
264,
25,
220,
16,
11,
293,
25,
220,
17,
1153,
286,
609,
9640,
310,
9660,
486,
9422,
314,
829... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_math_stmt() {
let source1 = "startdoc \\(\\sum_1^\\infty f(x)\\)";
let source2 = "startdoc \\[\\sum_1^\\infty f(x)\\]";
let expected1 = r#"\begin{document}
\(\sum_1^\infty f(x)\)
\end{document}
"#;
let expected2 = r#"\begin{document}
\[\sum_1^\infty f(x)\]
\end{document}
"#;
let mut parser1 = Parser::new(Lexer::new(source1));
let mut parser2 = Parser::new(Lexer::new(source2));
assert_eq!(expected1, parser1.make_latex_format().unwrap());
assert_eq!(expected2, parser2.make_latex_format().unwrap());
} | rust_cleaned_test_functions.jsonl/131293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
65561,
21824,
368,
341,
262,
1077,
2530,
16,
284,
330,
2468,
5236,
24984,
7,
3422,
1242,
62,
16,
61,
3422,
258,
36958,
282,
2075,
8,
3422,
24023,
262,
1077,
2530,
17,
284,
330,
2468,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_term_query_debug() {
let term_query = TermQuery::new(
Term::from_field_text(Field::from_field_id(1), "hello"),
IndexRecordOption::WithFreqs,
);
assert_eq!(
format!("{:?}", term_query),
"TermQuery(Term(field=1,bytes=[104, 101, 108, 108, 111]))"
);
} | rust_cleaned_test_functions.jsonl/53381 | {
"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,
17464,
5738,
15446,
368,
341,
286,
1077,
4647,
5738,
284,
17519,
2859,
486,
931,
1006,
310,
17519,
486,
1499,
5013,
4326,
57788,
486,
1499,
5013,
842,
7,
16,
701,
330,
14990,
4461,
310,
8008,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_follow_negative() {
let driver = fake::FakeDriver::default();
let mut gov = Governance::new(
fixture_for_following(),
driver.get_fake_env(),
driver.get_fake_ledger(),
);
gov.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "test".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: "dummy text".to_string(),
})),
..Default::default()
},
)
.unwrap();
// No controller for 4 yet.
let result = fake::register_vote(
&mut gov,
// Must match neuron 4's serialized_id.
principal(4),
NeuronId { id: 4 },
ProposalId { id: 1 },
Vote::No,
);
assert_matches!(
result.command,
Some(manage_neuron_response::Command::Error(err))
if err.error_type == ErrorType::NotAuthorized as i32
);
gov.proto.neurons.get_mut(&4).unwrap().controller = Some(principal(4));
fake::register_vote_assert_success(
&mut gov,
principal(4),
NeuronId { id: 4 },
ProposalId { id: 1 },
Vote::No,
);
fake::register_vote_assert_success(
&mut gov,
principal(5),
NeuronId { id: 5 },
ProposalId { id: 1 },
Vote::No,
);
fake::register_vote_assert_success(
&mut gov,
principal(6),
NeuronId { id: 6 },
ProposalId { id: 1 },
Vote::No,
);
gov.run_periodic_tasks().now_or_never();
// The proposal should now be rejected.
assert_eq!(
ProposalStatus::Rejected,
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.status()
);
// Make sure that the neuron has been changed the reject fee.
assert_eq!(
gov.proto.neurons.get(&1).unwrap().neuron_fees_e8s,
gov.proto.economics.unwrap().reject_cost_e8s
);
} | rust_cleaned_test_functions.jsonl/1122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1016
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43490,
53865,
368,
341,
262,
1077,
5579,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
5206,
47625,
284,
80589,
486,
931,
1006,
286,
12507,
5478,
43490,
287,
3148,
286,
5579,
670,
5688... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_radio_mock_set_incorrect_state() {
let mut radio = MockRadio::new(&[Transaction::set_state(MockState::Idle, None)]);
radio.set_state(MockState::Sleep).unwrap();
radio.done();
} | rust_cleaned_test_functions.jsonl/35585 | {
"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,
49740,
34134,
2602,
1243,
19928,
4387,
368,
341,
286,
1077,
5206,
8887,
284,
14563,
28203,
486,
931,
2099,
58,
8070,
486,
746,
4387,
66436,
1397,
486,
41370,
11,
2240,
7252,
626,
286,
8887,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_simple() {
let room = Room::from_str("10\n\
3 6\n\
0 4\n\
7 3\n\
9 9").unwrap();
let e = room.get_enabled_light_count();
assert_eq!( 7, e );
} | rust_cleaned_test_functions.jsonl/128408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
286,
1077,
3054,
284,
10420,
486,
1499,
2895,
445,
16,
15,
1699,
5661,
18,
220,
21,
1699,
5661,
15,
220,
19,
1699,
5661,
22,
220,
18,
1699,
5661,
24,
220,
24,
1827,
15454,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_alogithm_id() {
assert_eq!(
SignatureScheme::try_from(TPM2_ALG_RSASSA).unwrap(),
SignatureScheme::RsaSsa
);
assert_eq!(
SignatureScheme::try_from(TPM2_ALG_RSAPSS).unwrap(),
SignatureScheme::RsaPss
);
assert_eq!(
SignatureScheme::try_from(TPM2_ALG_ECDSA).unwrap(),
SignatureScheme::EcDsa
);
assert_eq!(
SignatureScheme::try_from(TPM2_ALG_ECDAA).unwrap(),
SignatureScheme::EcDaa
);
assert_eq!(
SignatureScheme::try_from(TPM2_ALG_ECSCHNORR).unwrap(),
SignatureScheme::EcSchnorr
);
assert_eq!(
SignatureScheme::try_from(TPM2_ALG_SM2).unwrap(),
SignatureScheme::Sm2
);
assert!(
SignatureScheme::try_from(TPM2_ALG_ERROR).is_err(),
"Error should not exist in SignatureScheme"
);
} | rust_cleaned_test_functions.jsonl/41504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
32232,
28906,
486,
1539,
5673,
4140,
8795,
17,
8912,
38,
59138,
4939,
32,
568,
15454,
3148,
310,
32232,
28906,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range() {
assert_eq!((0..5).collect::<Vec<_>>(), [0, 1, 2, 3, 4]);
assert_eq!((-10..-1).collect::<Vec<_>>(), [-10, -9, -8, -7, -6, -5, -4, -3, -2]);
assert_eq!((0..5).rev().collect::<Vec<_>>(), [4, 3, 2, 1, 0]);
assert_eq!((200..-5).count(), 0);
assert_eq!((200..-5).rev().count(), 0);
assert_eq!((200..200).count(), 0);
assert_eq!((200..200).rev().count(), 0);
assert_eq!((0..100).size_hint(), (100, Some(100)));
// this test is only meaningful when sizeof usize < sizeof u64
assert_eq!((usize::MAX - 1..usize::MAX).size_hint(), (1, Some(1)));
assert_eq!((-10..-1).size_hint(), (9, Some(9)));
assert_eq!((-1..-10).size_hint(), (0, Some(0)));
assert_eq!((-70..58).size_hint(), (128, Some(128)));
assert_eq!((-128..127).size_hint(), (255, Some(255)));
assert_eq!((-2..isize::MAX).size_hint(),
(isize::MAX as usize + 2, Some(isize::MAX as usize + 2)));
} | rust_cleaned_test_functions.jsonl/25951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
368,
341,
262,
2060,
10714,
0,
1188,
15,
496,
20,
568,
17384,
27638,
10050,
32399,
2452,
1507,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
2558,
262,
2060,
10714,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let packet = Packet::new_unchecked(&PACKET_BYTES[..]);
let repr = Repr::parse(&packet, &SRC_ADDR.into(), &DST_ADDR.into(),
&ChecksumCapabilities::default()).unwrap();
assert_eq!(repr, packet_repr());
} | rust_cleaned_test_functions.jsonl/36419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
17279,
1348,
40705,
95874,
2558,
286,
1077,
30636,
284,
1032,
649,
486,
6400,
2099,
24829,
11,
609,
56017,
16058,
39860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_to_vec() {
let r: Record = 3i64.into();
assert_eq!("3".as_bytes().to_vec(), r.to_vec());
let r: Record = "foo".into();
assert_eq!("foo".as_bytes().to_vec(), r.to_vec());
} | rust_cleaned_test_functions.jsonl/97523 | {
"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,
14192,
2346,
13251,
368,
341,
262,
1077,
435,
25,
13583,
284,
220,
18,
72,
21,
19,
39860,
543,
262,
2060,
10714,
17223,
18,
3263,
300,
12524,
1005,
983,
13251,
1507,
435,
2389,
13251,
5231,
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_split_check() {
let path = TempDir::new("test-raftstore").unwrap();
let path_str = path.path().to_str().unwrap();
let db_opts = DBOptions::new();
let cfs_opts = ALL_CFS
.iter()
.map(|cf| CFOptions::new(cf, ColumnFamilyOptions::new()))
.collect();
let engine = Arc::new(new_engine_opt(path_str, db_opts, cfs_opts).unwrap());
let mut region = Region::new();
region.set_id(1);
region.mut_peers().push(Peer::new());
region.mut_region_epoch().set_version(2);
region.mut_region_epoch().set_conf_ver(5);
let (tx, rx) = mpsc::sync_channel(100);
let ch = RetryableSendCh::new(tx, "test-split");
let mut cfg = Config::default();
cfg.region_max_size = ReadableSize(BUCKET_NUMBER_LIMIT as u64);
let mut runnable = SplitCheckRunner::new(
Arc::clone(&engine),
ch.clone(),
Arc::new(CoprocessorHost::new(cfg, ch.clone())),
);
// so split key will be z0006
for i in 0..12 {
let s = keys::data_key(format!("{:04}", i).as_bytes());
engine.put(&s, &s).unwrap();
}
runnable.run(SplitCheckTask::new(®ion, false));
loop {
match rx.try_recv() {
Ok(Msg::SplitRegion {
region_id,
region_epoch,
split_key,
..
}) => {
assert_eq!(region_id, region.get_id());
assert_eq!(®ion_epoch, region.get_region_epoch());
assert_eq!(split_key, b"0006");
break;
}
Ok(Msg::ApproximateRegionSize { region_id, .. }) => {
assert_eq!(region_id, region.get_id());
continue;
}
others => panic!("expect split check result, but got {:?}", others),
}
}
} | rust_cleaned_test_functions.jsonl/30855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
7200,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
445,
1944,
12,
2944,
4314,
1827,
15454,
543,
286,
1077,
1815,
2895,
284,
1815,
3875,
1005,
983,
2895,
1005,
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... | 3 |
#[test]
fn test_try_from_row_for_tuple_2() -> Result<()> {
use std::convert::TryFrom;
let conn = Connection::open_in_memory()?;
conn.execute("CREATE TABLE test (a INTEGER, b INTEGER)", [])?;
conn.execute("INSERT INTO test VALUES (42, 47)", [])?;
let val = conn.query_row("SELECT a, b FROM test", [], |row| {
<(u32, u32)>::try_from(row)
})?;
assert_eq!(val, (42, 47));
let fail = conn.query_row("SELECT a, b FROM test", [], |row| {
<(u32, u32, u32)>::try_from(row)
});
assert!(fail.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/42676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8530,
5478,
21773,
62,
17,
368,
1464,
5714,
71698,
341,
286,
990,
1460,
486,
14166,
486,
21453,
3830,
401,
286,
1077,
4534,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
4534,
7769,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_all_attrs_set_correctly() {
let attrs: ParamAttrs = syn::parse_quote!(
/// TEST DOC
#[param(name = "NAME", description = "DESC", internal, default=20, range=2..=10)]
);
let lit_default: syn::Lit = syn::parse_quote!(20);
let lit_range: (syn::Lit, syn::Lit) = (syn::parse_quote!(2), syn::parse_quote!(10));
assert_eq!(attrs.name, Some("NAME".to_string()));
assert_eq!(attrs.desc, Some("DESC".to_string()));
assert!(attrs.internal);
assert_eq!(attrs.default, Some(lit_default));
assert_eq!(attrs.range, Some(lit_range));
} | rust_cleaned_test_functions.jsonl/22301 | {
"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,
5705,
39578,
2602,
31550,
398,
368,
341,
286,
1077,
16204,
25,
6991,
53671,
284,
6782,
486,
6400,
45236,
33673,
310,
1048,
13602,
60355,
198,
310,
11506,
903,
3153,
284,
330,
7535,
497,
4008,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_event() {
let stream = r#"{"vs":"KERI10JSON000159_","pre":"ECui-E44CqN2U7uffCikRCp_YKLkPrA4jsTZ_A0XRLzc","sn":"0","ilk":"icp","sith":"2","keys":["DSuhyBcPZEZLK-fcw5tzHn2N46wRCG_ZOoeKtWTOunRA","DVcuJOOJF1IE8svqEtrSuyQjGTd2HhfAkt9y2QkUtFJI","DT1iAhBWCkvChxNWsby2J0pJyxBIxbAtbLA0Ljx-Grh8"],"nxt":"Evhf3437ZRRnVhT0zOxo_rBX_GxpGoAnLuzrVlDK8ZdM","toad":"0","wits":[],"cnfg":[]}extra data"#;
assert!(message(stream).is_ok())
} | rust_cleaned_test_functions.jsonl/105156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
368,
341,
262,
1077,
4269,
284,
435,
55543,
4913,
11562,
3252,
79842,
40,
16,
15,
5370,
15,
15,
15,
16,
20,
24,
62,
2198,
1726,
3252,
7498,
1963,
13431,
19,
19,
34,
80,
45,
17,
52,
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_iterator_peekable() {
let xs = vec![0u, 1, 2, 3, 4, 5];
let mut it = xs.iter().map(|&x|x).peekable();
assert_eq!(it.peek().unwrap(), &0);
assert_eq!(it.next().unwrap(), 0);
assert_eq!(it.next().unwrap(), 1);
assert_eq!(it.next().unwrap(), 2);
assert_eq!(it.peek().unwrap(), &3);
assert_eq!(it.peek().unwrap(), &3);
assert_eq!(it.next().unwrap(), 3);
assert_eq!(it.next().unwrap(), 4);
assert_eq!(it.peek().unwrap(), &5);
assert_eq!(it.next().unwrap(), 5);
assert!(it.peek().is_none());
assert!(it.next().is_none());
} | rust_cleaned_test_functions.jsonl/7949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
62,
29107,
480,
368,
341,
262,
1077,
11943,
284,
7486,
20703,
15,
84,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
432,
284,
11943,
19471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_size() {
println!(
"String: {}",
std::mem::size_of::<crate::string::StdString>()
);
println!(
"Box<str>: {}",
std::mem::size_of::<crate::string::OwnedStr>()
);
println!(
"Box<Box<str>>: {}",
std::mem::size_of::<Box<crate::string::OwnedStr>>()
);
println!("str: {}", std::mem::size_of::<&'static str>());
println!(
"Cow: {}",
std::mem::size_of::<std::borrow::Cow<'static, str>>()
);
} | rust_cleaned_test_functions.jsonl/75292 | {
"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,
2368,
368,
341,
286,
13751,
33673,
310,
330,
703,
25,
4687,
756,
310,
1460,
486,
10536,
486,
2141,
3575,
27638,
61711,
486,
917,
486,
47341,
18949,
286,
1439,
286,
13751,
33673,
310,
330,
1611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_and_non_exhaustive() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_struct("Foo")
.field("bar", &true)
.field("baz", &format_args!("{}/{}", 10, 20))
.finish_non_exhaustive()
}
}
assert_eq!("Foo { bar: true, baz: 10/20, .. }", debug3::pprint(Foo));
} | rust_cleaned_test_functions.jsonl/124738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
8378,
21637,
2702,
15074,
533,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
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_gc() {
let mut w = test_writer();
let mut replica = test_replica();
execute(&mut w, &mut replica).unwrap();
assert_eq!(&w.into_string(), "garbage collected.\n")
} | rust_cleaned_test_functions.jsonl/123300 | {
"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,
49423,
368,
341,
286,
1077,
5206,
289,
284,
1273,
28908,
543,
286,
1077,
5206,
36954,
284,
1273,
25533,
15317,
543,
286,
9026,
2099,
6984,
289,
11,
609,
6984,
36954,
568,
15454,
543,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_send_window() {
let stream_start = Wrapping(u32::MAX - 11);
let write_data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
let mut send_data = [0; 16];
let mut send_window = SendWindow::new(8, stream_start);
assert_eq!(send_window.write_available(), 8);
assert_eq!(send_window.send_pos(), stream_start);
assert_eq!(send_window.write(&write_data[0..4]), 4);
assert_eq!(send_window.write(&write_data[4..6]), 2);
assert_eq!(send_window.write(&write_data[6..10]), 2);
assert_eq!(send_window.send_pos(), stream_start);
assert_eq!(send_window.send_available(), 8);
assert_eq!(
send_window.send(&mut send_data[0..6]),
Some((stream_start, stream_start + Wrapping(6)))
);
for i in 0..6 {
assert_eq!(send_data[i], i as u8);
}
assert_eq!(send_window.send_pos(), stream_start + Wrapping(6));
assert_eq!(send_window.write_available(), 0);
assert_eq!(
send_window.ack_range(stream_start, stream_start + Wrapping(4)),
AckResult::PartialAck(stream_start + Wrapping(6))
);
assert_eq!(send_window.write_available(), 4);
assert_eq!(send_window.write(&write_data[8..16]), 4);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(4), stream_start + Wrapping(6)),
AckResult::Ack
);
assert_eq!(send_window.write_available(), 2);
assert_eq!(send_window.write(&write_data[12..16]), 2);
assert_eq!(send_window.send_available(), 8);
assert_eq!(
send_window.send(&mut send_data[6..9]),
Some((stream_start + Wrapping(6), stream_start + Wrapping(9)))
);
for i in 6..9 {
assert_eq!(send_data[i], i as u8);
}
assert_eq!(send_window.send_pos(), stream_start + Wrapping(9));
assert_eq!(send_window.send_available(), 5);
assert_eq!(
send_window.send(&mut send_data[9..11]),
Some((stream_start + Wrapping(9), stream_start + Wrapping(11)))
);
for i in 9..11 {
assert_eq!(send_data[i], i as u8);
}
assert_eq!(send_window.send_pos(), stream_start + Wrapping(11));
assert_eq!(send_window.send_available(), 3);
assert_eq!(
send_window.send(&mut send_data[11..16]),
Some((stream_start + Wrapping(11), stream_start + Wrapping(14)))
);
for i in 11..14 {
assert_eq!(send_data[i], i as u8);
}
assert_eq!(send_window.send_pos(), stream_start + Wrapping(14));
// Ack ranges that error should not affect anything
assert_eq!(
send_window.ack_range(stream_start + Wrapping(10), stream_start + Wrapping(11)),
AckResult::NotFound
);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(11), stream_start + Wrapping(15)),
AckResult::InvalidRange
);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(11), stream_start + Wrapping(12)),
AckResult::PartialAck(stream_start + Wrapping(14))
);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(6), stream_start + Wrapping(9)),
AckResult::Ack
);
assert_eq!(send_window.write_available(), 3);
assert_eq!(send_window.send_pos(), stream_start + Wrapping(14));
assert_eq!(send_window.write(&write_data[14..16]), 2);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(12), stream_start + Wrapping(14)),
AckResult::Ack
);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(9), stream_start + Wrapping(11)),
AckResult::Ack
);
assert_eq!(send_window.write_available(), 6);
assert_eq!(send_window.send_available(), 2);
assert_eq!(
send_window.send(&mut send_data[14..16]),
Some((stream_start + Wrapping(14), stream_start + Wrapping(16)))
);
for i in 14..16 {
assert_eq!(send_data[i], i as u8);
}
assert_eq!(
send_window.ack_range(stream_start + Wrapping(14), stream_start + Wrapping(15)),
AckResult::PartialAck(stream_start + Wrapping(16)),
);
assert_eq!(
send_window.ack_range(stream_start + Wrapping(15), stream_start + Wrapping(16)),
AckResult::Ack,
);
assert_eq!(send_window.write_available(), 8);
} | rust_cleaned_test_functions.jsonl/36075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
12571,
368,
341,
286,
1077,
4269,
4906,
284,
31630,
3629,
8154,
18,
17,
486,
10586,
481,
220,
16,
16,
317,
286,
1077,
3270,
1769,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_pubfile() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let dir = TempDir::new("test").unwrap();
{
let acct_key = AccountKey::random(&mut rng);
let pubaddr = acct_key.default_subaddress();
let f2 = dir.path().join("f2");
write_pubfile(&f2, &pubaddr).unwrap();
let result = read_pubfile(&f2).unwrap();
assert_eq!(pubaddr, result);
}
{
let acct_key = AccountKey::random_with_fog(&mut rng);
let pubaddr = acct_key.default_subaddress();
let f3 = dir.path().join("f3");
write_pubfile(&f3, &pubaddr).unwrap();
let result = read_pubfile(&f3).unwrap();
assert_eq!(pubaddr, result);
}
} | rust_cleaned_test_functions.jsonl/11794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
1192,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
5419,
284,
19944,
6184,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pooling_allocator_with_reservation_size_exceeded() {
assert_eq!(
PoolingInstanceAllocator::new(
PoolingAllocationStrategy::Random,
ModuleLimits {
memory_pages: 2,
..Default::default()
},
InstanceLimits { count: 1 },
4096,
&Tunables {
static_memory_bound: 1,
static_memory_offset_guard_size: 0,
..Tunables::default()
},
)
.map_err(|e| e.to_string())
.expect_err("expected a failure constructing instance allocator"),
"module memory page limit of 2 pages exceeds maximum static memory limit of 1 pages"
);
} | rust_cleaned_test_functions.jsonl/48879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
287,
56910,
6615,
96548,
2368,
2702,
94206,
368,
341,
286,
2060,
10714,
33673,
310,
22728,
287,
2523,
42730,
486,
931,
1006,
394,
22728,
287,
78316,
19816,
486,
13999,
345,
394,
13711,
94588,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all_args_default() {
#[cross_check(yes, all_args)]
fn abcd(_a: u8, _b: u64) {}
abcd(0x7fu8, 1u64);
expect_xcheck(FUNCTION_ENTRY_TAG, 0x7c93ee4f_u64);
expect_xcheck(FUNCTION_ARG_TAG, 0x7f_u64);
expect_xcheck(FUNCTION_ARG_TAG, 0x0f0f0f0f_0f0f0f0f_u64);
expect_xcheck(FUNCTION_EXIT_TAG, 0x7c93ee4f_u64);
expect_no_xchecks();
} | rust_cleaned_test_functions.jsonl/41191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
8384,
9993,
368,
341,
286,
11506,
28842,
7200,
7021,
288,
11,
678,
8384,
5563,
286,
5168,
668,
4385,
2490,
64,
25,
575,
23,
11,
716,
65,
25,
575,
21,
19,
8,
10086,
286,
668,
4385,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_borrow_mut() {
let mut i = 0;
borrow_add_one(&mut i);
borrow_add_one(&mut i);
assert_eq!(i, 2)
} | rust_cleaned_test_functions.jsonl/123172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
7768,
29523,
368,
341,
262,
1077,
5206,
600,
284,
220,
15,
280,
262,
17193,
2891,
11667,
2099,
6984,
600,
317,
262,
17193,
2891,
11667,
2099,
6984,
600,
626,
262,
2060,
10714,
10297,
72,
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 |
#[test]
fn test_rgba_encode_start_pixel_out_of_bounds() {
RgbaCypher::encode(ImageBuffer::new(1, 1), "a".as_bytes(), 1000);
} | rust_cleaned_test_functions.jsonl/43064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
95229,
11224,
4906,
29760,
6068,
3575,
36878,
368,
341,
286,
431,
56380,
56715,
28082,
486,
6180,
30122,
4095,
486,
931,
7,
16,
11,
220,
16,
701,
330,
64,
3263,
300,
12524,
1507,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_new() {
assert!(KeltnerChannel::new(0, 2_f64).is_err());
assert!(KeltnerChannel::new(1, 2_f64).is_ok());
assert!(KeltnerChannel::new(2, 2_f64).is_ok());
} | rust_cleaned_test_functions.jsonl/130305 | {
"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,
5921,
368,
341,
286,
2060,
10297,
42,
3818,
1194,
9629,
486,
931,
7,
15,
11,
220,
17,
761,
21,
19,
568,
285,
9266,
1423,
286,
2060,
10297,
42,
3818,
1194,
9629,
486,
931,
7,
16,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nmaximizer_size() {
let mut highs = NMaximizer::new(4);
let data = vec![4.0, 3.0];
highs.insert_values(&data);
assert_eq!(highs.size(), 2);
} | rust_cleaned_test_functions.jsonl/40401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2810,
41699,
2368,
368,
341,
286,
1077,
5206,
53779,
284,
451,
5974,
41699,
486,
931,
7,
19,
626,
286,
1077,
821,
284,
7486,
20703,
19,
13,
15,
11,
220,
18,
13,
15,
935,
286,
53779,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nearest_neighbor_iterator_with_distance_2() {
let points = create_random_points(1000, SEED_2);
let tree = RTree::bulk_load(points.clone());
let sample_points = create_random_points(50, SEED_1);
for sample_point in &sample_points {
let mut last_distance = 0.0;
for (point, distance) in tree.nearest_neighbor_iter_with_distance_2(&sample_point) {
assert_eq!(point.distance_2(sample_point), distance);
assert!(last_distance < distance);
last_distance = distance;
}
}
} | rust_cleaned_test_functions.jsonl/70399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
15432,
71888,
13491,
6615,
19464,
62,
17,
368,
341,
286,
1077,
3501,
284,
1855,
22644,
12928,
7,
16,
15,
15,
15,
11,
5052,
1479,
62,
17,
317,
286,
1077,
4916,
284,
431,
6533,
486,
67142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Elf_from_hdr_15_bytes() {
let elf: Result<Elf<'_, LittleEndian, Elf32>, ElfError> =
Elf::try_from(&ELF32_DYNAMIC_ELF_HDR[0 .. 15]);
assert!(elf.is_err());
assert_eq!(elf.err(), Some(ElfError::TooShort));
} | rust_cleaned_test_functions.jsonl/119477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2089,
11008,
5673,
28238,
62,
16,
20,
12524,
368,
341,
262,
1077,
40745,
25,
5714,
27,
75832,
18291,
6878,
14671,
43231,
11,
43600,
18,
17,
8066,
43600,
1454,
29,
4035,
286,
43600,
486,
1539,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resize() {
let gil = Python::acquire_gil();
let py = gil.python();
let src = b"Hello Python";
let bytearray = PyByteArray::new(py, src);
bytearray.resize(20).unwrap();
assert_eq!(20, bytearray.len());
} | rust_cleaned_test_functions.jsonl/60119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53370,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
1428,
286,
1077,
2286,
284,
293,
1,
9707,
13027,
876,
286,
1077,
95603,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consensus_request() -> Result<()> {
let d1 = RsaIdentity::from_bytes(
&hex::decode("03479E93EBF3FF2C58C1C9DBF2DE9DE9C2801B3E").unwrap(),
)
.unwrap();
let d2 = b"blah blah blah 12 blah blah blah";
let d3 = SystemTime::now();
let mut req = ConsensusRequest::default();
let when = httpdate::fmt_http_date(d3);
req.push_authority_id(d1);
req.push_old_consensus_digest(*d2);
req.set_last_consensus_date(d3);
assert!(!req.partial_docs_ok());
assert_eq!(req.max_response_len(), (16 << 20) - 1);
assert_eq!(req.old_consensus_digests().next(), Some(d2));
assert_eq!(req.authority_ids().next(), Some(&d1));
assert_eq!(req.last_consensus_date(), Some(d3));
let req = crate::util::encode_request(&req.make_request()?);
assert_eq!(req,
format!("GET /tor/status-vote/current/consensus-microdesc/03479e93ebf3ff2c58c1c9dbf2de9de9c2801b3e.z HTTP/1.0\r\naccept-encoding: {}\r\nif-modified-since: {}\r\nx-or-diff-from-consensus: 626c616820626c616820626c616820313220626c616820626c616820626c6168\r\n\r\n", encodings(), when));
Ok(())
} | rust_cleaned_test_functions.jsonl/22459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 612
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
13626,
7893,
368,
1464,
5714,
71698,
341,
286,
1077,
294,
16,
284,
431,
9081,
18558,
486,
1499,
12524,
1006,
310,
609,
17308,
486,
18196,
445,
15,
18,
19,
22,
24,
36,
24,
18,
8264,
37,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_write_error_closes() {
let url = Url::parse("http://hyper.rs").unwrap();
let req = Request::with_connector(
Get, url, &mut MockConnector
).unwrap();
let mut req = req.start().unwrap();
req.message.downcast_mut::<Http11Message>().unwrap()
.get_mut().downcast_mut::<MockStream>().unwrap()
.error_on_write = true;
req.write(b"foo").unwrap();
assert!(req.flush().is_err());
assert!(req.message.downcast_ref::<Http11Message>().unwrap()
.get_ref().downcast_ref::<MockStream>().unwrap()
.is_closed);
} | rust_cleaned_test_functions.jsonl/2072 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
4096,
666,
49341,
368,
341,
286,
1077,
2515,
284,
22840,
486,
6400,
445,
1254,
1110,
68192,
25638,
1827,
15454,
543,
286,
1077,
4232,
284,
6145,
486,
4197,
76393,
1006,
310,
2126,
11,
2515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hdt() {
match NmeaParser::new().parse_sentence("$IIHDT,15.0,T*16") {
Ok(ps) => match ps {
ParsedMessage::Hdt(hdt) => {
assert_eq!(hdt.heading_true, Some(15.0))
}
_ => {
assert!(false);
}
},
Err(e) => {
assert_eq!(e.to_string(), "OK");
}
}
} | rust_cleaned_test_functions.jsonl/53434 | {
"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,
21039,
1523,
8047,
368,
341,
286,
2432,
451,
2660,
64,
6570,
486,
931,
1005,
6400,
48332,
20912,
5543,
39,
10599,
11,
16,
20,
13,
15,
19997,
9,
16,
21,
899,
341,
310,
7622,
43036,
8,
589,
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... | 3 |
#[test]
fn test_vec_list_back() {
let mut list = VecList::new();
assert_eq!(list.back(), None);
let index_1 = list.push_back(0);
assert_eq!(list.back(), Some(&0));
let index_2 = list.push_back(1);
assert_eq!(list.back(), Some(&1));
list.remove(index_2);
assert_eq!(list.back(), Some(&0));
list.remove(index_1);
assert_eq!(list.back(), None);
} | rust_cleaned_test_functions.jsonl/11512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
3895,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
2060,
10714,
10297,
1607,
7335,
1507,
2240,
626,
286,
1077,
1922,
62,
16,
284,
1140,
2552,
3895,
7,
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_read_u64() {
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x1000);
let bad_addr = GuestAddress(0x2001);
let gm = GuestMemory::new(&vec![(start_addr1, 0x1000), (start_addr2, 0x1000)]).unwrap();
let val1: u64 = 0xaa55aa55aa55aa55;
let val2: u64 = 0x55aa55aa55aa55aa;
assert_eq!(
format!("{:?}", gm.write_obj_at_addr(val1, bad_addr).err().unwrap()),
format!("InvalidGuestAddress({:?})", bad_addr)
);
gm.write_obj_at_addr(val1, GuestAddress(0x500)).unwrap();
gm.write_obj_at_addr(val2, GuestAddress(0x1000 + 32))
.unwrap();
let num1: u64 = gm.read_obj_from_addr(GuestAddress(0x500)).unwrap();
let num2: u64 = gm.read_obj_from_addr(GuestAddress(0x1000 + 32)).unwrap();
assert_eq!(val1, num1);
assert_eq!(val2, num2);
} | rust_cleaned_test_functions.jsonl/35878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
7300,
21,
19,
368,
341,
286,
1077,
1191,
7387,
16,
284,
26215,
4286,
7,
15,
87,
15,
317,
286,
1077,
1191,
7387,
17,
284,
26215,
4286,
7,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
3873,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scheduler() {
// Test when the number of validators equals
// is selected once
let mut num_validators = 100;
let mut bootstrap_height = 500;
let mut leader_rotation_interval = 100;
let mut seed_rotation_interval = leader_rotation_interval * num_validators;
run_scheduler_test(
num_validators,
bootstrap_height,
leader_rotation_interval as u64,
seed_rotation_interval as u64,
);
// Test when there are fewer validators than
// is selected multiple times
num_validators = 3;
bootstrap_height = 500;
leader_rotation_interval = 100;
seed_rotation_interval = 1000;
run_scheduler_test(
num_validators,
bootstrap_height,
leader_rotation_interval as u64,
seed_rotation_interval as u64,
);
// Test when there are fewer number of validators than
// may not be selected
num_validators = 10;
bootstrap_height = 500;
leader_rotation_interval = 100;
seed_rotation_interval = 200;
run_scheduler_test(
num_validators,
bootstrap_height,
leader_rotation_interval as u64,
seed_rotation_interval as u64,
);
// only one validator should be selected
num_validators = 10;
bootstrap_height = 1;
leader_rotation_interval = 1;
seed_rotation_interval = 1;
run_scheduler_test(
num_validators,
bootstrap_height,
leader_rotation_interval as u64,
seed_rotation_interval as u64,
);
} | rust_cleaned_test_functions.jsonl/18352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 870
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53646,
368,
341,
286,
442,
3393,
979,
279,
1372,
315,
38588,
16819,
8945,
286,
442,
374,
4091,
3055,
198,
286,
1077,
5206,
1629,
8337,
2973,
284,
220,
16,
15,
15,
280,
286,
1077,
5206,
26925,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_time() {
let cs = vec![
(
"[2019/08/23 18:09:52.387 +08:00]",
"",
"2019/08/23 18:09:52.387 +08:00",
),
(
" [2019/08/23 18:09:52.387 +08:00] [",
" [",
"2019/08/23 18:09:52.387 +08:00",
),
];
for (input, remain, time) in cs {
let result = parse_time(input);
assert_eq!(result.unwrap(), (remain, time));
}
} | rust_cleaned_test_functions.jsonl/82294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3009,
368,
341,
1789,
286,
1077,
10532,
284,
7486,
90515,
310,
2399,
394,
10545,
17,
15,
16,
24,
14,
15,
23,
14,
17,
18,
220,
16,
23,
25,
15,
24,
25,
20,
17,
13,
18,
23,
22,
488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fr_serialize() {
#[derive(Debug, Default, Serialize, Deserialize)]
struct Reference {
#[serde(with = "FrSerde")]
value: Fr,
}
let value = Reference::default();
let serialized_fr = serde_json::to_string(&value).expect("Serialization failed");
let expected = json!({
"value": "0000000000000000000000000000000000000000000000000000000000000000"
});
assert_eq!(serialized_fr, expected.to_string());
} | rust_cleaned_test_functions.jsonl/68287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
88686,
368,
341,
286,
11506,
27098,
42618,
11,
7899,
11,
39900,
11,
48440,
5563,
286,
2036,
17207,
341,
310,
11506,
47024,
16980,
284,
330,
22560,
31745,
450,
5422,
310,
897,
25,
2869,
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_request_extract() {
let mut req = TestRequest::with_uri("/name/user1/?id=test").finish();
let mut resource = ResourceHandler::<()>::default();
resource.name("index");
let mut routes = Vec::new();
routes.push((
Resource::new("index", "/{key}/{value}/"),
Some(resource),
));
let (router, _) = Router::new("", ServerSettings::default(), routes);
assert!(router.recognize(&mut req).is_some());
match Path::<MyStruct>::from_request(&req, &())
.poll()
.unwrap()
{
Async::Ready(s) => {
assert_eq!(s.key, "name");
assert_eq!(s.value, "user1");
}
_ => unreachable!(),
}
match Path::<(String, String)>::from_request(&req, &())
.poll()
.unwrap()
{
Async::Ready(s) => {
assert_eq!(s.0, "name");
assert_eq!(s.1, "user1");
}
_ => unreachable!(),
}
match Query::<Id>::from_request(&req, &()).poll().unwrap() {
Async::Ready(s) => {
assert_eq!(s.id, "test");
}
_ => unreachable!(),
}
let mut req = TestRequest::with_uri("/name/32/").finish();
assert!(router.recognize(&mut req).is_some());
match Path::<Test2>::from_request(&req, &()).poll().unwrap() {
Async::Ready(s) => {
assert_eq!(s.as_ref().key, "name");
assert_eq!(s.value, 32);
}
_ => unreachable!(),
}
match Path::<(String, u8)>::from_request(&req, &())
.poll()
.unwrap()
{
Async::Ready(s) => {
assert_eq!(s.0, "name");
assert_eq!(s.1, 32);
}
_ => unreachable!(),
}
match Path::<Vec<String>>::from_request(&req, &())
.poll()
.unwrap()
{
Async::Ready(s) => {
assert_eq!(
s.into_inner(),
vec!["name".to_owned(), "32".to_owned()]
);
}
_ => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/75111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
39123,
368,
341,
286,
1077,
5206,
4232,
284,
3393,
1900,
486,
4197,
15572,
4283,
606,
11739,
16,
17763,
307,
53538,
1827,
30150,
1428,
286,
1077,
5206,
5101,
284,
11765,
3050,
27638,
368,
68... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_newline() {
assert_eq!(newline("\n"), Ok(("", ())));
assert_eq!(newline("\r\n"), Ok(("", ())));
assert_eq!(newline("\n\n"), Ok(("\n", ())));
assert!(newline("\r").is_err());
assert!(newline("blah").is_err());
} | rust_cleaned_test_functions.jsonl/116081 | {
"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,
5921,
1056,
368,
341,
286,
2060,
10714,
10297,
89202,
4921,
77,
3975,
7622,
7,
19814,
320,
38776,
286,
2060,
10714,
10297,
89202,
4921,
81,
1699,
3975,
7622,
7,
19814,
320,
38776,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad() {
use crate::types::policy::PolicyError;
use crate::Pos;
fn check(fname: &str, e: Error) {
let text = read_bad(fname);
let rd = RouterDesc::parse(&text);
assert!(rd.is_err());
assert_eq!(rd.err().unwrap(), e);
}
check(
"bad-sig-order",
Error::UnexpectedToken("router-sig-ed25519", Pos::from_line(50, 1)),
);
check(
"bad-start1",
Error::MisplacedToken("identity-ed25519", Pos::from_line(1, 1)),
);
check("bad-start2", Error::MissingToken("identity-ed25519"));
check(
"mismatched-fp",
Error::BadArgument(
Pos::from_line(12, 1),
"fingerprint does not match RSA identity".into(),
),
);
check("no-ed-sk", Error::MissingToken("identity-ed25519"));
check(
"bad-cc-sign",
Error::BadArgument(Pos::from_line(34, 26), "not 0 or 1".into()),
);
check(
"bad-ipv6policy",
Error::BadPolicy(Pos::from_line(43, 1), PolicyError::InvalidPolicy),
);
} | rust_cleaned_test_functions.jsonl/82080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 651
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
368,
341,
286,
990,
17717,
486,
9242,
486,
34790,
486,
13825,
1454,
280,
286,
990,
17717,
486,
4859,
280,
286,
5168,
1779,
32326,
25,
609,
495,
11,
384,
25,
4600,
8,
341,
310,
1077,
146... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_with_rent() {
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(StakeState::size_of());
let minimum_delegation = crate::get_minimum_delegation(&FeatureSet::all_enabled());
let minimum_balance = rent_exempt_reserve + minimum_delegation;
let stake_lamports = minimum_balance * 2;
let stake_address = solana_sdk::pubkey::new_rand();
let split_to_address = solana_sdk::pubkey::new_rand();
let split_to_account = AccountSharedData::new_data_with_space(
0,
&StakeState::Uninitialized,
StakeState::size_of(),
&id(),
)
.unwrap();
let instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: split_to_address,
is_signer: false,
is_writable: false,
},
];
let meta = Meta {
authorized: Authorized::auto(&stake_address),
rent_exempt_reserve,
..Meta::default()
};
// test splitting both an Initialized stake and a Staked stake
for state in &[
StakeState::Initialized(meta),
just_stake(meta, stake_lamports - rent_exempt_reserve),
] {
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
state,
StakeState::size_of(),
&id(),
)
.unwrap();
let mut transaction_accounts = vec![
(stake_address, stake_account),
(split_to_address, split_to_account.clone()),
(
sysvar::rent::id(),
account::create_account_shared_data_for_test(&rent),
),
];
// not enough to make a non-zero stake account
process_instruction(
&serialize(&StakeInstruction::Split(rent_exempt_reserve)).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(InstructionError::InsufficientFunds),
);
// doesn't leave enough for initial stake to be non-zero
process_instruction(
&serialize(&StakeInstruction::Split(
stake_lamports - rent_exempt_reserve,
))
.unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(InstructionError::InsufficientFunds),
);
// split account already has way enough lamports
transaction_accounts[1].1.set_lamports(minimum_balance);
let accounts = process_instruction(
&serialize(&StakeInstruction::Split(stake_lamports - minimum_balance)).unwrap(),
transaction_accounts,
instruction_accounts.clone(),
Ok(()),
);
// verify no stake leakage in the case of a stake
if let StakeState::Stake(meta, stake) = state {
assert_eq!(
accounts[1].state(),
Ok(StakeState::Stake(
*meta,
Stake {
delegation: Delegation {
stake: stake_lamports - minimum_balance,
..stake.delegation
},
..*stake
}
))
);
assert_eq!(accounts[0].lamports(), minimum_balance,);
assert_eq!(accounts[1].lamports(), stake_lamports,);
}
}
} | rust_cleaned_test_functions.jsonl/31658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
6615,
83127,
368,
341,
286,
1077,
8016,
284,
29737,
486,
2258,
543,
286,
1077,
8016,
95736,
89591,
284,
8016,
57790,
29396,
7,
623,
726,
1397,
486,
2141,
3575,
1423,
286,
1077,
8028,
2259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dispatch_table_signatures_none() {
let signatures = &[];
let fn_ptrs = &mut [];
let dispatch_table = fake_dispatch_table(signatures, fn_ptrs);
assert_eq!(dispatch_table.prototypes().len(), 0);
} | rust_cleaned_test_functions.jsonl/47221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
5237,
11172,
2789,
31488,
368,
341,
286,
1077,
32628,
284,
609,
15078,
286,
1077,
5168,
79533,
284,
609,
6984,
5907,
286,
1077,
6845,
5237,
284,
12418,
42991,
5237,
40046,
2789,
11,
5168,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stake_history_is_cow() {
let mut stake_history = StakeHistory::default();
(100..109).for_each(|epoch| {
let entry = rand_stake_history_entry();
stake_history.add(epoch, entry);
});
// Test: Clone the stake history and **do not modify**. Assert the underlying instances
// are the same.
{
let stake_history2 = stake_history.clone();
assert_eq!(stake_history, stake_history2);
assert!(
Arc::ptr_eq(&stake_history.0, &stake_history2.0),
"Inner Arc must point to the same underlying instance"
);
assert!(
std::ptr::eq(stake_history.deref(), stake_history2.deref()),
"Deref must point to the same underlying instance"
);
}
// Test: Clone the stake history and then modify. Assert the underlying instances are
// unique.
{
let mut stake_history2 = stake_history.clone();
assert_eq!(stake_history, stake_history2);
(200..209).for_each(|epoch| {
let entry = rand_stake_history_entry();
stake_history2.add(epoch, entry);
});
assert_ne!(stake_history, stake_history2);
assert!(
!Arc::ptr_eq(&stake_history.0, &stake_history2.0),
"Inner Arc must point to a different underlying instance"
);
assert!(
!std::ptr::eq(stake_history.deref(), stake_history2.deref()),
"Deref must point to a different underlying instance"
);
}
} | rust_cleaned_test_functions.jsonl/59725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 850
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
19802,
6892,
666,
363,
368,
341,
286,
1077,
5206,
18279,
19802,
284,
98246,
13424,
486,
2258,
543,
286,
320,
16,
15,
15,
496,
16,
15,
24,
568,
1958,
32046,
22428,
20197,
91,
341,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_increment_le_overflow() {
for i in 1usize..256 {
let mut x = vec![255u8; i];
increment_le(&mut x);
assert!(x.iter().all(|xi| *xi == 0));
}
} | rust_cleaned_test_functions.jsonl/20154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51482,
11751,
79073,
368,
341,
286,
369,
600,
304,
220,
16,
51878,
496,
17,
20,
21,
341,
310,
1077,
5206,
856,
284,
7486,
20703,
17,
20,
20,
84,
23,
26,
600,
935,
310,
16252,
11751,
2099,
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... | 2 |
#[test]
fn test_initial_events() {
const PANIC_MESSAGE: &str = "the initial events have been changed.";
let state = CoordinatorStateBuilder::new().build();
let (_, subscriber) = EventBusBuilder::new(&state).build();
let events = EventSnapshot::from(&subscriber);
assert_eq!(
events.phase.event,
PhaseName::Idle,
"{} {}",
PANIC_MESSAGE,
WARNING
);
assert_eq!(
events.model.event,
ModelUpdate::Invalidate,
"{} {}",
PANIC_MESSAGE,
WARNING
);
assert_eq!(
events.sum_dict.event,
DictionaryUpdate::Invalidate,
"{} {}",
PANIC_MESSAGE,
WARNING
);
assert_eq!(
events.seed_dict.event,
DictionaryUpdate::Invalidate,
"{} {}",
PANIC_MESSAGE,
WARNING
);
} | rust_cleaned_test_functions.jsonl/99533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15809,
19691,
368,
341,
262,
733,
72281,
1317,
14641,
25,
609,
495,
284,
330,
1782,
2856,
4357,
614,
1012,
5497,
58724,
262,
1077,
1584,
284,
42324,
1397,
3297,
486,
931,
1005,
5834,
543,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_too_much_data() {
let test_data = [0u8; 100].as_ref();
samples::UnNamedDeku::try_from(test_data).unwrap();
} | rust_cleaned_test_functions.jsonl/123222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
717,
1387,
1769,
368,
341,
262,
1077,
1273,
1769,
284,
508,
15,
84,
23,
26,
220,
16,
15,
15,
936,
300,
7793,
543,
262,
10469,
486,
1806,
15810,
35,
1225,
84,
486,
1539,
5673,
8623,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_wmi_printers () {
let reader: Box<dyn WmiPrintersIface> = Box::new(Test{});
let test_printers = &WmiPrinters::get_specific_ex(reader.borrow())[0];
assert_eq!(test_printers.caption, "Snagit 2018");
assert_eq!(test_printers.creation_class_name, "Win32_Printer");
assert_eq!(test_printers.device_id, "Snagit 2018");
assert_eq!(test_printers.do_complete_first, "false");
assert_eq!(test_printers.driver_name, "Snagit 18 Printer");
assert_eq!(test_printers.extended_printer_status, 2);
assert_eq!(test_printers.horizontal_resolution, 200);
assert_eq!(test_printers.local, "true");
assert_eq!(test_printers.name, "Snagit 2018");
assert_eq!(test_printers.port_name, "C:\\ProgramData\\TechSmith\\Snagit18\\PrinterPortFile");
assert_eq!(test_printers.printer_status, 3);
assert_eq!(test_printers.print_job_data_type, "RAW");
assert_eq!(test_printers.print_processor, "winprint");
assert_eq!(test_printers.priority, 1);
assert_eq!(test_printers.status, "Unknown");
assert_eq!(test_printers.system_creation_class_name, "Win32_ComputerSystem");
assert_eq!(test_printers.system_name, "ekyaw");
assert_eq!(test_printers.vertical_resolution, 200);
} | rust_cleaned_test_functions.jsonl/110900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
8155,
10064,
388,
1719,
341,
286,
1077,
6604,
25,
8261,
92846,
467,
8155,
8994,
388,
40,
1564,
29,
284,
8261,
486,
931,
31159,
90,
2960,
286,
1077,
1273,
10064,
388,
284,
609,
54,
8155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_invalid_specification() {
assert_eq!(parse_format_spec("%3"), Err("Invalid format specifier"));
assert_eq!(parse_format_spec(".2fa"), Err("Invalid format specifier"));
assert_eq!(parse_format_spec("ds"), Err("Invalid format specifier"));
assert_eq!(parse_format_spec("x+"), Err("Invalid format specifier"));
assert_eq!(parse_format_spec("b4"), Err("Invalid format specifier"));
assert_eq!(parse_format_spec("o!"), Err("Invalid format specifier"));
assert_eq!(parse_format_spec("d "), Err("Invalid format specifier"));
} | rust_cleaned_test_functions.jsonl/98969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
31433,
13594,
2404,
368,
341,
286,
2060,
10714,
10297,
6400,
8955,
13594,
4430,
18,
3975,
15495,
445,
7928,
3561,
97616,
4010,
286,
2060,
10714,
10297,
6400,
8955,
13594,
5680,
17,
3632,
3975,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_truncated_middle_of_varint() {
// 96 is non-final byte of varint
let bytes = decode_hex("08 96");
let r = TestTruncated::parse_from_bytes(&bytes);
assert!(r.is_err());
} | rust_cleaned_test_functions.jsonl/2720 | {
"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,
3547,
38007,
62580,
3575,
4612,
396,
368,
341,
1066,
262,
442,
220,
24,
21,
374,
2477,
54862,
4922,
315,
762,
396,
198,
262,
1077,
5820,
284,
16895,
32655,
445,
15,
23,
220,
24,
21,
797,
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_list_array_index_out_of_bound() {
// Construct a value array
let value_data = ArrayData::builder(DataType::Int32)
.len(10)
.add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]))
.build();
let value_offsets = Buffer::from_slice_ref(&[0i64, 2, 2, 2, 4, 6, 6, 9, 9, 10]);
let mut null_bits: [u8; 2] = [0; 2];
bit_util::set_bit(&mut null_bits, 0);
bit_util::set_bit(&mut null_bits, 3);
bit_util::set_bit(&mut null_bits, 4);
bit_util::set_bit(&mut null_bits, 6);
bit_util::set_bit(&mut null_bits, 8);
// Construct a list array from the above two
let list_data_type =
DataType::LargeList(Box::new(Field::new("item", DataType::Int32, false)));
let list_data = ArrayData::builder(list_data_type)
.len(9)
.add_buffer(value_offsets)
.add_child_data(value_data)
.null_bit_buffer(Buffer::from(null_bits))
.build();
let list_array = LargeListArray::from(list_data);
assert_eq!(9, list_array.len());
list_array.value(10);
} | rust_cleaned_test_functions.jsonl/3845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3858,
3560,
6068,
3575,
19447,
368,
341,
286,
442,
18678,
264,
897,
1334,
198,
286,
1077,
897,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
1072,
18,
17,
340,
310,
659,
2892,
7,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_state_synchronization() {
// - Kill one node and continue submitting transactions to the others.
// - Restart the node
// - Wait for all the nodes to catch up
// - Verify that the restarted node has synced up with the submitted transactions.
let mut swarm = new_local_swarm(4);
for validator in swarm.validators_mut() {
let mut config = validator.config().clone();
config.state_sync.chunk_limit = 5;
config.save(validator.config_path()).unwrap();
validator.restart().unwrap();
}
swarm.launch().unwrap(); // Make sure all nodes are healthy and live
let validator_peer_ids = swarm.validators().map(|v| v.peer_id()).collect::<Vec<_>>();
let client_1 = swarm
.validator(validator_peer_ids[1])
.unwrap()
.rest_client();
let transaction_factory = swarm.chain_info().transaction_factory();
let runtime = Runtime::new().unwrap();
let mut account_0 = runtime.block_on(create_and_fund_account(&mut swarm, 100));
let account_1 = runtime.block_on(create_and_fund_account(&mut swarm, 10));
runtime.block_on(async {
transfer_coins(
&client_1,
&transaction_factory,
&mut account_0,
&account_1,
10,
)
.await;
assert_balance(&client_1, &account_0, 90).await;
assert_balance(&client_1, &account_1, 20).await;
});
// Stop a node
let node_to_restart = validator_peer_ids[0];
swarm.validator_mut(node_to_restart).unwrap().stop();
// Do a transfer and ensure it still executes
runtime.block_on(async {
transfer_coins(
&client_1,
&transaction_factory,
&mut account_0,
&account_1,
1,
)
.await;
assert_balance(&client_1, &account_0, 89).await;
assert_balance(&client_1, &account_1, 21).await;
});
// Restart killed node and wait for all nodes to catchup
swarm
.validator_mut(node_to_restart)
.unwrap()
.start()
.unwrap();
swarm
.validator_mut(node_to_restart)
.unwrap()
.wait_until_healthy(Instant::now() + Duration::from_secs(10))
.unwrap();
swarm
.wait_for_all_nodes_to_catchup(Instant::now() + Duration::from_secs(60))
.unwrap();
// Connect to the newly recovered node and verify its state
let client_0 = swarm.validator(node_to_restart).unwrap().rest_client();
runtime.block_on(async {
assert_balance(&client_0, &account_0, 89).await;
assert_balance(&client_0, &account_1, 21).await;
});
// Test multiple chunk sync
swarm.validator_mut(node_to_restart).unwrap().stop();
runtime.block_on(async {
for _ in 0..10 {
transfer_coins(
&client_1,
&transaction_factory,
&mut account_0,
&account_1,
1,
)
.await;
}
assert_balance(&client_1, &account_0, 79).await;
assert_balance(&client_1, &account_1, 31).await;
});
// Restart killed node and wait for all nodes to catchup
swarm
.validator_mut(node_to_restart)
.unwrap()
.start()
.unwrap();
swarm
.validator_mut(node_to_restart)
.unwrap()
.wait_until_healthy(Instant::now() + Duration::from_secs(10))
.unwrap();
swarm
.wait_for_all_nodes_to_catchup(Instant::now() + Duration::from_secs(60))
.unwrap();
runtime.block_on(async {
assert_balance(&client_0, &account_0, 79).await;
assert_balance(&client_0, &account_1, 31).await;
});
} | rust_cleaned_test_functions.jsonl/29246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
4387,
643,
67929,
368,
341,
1066,
262,
442,
481,
26835,
825,
2436,
323,
3060,
33094,
14131,
311,
279,
3800,
624,
262,
442,
481,
56801,
279,
2436,
198,
262,
442,
481,
13824,
369,
678,
279,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_carriage_return_should_reset_column_count() {
new_ucmd!()
.arg("-w6")
.pipe_in("12345\r123456789abcdef")
.succeeds()
.stdout_is("12345\r123456\n789abc\ndef");
} | rust_cleaned_test_functions.jsonl/23296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26616,
8775,
12511,
43378,
18983,
8744,
3180,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
86,
21,
1138,
286,
659,
13768,
1243,
445,
16,
17,
18,
19,
20,
12016,
16,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tap_get_ifreq() {
let _tap_ip_guard = TAP_IP_LOCK.lock().unwrap();
let tap = Tap::new(1).unwrap();
let ret = tap.get_ifreq();
assert_eq!(
"__BindgenUnionField",
format!("{:?}", ret.ifr_ifrn.ifrn_name)
);
} | rust_cleaned_test_functions.jsonl/55545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
3062,
11119,
2958,
368,
341,
286,
1077,
716,
30047,
10385,
36796,
284,
350,
2537,
16607,
27661,
21003,
1005,
15454,
1428,
286,
1077,
15239,
284,
36134,
486,
931,
7,
16,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rect_set() {
let r1 = Rect::with_size(0, 0, 1, 1);
let points = r1.point_set();
assert!(points.contains(&Point::new(0, 0)));
assert!(points.contains(&Point::new(1, 0)));
assert!(points.contains(&Point::new(0, 1)));
assert!(points.contains(&Point::new(1, 1)));
} | rust_cleaned_test_functions.jsonl/92892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16979,
2602,
368,
341,
286,
1077,
435,
16,
284,
11920,
486,
4197,
2368,
7,
15,
11,
220,
15,
11,
220,
16,
11,
220,
16,
317,
286,
1077,
3501,
284,
435,
16,
23233,
2602,
543,
286,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assemble_mirrored_offset_error() -> Result<()> {
// Test image assembly where one of the source files isn't read completely.
let mut image = ImageAssembler::with_params(16, true);
image.parse(&[
testdata!("hello.txt@0").to_str().unwrap(),
testdata!("world.txt@0x5").to_str().unwrap(),
])?;
let err = image.assemble().unwrap_err();
assert_eq!(
err.to_string(),
"Incomplete read: expected to read 5 bytes but read 3 bytes"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/12333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
15790,
717,
404,
47643,
6917,
4096,
368,
1464,
5714,
71698,
341,
286,
442,
3393,
2168,
14614,
1380,
825,
315,
279,
2530,
3542,
4436,
944,
1349,
6587,
624,
286,
1077,
5206,
2168,
284,
4654,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multisig() {
let alice = crypto::gen_keypair();
let bob = crypto::gen_keypair();
let mut testkit = create_testkit_with_multisig(vec![alice.0, bob.0], 2);
let ms_address = Caller::Service {
instance_id: MULTISIG_ID,
}
.address();
// Create the multisig wallet. This takes two separate transactions from both
// multisig participants.
let action = TxStub.create_wallet(SERVICE_ID, CreateWallet::new("Alice + Bob"));
let tx = alice.propose_action(MULTISIG_ID, action);
let action_hash = tx.object_hash();
let block = testkit.create_block_with_transaction(tx);
block[0].status().unwrap();
let tx = bob.support_action(MULTISIG_ID, action_hash);
let block = testkit.create_block_with_transaction(tx);
block[0].status().unwrap();
// Check that the multisig wallet is created.
let snapshot = testkit.snapshot();
let schema: Schema<_> = snapshot.service_schema(SERVICE_ID).unwrap();
let ms_wallet = schema.wallets.get(&ms_address).unwrap();
assert_eq!(ms_wallet.name, "Alice + Bob");
assert_eq!(ms_wallet.balance, 100);
// Spend some tokens from the wallet!
let alice_address = CallerAddress::from_key(alice.0);
let action = TxStub.transfer(
SERVICE_ID,
Transfer {
to: alice_address,
amount: 15,
seed: 0,
},
);
let tx = bob.propose_action(MULTISIG_ID, action);
let action_hash = tx.object_hash();
let block = testkit.create_block_with_transaction(tx);
block[0].status().unwrap();
// for now.
let snapshot = testkit.snapshot();
let schema: Schema<_> = snapshot.service_schema(SERVICE_ID).unwrap();
let ms_wallet = schema.wallets.get(&ms_address).unwrap();
assert_eq!(ms_wallet.balance, 100);
let tx = alice.create_wallet(SERVICE_ID, CreateWallet::new("Alice"));
testkit.create_block_with_transaction(tx);
let tx = alice.support_action(MULTISIG_ID, action_hash);
let block = testkit.create_block_with_transaction(tx);
block[0].status().unwrap();
// Now the balance of the multisig service should change.
let snapshot = testkit.snapshot();
let schema: Schema<_> = snapshot.service_schema(SERVICE_ID).unwrap();
let ms_wallet = schema.wallets.get(&ms_address).unwrap();
assert_eq!(ms_wallet.balance, 85);
let alice_wallet = schema.wallets.get(&alice_address).unwrap();
assert_eq!(alice_wallet.balance, 115);
} | rust_cleaned_test_functions.jsonl/72164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 978
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
285,
343,
368,
341,
262,
1077,
70433,
284,
19028,
486,
4370,
3097,
12670,
543,
262,
1077,
35192,
284,
19028,
486,
4370,
3097,
12670,
543,
262,
1077,
5206,
1273,
8226,
284,
1855,
4452,
8226,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_around_1_ok() {
let env = env_1!();
let in_w = super::IN_DAT_TARGET_LIST.to_string();
let (r, sioe) = do_execute!(
&env,
&["-e", "musl", "--color", "always", "--around", "1"],
in_w.as_str(),
);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(
buff!(sioe, sout),
concat!(
"aarch64-unknown-linux-gnu (installed)\n",
"aarch64-unknown-linux-<S>musl<E> (installed)\n",
"aarch64-unknown-none\n",
"\n",
"arm-unknown-linux-gnueabihf\n",
"arm-unknown-linux-<S>musl<E>eabi\n",
"arm-unknown-linux-<S>musl<E>eabihf\n",
"armebv7r-none-eabi\n",
"\n",
"armv5te-unknown-linux-gnueabi\n",
"armv5te-unknown-linux-<S>musl<E>eabi\n",
"armv7-linux-androideabi\n",
"\n",
"armv7-unknown-linux-gnueabihf (installed)\n",
"armv7-unknown-linux-<S>musl<E>eabi\n",
"armv7-unknown-linux-<S>musl<E>eabihf (installed)\n",
"armv7a-none-eabi\n",
"\n",
"i586-unknown-linux-gnu\n",
"i586-unknown-linux-<S>musl<E>\n",
"i686-linux-android\n",
"\n",
"i686-unknown-linux-gnu (installed)\n",
"i686-unknown-linux-<S>musl<E> (installed)\n",
"mips-unknown-linux-gnu\n",
"\n",
"mips-unknown-linux-<S>musl<E>\n",
"mips64-unknown-linux-gnuabi64\n",
"\n",
"mips64-unknown-linux-<S>musl<E>abi64\n",
"mips64el-unknown-linux-gnuabi64 (installed)\n",
"\n",
"mips64el-unknown-linux-<S>musl<E>abi64 (installed)\n",
"mipsel-unknown-linux-gnu (installed)\n",
"\n",
"mipsel-unknown-linux-<S>musl<E> (installed)\n",
"nvptx64-nvidia-cuda\n",
"\n",
"x86_64-unknown-linux-gnux32\n",
"x86_64-unknown-linux-<S>musl<E> (installed)\n",
"x86_64-unknown-netbsd\n",
"\n",
)
);
assert_eq!(r.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/62181 | {
"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,
62,
19454,
62,
16,
19817,
368,
341,
286,
1077,
6105,
284,
6105,
62,
16,
0,
543,
286,
1077,
304,
1670,
284,
2256,
486,
687,
36347,
29299,
11899,
2389,
3904,
543,
286,
1077,
320,
81,
11,
274,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_first_page_not_override_header() -> Result<(), Error> {
let mut pager = open_test_pager()?;
let page_number = pager.allocate_page();
let mem_page = [1; PAGE_SIZE];
pager.write_page(page_number, &mem_page)?;
let mut page = [0; PAGE_SIZE];
pager.read_page(page_number, &mut page)?;
assert_eq!(pager.read_header()?, Header::default());
assert_eq!(mem_page, page);
Ok(())
} | rust_cleaned_test_functions.jsonl/127398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
6129,
7913,
48576,
8757,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
52588,
284,
1787,
4452,
620,
1409,
94136,
286,
1077,
2150,
5500,
284,
52588,
68726,
6129,
543,
286,
1077,
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... | 5 |
#[test]
fn test_json() {
let resp = HttpResponse::build(StatusCode::OK).json(vec!["v1", "v2", "v3"]);
let ct = resp.headers().get(CONTENT_TYPE).unwrap();
assert_eq!(ct, HeaderValue::from_static("application/json"));
assert_eq!(
*resp.body(),
Body::from(Bytes::from_static(b"[\"v1\",\"v2\",\"v3\"]"))
);
} | rust_cleaned_test_functions.jsonl/2950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
368,
341,
286,
1077,
9039,
284,
17580,
486,
5834,
7,
15872,
486,
3925,
568,
2236,
25592,
0,
1183,
85,
16,
497,
330,
85,
17,
497,
330,
85,
18,
15049,
286,
1077,
20251,
284,
9039,
18022,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_get_messages_panic_wrong_sequencer() {
let state =
MockBufferSharedState::empty_with_n_sequencers(NonZeroU32::try_from(2).unwrap());
state.get_messages(2);
} | rust_cleaned_test_functions.jsonl/53067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
3062,
23428,
620,
31270,
75198,
3453,
446,
19529,
368,
341,
286,
1077,
1584,
4035,
310,
14563,
4095,
16997,
1397,
486,
3194,
6615,
1089,
3453,
446,
62294,
7,
8121,
17999,
52,
18,
17,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_report_installation_error() {
block_on(async {
let response = json!({"response":{
"server": "prod",
"protocol": "3.0",
"app": [{
"appid": "{00000000-0000-0000-0000-000000000001}",
"status": "ok",
"updatecheck": {
"status": "ok",
"manifest": {
"version": "5.6.7.8",
"actions": {
"action": [],
},
"packages": {
"package": [],
},
}
}
}],
}});
let response = serde_json::to_vec(&response).unwrap();
let http = MockHttpRequest::new(HttpResponse::new(response));
let mut state_machine = StateMachineBuilder::new_stub()
.http(http)
.installer(StubInstaller { should_fail: true })
.build()
.await;
let (response, install_result) = state_machine.oneshot().await.unwrap();
assert_eq!(Action::InstallPlanExecutionError, response.app_responses[0].result);
assert_eq!(None, install_result);
let request_params = RequestParams::default();
let mut request_builder = RequestBuilder::new(&state_machine.config, &request_params);
let event = Event {
previous_version: Some("1.2.3.4".to_string()),
next_version: Some("5.6.7.8".to_string()),
download_time_ms: Some(0),
..Event::error(EventErrorCode::Installation)
};
let apps = state_machine.app_set.to_vec().await;
request_builder = request_builder
.add_event(&apps[0], &event)
.session_id(GUID::from_u128(0))
.request_id(GUID::from_u128(3));
assert_request(state_machine.http, request_builder).await;
});
} | rust_cleaned_test_functions.jsonl/59670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
34245,
367,
4096,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2033,
284,
2951,
0,
16864,
2322,
12602,
1060,
330,
4030,
788,
330,
19748,
756,
1060,
330,
17014,
788,
330,
18,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_param() {
let ethabi_constructor = ethabi::Constructor {
inputs: vec![ethabi::Param { name: "foo".into(), kind: ethabi::ParamType::Uint(256) }],
};
let c = Constructor::from(ðabi_constructor);
let expected = quote! {
/// Encodes a call to contract's constructor.
pub fn constructor<T0: Into<ethabi::Uint> >(code: ethabi::Bytes, foo: T0) -> ethabi::Bytes {
let c = ethabi::Constructor {
inputs: vec![ethabi::Param {
name: "foo".to_owned(),
kind: ethabi::ParamType::Uint(256usize)
}],
};
let tokens = vec![ethabi::Token::Uint(foo.into())];
c.encode_input(code, &tokens).expect(INTERNAL_ERR)
}
};
assert_eq!(expected.to_string(), c.generate().to_string());
} | rust_cleaned_test_functions.jsonl/11218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
4090,
368,
341,
197,
10217,
8372,
25084,
66210,
284,
8372,
25084,
486,
13288,
341,
298,
22427,
82,
25,
7486,
20703,
769,
25084,
486,
2001,
314,
829,
25,
330,
7975,
3263,
18122,
1507,
3093,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_groupby_windows_duplicates_2931() {
let dates = [0, 3, 3, 5, 5];
let window = Window::new(
Duration::parse("1ms"),
Duration::parse("1ms"),
Duration::parse("0ns"),
);
let (groups, _, _) = groupby_windows(
window,
&dates,
false,
ClosedWindow::Left,
TimeUnit::Milliseconds,
);
assert_eq!(groups, [[0, 1], [1, 2], [3, 2]]);
} | rust_cleaned_test_functions.jsonl/61977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
1694,
58220,
75051,
62,
17,
24,
18,
16,
368,
341,
262,
1077,
12713,
284,
508,
15,
11,
220,
18,
11,
220,
18,
11,
220,
20,
11,
220,
20,
935,
262,
1077,
3241,
284,
13642,
486,
931,
1006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_iter_double_ended() {
let mut list = VecList::new();
list.push_back(0);
list.push_back(1);
list.push_back(-1);
list.push_back(2);
list.push_back(-2);
let mut iter = list.into_iter();
assert_eq!(iter.next(), Some(0));
assert_eq!(iter.next_back(), Some(-2));
assert_eq!(iter.next(), Some(1));
assert_eq!(iter.next_back(), Some(2));
assert_eq!(iter.next(), Some(-1));
assert_eq!(iter.next_back(), None);
} | rust_cleaned_test_functions.jsonl/11498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
11723,
24598,
62,
2883,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1140,
2552,
3895,
7,
15,
317,
286,
1140,
2552,
3895,
7,
16,
317,
286,
1140,
2552,
3895,
408... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut_iterator() {
let mut m = SmallIntMap::new();
assert!(m.insert(0, 1));
assert!(m.insert(1, 2));
assert!(m.insert(3, 5));
assert!(m.insert(6, 10));
assert!(m.insert(10, 11));
for (k, v) in m.mut_iter() {
*v += k as int;
}
let mut it = m.iter();
assert_eq!(it.next().unwrap(), (0, &1));
assert_eq!(it.next().unwrap(), (1, &3));
assert_eq!(it.next().unwrap(), (3, &8));
assert_eq!(it.next().unwrap(), (6, &16));
assert_eq!(it.next().unwrap(), (10, &21));
assert!(it.next().is_none());
} | rust_cleaned_test_functions.jsonl/7540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
13491,
368,
341,
286,
1077,
5206,
296,
284,
14994,
1072,
2227,
486,
931,
1428,
286,
2060,
10297,
76,
7030,
7,
15,
11,
220,
16,
1106,
286,
2060,
10297,
76,
7030,
7,
16,
11,
220,
17,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nonce_to_instruction_error() {
assert_eq!(
nonce_to_instruction_error(NonceError::NoRecentBlockhashes, false),
NonceError::NoRecentBlockhashes.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::NotExpired, false),
NonceError::NotExpired.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::UnexpectedValue, false),
NonceError::UnexpectedValue.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::BadAccountState, false),
NonceError::BadAccountState.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::NoRecentBlockhashes, true),
SystemError::NonceNoRecentBlockhashes.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::NotExpired, true),
SystemError::NonceBlockhashNotExpired.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::UnexpectedValue, true),
SystemError::NonceUnexpectedBlockhashValue.into(),
);
assert_eq!(
nonce_to_instruction_error(NonceError::BadAccountState, true),
InstructionError::InvalidAccountData,
);
} | rust_cleaned_test_functions.jsonl/35041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
2346,
54923,
4096,
368,
341,
286,
2060,
10714,
33673,
310,
39676,
2346,
54923,
4096,
7,
90528,
1454,
486,
2753,
25140,
4713,
8296,
288,
11,
895,
1326,
310,
11581,
346,
1454,
486,
2753,
2514... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_straight_scoring() {
test(&["2H 3C 4D 5D 6H", "4S AH 3S 2D 5H"], &["2H 3C 4D 5D 6H"])
} | rust_cleaned_test_functions.jsonl/49911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
7386,
13171,
5503,
368,
341,
1066,
262,
1273,
2099,
1183,
17,
39,
220,
18,
34,
220,
19,
35,
220,
20,
35,
220,
21,
39,
497,
330,
19,
50,
47288,
220,
18,
50,
220,
17,
35,
220,
20,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterable() {
assert_eq!(iterable(Some(&to_value(vec!["1"]).unwrap()), &[]).unwrap(), true);
assert_eq!(iterable(Some(&to_value(1).unwrap()), &[]).unwrap(), false);
assert_eq!(iterable(Some(&to_value("hello").unwrap()), &[]).unwrap(), false);
} | rust_cleaned_test_functions.jsonl/125452 | {
"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,
11723,
480,
368,
341,
286,
2060,
10714,
10297,
2015,
480,
65405,
2099,
983,
3142,
25592,
0,
1183,
16,
45014,
15454,
11858,
609,
1294,
568,
15454,
1507,
830,
317,
286,
2060,
10714,
10297,
2015,
480... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_number_of_aperiodicities() {
let fs = 44100;
let n_aperiodicities;
unsafe {
n_aperiodicities = GetNumberOfAperiodicities(fs);
}
assert_eq!(n_aperiodicities, 5);
} | rust_cleaned_test_functions.jsonl/20836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5500,
3575,
62,
3191,
3127,
292,
1361,
368,
341,
10217,
8619,
284,
220,
19,
19,
16,
15,
15,
280,
10217,
308,
62,
3191,
3127,
292,
1361,
280,
197,
38157,
341,
2760,
308,
62,
3191,
3127,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tree_and_inmemory_compare() {
let mut rng = rand::thread_rng();
let leaf_count = rng.gen_range(100..200);
let leaves = create_leaves(0..leaf_count);
let mut accumulator = InMemoryAccumulator::default();
accumulator = accumulator.append(leaves.as_slice());
let store = MockAccumulatorStore::new();
let mut tree_accumulator = AccumulatorTree::new_empty(Arc::new(store));
tree_accumulator.append(leaves.as_slice()).unwrap();
tree_accumulator.flush().unwrap();
assert_eq!(accumulator.root_hash, tree_accumulator.root_hash);
assert_eq!(
accumulator.frozen_subtree_roots,
tree_accumulator.get_frozen_subtree_roots()
);
assert_eq!(accumulator.num_leaves, tree_accumulator.num_leaves);
} | rust_cleaned_test_functions.jsonl/24097 | {
"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,
11663,
8378,
1243,
17269,
32235,
368,
341,
262,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
262,
1077,
15933,
3180,
284,
28422,
22822,
9698,
7,
16,
15,
15,
496,
17,
15,
15,
317,
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_slice_inclusive_range() {
let arr = array![[1, 2, 3], [4, 5, 6]];
assert_eq!(arr.slice(s![1..=1, 1..=2]), array![[5, 6]]);
assert_eq!(arr.slice(s![1..=-1, -2..=2;-1]), array![[6, 5]]);
assert_eq!(arr.slice(s![0..=-1, 0..=2;2]), array![[1, 3], [4, 6]]);
} | rust_cleaned_test_functions.jsonl/92592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
1243,
8336,
9698,
368,
341,
262,
1077,
2890,
284,
1334,
0,
15505,
16,
11,
220,
17,
11,
220,
18,
1125,
508,
19,
11,
220,
20,
11,
220,
21,
13204,
262,
2060,
10714,
10297,
1118,
14530,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_authorization_with_credentials() -> Result<()> {
let rights = AuthorizationItemSetBuilder::new()
.add_right("system.privilege.admin")?
.build();
let env = create_credentials_env()?;
Authorization::new(Some(rights), Some(env), Flags::EXTEND_RIGHTS).unwrap();
Ok(())
} | rust_cleaned_test_functions.jsonl/74278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
22938,
2022,
6615,
47396,
368,
1464,
5714,
71698,
341,
286,
1077,
3188,
284,
30562,
1234,
1649,
3297,
486,
931,
741,
310,
659,
718,
10539,
445,
8948,
82571,
42769,
18203,
899,
5267,
310,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_proc_var_vec() {
tls_init!(V, Vec<i32>, vec![]);
tls_set!(V, |v| v.push(100));
tls_set!(V, |v| v.push(200));
assert_eq!(tls_get!(V)[0], 100);
} | rust_cleaned_test_functions.jsonl/90025 | {
"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,
24436,
4612,
13251,
368,
341,
286,
55026,
6137,
10297,
53,
11,
11312,
21897,
18,
17,
8066,
7486,
0,
56703,
286,
55026,
2602,
10297,
53,
11,
760,
85,
91,
348,
2552,
7,
16,
15,
15,
1106,
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_repr_parse_valid() {
let packet = Packet::new(&REPR_PACKET_BYTES[..]);
let repr = Repr::parse(&packet).unwrap();
assert_eq!(repr, packet_repr());
} | rust_cleaned_test_functions.jsonl/91037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68535,
21039,
8337,
368,
341,
286,
1077,
10151,
284,
28889,
486,
931,
2099,
787,
6480,
40328,
40705,
95874,
2558,
286,
1077,
30636,
284,
1032,
649,
486,
6400,
2099,
24829,
568,
15454,
543,
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 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words: String = words.into_iter().fold("".to_owned(), |acc, x| acc + &capitalize_first(x));
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/22125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
923,
284,
4244,
39860,
11723,
1005,
19961,
445,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alphanumeric_he() {
let data = "HE";
let res = encode_alphanumeric(data.as_bytes());
let goal: usize = 0b01100001011;
assert_eq!(res[0], BitsWithLength(goal, 11));
} | rust_cleaned_test_functions.jsonl/114437 | {
"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,
8418,
65788,
41876,
368,
341,
286,
1077,
821,
284,
330,
1799,
876,
286,
1077,
592,
284,
16164,
8418,
65788,
2592,
5357,
12524,
1423,
286,
1077,
5795,
25,
22301,
284,
220,
15,
65,
15,
16,
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... | 1 |
#[test]
fn test_nil_string() {
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&b"$-1\r\n"[..]);
let codec = Codec;
let deserialized = codec.decode(&mut bytes).unwrap().unwrap();
assert_eq!(deserialized, Response::Nil);
} | rust_cleaned_test_functions.jsonl/78674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36175,
3904,
368,
341,
286,
1077,
5206,
5820,
284,
30024,
51440,
486,
931,
543,
286,
5820,
15831,
5673,
26488,
2099,
65,
33732,
12,
16,
12016,
1699,
36864,
496,
10149,
286,
1077,
34647,
284,
67077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync_process() {
let consensus = Consensus::default();
let (chain_controller1, shared1) = start_chain(Some(consensus.clone()));
let (chain_controller2, shared2) = start_chain(Some(consensus));
let num = 200;
for i in 1..num {
insert_block(&chain_controller1, &shared1, u128::from(i), i);
}
let synchronizer1 = gen_synchronizer(chain_controller1, shared1.clone());
let locator1 = synchronizer1
.shared
.active_chain()
.get_locator(&shared1.snapshot().tip_header());
for i in 1..=num {
let j = if i > 192 { i + 1 } else { i };
insert_block(&chain_controller2, &shared2, u128::from(j), i);
}
let synchronizer2 = gen_synchronizer(chain_controller2, shared2.clone());
let latest_common = synchronizer2
.shared
.active_chain()
.locate_latest_common_block(&Byte32::zero(), &locator1[..]);
assert_eq!(latest_common, Some(192));
let headers = synchronizer2
.shared
.active_chain()
.get_locator_response(192, &Byte32::zero());
assert_eq!(
headers.first().unwrap().hash(),
shared2.store().get_block_hash(193).unwrap()
);
assert_eq!(
headers.last().unwrap().hash(),
shared2.store().get_block_hash(200).unwrap()
);
let sendheaders = SendHeadersBuilder::default()
.headers(headers.iter().map(|h| h.data()).pack())
.build();
let mock_nc = mock_network_context(4);
let peer1: PeerIndex = 1.into();
let peer2: PeerIndex = 2.into();
synchronizer1.on_connected(&mock_nc, peer1);
synchronizer1.on_connected(&mock_nc, peer2);
assert_eq!(
HeadersProcess::new(sendheaders.as_reader(), &synchronizer1, peer1, &mock_nc).execute(),
Status::ok(),
);
let best_known_header = synchronizer1.peers().get_best_known_header(peer1);
assert_eq!(best_known_header.unwrap().inner(), headers.last().unwrap());
let blocks_to_fetch = synchronizer1
.get_blocks_to_fetch(peer1, IBDState::Out)
.unwrap();
assert_eq!(
blocks_to_fetch[0].first().unwrap(),
&shared2.store().get_block_hash(193).unwrap()
);
assert_eq!(
blocks_to_fetch[0].last().unwrap(),
&shared2.store().get_block_hash(200).unwrap()
);
let mut fetched_blocks = Vec::new();
for block_hash in &blocks_to_fetch[0] {
fetched_blocks.push(shared2.store().get_block(block_hash).unwrap());
}
for block in &fetched_blocks {
let block = SendBlockBuilder::default().block(block.data()).build();
assert_eq!(
BlockProcess::new(block.as_reader(), &synchronizer1, peer1).execute(),
Status::ok(),
);
}
synchronizer1
.shared()
.state()
.write_inflight_blocks()
.remove_by_peer(peer1);
insert_block(&synchronizer2.chain, &shared2, 201u128, 201);
let headers = vec![synchronizer2.shared.active_chain().tip_header()];
let sendheaders = SendHeadersBuilder::default()
.headers(headers.iter().map(|h| h.data()).pack())
.build();
assert_eq!(
HeadersProcess::new(sendheaders.as_reader(), &synchronizer1, peer1, &mock_nc).execute(),
Status::ok(),
);
synchronizer1
.get_blocks_to_fetch(peer1, IBDState::Out)
.unwrap();
let last_common_header2 = synchronizer1.peers().get_last_common_header(peer1).unwrap();
assert_eq!(
&last_common_header2.hash(),
blocks_to_fetch[0].last().unwrap(),
"last_common_header change because it update during get_blocks_to_fetch",
);
} | rust_cleaned_test_functions.jsonl/95018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1975
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
11305,
368,
341,
286,
1077,
23869,
284,
7292,
13626,
486,
2258,
543,
286,
1077,
320,
8819,
21600,
16,
11,
6094,
16,
8,
284,
1191,
30583,
65405,
7,
6254,
13626,
15997,
7392,
286,
1077,
320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_child_of_leaf_label() -> Result<(), Error> {
let label_gen = BitstringLabelGenerator::new(2, 2)?;
let root = label_gen.root();
assert_label_value_and_length!(root, 0, 0);
let child_0 = label_gen.child_label(&root, 0)?;
assert_label_value_and_length!(child_0, 0, 1);
assert!(label_gen.child_label(&child_0, 0).is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/68790 | {
"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,
17268,
3575,
38909,
6106,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
2383,
16322,
284,
6495,
917,
2476,
12561,
486,
931,
7,
17,
11,
220,
17,
40007,
286,
1077,
3704,
284,
2383,
16322,
1257... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nested_filter_ref() {
let t = NestedFilterTemplate {
x: " floo & bar".to_string(),
};
assert_eq!(t.render().unwrap(), "floo & bar");
} | rust_cleaned_test_functions.jsonl/8700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
8727,
7793,
368,
341,
262,
1077,
259,
284,
71742,
5632,
7275,
341,
286,
856,
25,
330,
9744,
78,
609,
3619,
3263,
983,
3904,
3148,
262,
2605,
262,
2060,
10714,
10297,
83,
8740,
1005,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_file() {
let dictionary_path = "./dict_examples/test_dictionary_dict";
let dict = Dictionary::from_file(dictionary_path).unwrap();
let mut attributes: Vec<DictionaryAttribute> = Vec::new();
attributes.push(DictionaryAttribute {
name: "User-Name".to_string(),
vendor_name: "".to_string(),
code: "1".to_string(),
code_type: Some(SupportedAttributeTypes::AsciiString)
});
attributes.push(DictionaryAttribute {
name: "NAS-IP-Address".to_string(),
vendor_name: "".to_string(),
code: "4".to_string(),
code_type: Some(SupportedAttributeTypes::IPv4Addr)
});
attributes.push(DictionaryAttribute {
name: "NAS-Port-Id".to_string(),
vendor_name: "".to_string(),
code: "5".to_string(),
code_type: Some(SupportedAttributeTypes::Integer)
});
attributes.push(DictionaryAttribute {
name: "Framed-Protocol".to_string(),
vendor_name: "".to_string(),
code: "7".to_string(),
code_type: Some(SupportedAttributeTypes::Integer)
});
attributes.push(DictionaryAttribute {
name: "Somevendor-Name".to_string(),
vendor_name: "Somevendor".to_string(),
code: "1".to_string(),
code_type: Some(SupportedAttributeTypes::AsciiString)
});
attributes.push(DictionaryAttribute {
name: "Somevendor-Number".to_string(),
vendor_name: "Somevendor".to_string(),
code: "2".to_string(),
code_type: Some(SupportedAttributeTypes::Integer)
});
attributes.push(DictionaryAttribute {
name: "Test-IP".to_string(),
vendor_name: "".to_string(),
code: "25".to_string(),
code_type: Some(SupportedAttributeTypes::IPv4Addr)
});
let mut values: Vec<DictionaryValue> = Vec::new();
values.push(DictionaryValue {
attribute_name: "Framed-Protocol".to_string(),
value_name: "PPP".to_string(),
vendor_name: "".to_string(),
value: "1".to_string()
});
values.push(DictionaryValue {
attribute_name: "Somevendor-Number".to_string(),
value_name: "Two".to_string(),
vendor_name: "Somevendor".to_string(),
value: "2".to_string()
});
let mut vendors: Vec<DictionaryVendor> = Vec::new();
vendors.push(DictionaryVendor {
name: "Somevendor".to_string(),
id: "10".to_string(),
});
let expected_dict = Dictionary { attributes, values, vendors };
assert_eq!(dict, expected_dict)
} | rust_cleaned_test_functions.jsonl/126934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1487
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2458,
368,
341,
286,
1077,
10997,
2638,
284,
5924,
8477,
45279,
12697,
42605,
5243,
3302,
286,
1077,
6451,
284,
10466,
486,
1499,
2458,
73592,
2638,
568,
15454,
1428,
286,
1077,
5206,
8201,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normal_motion_charsearch() {
let mut vm: VimMachine<KeyEvent> = VimMachine::default();
let mut ctx = VimContext::default();
ctx.persist.charsearch_params = (MoveDir1D::Next, true);
ctx.persist.charsearch = Some('a'.into());
ctx.action.any = Some(key!('a'));
vm.input_key(key!('f'));
vm.input_key(key!('a'));
assert_pop2!(vm, SEARCH_CHAR_SAME, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// ";" should continue character search.
ctx.persist.charsearch_params = (MoveDir1D::Next, true);
ctx.persist.charsearch = Some('a'.into());
ctx.action.any = None;
vm.input_key(key!(';'));
assert_pop2!(vm, SEARCH_CHAR_SAME, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
ctx.persist.charsearch_params = (MoveDir1D::Next, true);
ctx.persist.charsearch = Some('a'.into());
ctx.action.any = None;
vm.input_key(key!(','));
assert_pop2!(vm, SEARCH_CHAR_FLIP, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// "T<C-V>o125" should update params and continue search for codepoint.
ctx.persist.charsearch_params = (MoveDir1D::Previous, false);
ctx.persist.charsearch = Some('U'.into());
ctx.action.oct = Some(85);
vm.input_key(key!('T'));
vm.input_key(ctl!('v'));
vm.input_key(key!('o'));
vm.input_key(key!('1'));
vm.input_key(key!('2'));
vm.input_key(key!('5'));
assert_pop2!(vm, SEARCH_CHAR_SAME, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// ";" should continue search.
ctx.persist.charsearch_params = (MoveDir1D::Previous, false);
ctx.persist.charsearch = Some('U'.into());
ctx.action.oct = None;
vm.input_key(key!(';'));
assert_pop2!(vm, SEARCH_CHAR_SAME, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// "F<C-K>Z<" should update params and continue search for digraph.
ctx.persist.charsearch_params = (MoveDir1D::Previous, true);
ctx.persist.charsearch = Some(Char::Digraph('Z', '<'));
ctx.action.digraph1 = Some('Z');
ctx.action.digraph2 = Some('<');
vm.input_key(key!('F'));
vm.input_key(ctl!('k'));
vm.input_key(key!('Z'));
vm.input_key(key!('<'));
assert_pop2!(vm, SEARCH_CHAR_SAME, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
ctx.persist.charsearch_params = (MoveDir1D::Previous, true);
ctx.persist.charsearch = Some(Char::Digraph('Z', '<'));
ctx.action.digraph1 = None;
ctx.action.digraph2 = None;
vm.input_key(key!(','));
assert_pop2!(vm, SEARCH_CHAR_FLIP, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// "t<Esc>" should do nothing leave persistent search parameters alone.
vm.input_key(key!('t'));
vm.input_key(key!(KeyCode::Esc));
ctx.persist.charsearch_params = (MoveDir1D::Previous, true);
ctx.persist.charsearch = Some(Char::Digraph('Z', '<'));
ctx.action.charsearch_params = Some((MoveDir1D::Next, false));
ctx.action.postaction = Some(SEARCH_CHAR_SAME.clone());
assert_pop2!(vm, Action::NoOp, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
} | rust_cleaned_test_functions.jsonl/74575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13973,
65460,
9232,
1836,
368,
341,
286,
1077,
5206,
10995,
25,
94484,
21605,
42003,
1556,
29,
284,
94484,
21605,
486,
2258,
543,
286,
1077,
5206,
5635,
284,
94484,
1972,
486,
2258,
1428,
1789,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canny() {
compare_to_truth_grayscale("zebra.png", "zebra_canny.png", |image| canny(image, 250.0, 300.0));
} | rust_cleaned_test_functions.jsonl/20074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 64
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
12888,
368,
341,
262,
9429,
2346,
49186,
15682,
50348,
445,
2986,
14383,
3508,
497,
330,
2986,
14383,
666,
12888,
3508,
497,
760,
1805,
91,
646,
3834,
10075,
11,
220,
17,
20,
15,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unknown_tag() {
let bytes = hex!("1d 01 00");
let res = parse_ber(&bytes).expect("parsing failed");
assert!(res.0.is_empty());
assert_eq!(
res.1,
BerObject::from_obj(BerObjectContent::Unknown(
Class::Universal,
Tag(0x1d),
&bytes[2..]
))
);
let res = parse_der(&bytes).expect("parsing failed");
assert!(res.0.is_empty());
assert_eq!(
res.1,
BerObject::from_obj(BerObjectContent::Unknown(
Class::Universal,
Tag(0x1d),
&bytes[2..]
))
);
} | rust_cleaned_test_functions.jsonl/67464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
9372,
368,
341,
262,
1077,
5820,
284,
12371,
17223,
16,
67,
220,
15,
16,
220,
15,
15,
797,
262,
1077,
592,
284,
4715,
88165,
2099,
9651,
568,
17119,
445,
79,
28598,
4641,
797,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lohit() {
run_test(
&TEST_DATA,
"harfbuzz/good-lohit.ta",
"tamil/lohit_ta.ttf",
&[JOINER_GLYPH_INDEX],
0,
);
} | rust_cleaned_test_functions.jsonl/91168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
22492,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
26480,
22492,
72160,
756,
503,
330,
83,
20933,
14,
385,
22492,
91710,
45192,
756... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transform_fit() {
let s0 = BBox::new(Point::new(1.0, 1.0), Point::new(2.0, 2.0));
let s1 = BBox::new(Point::new(1.0, 1.0), Point::new(1.5, 2.0));
let s2 = BBox::new(Point::new(1.0, 1.0), Point::new(2.0, 1.5));
let d = BBox::new(Point::new(3.0, 5.0), Point::new(13.0, 15.0));
let tr0 = Transform::fit_bbox(s0, d, Align::Mid);
assert!(tr0.apply(s0.min).is_close_to(d.min));
assert!(tr0.apply(s0.max).is_close_to(d.max));
let tr1 = Transform::fit_bbox(s1, d, Align::Min);
assert!(tr1.apply(s1.min).is_close_to(d.min));
assert!(tr1.apply(s1.max).is_close_to(Point::new(8.0, 15.0)));
let tr2 = Transform::fit_bbox(s2, d, Align::Max);
assert!(tr2.apply(s2.max).is_close_to(d.max));
assert!(tr2.apply(s2.min).is_close_to(Point::new(3.0, 10.0)));
let tr3 = Transform::fit_bbox(s1, d, Align::Mid);
assert!(tr3
.apply((s1.min + s1.max) / 2.0)
.is_close_to((d.min + d.max) / 2.0));
assert!(tr3.apply(s1.min).is_close_to(Point::new(5.5, 5.0)));
assert!(tr3.apply(s1.max).is_close_to(Point::new(10.5, 15.0)));
let tr4 = Transform::fit_bbox(s2, d, Align::Mid);
assert!(tr4
.apply((s2.min + s2.max) / 2.0)
.is_close_to((d.min + d.max) / 2.0));
assert!(tr4.apply(s2.min).is_close_to(Point::new(3.0, 7.5)));
assert!(tr4.apply(s2.max).is_close_to(Point::new(13.0, 12.5)));
} | rust_cleaned_test_functions.jsonl/20227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 846
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
32416,
368,
341,
286,
1077,
274,
15,
284,
425,
1611,
486,
931,
32737,
486,
931,
7,
16,
13,
15,
11,
220,
16,
13,
15,
701,
5126,
486,
931,
7,
17,
13,
15,
11,
220,
17,
13,
15,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_unblock_signal() {
let signal = SIGRTMIN() + 0;
// Check if it is blocked.
unsafe {
let mut sigset: sigset_t = mem::zeroed();
pthread_sigmask(SIG_BLOCK, null(), &mut sigset as *mut sigset_t);
assert_eq!(sigismember(&sigset, signal), 0);
}
block_signal(signal).unwrap();
assert!(get_blocked_signals().unwrap().contains(&(signal)));
unblock_signal(signal).unwrap();
assert!(!get_blocked_signals().unwrap().contains(&(signal)));
} | rust_cleaned_test_functions.jsonl/86273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
4907,
4574,
21137,
368,
341,
286,
1077,
8286,
284,
25038,
5350,
16413,
368,
488,
220,
15,
401,
286,
442,
4248,
421,
432,
374,
19299,
624,
286,
19860,
341,
310,
1077,
5206,
8366,
746,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call() {
let text = "{{ call my_macro with foo.bar }}";
let instructions = compile(text).unwrap();
assert_eq!(1, instructions.len());
assert_eq!(&Call("my_macro", vec!["foo", "bar"]), &instructions[0]);
} | rust_cleaned_test_functions.jsonl/131999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
368,
972,
286,
1077,
1467,
284,
47219,
1618,
847,
58810,
448,
15229,
22001,
3869,
3534,
286,
1077,
11221,
284,
19192,
7235,
568,
15454,
1647,
286,
2060,
10714,
10297,
16,
11,
11221,
19406,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.