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_read_at() {
let file = File::open("tests/pi.txt").unwrap();
let mut buf = [0; 4];
file.read_exact_at(10, buf.as_mut()).unwrap();
assert_eq!(&buf, b"3589");
} | rust_cleaned_test_functions.jsonl/115213 | {
"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,
6443,
3752,
368,
341,
262,
1077,
1034,
284,
2887,
486,
2508,
445,
23841,
62228,
3909,
1827,
15454,
543,
262,
1077,
5206,
6607,
284,
508,
15,
26,
220,
19,
935,
262,
1034,
4125,
71084,
3752,
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_changeset_override() {
let debugger = AptosDebugger::new(Box::new(TestInterface::genesis()));
let address = AccountAddress::random();
let mut override_changeset = ChangeSet::new();
override_changeset
.publish_resource(
address,
AccountResource::struct_tag(),
bcs::to_bytes(&AccountResource::new(0, vec![], address)).unwrap(),
)
.unwrap();
let mut script_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
script_path.push("examples/account_exists.move");
assert_eq!(
None,
debugger
.bisect_transactions_by_script(script_path.to_str().unwrap(), address, 1, 2, None)
.unwrap()
);
assert_eq!(
Some(1),
debugger
.bisect_transactions_by_script(
script_path.to_str().unwrap(),
address,
1,
2,
Some(override_changeset)
)
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/96207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47526,
295,
48576,
368,
341,
262,
1077,
44473,
284,
96987,
436,
67239,
486,
931,
67758,
486,
931,
31159,
5051,
486,
77894,
7392,
262,
1077,
2621,
284,
8615,
4286,
486,
11463,
543,
262,
1077,
5206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_array() {
assert_eq!(<[u32; 32]>::max_size(), 32 * size_of::<u32>());
assert_eq!(<[u64; 8]>::max_size(), 8 * size_of::<u64>());
assert_eq!(<[u8; 19]>::max_size(), 19 * size_of::<u8>());
} | rust_cleaned_test_functions.jsonl/24557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
3858,
368,
341,
262,
2060,
10714,
10297,
66746,
84,
18,
17,
26,
220,
18,
17,
60,
6831,
2810,
2368,
1507,
220,
18,
17,
353,
1379,
3575,
27638,
84,
18,
17,
32872,
262,
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_nonce_fee_calculator_updates() {
let (mut genesis_config, mint_keypair) = create_genesis_config(1_000_000);
genesis_config.rent.lamports_per_byte_year = 0;
let mut bank = Arc::new(Bank::new(&genesis_config));
let (custodian_keypair, nonce_keypair) =
nonce_setup(&mut bank, &mint_keypair, 500_000, 100_000, None).unwrap();
let custodian_pubkey = custodian_keypair.pubkey();
let nonce_pubkey = nonce_keypair.pubkey();
// Grab the hash and fee_calculator stored in the nonce account
let (stored_nonce_hash, stored_fee_calculator) = bank
.get_account(&nonce_pubkey)
.and_then(|acc| {
let state =
StateMut::<nonce::state::Versions>::state(&acc).map(|v| v.convert_to_current());
match state {
Ok(nonce::State::Initialized(ref data)) => {
Some((data.blockhash, data.fee_calculator.clone()))
}
_ => None,
}
})
.unwrap();
// Kick nonce hash off the blockhash_queue
for _ in 0..MAX_RECENT_BLOCKHASHES + 1 {
goto_end_of_slot(Arc::get_mut(&mut bank).unwrap());
bank = Arc::new(new_from_parent(&bank));
}
// Durable Nonce transfer
let nonce_tx = Transaction::new_signed_with_payer(
&[
system_instruction::advance_nonce_account(&nonce_pubkey, &nonce_pubkey),
system_instruction::transfer(
&custodian_pubkey,
&solana_sdk::pubkey::new_rand(),
100_000,
),
],
Some(&custodian_pubkey),
&[&custodian_keypair, &nonce_keypair],
stored_nonce_hash,
);
bank.process_transaction(&nonce_tx).unwrap();
// Grab the new hash and fee_calculator; both should be updated
let (nonce_hash, fee_calculator) = bank
.get_account(&nonce_pubkey)
.and_then(|acc| {
let state =
StateMut::<nonce::state::Versions>::state(&acc).map(|v| v.convert_to_current());
match state {
Ok(nonce::State::Initialized(ref data)) => {
Some((data.blockhash, data.fee_calculator.clone()))
}
_ => None,
}
})
.unwrap();
assert_ne!(stored_nonce_hash, nonce_hash);
assert_ne!(stored_fee_calculator, fee_calculator);
} | rust_cleaned_test_functions.jsonl/2625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
34305,
24005,
20022,
57829,
368,
341,
286,
1077,
320,
6984,
59366,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
62,
15,
15,
15,
62,
15,
15,
15,
317,
286,
59366... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nonexistent_file_returns_error() {
let pattern = "Agamemnon";
let flags = Flags::new(&[]);
let files = vec!["test_nonexistent_file_returns_error_iliad.txt"];
assert!(grep(pattern, &flags, &files).is_err());
} | rust_cleaned_test_functions.jsonl/70371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
64085,
2458,
58900,
4096,
368,
341,
262,
1077,
5383,
284,
330,
9042,
309,
336,
6280,
3302,
262,
1077,
8042,
284,
33205,
486,
931,
2099,
1294,
626,
262,
1077,
3542,
284,
7486,
0,
1183,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_bytes_compatibility() {
let cv = CanonicalVote::new(Vote::default(), "");
let mut got = vec![];
// SignBytes are encoded using MarshalBinary and not MarshalBinaryBare
cv.encode_length_delimited(&mut got).unwrap();
let want = vec![
0xd, 0x2a, 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1,
];
assert_eq!(got, want);
{
let mut vt_precommit = Vote::default();
vt_precommit.height = 1;
vt_precommit.round = 1;
vt_precommit.vote_type = SignedMsgType::PreCommit.to_u32(); // precommit
println!("{:?}", vt_precommit);
let cv_precommit = CanonicalVote::new(vt_precommit, "");
let got = AminoMessage::bytes_vec(&cv_precommit);
let want = vec![
0x8,
0x2, // PrecommitType
0x11,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height
0x19,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round
0x2a,
0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1,
];
assert_eq!(got, want);
}
{
let mut vt_prevote = Vote::default();
vt_prevote.height = 1;
vt_prevote.round = 1;
vt_prevote.vote_type = SignedMsgType::PreVote.to_u32();
let cv_prevote = CanonicalVote::new(vt_prevote, "");
let got = AminoMessage::bytes_vec(&cv_prevote);
let want = vec![
0x8,
0x1, // PrevoteType
0x11,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height
0x19,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round
0x2a,
0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1,
];
assert_eq!(got, want);
}
{
let mut vt_no_type = Vote::default();
vt_no_type.height = 1;
vt_no_type.round = 1;
let cv = CanonicalVote::new(vt_no_type, "");
let got = AminoMessage::bytes_vec(&cv);
let want = vec![
0x11,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height
0x19,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round
0x2a, 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1,
];
assert_eq!(got, want);
}
// containing non-empty chain_id:
{
let mut no_vote_type2 = Vote::default();
no_vote_type2.height = 1;
no_vote_type2.round = 1;
let with_chain_id = CanonicalVote::new(no_vote_type2, "test_chain_id");
got = AminoMessage::bytes_vec(&with_chain_id);
let want = vec![
0x11,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height
0x19,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round
// remaining fields:
0x2a,
0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff,
0x1, // timestamp
0x32,
0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69,
0x64, // chainID
];
assert_eq!(got, want);
}
} | rust_cleaned_test_functions.jsonl/71173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
12524,
2965,
53053,
368,
341,
286,
1077,
5544,
284,
95177,
41412,
486,
931,
12410,
1272,
486,
2258,
1507,
14498,
286,
1077,
5206,
2684,
284,
7486,
0,
15078,
286,
442,
7075,
7078,
525,
20498... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_batch_scan() {
test_raw_batch_scan_impl(ApiVersion::V1);
test_raw_batch_scan_impl(ApiVersion::V1ttl);
test_raw_batch_scan_impl(ApiVersion::V2);
} | rust_cleaned_test_functions.jsonl/133286 | {
"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,
16067,
14534,
28857,
368,
341,
286,
1273,
16067,
14534,
28857,
21007,
65830,
5637,
486,
53,
16,
317,
286,
1273,
16067,
14534,
28857,
21007,
65830,
5637,
486,
53,
16,
62858,
317,
286,
1273,
16067,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dueling_pre_candidates() {
let l = default_logger();
let a = new_test_raft_with_prevote(1, vec![1, 2, 3], 10, 1, new_storage(), true, &l);
let b = new_test_raft_with_prevote(2, vec![1, 2, 3], 10, 1, new_storage(), true, &l);
let c = new_test_raft_with_prevote(3, vec![1, 2, 3], 10, 1, new_storage(), true, &l);
let mut config = Network::default_config();
config.pre_vote = true;
let mut nt = Network::new_with_config(vec![Some(a), Some(b), Some(c)], &config, &l);
nt.cut(1, 3);
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
// 1 becomes leader since it receives votes from 1 and 2
assert_eq!(nt.peers[&1].state, StateRole::Leader);
// 3 campaigns then reverts to follower when its pre_vote is rejected
assert_eq!(nt.peers[&3].state, StateRole::Follower);
nt.recover();
// Candidate 3 now increases its term and tries to vote again.
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
let tests = vec![
(1, StateRole::Leader, 1, (1, 0, 1)),
(2, StateRole::Follower, 1, (1, 0, 1)),
(3, StateRole::Follower, 1, (0, 0, 0)),
];
for (i, &(id, state, term, raft_log)) in tests.iter().enumerate() {
if nt.peers[&id].state != state {
panic!(
"#{}: state = {:?}, want {:?}",
i, nt.peers[&id].state, state
);
}
if nt.peers[&id].term != term {
panic!("#{}: term = {}, want {}", i, nt.peers[&id].term, term);
}
let prefix = format!("#{}: ", i);
assert_raft_log(&prefix, &nt.peers[&id].raft_log, raft_log);
}
} | rust_cleaned_test_functions.jsonl/19098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 825
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
78997,
10442,
73553,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
264,
284,
501,
4452,
62,
2944,
6615,
25566,
1272,
7,
16,
11,
7486,
20703,
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... | 4 |
#[test]
fn test_block_with_transactions() {
let mut blockchain = create_blockchain();
let txs: Vec<_> = tx_generator().take(5).collect();
create_block(&mut blockchain, txs);
let explorer = BlockchainExplorer::new(&blockchain);
let block = explorer.block_with_txs(Height(1)).unwrap();
assert_eq!(block.len(), 5);
assert!(!block.is_empty());
assert!(block[1].status().is_ok());
assert!(block.iter().all(|tx| {
if let ExplorerTransactions::CreateWallet(_) =
ExplorerTransactions::tx_from_raw(tx.content().raw_transaction()).unwrap()
{
true
} else {
false
}
}));
} | rust_cleaned_test_functions.jsonl/70357 | {
"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,
7113,
6615,
68182,
368,
341,
262,
1077,
5206,
17944,
284,
1855,
7113,
8819,
543,
262,
1077,
9854,
82,
25,
11312,
32399,
29,
284,
9854,
25813,
1005,
22769,
7,
20,
568,
17384,
543,
262,
1855,
7113... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_asinh() {
assert!(close(_0_0i.asinh(), _0_0i));
assert!(close(_1_0i.asinh(), _1_0i.scale(1.0 + 2.0.sqrt()).ln()));
assert!(close(_0_1i.asinh(), _0_1i.scale(f64::consts::PI / 2.0)));
assert!(close(
_0_1i.asinh().scale(-1.0),
_0_1i.scale(-f64::consts::PI / 2.0)
));
for &c in all_consts.iter() {
assert!(close(c.conj().asinh(), c.conj().asinh()));
assert!(close(c.scale(-1.0).asinh(), c.asinh().scale(-1.0)));
assert!(
-f64::consts::PI / 2.0 <= c.asinh().im && c.asinh().im <= f64::consts::PI / 2.0
);
}
} | rust_cleaned_test_functions.jsonl/105700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
20868,
368,
341,
310,
2060,
10297,
5552,
2490,
15,
62,
15,
72,
5357,
20868,
1507,
716,
15,
62,
15,
72,
1106,
310,
2060,
10297,
5552,
2490,
16,
62,
15,
72,
5357,
20868,
1507,
716,
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... | 3 |
#[test]
fn test_block() {
let (pub_key, secret_key) = gen_keypair();
let ts = Utc::now();
let txs = [2];
let tx_count = txs.len() as u32;
let content = Block::new(
blockchain::SCHEMA_MAJOR_VERSION,
ValidatorId::zero(),
Height(500),
tx_count,
&hash(&[1]),
&hash(&txs),
&hash(&[3]),
);
let precommits = vec![
Precommit::new(
ValidatorId(123),
Height(15),
Round(25),
&hash(&[1, 2, 3]),
&hash(&[3, 2, 1]),
ts,
&secret_key,
),
Precommit::new(
ValidatorId(13),
Height(25),
Round(35),
&hash(&[4, 2, 3]),
&hash(&[3, 3, 1]),
ts,
&secret_key,
),
Precommit::new(
ValidatorId(323),
Height(15),
Round(25),
&hash(&[1, 1, 3]),
&hash(&[5, 2, 1]),
ts,
&secret_key,
),
];
let transactions = vec![
Status::new(&pub_key, Height(2), &hash(&[]), &secret_key)
.raw()
.clone(),
Status::new(&pub_key, Height(4), &hash(&[2]), &secret_key)
.raw()
.clone(),
Status::new(&pub_key, Height(7), &hash(&[3]), &secret_key)
.raw()
.clone(),
];
let block = BlockResponse::new(
&pub_key,
&pub_key,
content.clone(),
precommits.clone(),
transactions.clone(),
&secret_key,
);
assert_eq!(block.from(), &pub_key);
assert_eq!(block.to(), &pub_key);
assert_eq!(block.block(), content);
assert_eq!(block.precommits(), precommits);
assert_eq!(block.transactions(), transactions);
let block2 = BlockResponse::from_raw(block.raw().clone()).unwrap();
assert_eq!(block2.from(), &pub_key);
assert_eq!(block2.to(), &pub_key);
assert_eq!(block2.block(), content);
assert_eq!(block2.precommits(), precommits);
assert_eq!(block2.transactions(), transactions);
let block_proof = BlockProof {
block: content.clone(),
precommits: precommits.clone(),
};
let json_str = ::serde_json::to_string(&block_proof).unwrap();
let block_proof_1: BlockProof = ::serde_json::from_str(&json_str).unwrap();
assert_eq!(block_proof, block_proof_1);
} | rust_cleaned_test_functions.jsonl/118859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
368,
341,
262,
1077,
320,
9585,
3097,
11,
6234,
3097,
8,
284,
4081,
3097,
12670,
543,
262,
1077,
10591,
284,
547,
10413,
486,
3328,
543,
262,
1077,
9854,
82,
284,
508,
17,
935,
262,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input_stream_io_bufread() {
test_read("aa bb cc", |is| {
assert_eq!(
BufRead::fill_buf(is).expect("io::BufRead::fill_buf"),
&[0xaa, 0xbb, 0xcc]
);
BufRead::consume(is, 3);
});
} | rust_cleaned_test_functions.jsonl/104509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
12673,
16939,
10363,
878,
368,
341,
286,
1273,
6443,
445,
5305,
16520,
12527,
497,
760,
285,
91,
341,
310,
2060,
10714,
33673,
394,
69013,
4418,
486,
7559,
10363,
9623,
568,
17119,
445,
815,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_weighted_net_and_grid2_chord() {
let seed: &[_] = &[1,2,3,4,9];
let mut rng: StdRng = rand::SeedableRng::from_seed(seed);
let num_neighbors = 2;
let k = 5; // 5 X 5 grid
let l: usize = 6; // Size of keyspace
random_weighted_net_and_grid2_chord(k,num_neighbors, 1, 2, l, &mut rng);
} | rust_cleaned_test_functions.jsonl/53247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
15876,
291,
19722,
8378,
15604,
17,
4138,
539,
368,
341,
286,
1077,
10320,
25,
609,
13496,
60,
284,
44590,
16,
11,
17,
11,
18,
11,
19,
11,
24,
935,
286,
1077,
5206,
28422,
25,
42517,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transition_local() {
assert_eq!(
transition_local::<f32>(5, 3, WindowType::Triangle, false),
array![
[2f32 / 3., 1. / 3., 0., 0., 0.],
[0.25, 0.5, 0.25, 0., 0.],
[0., 0.25, 0.5, 0.25, 0.],
[0., 0., 0.25, 0.5, 0.25],
[0., 0., 0., 1. / 3., 2. / 3.]
]
);
assert_eq!(
transition_local::<f32>(5, 3, WindowType::Triangle, true),
array![
[0.5f32, 0.25, 0., 0., 0.25],
[0.25, 0.5, 0.25, 0., 0.],
[0., 0.25, 0.5, 0.25, 0.],
[0., 0., 0.25, 0.5, 0.25],
[0.25, 0., 0., 0.25, 0.5]
]
);
} | rust_cleaned_test_functions.jsonl/82674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53593,
13564,
368,
341,
286,
2060,
10714,
33673,
310,
9142,
13564,
27638,
69,
18,
17,
2235,
20,
11,
220,
18,
11,
13642,
929,
486,
51942,
11,
895,
1326,
310,
1334,
90515,
394,
508,
17,
69,
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_small_transparent_commitment() {
use crate::pairing::bn256::{Bn256, Fr};
const SIZE:usize = 16;
let worker = Worker::new();
let coeffs: Vec<_> = vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1];
let coeffs = convert_to_field_elements(&coeffs, &worker);
let poly = Polynomial::<Fr, _>::from_coeffs(coeffs).unwrap();
let mut transcript = Blake2sTranscript::<Fr>::new();
type Iop = TrivialBlake2sIOP<Fr>;
type Fri = NaiveFriIop<Fr, Iop>;
type Committer = StatelessTransparentCommitter<Fr, Fri, Blake2sTranscript<Fr>>;
let meta = TransparentCommitterParameters {
lde_factor: 16,
num_queries: 2,
output_coeffs_at_degree_plus_one: 1,
fri_params: ()
};
let committer = <Committer as CommitmentScheme<Fr>>::new_for_size(SIZE, meta);
let (commitment, aux_data) = committer.commit_single(&poly);
let open_at = Fr::from_str("123").unwrap();
let expected_at_z = poly.evaluate_at(&worker, open_at);
let proof = committer.open_single(&poly, open_at, expected_at_z, &aux_data.as_ref(), &mut transcript);
let mut transcript = Blake2sTranscript::<Fr>::new();
let valid = committer.verify_single(&commitment, open_at, expected_at_z, &proof, &mut transcript);
assert!(valid);
} | rust_cleaned_test_functions.jsonl/4058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
7965,
3765,
36346,
478,
368,
341,
286,
990,
17717,
486,
12670,
287,
486,
11081,
17,
20,
21,
22964,
33,
77,
17,
20,
21,
11,
2869,
2315,
286,
733,
25341,
25,
51878,
284,
220,
16,
21,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intraday_quote_401_failed() {
let it = crawler::IntradayBuilder::new().token("").build();
assert_err!(it.quote("2884").call(), Err(FugleError::Unauthorized));
} | rust_cleaned_test_functions.jsonl/49443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
47026,
352,
45236,
62,
19,
15,
16,
35060,
368,
341,
262,
1077,
432,
284,
73094,
486,
641,
47026,
352,
3297,
486,
931,
1005,
5839,
80821,
5834,
543,
262,
2060,
9266,
10297,
275,
61565,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_accountsdb_compute_merkle_root_and_capitalization_overflow() {
solana_logger::setup();
let fanout = 2;
let input = vec![
(Pubkey::new_unique(), Hash::new_unique(), u64::MAX),
(Pubkey::new_unique(), Hash::new_unique(), 1),
];
AccountsDB::compute_merkle_root_and_capitalization(input, fanout);
} | rust_cleaned_test_functions.jsonl/60853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
57028,
717,
16754,
273,
12993,
8378,
16388,
2174,
2022,
79073,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
8405,
411,
284,
220,
17,
280,
286,
1077,
1946,
284,
7486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prune_1_executed() {
let mut block_tree = create_block_tree();
set_executed(&mut block_tree, &[id(1)]);
block_tree.mark_as_committed(id(1), ()).unwrap();
let to_store = block_tree.prune();
assert_to_store(&to_store, &[id(1)]);
assert_heads(&block_tree, vec![2, 3]);
assert_eq!(block_tree.last_committed_id, id(1));
for i in 1..=11 {
let block = block_tree.get_block(id(i));
match i {
2 | 3 | 4 | 5 => assert!(block.is_some()),
_ => assert!(block.is_none()),
}
}
} | rust_cleaned_test_functions.jsonl/87731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
2886,
62,
16,
18430,
2774,
368,
341,
262,
1077,
5206,
2504,
11663,
284,
1855,
7113,
11663,
543,
262,
738,
18430,
2774,
2099,
6984,
2504,
11663,
11,
44590,
307,
7,
16,
41958,
262,
2504,
116... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_count_return_type() -> Result<()> {
let observed = return_type(&AggregateFunction::Count, &[DataType::Utf8])?;
assert_eq!(DataType::UInt64, observed);
let observed = return_type(&AggregateFunction::Count, &[DataType::Int8])?;
assert_eq!(DataType::UInt64, observed);
Ok(())
} | rust_cleaned_test_functions.jsonl/56703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
12511,
1819,
368,
1464,
5714,
71698,
341,
286,
1077,
13166,
284,
470,
1819,
2099,
64580,
5152,
486,
2507,
11,
44590,
22653,
486,
38980,
23,
2467,
37445,
286,
2060,
10714,
10297,
22653,
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... | 3 |
#[test]
fn test_process_op_not() {
let filter = filter();
let mut op = Operator::Not(Box::new(Operator::And(vec![
Operator::Eq(schema_id_tag(), unencrypted_target(SCHEMA_ID.to_string())),
Operator::Eq(cred_def_id_tag(), unencrypted_target(CRED_DEF_ID.to_string()))
])));
assert!(Verifier::_process_operator("zip", &op, &filter).is_err());
op = Operator::Not(Box::new(Operator::And(vec![
Operator::Eq(schema_id_tag(), unencrypted_target("Not Here".to_string())),
Operator::Eq(cred_def_id_tag(), unencrypted_target("Not Here".to_string()))
])));
Verifier::_process_operator("zip", &op, &filter).unwrap()
} | rust_cleaned_test_functions.jsonl/71871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
10287,
7913,
368,
341,
286,
1077,
4051,
284,
4051,
543,
286,
1077,
5206,
1179,
284,
28498,
486,
2623,
67758,
486,
931,
7,
18461,
486,
3036,
25592,
90515,
310,
28498,
486,
27312,
42735,
842,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sparse_mixed_with_nulls() {
let mut builder = UnionBuilder::new_sparse(5);
builder.append::<Int32Type>("a", 1).unwrap();
builder.append_null().unwrap();
builder.append::<Float64Type>("c", 3.0).unwrap();
builder.append::<Int32Type>("a", 4).unwrap();
let union = builder.build().unwrap();
let expected_type_ids = vec![0_i8, 0, 1, 0];
// Check type ids
assert_eq!(
Buffer::from_slice_ref(&expected_type_ids),
union.data().buffers()[0]
);
for (i, id) in expected_type_ids.iter().enumerate() {
assert_eq!(id, &union.type_id(i));
}
assert_eq!(union.data().buffers().len(), 1);
for i in 0..union.len() {
let slot = union.value(i);
match i {
0 => {
let slot = slot.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(false, union.is_null(i));
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert_eq!(1_i32, value);
}
1 => assert!(union.is_null(i)),
2 => {
let slot = slot.as_any().downcast_ref::<Float64Array>().unwrap();
assert_eq!(false, union.is_null(i));
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert!(value - 3_f64 < f64::EPSILON);
}
3 => {
let slot = slot.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(false, union.is_null(i));
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert_eq!(4_i32, value);
}
_ => unreachable!(),
}
}
} | rust_cleaned_test_functions.jsonl/25637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
717,
3286,
6615,
15162,
82,
368,
341,
286,
1077,
5206,
7363,
284,
9145,
3297,
486,
931,
71123,
7,
20,
317,
286,
7363,
2057,
27638,
1072,
18,
17,
929,
13211,
64,
497,
220,
16,
568,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_parse_array() {
let mut nil_value_data = Vec::from("$-1\r\n\r\n");
// "Error message"
let mut error_value_data = Vec::from("-Error message\r\n");
// "Status message"
let mut status_value_data = Vec::from("+Status message\r\n");
let mut int_value_data = Vec::from(":-1423\r\n");
// "Bulk\r\nstring\tmessage"
let mut bulkstring_value_data = Vec::from("$20\r\nBulk\r\nstring\tmessage\r\n");
let mut array_value_data = Vec::from("*3\r\n:1\r\n:2\r\n:3\r\n");
let mut array_data: Vec<u8> = Vec::from("*6\r\n");
array_data.append(&mut nil_value_data);
array_data.append(&mut error_value_data);
array_data.append(&mut status_value_data);
array_data.append(&mut int_value_data);
array_data.append(&mut bulkstring_value_data);
array_data.append(&mut array_value_data);
let expected_value_len = array_data.len();
array_data.append(&mut "trash".as_bytes().to_vec());
let origin = RespInternalValue::Array(
vec![RespInternalValue::Nil,
RespInternalValue::Error("Error message".to_string()),
RespInternalValue::Status("Status message".to_string()),
RespInternalValue::Int(-1423),
RespInternalValue::BulkString("Bulk\r\nstring\tmessage".as_bytes().to_vec()),
RespInternalValue::Array(vec![RespInternalValue::Int(1),
RespInternalValue::Int(2),
RespInternalValue::Int(3)])
]);
let ParseResult { value, value_src_len }
= parse_resp_value(&array_data).unwrap().unwrap();
assert_eq!(origin, value);
assert_eq!(expected_value_len, value_src_len);
} | rust_cleaned_test_functions.jsonl/85370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 921
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3858,
368,
341,
286,
1077,
5206,
2092,
3142,
1769,
284,
11312,
486,
1499,
20912,
12,
16,
12016,
1699,
12016,
1699,
797,
286,
442,
330,
1454,
1943,
698,
286,
1077,
5206,
1465,
3142,
1769,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_withdraw_rent_exempt() {
let stake_pubkey = analog_sdk::pubkey::new_rand();
let clock = Clock::default();
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(std::mem::size_of::<StakeState>());
let stake = 42;
let stake_account = AccountSharedData::new_ref_data_with_space(
stake + rent_exempt_reserve,
&StakeState::Initialized(Meta {
rent_exempt_reserve,
..Meta::auto(&stake_pubkey)
}),
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let to = analog_sdk::pubkey::new_rand();
let to_account = AccountSharedData::new_ref(1, 0, &system_program::id());
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
// fail after
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
stake,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account,
None,
false,
),
Ok(())
);
stake_account
.borrow_mut()
.checked_add_lamports(stake)
.unwrap(); // top up account
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
stake,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account,
None,
true,
),
Err(InstructionError::InsufficientFunds)
);
// Withdrawal that would leave less than rent-exempt reserve should fail
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
stake + 1,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account,
None,
false,
),
Err(InstructionError::InsufficientFunds)
);
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
stake + 1,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account,
None,
true,
),
Err(InstructionError::InsufficientFunds)
);
// Withdrawal of complete account should succeed
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
stake + rent_exempt_reserve,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account,
None,
true,
),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/15302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
7633,
83127,
95736,
368,
341,
286,
1077,
18279,
34014,
792,
284,
23400,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
8866,
284,
26142,
486,
2258,
543,
286,
1077,
8016,
284,
29737,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_valid() {
fn new(data: Vec<i32>) -> IntervalHeap<i32> {
IntervalHeap { data: data, cmp: ::compare::Natural }
}
assert!(new(vec![]).is_valid());
assert!(new(vec![1]).is_valid());
assert!(new(vec![1, 1]).is_valid());
assert!(new(vec![1, 5]).is_valid());
assert!(new(vec![1, 5, 1]).is_valid());
assert!(new(vec![1, 5, 1, 1]).is_valid());
assert!(new(vec![1, 5, 5]).is_valid());
assert!(new(vec![1, 5, 5, 5]).is_valid());
assert!(new(vec![1, 5, 2, 4]).is_valid());
assert!(new(vec![1, 5, 2, 4, 3]).is_valid());
assert!(new(vec![1, 5, 2, 4, 3, 3]).is_valid());
assert!(!new(vec![2, 1]).is_valid()); // violates 2a
assert!(!new(vec![1, 5, 4, 3]).is_valid()); // violates 2a
assert!(!new(vec![1, 5, 0]).is_valid()); // violates 2b
assert!(!new(vec![1, 5, 0, 5]).is_valid()); // violates 2b
assert!(!new(vec![1, 5, 6]).is_valid()); // violates 2c
assert!(!new(vec![1, 5, 1, 6]).is_valid()); // violates 2c
assert!(!new(vec![1, 5, 0, 6]).is_valid()); // violates 2b and 2c
} | rust_cleaned_test_functions.jsonl/42263 | {
"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,
6892,
8337,
368,
341,
286,
5168,
501,
2592,
25,
11312,
21897,
18,
17,
9231,
1464,
40584,
27909,
21897,
18,
17,
29,
341,
310,
40584,
27909,
314,
821,
25,
821,
11,
26089,
25,
3504,
18948,
486,
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_len() {
check_output_lists(
"print(len(\"\")); \n\
print(len(\"cat\")); \n\
print(len([])); \n\
print(len([1,2,3,4]));",
"0\n3\n0\n4",
)
} | rust_cleaned_test_functions.jsonl/111866 | {
"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,
6043,
368,
341,
286,
1779,
7645,
37288,
1006,
310,
330,
1350,
6901,
36014,
2105,
5905,
1124,
77,
5661,
1797,
1173,
6901,
36014,
4616,
2105,
5905,
1124,
77,
5661,
1797,
1173,
6901,
10556,
5905,
112... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_permitted_algorithms_ok() {
// SlotConfig init
let slot_config = SlotConfig {
write_config: rust_cryptoauthlib::WriteConfig::Encrypt,
key_type: rust_cryptoauthlib::KeyType::P256EccKey,
read_key: ReadKey {
encrypt_read: false,
slot_number: 0,
},
ecc_key_attr: EccKeyAttr {
is_private: true,
ext_sign: true,
int_sign: false,
ecdh_operation: false,
ecdh_secret_out: false,
},
x509id: 0,
auth_key: 0,
write_key: 0,
is_secret: true,
limited_use: false,
no_mac: false,
persistent_disable: false,
req_auth: false,
req_random: false,
lockable: false,
pub_info: true,
};
// AteccKeySlot init
let mut key_slot = AteccKeySlot {
ref_count: 1,
status: KeySlotStatus::Busy,
config: slot_config,
};
// ECC Key Attributes
let mut attributes = Attributes {
lifetime: Lifetime::Persistent,
key_type: Type::EccPublicKey {
curve_family: EccFamily::SecpR1,
},
bits: 256,
policy: Policy {
usage_flags: {
let mut flags = UsageFlags::default();
let _ = flags
.set_sign_hash()
.set_verify_hash()
.set_sign_message()
.set_export()
.set_copy();
flags
},
permitted_algorithms: AsymmetricSignature::Ecdsa {
hash_alg: Hash::Sha256.into(),
}
.into(),
},
};
// KeyType::P256EccKey
assert!(key_slot.is_permitted_algorithms_ok(&attributes, None));
attributes.policy.permitted_algorithms = Mac::FullLength(FullLengthMac::Hmac {
hash_alg: Hash::Sha256,
})
.into();
assert!(!key_slot.is_permitted_algorithms_ok(&attributes, None));
attributes.policy.permitted_algorithms = AsymmetricSignature::DeterministicEcdsa {
hash_alg: Hash::Sha256.into(),
}
.into();
assert!(!key_slot.is_permitted_algorithms_ok(&attributes, None));
attributes.policy.permitted_algorithms = KeyAgreement::Raw(RawKeyAgreement::Ecdh).into();
assert!(key_slot.is_permitted_algorithms_ok(&attributes, None));
// KeyType::Aes
attributes.policy.permitted_algorithms =
Aead::AeadWithDefaultLengthTag(AeadWithDefaultLengthTag::Ccm).into();
key_slot.config.key_type = rust_cryptoauthlib::KeyType::Aes;
assert!(key_slot.is_permitted_algorithms_ok(&attributes, None));
attributes.policy.permitted_algorithms = Algorithm::Cipher(Cipher::CbcPkcs7);
assert!(key_slot.is_permitted_algorithms_ok(&attributes, None));
} | rust_cleaned_test_functions.jsonl/133313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1758
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
31961,
3762,
8418,
18980,
19817,
368,
341,
286,
442,
31316,
2648,
2930,
198,
286,
1077,
9446,
5332,
284,
31316,
2648,
341,
310,
3270,
5332,
25,
23071,
78298,
3242,
2740,
486,
7985,
2648,
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_check_len() {
// less than 8 bytes
assert_eq!(Err(Error::Truncated),
Header::new_unchecked(&BYTES_HEADER_MORE_FRAG[..7]).check_len());
// valid
assert_eq!(Ok(()),
Header::new_unchecked(&BYTES_HEADER_MORE_FRAG).check_len());
} | rust_cleaned_test_functions.jsonl/22423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6043,
368,
341,
286,
442,
2686,
1091,
220,
23,
5820,
198,
286,
2060,
10714,
10297,
7747,
37396,
486,
1282,
38007,
1326,
4293,
12104,
486,
931,
4907,
7549,
2099,
97849,
20330,
75131,
14220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_updates_since_nothing() {
let path = DBPath::new("_rust_rocksdb_test_get_updates_since_nothing");
let db = DB::open_default(&path).unwrap();
db.put(b"key1", b"value1").unwrap();
let seq1 = db.latest_sequence_number();
let mut iter = db.get_updates_since(seq1).unwrap();
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/91352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
57829,
56262,
6536,
1596,
368,
341,
262,
1077,
1815,
284,
5952,
1820,
486,
931,
16975,
35788,
26608,
14553,
1999,
4452,
3062,
57829,
56262,
6536,
1596,
797,
262,
1077,
2927,
284,
5952,
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_pubkey_from_bad_slice() {
// Bad sizes
assert_eq!(PublicKey::from_slice(&[0; constants::COMPRESSED_PUBLIC_KEY_SIZE - 1]),
Err(InvalidPublicKey));
assert_eq!(PublicKey::from_slice(&[0; constants::COMPRESSED_PUBLIC_KEY_SIZE + 1]),
Err(InvalidPublicKey));
assert_eq!(PublicKey::from_slice(&[0; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE - 1]),
Err(InvalidPublicKey));
assert_eq!(PublicKey::from_slice(&[0; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE + 1]),
Err(InvalidPublicKey));
// Bad parse
assert_eq!(PublicKey::from_slice(&[0xff; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE]),
Err(InvalidPublicKey));
assert_eq!(PublicKey::from_slice(&[0x55; constants::COMPRESSED_PUBLIC_KEY_SIZE]),
Err(InvalidPublicKey));
} | rust_cleaned_test_functions.jsonl/41401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
792,
5673,
34199,
26488,
368,
341,
286,
442,
11461,
12282,
198,
286,
2060,
10714,
10297,
61822,
486,
1499,
26488,
2099,
58,
15,
26,
18021,
486,
23707,
49061,
36209,
6600,
4098,
481,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_folds() {
let mut paper = Paper::parse_from_str(EXAMPLE_INPUT).unwrap();
paper.apply_folds();
assert_eq!(paper.num_points(), 16);
} | rust_cleaned_test_functions.jsonl/98777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
761,
18431,
368,
341,
286,
1077,
5206,
5567,
284,
17862,
486,
6400,
5673,
2895,
25409,
18918,
21022,
568,
15454,
543,
286,
5567,
13045,
761,
18431,
543,
286,
2060,
10714,
10297,
19166,
10522,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_partial_eof() {
let mut buf = BytesMut::from("GET /test HTTP/1.1\r\n");
let settings = WorkerSettings::<HttpApplication>::new(Vec::new(), KeepAlive::Os);
let mut reader = H1Decoder::new();
assert!(reader.decode(&mut buf, &settings).unwrap().is_none());
buf.extend(b"\r\n");
match reader.decode(&mut buf, &settings) {
Ok(Some(msg)) => {
let req = HttpRequest::from_message(msg.message());
assert_eq!(req.version(), Version::HTTP_11);
assert_eq!(*req.method(), Method::GET);
assert_eq!(req.path(), "/test");
}
Ok(_) | Err(_) => unreachable!("Error during parsing http request"),
}
} | rust_cleaned_test_functions.jsonl/110384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
52068,
90792,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
445,
3806,
608,
1944,
10130,
14,
16,
13,
16,
12016,
1699,
797,
286,
1077,
5003,
284,
33086,
6086,
27638,
2905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_args() {
let ctx = TestContext::new();
let connect = ctx.async_connection();
block_on_all(connect.and_then(|con| {
redis::cmd("SET")
.arg("key1")
.arg(b"foo")
.query_async(con)
.and_then(|(con, ())| redis::cmd("SET").arg(&["key2", "bar"]).query_async(con))
.and_then(|(con, ())| {
redis::cmd("MGET")
.arg(&["key1", "key2"])
.query_async(con)
.map(|t| t.1)
})
.then(|result| {
assert_eq!(result, Ok(("foo".to_string(), b"bar".to_vec())));
result
})
}))
.unwrap();
} | rust_cleaned_test_functions.jsonl/10902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
4564,
284,
5635,
24747,
15866,
1428,
262,
2504,
4470,
5705,
73480,
34724,
68367,
22428,
443,
91,
341,
286,
20870,
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_create_program_kernels() {
let platforms = get_platforms().unwrap();
assert!(0 < platforms.len());
// Get the first platform
let platform = &platforms[0];
let devices = platform.get_devices(CL_DEVICE_TYPE_GPU).unwrap();
assert!(0 < devices.len());
// Get the first device
let device = Device::new(devices[0]);
let context = Context::from_device(&device).unwrap();
let program =
Program::create_and_build_from_source(&context, PROGRAM_SOURCE, CL_KERNEL_ARG_INFO)
.expect("Program::create_and_build_from_source failed");
// Create the kernels from the OpenCL program source.
let kernels = create_program_kernels(&program).unwrap();
assert!(2 == kernels.len());
let kernel_0_name = kernels[0].function_name().unwrap();
println!("OpenCL kernel_0_name: {}", kernel_0_name);
let kernel_1_name = kernels[1].function_name().unwrap();
println!("OpenCL kernel_1_name: {}", kernel_1_name);
let kernel_names: HashSet<&str> = program.kernel_names().split(';').collect();
assert!(kernel_names.contains(&kernel_0_name as &str));
assert!(kernel_names.contains(&kernel_1_name as &str));
let num_args_0 = kernels[0].num_args().expect("OpenCL kernel_0.num_args");
println!("OpenCL kernel_0 num args: {}", num_args_0);
let value = kernels[0].num_args().unwrap();
println!("kernel.num_args(): {}", value);
assert_eq!(2, value);
let value = kernels[0].reference_count().unwrap();
println!("kernel.reference_count(): {}", value);
assert_eq!(1, value);
let value = kernels[0].context().unwrap();
assert!(context.get() == value);
let value = kernels[0].program().unwrap();
assert!(program.get() == value);
let value = kernels[0].attributes().unwrap();
println!("kernel.attributes(): {}", value);
#[cfg(feature = "CL_VERSION_1_2")]
{
let arg0_address = kernels[0]
.get_arg_address_qualifier(0)
.expect("OpenCL kernel_0.get_arg_address_qualifier");
println!(
"OpenCL kernel_0.get_arg_address_qualifier: {:X}",
arg0_address
);
let arg0_access = kernels[0]
.get_arg_access_qualifier(0)
.expect("OpenCL kernel_0.get_arg_access_qualifier");
println!(
"OpenCL kernel_0.get_arg_access_qualifier: {:X}",
arg0_access
);
let arg0_type_name = kernels[0]
.get_arg_type_name(0)
.expect("OpenCL kernel_0.get_arg_type_name");
println!("OpenCL kernel_0.get_arg_type_name: {}", arg0_type_name);
let arg0_type = kernels[0]
.get_arg_type_qualifier(0)
.expect("OpenCL kernel_0.get_arg_type_qualifier");
println!("OpenCL kernel_0.get_arg_type_qualifier: {}", arg0_type);
let arg0_name = kernels[0]
.get_arg_name(0)
.expect("OpenCL kernel_0.get_arg_name");
println!("OpenCL kernel_0.get_arg_name: {}", arg0_name);
}
let value = kernels[0].get_work_group_size(device.id()).unwrap();
println!("kernel.get_work_group_size(): {}", value);
let value = kernels[0].get_compile_work_group_size(device.id()).unwrap();
println!("kernel.get_work_group_size(): {:?}", value);
assert_eq!(3, value.len());
let value = kernels[0].get_local_mem_size(device.id()).unwrap();
println!("kernel.get_local_mem_size(): {}", value);
let value = kernels[0]
.get_work_group_size_multiple(device.id())
.unwrap();
println!("kernel.get_work_group_size_multiple(): {}", value);
let value = kernels[0].get_private_mem_size(device.id()).unwrap();
println!("kernel.get_private_mem_size(): {}", value);
} | rust_cleaned_test_functions.jsonl/64167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1945
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25096,
4698,
42329,
368,
341,
286,
1077,
15409,
284,
633,
34260,
82,
1005,
15454,
543,
286,
2060,
10297,
15,
366,
15409,
19406,
5231,
286,
442,
2126,
279,
1156,
5339,
198,
286,
1077,
5339,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reading_to_string() {
let fs = FileSystem::default();
let mut file = fs
.new_open_options()
.read(true)
.write(true)
.create_new(true)
.open(path!("/foo.txt"))
.expect("failed to create a new file");
assert!(
matches!(file.write(b"foobarbazqux"), Ok(12)),
"writing `foobarbazqux`",
);
assert!(
matches!(file.seek(io::SeekFrom::Start(6)), Ok(6)),
"seeking to 0",
);
let mut string = String::new();
assert!(
matches!(file.read_to_string(&mut string), Ok(6)),
"reading a string",
);
assert_eq!(string, "bazqux", "checking the string");
} | rust_cleaned_test_functions.jsonl/52785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81859,
2346,
3904,
368,
341,
286,
1077,
8619,
284,
53461,
486,
2258,
1428,
286,
1077,
5206,
1034,
284,
8619,
198,
310,
659,
931,
11311,
8743,
741,
310,
659,
878,
3715,
340,
310,
659,
4934,
3715,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_line() {
let line = Line::new(coord! { x: 0., y: 0. }, coord! { x: 5., y: 10. });
let want = vec![Line::new(coord! { x: 0., y: 0. }, coord! { x: 5., y: 10. })];
assert_eq!(want, line.lines_iter().collect::<Vec<_>>());
} | rust_cleaned_test_functions.jsonl/83531 | {
"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,
6528,
368,
341,
286,
1077,
1555,
284,
7083,
486,
931,
65037,
0,
314,
856,
25,
220,
15,
2572,
379,
25,
220,
15,
13,
2470,
16489,
0,
314,
856,
25,
220,
20,
2572,
379,
25,
220,
16,
15,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_log_file() {
assert!(process_file("tests/data/file4.log").is_err());
assert!(process_file_with_line_skipping("tests/data/file4.log").is_err());
} | rust_cleaned_test_functions.jsonl/18312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
38007,
5224,
2458,
368,
341,
262,
2060,
10297,
4630,
2458,
445,
23841,
13167,
23903,
19,
1665,
1827,
285,
9266,
1423,
262,
2060,
10297,
4630,
2458,
6615,
6528,
33811,
5654,
445,
23841,
13167,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_concurrent_transfers_single_node() {
let (_swarm, mut client_proxy) = setup_swarm_and_client_proxy(1, 0);
client_proxy.create_next_account(false).unwrap();
client_proxy
.mint_coins(&["mintb", "0", "100"], true)
.unwrap();
client_proxy.create_next_account(false).unwrap();
for _ in 0..20 {
client_proxy
.transfer_coins(&["t", "0", "1", "1"], false)
.unwrap();
}
client_proxy
.transfer_coins(&["tb", "0", "1", "1"], true)
.unwrap();
assert_eq!(
Decimal::from_f64(79.0),
Decimal::from_str(&client_proxy.get_balance(&["b", "0"]).unwrap()).ok()
);
assert_eq!(
Decimal::from_f64(21.0),
Decimal::from_str(&client_proxy.get_balance(&["b", "1"]).unwrap()).ok()
);
} | rust_cleaned_test_functions.jsonl/32470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
7965,
49793,
19487,
5084,
368,
341,
262,
1077,
5453,
2280,
2178,
11,
5206,
2943,
29712,
8,
284,
6505,
32581,
2178,
8378,
8179,
29712,
7,
16,
11,
220,
15,
317,
262,
2943,
29712,
2520,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_display_output_rows() {
let count = Count::new();
let values = vec![
MetricValue::OutputRows(count.clone()),
MetricValue::Count {
name: "my_counter".into(),
count: count.clone(),
},
];
for value in &values {
assert_eq!("0", value.to_string(), "value {:?}", value);
}
count.add(42);
for value in &values {
assert_eq!("42", value.to_string(), "value {:?}", value);
}
} | rust_cleaned_test_functions.jsonl/22802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
7645,
10949,
368,
341,
286,
1077,
1760,
284,
4504,
486,
931,
543,
286,
1077,
2750,
284,
7486,
90515,
310,
52458,
1130,
486,
5097,
9024,
11512,
15997,
14702,
310,
52458,
1130,
486,
2507,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_isolating_run_sequences_sos_and_eos() {
// == Example 1 ==
// text1·RLE·text2·LRE·text3·PDF·text4·PDF·RLE·text5·PDF·text6
// index 0 1 2 3 4 5 6 7 8 9 10 11
let classes = &[L, RLE, L, LRE, L, PDF, L, PDF, RLE, L, PDF, L];
let levels = &[0, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 0];
let para_level = Level::ltr();
let mut sequences = isolating_run_sequences(para_level, classes, &Level::vec(levels));
sequences.sort_by(|a, b| a.runs[0].clone().cmp(b.runs[0].clone()));
// text1
assert_eq!(
&sequences[0],
&IsolatingRunSequence {
runs: vec![0..2],
sos: L,
eos: R,
}
);
// text2
assert_eq!(
&sequences[1],
&IsolatingRunSequence {
runs: vec![2..4],
sos: R,
eos: L,
}
);
// text3
assert_eq!(
&sequences[2],
&IsolatingRunSequence {
runs: vec![4..6],
sos: L,
eos: L,
}
);
// text4 text5
assert_eq!(
&sequences[3],
&IsolatingRunSequence {
runs: vec![6..11],
sos: L,
eos: R,
}
);
// text6
assert_eq!(
&sequences[4],
&IsolatingRunSequence {
runs: vec![11..12],
sos: R,
eos: L,
}
);
// == Example 2 ==
// text1·RLI·text2·LRI·text3·PDI·text4·PDI·RLI·text5·PDI·text6
// index 0 1 2 3 4 5 6 7 8 9 10 11
let classes = &[L, RLI, L, LRI, L, PDI, L, PDI, RLI, L, PDI, L];
let levels = &[0, 0, 1, 1, 2, 1, 1, 0, 0, 1, 0, 0];
let para_level = Level::ltr();
let mut sequences = isolating_run_sequences(para_level, classes, &Level::vec(levels));
sequences.sort_by(|a, b| a.runs[0].clone().cmp(b.runs[0].clone()));
// text1·RLI·PDI·RLI·PDI·text6
assert_eq!(
&sequences[0],
&IsolatingRunSequence {
runs: vec![0..2, 7..9, 10..12],
sos: L,
eos: L,
}
);
// text2·LRI·PDI·text4
assert_eq!(
&sequences[1],
&IsolatingRunSequence {
runs: vec![2..4, 5..7],
sos: R,
eos: R,
}
);
// text3
assert_eq!(
&sequences[2],
&IsolatingRunSequence {
runs: vec![4..5],
sos: L,
eos: L,
}
);
// text5
assert_eq!(
&sequences[3],
&IsolatingRunSequence {
runs: vec![9..10],
sos: R,
eos: R,
}
);
} | rust_cleaned_test_functions.jsonl/9190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1997
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
337,
1095,
14007,
58732,
643,
436,
8378,
2204,
436,
368,
1476,
286,
442,
621,
13383,
220,
16,
47761,
286,
442,
1467,
16,
13935,
49,
867,
13935,
1318,
17,
13935,
43,
787,
13935,
1318,
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_persist_app() {
block_on(async {
let storage = Rc::new(Mutex::new(MemStorage::new()));
let app_set = make_test_app_set();
StateMachineBuilder::new_stub()
.storage(Rc::clone(&storage))
.app_set(app_set.clone())
.oneshot_check()
.await
.map(|_| ())
.collect::<()>()
.await;
let storage = storage.lock().await;
let apps = app_set.to_vec().await;
storage.get_string(&apps[0].id).await.unwrap();
assert!(storage.committed());
});
} | rust_cleaned_test_functions.jsonl/59696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4975,
8191,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5819,
284,
81463,
486,
931,
3189,
9371,
486,
931,
3189,
336,
5793,
486,
931,
7392,
310,
1077,
906,
2602,
284,
1281,
4452,
8191,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize() {
let buf = (&new_serialize_buf()[..])
.into_serializer()
.encapsulate(EthernetFrameBuilder::new(
DEFAULT_DST_MAC,
DEFAULT_SRC_MAC,
EtherType::Arp,
))
.serialize_vec_outer()
.unwrap();
assert_eq!(
&buf.as_ref()[..ETHERNET_HDR_LEN_NO_TAG],
[6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 0x08, 0x06]
);
} | rust_cleaned_test_functions.jsonl/35167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
341,
286,
1077,
6607,
284,
15899,
931,
88686,
10363,
10116,
496,
2546,
310,
659,
18122,
67441,
741,
310,
659,
954,
2625,
6334,
10722,
696,
4711,
4369,
3297,
486,
931,
1006,
394,
11955,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_reward() {
let mut deps = mock_dependencies(&[]);
let msg = InstantiateMsg {
anchor_token: "reward0000".to_string(),
staking_token: "staking0000".to_string(),
distribution_schedule: vec![
(
mock_env().block.time.seconds(),
mock_env().block.time.seconds() + 100,
Uint128::from(1000000u128),
),
(
mock_env().block.time.seconds() + 100,
mock_env().block.time.seconds() + 200,
Uint128::from(10000000u128),
),
],
};
let info = mock_info("addr0000", &[]);
let _res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap();
// bond 100 tokens
let msg = ExecuteMsg::Receive(Cw20ReceiveMsg {
sender: "addr0000".to_string(),
amount: Uint128::from(100u128),
msg: to_binary(&Cw20HookMsg::Bond {}).unwrap(),
});
let info = mock_info("staking0000", &[]);
let mut env = mock_env();
let _res = execute(deps.as_mut(), env.clone(), info.clone(), msg).unwrap();
// 100 seconds passed
env.block.time = env.block.time.plus_seconds(100);
// bond 100 more tokens
let msg = ExecuteMsg::Receive(Cw20ReceiveMsg {
sender: "addr0000".to_string(),
amount: Uint128::from(100u128),
msg: to_binary(&Cw20HookMsg::Bond {}).unwrap(),
});
let _res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
assert_eq!(
from_binary::<StakerInfoResponse>(
&query(
deps.as_ref(),
mock_env(),
QueryMsg::StakerInfo {
staker: "addr0000".to_string(),
block_time: None,
},
)
.unwrap()
)
.unwrap(),
StakerInfoResponse {
staker: "addr0000".to_string(),
reward_index: Decimal::from_ratio(10000u128, 1u128),
pending_reward: Uint128::from(1000000u128),
bond_amount: Uint128::from(200u128),
}
);
// 100 seconds passed
env.block.time = env.block.time.plus_seconds(10);
let info = mock_info("addr0000", &[]);
// unbond
let msg = ExecuteMsg::Unbond {
amount: Uint128::from(100u128),
};
let _res = execute(deps.as_mut(), env, info, msg).unwrap();
assert_eq!(
from_binary::<StakerInfoResponse>(
&query(
deps.as_ref(),
mock_env(),
QueryMsg::StakerInfo {
staker: "addr0000".to_string(),
block_time: None,
},
)
.unwrap()
)
.unwrap(),
StakerInfoResponse {
staker: "addr0000".to_string(),
reward_index: Decimal::from_ratio(15000u64, 1u64),
pending_reward: Uint128::from(2000000u128),
bond_amount: Uint128::from(100u128),
}
);
// query future block
assert_eq!(
from_binary::<StakerInfoResponse>(
&query(
deps.as_ref(),
mock_env(),
QueryMsg::StakerInfo {
staker: "addr0000".to_string(),
block_time: Some(mock_env().block.time.plus_seconds(120).seconds()),
},
)
.unwrap()
)
.unwrap(),
StakerInfoResponse {
staker: "addr0000".to_string(),
reward_index: Decimal::from_ratio(25000u64, 1u64),
pending_reward: Uint128::from(3000000u128),
bond_amount: Uint128::from(100u128),
}
);
} | rust_cleaned_test_functions.jsonl/2050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1967
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
38260,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
1294,
626,
262,
1077,
3750,
284,
32288,
6611,
341,
286,
17105,
6458,
25,
330,
49007,
15,
15,
15,
15,
3263,
983,
3904,
3148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_btree_map_range_mut_panic_1() {
let mut map: BTreeMap<usize, usize> = BTreeMap::new();
map.insert(3, 3);
map.insert(5, 5);
map.insert(8, 8);
let _bad_range = map.range_mut((Included(&8), Included(&3)));
} | rust_cleaned_test_functions.jsonl/18661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
9344,
5376,
9698,
29523,
620,
31270,
62,
16,
368,
341,
262,
1077,
5206,
2415,
25,
425,
6533,
2227,
90244,
11,
22301,
29,
284,
425,
6533,
2227,
486,
931,
543,
262,
2415,
7030,
7,
18,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_struct_round_trip() {
let point = Point { x: 1, y: 2 };
let point_pb = point.to_pb();
let point_convert_round_trip: Point = ProtobufConvert::from_pb(point_pb).unwrap();
assert_eq!(point_convert_round_trip, point);
let bytes = point.to_bytes();
let point_encode_round_trip = Point::from_bytes(Cow::from(&bytes)).unwrap();
assert_eq!(point_encode_round_trip, point);
} | rust_cleaned_test_functions.jsonl/15767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
15126,
29896,
63883,
368,
341,
262,
1077,
1459,
284,
5126,
314,
856,
25,
220,
16,
11,
379,
25,
220,
17,
3634,
262,
1077,
1459,
31409,
284,
1459,
2389,
31409,
543,
262,
1077,
1459,
34910,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_distribution_multiple_values_with_tags() {
let client = StatsdClient::from_sink("prefix", NopMetricSink);
let res = client
.distribution_with_tags("some.distr", vec![27, 28, 29])
.with_tag("host", "www03.example.com")
.with_tag_value("rc1")
.try_send();
assert_eq!(
"prefix.some.distr:27:28:29|d|#host:www03.example.com,rc1",
res.unwrap().as_metric_str()
);
} | rust_cleaned_test_functions.jsonl/10608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
41465,
45233,
9146,
6615,
16333,
368,
341,
286,
1077,
2943,
284,
29927,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
453,
54310,
45094,
317,
286,
1077,
592,
284,
2943,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cvttss2si() {
assert_emit!(0xf3, 0x0f, 0x2c, 0xc8; cvttss2si(0, RCX, XMM0));
assert_emit!(0xf3, 0x44, 0x0f, 0x2c, 0xfb; cvttss2si(0, R15, XMM3));
assert_emit!(0xf3, 0x41, 0x0f, 0x2c, 0xe0; cvttss2si(0, RSP, XMM8));
assert_emit!(0xf3, 0x48, 0x0f, 0x2c, 0xc8; cvttss2si(1, RCX, XMM0));
assert_emit!(0xf3, 0x4c, 0x0f, 0x2c, 0xfb; cvttss2si(1, R15, XMM3));
assert_emit!(0xf3, 0x49, 0x0f, 0x2c, 0xe0; cvttss2si(1, RSP, XMM8));
} | rust_cleaned_test_functions.jsonl/85500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43233,
5566,
778,
17,
6321,
368,
341,
286,
2060,
69082,
10297,
15,
5848,
18,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
17,
66,
11,
220,
15,
8148,
23,
26,
5544,
5566,
778,
17,
6321,
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_parse() {
let parsed = parse(INPUT).unwrap();
assert_eq!(
parsed.draws,
vec![
7, 4, 9, 5, 11, 17, 23, 2, 0, 14, 21, 24, 10, 16, 13, 6, 15, 25, 12, 22, 18, 20, 8,
19, 3, 26, 1
]
);
assert_eq!(parsed.boards.len(), 3);
assert_eq!(
parsed.boards[0].squares,
Matrix5::<u32>::new(
22, 13, 17, 11, 0,
8, 2, 23, 4, 24,
21, 9, 14, 16, 7,
6, 10, 3, 18, 5,
1, 12, 20, 15, 19,
)
);
} | rust_cleaned_test_functions.jsonl/27870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
15676,
284,
4715,
57911,
568,
15454,
543,
286,
2060,
10714,
33673,
310,
15676,
7007,
82,
345,
310,
7486,
90515,
394,
220,
22,
11,
220,
19,
11,
220,
24,
11,
220,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone() {
let mut map = BTreeMap::new();
let size = 100;
assert_eq!(map.len(), 0);
for i in 0..size {
assert_eq!(map.insert(i, 10 * i), None);
assert_eq!(map.len(), i + 1);
assert_eq!(map, map.clone());
}
for i in 0..size {
assert_eq!(map.insert(i, 100 * i), Some(10 * i));
assert_eq!(map.len(), size);
assert_eq!(map, map.clone());
}
for i in 0..size / 2 {
assert_eq!(map.remove(&(i * 2)), Some(i * 200));
assert_eq!(map.len(), size - i - 1);
assert_eq!(map, map.clone());
}
for i in 0..size / 2 {
assert_eq!(map.remove(&(2 * i)), None);
assert_eq!(map.remove(&(2 * i + 1)), Some(i * 200 + 100));
assert_eq!(map.len(), size / 2 - i - 1);
assert_eq!(map, map.clone());
}
} | rust_cleaned_test_functions.jsonl/49399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
262,
1077,
5206,
2415,
284,
425,
6533,
2227,
486,
931,
543,
262,
1077,
1379,
284,
220,
16,
15,
15,
280,
262,
2060,
10714,
10297,
2186,
19406,
1507,
220,
15,
626,
262,
369,
600... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_delta_true() {
let (genesis_block, mint_keypair) = GenesisBlock::new(500);
let bank = Arc::new(Bank::new(&genesis_block));
let key1 = Keypair::new();
let tx_transfer_mint_to_1 =
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
assert_eq!(bank.process_transaction(&tx_transfer_mint_to_1), Ok(()));
assert_eq!(bank.is_delta.load(Ordering::Relaxed), true);
} | rust_cleaned_test_functions.jsonl/41909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
26710,
16082,
368,
341,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
7,
20,
15,
15,
317,
286,
1077,
6073,
284,
19689,
486,
931,
5349,
1180,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unset_variable() {
// This test depends on the HOME variable being pre-defined by the
// default shell
let out = TestScenario::new(util_name!())
.ucmd_keepenv()
.arg("-u")
.arg("HOME")
.run()
.stdout;
assert_eq!(out.lines().any(|line| line.starts_with("HOME=")), false);
} | rust_cleaned_test_functions.jsonl/1547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98109,
14635,
368,
341,
262,
442,
1096,
1273,
13798,
389,
279,
40567,
3890,
1660,
855,
38717,
553,
279,
198,
262,
442,
1638,
12528,
198,
262,
1077,
700,
284,
3393,
54031,
486,
931,
67811,
1269,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finish() {
let mut dataset = dataset!(
routes:
route_id, agency_id, route_short_name, route_type;
1, 1, "S1", 109;
2, 1, "S42", 109;
3, 2, "U4", 400;
4, 2, "12", 900
colors:
line, color;
"S1", "#dc6ba6";
"S42", "#cc6112";
"U4", "#ffd900"
);
let importer = Importer::import(&mut dataset).unwrap();
let lines = importer
.finish(vec![
vec![],
vec![],
vec![],
vec![routes::tram_12::oranienburger_tor_am_kupfergraben()],
])
.unwrap();
assert_eq!(lines.len(), 2);
assert!(lines[&"1".into()].contains(&lines::s1()));
assert!(lines[&"1".into()].contains(&lines::s42()));
assert!(lines[&"2".into()].contains(&lines::u4()));
assert!(lines[&"2".into()].contains(&lines::tram_12_with_route()));
} | rust_cleaned_test_functions.jsonl/33306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 774
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42980,
368,
341,
286,
1077,
5206,
10337,
284,
10337,
33673,
310,
11291,
510,
394,
6021,
842,
11,
9088,
842,
11,
6021,
16673,
1269,
11,
6021,
1819,
280,
394,
220,
16,
11,
286,
220,
16,
11,
260,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_redshift_describe_clusters() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-describe-clusters.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeClustersMessage::default();
let result = client.describe_clusters(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
26058,
13418,
15768,
3114,
46243,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
1151,
13418,
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... | 1 |
#[test]
fn test_error_builder() {
fn op_err(
_: &mut OpState,
_: (),
_: Option<ZeroCopyBuf>,
) -> Result<(), AnyError> {
Err(custom_error("DOMExceptionOperationError", "abc"))
}
pub fn get_error_class_name(_: &AnyError) -> &'static str {
"DOMExceptionOperationError"
}
run_in_task(|mut cx| {
let mut runtime = JsRuntime::new(RuntimeOptions {
get_error_class_fn: Some(&get_error_class_name),
..Default::default()
});
runtime.register_op("op_err", op_sync(op_err));
runtime.sync_ops_cache();
runtime
.execute_script(
"error_builder_test.js",
include_str!("error_builder_test.js"),
)
.unwrap();
if let Poll::Ready(Err(_)) = runtime.poll_event_loop(&mut cx, false) {
unreachable!();
}
});
} | rust_cleaned_test_functions.jsonl/23456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
28532,
368,
341,
262,
5168,
1179,
9266,
1006,
414,
58536,
609,
6984,
10672,
1397,
345,
414,
58536,
84201,
414,
58536,
6959,
27,
17999,
12106,
15064,
12520,
262,
873,
1464,
5714,
68843,
5765,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iter() {
let v: SmallVector<isize> = (vec![1is, 2, 3]).into_iter().collect();
assert_eq!(3, v.len());
assert_eq!(&1, v.get(0));
assert_eq!(&2, v.get(1));
assert_eq!(&3, v.get(2));
} | rust_cleaned_test_functions.jsonl/79081 | {
"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,
5673,
11723,
368,
341,
286,
1077,
348,
25,
14994,
3781,
27,
285,
551,
29,
284,
320,
4083,
20703,
16,
285,
11,
220,
17,
11,
220,
18,
10697,
18122,
11723,
1005,
17384,
543,
286,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_qdatetime_from_date_time_local_timezone() {
let qdate = QDate::from_y_m_d(2019, 10, 22);
let qtime = QTime::from_h_m_s_ms(10, 30, Some(40), Some(300));
let qdatetime = QDateTime::from_date_time_local_timezone(qdate, qtime);
let (actual_qdate, actual_qtime) = qdatetime.get_date_time();
assert_eq!((2019, 10, 22), actual_qdate.get_y_m_d());
assert_eq!((10, 30, 40, 300), actual_qtime.get_h_m_s_ms());
assert_eq!(10, actual_qtime.get_hour());
assert_eq!(30, actual_qtime.get_minute());
assert_eq!(40, actual_qtime.get_second());
assert_eq!(300, actual_qtime.get_msec());
} | rust_cleaned_test_functions.jsonl/45524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
15450,
5673,
4164,
3009,
13564,
53193,
368,
341,
262,
1077,
2804,
1028,
284,
1207,
1916,
486,
1499,
4178,
717,
814,
7,
17,
15,
16,
24,
11,
220,
16,
15,
11,
220,
17,
17,
317,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_channel_id() {
assert_eq!(
ChannelId::new(123).expect("non zero"),
ChannelId::parse("<#123>").unwrap()
);
assert_eq!(
&ParseMentionErrorType::Sigil {
expected: &["#"],
found: Some('@'),
},
ChannelId::parse("<@123>").unwrap_err().kind(),
);
} | rust_cleaned_test_functions.jsonl/3588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14571,
842,
368,
341,
286,
2060,
10714,
33673,
310,
13434,
764,
486,
931,
7,
16,
17,
18,
568,
17119,
445,
6280,
7168,
4461,
310,
13434,
764,
486,
6400,
9639,
2,
16,
17,
18,
61032,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dict() -> Result<()> {
let data = vec!["a", "b", "c", "a", "a", "c", "c"];
let array = DictionaryArray::<Int16Type>::from_iter(data.into_iter());
let cmp = build_compare(&array, &array)?;
assert_eq!(Ordering::Less, (cmp)(0, 1));
assert_eq!(Ordering::Equal, (cmp)(3, 4));
assert_eq!(Ordering::Greater, (cmp)(2, 3));
Ok(())
} | rust_cleaned_test_functions.jsonl/7139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5243,
368,
1464,
5714,
71698,
341,
286,
1077,
821,
284,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
497,
330,
64,
497,
330,
64,
497,
330,
66,
497,
330,
66,
6332,
286,
1077,
1334,
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... | 2 |
#[test]
fn test_update_skip_field() {
let mut cfg = TestConfig::default();
let mut updated_cfg = cfg.clone();
updated_cfg.skip_field = 100;
assert!(cfg.diff(&updated_cfg).is_empty(), "diff should be empty");
let mut diff = HashMap::new();
diff.insert("skip_field".to_owned(), ConfigValue::U64(123));
cfg.update(diff);
assert_eq!(cfg, TestConfig::default(), "cfg should not be updated");
} | rust_cleaned_test_functions.jsonl/3710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
44830,
5013,
368,
341,
286,
1077,
5206,
13286,
284,
3393,
2648,
486,
2258,
543,
286,
1077,
5206,
6049,
18343,
284,
13286,
15997,
1428,
286,
6049,
18343,
36596,
5013,
284,
220,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_context() {
let safe_point = Arc::new(AtomicU64::new((123 << PHYSICAL_SHIFT_BITS) * 1000));
let observer = Mvcc::<KvTestEngine>::new(safe_point);
let mut context = Vec::new();
assert!(observer.update_context(&mut context));
assert_eq!(context.len(), 9);
assert_eq!(context[0], ConsistencyCheckMethod::Mvcc as u8);
let safe_point = u64::from_le_bytes(context[1..9].try_into().unwrap());
assert_eq!(safe_point, (243 << PHYSICAL_SHIFT_BITS) * 1000);
} | rust_cleaned_test_functions.jsonl/27335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
8467,
368,
341,
286,
1077,
6092,
6085,
284,
19689,
486,
931,
7,
65857,
52,
21,
19,
486,
931,
1188,
16,
17,
18,
1115,
83987,
15571,
22657,
32695,
8,
353,
220,
16,
15,
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_value(){
assert_eq!(value("hello world!".as_bytes()), IResult::Done(&b""[..],"hello world!"));
assert_eq!(value("技術通報".as_bytes()), IResult::Done(&b""[..],"技術通報"));
} | rust_cleaned_test_functions.jsonl/114303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
3032,
262,
2060,
10714,
10297,
957,
445,
14990,
1879,
92993,
300,
12524,
11858,
358,
2077,
486,
17453,
2099,
65,
3014,
95874,
28503,
14990,
1879,
0,
4010,
262,
2060,
10714,
10297,
957,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pay_for_txn_fails_with_insufficient_tokens_in_wallet() {
init!("ledger");
mint_tokens_and_set_fees(Some(0), Some(0), Some(r#"{"101":50000000001}"#.to_string()), None).unwrap();
let (_, schema_json) = ::utils::libindy::anoncreds::tests::create_schema(::utils::constants::DEFAULT_SCHEMA_ATTRS);
let create_schema_req = ::utils::libindy::anoncreds::tests::create_schema_req(&schema_json);
let rc= pay_for_txn(&create_schema_req, "101");
assert!(rc.is_err());
} | rust_cleaned_test_functions.jsonl/10484 | {
"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,
28925,
5478,
92299,
761,
6209,
6615,
34386,
26683,
28838,
1243,
62308,
368,
341,
286,
2930,
17223,
50704,
797,
286,
28337,
28838,
8378,
2602,
761,
5516,
65405,
7,
15,
701,
4329,
7,
15,
701,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dedup() {
let mut dupes: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 1, 2, 3, 3]);
dupes.dedup();
assert_eq!(&*dupes, &[1, 2, 3]);
let mut empty: SmallVec<[i32; 5]> = SmallVec::new();
empty.dedup();
assert!(empty.is_empty());
let mut all_ones: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 1, 1, 1, 1]);
all_ones.dedup();
assert_eq!(all_ones.len(), 1);
let mut no_dupes: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 2, 3, 4, 5]);
no_dupes.dedup();
assert_eq!(no_dupes.len(), 5);
} | rust_cleaned_test_functions.jsonl/88174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
291,
454,
368,
341,
286,
1077,
5206,
22737,
288,
25,
14994,
10050,
66746,
72,
18,
17,
26,
220,
20,
25669,
284,
14994,
10050,
486,
1499,
26488,
2099,
58,
16,
11,
220,
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... | 1 |
#[test]
fn test_unknown_app_id() {
let json = br#"
{"response":{
"server":"prod",
"protocol":"3.0",
"app":[
{
"appid":"{00000000-0000-0000-0000-000000000001}",
"status": "error-unknownApplication"
}
]
}}"#;
let result = parse_json_response(json);
assert!(result.is_ok());
let response = result.unwrap();
let expected = Response {
protocol_version: "3.0".to_string(),
server: "prod".to_string(),
daystart: None,
apps: vec![App {
id: "{00000000-0000-0000-0000-000000000001}".to_string(),
status: OmahaStatus::Error("error-unknownApplication".to_string()),
..App::default()
}],
};
assert_eq!(response, expected);
} | rust_cleaned_test_functions.jsonl/14136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
8191,
842,
368,
341,
262,
1077,
2951,
284,
1411,
2,
698,
4913,
2322,
12602,
330,
4030,
3252,
19748,
756,
330,
17014,
3252,
18,
13,
15,
756,
330,
676,
8899,
198,
220,
341,
256,
330,
5834... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_trades_request_uri() {
let req = all()
.with_offer_id(123)
.with_base_asset(Asset::new_native())
.with_counter_asset(credit_asset0());
let uri = req.uri(&host()).unwrap();
assert!(uri
.to_string()
.starts_with("https://horizon.stellar.org/trades?"));
let query: HashMap<_, _> = uri.query_pairs().into_owned().collect();
assert_eq!(Some(&"native".to_string()), query.get("base_asset_type"));
assert_eq!(
Some(&"credit_alphanum4".to_string()),
query.get("counter_asset_type")
);
} | rust_cleaned_test_functions.jsonl/28551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
3547,
3452,
7893,
15572,
368,
341,
286,
1077,
4232,
284,
678,
741,
310,
659,
4197,
67814,
842,
7,
16,
17,
18,
340,
310,
659,
4197,
7651,
42299,
7,
16604,
486,
931,
44494,
2398,
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... | 1 |
#[test]
fn test_mo_deserialization() {
let mut a: Config = deserialize_file("./benches/config.toml").unwrap();
let mut mo = ManagedObject::default();
mo.name = String::from("tmux.conf");
mo.source = String::from("~/dotfiles/.tmux.conf");
mo.destination = String::from("~/.tmux.conf");
mo.method = String::from("symlink");
assert_eq!(mo, a.get_mo("tmux.conf".to_string()).unwrap());
} | rust_cleaned_test_functions.jsonl/95030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79258,
15768,
50563,
368,
341,
262,
1077,
5206,
264,
25,
5532,
284,
35240,
2458,
13988,
7964,
8528,
14730,
73494,
75,
1827,
15454,
543,
262,
1077,
5206,
4544,
284,
60744,
1190,
486,
2258,
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 |
#[test]
fn test_gpio_fsel_in() {
let mut mem = DirectMemory::get().unwrap();
let mut gpio_iface = mem.gpio().unwrap();
gpio_iface.fsel( 26, gpio::FSEL_INPUT );
} | rust_cleaned_test_functions.jsonl/32912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32001,
761,
9507,
1243,
368,
341,
286,
1077,
5206,
1833,
284,
7139,
10642,
486,
455,
1005,
15454,
543,
286,
1077,
5206,
31622,
67666,
284,
1833,
1302,
11917,
1005,
15454,
543,
286,
31622,
67666,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_as_i64(){
let json_value = from_str("-12").unwrap();
let json_num = json_value.as_i64();
assert_eq!(json_num, Some(-12));
} | rust_cleaned_test_functions.jsonl/6575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
5318,
21,
19,
3032,
286,
1077,
2951,
3142,
284,
504,
2895,
13645,
16,
17,
1827,
15454,
543,
286,
1077,
2951,
4273,
284,
2951,
3142,
5357,
5318,
21,
19,
543,
286,
2060,
10714,
10297,
2236,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_serialization_failure_cases() {
// a vec longer than representable range should result in failure
let bar = Bar {
a: 100,
b: vec![0; i32::max_value() as usize + 1],
c: Addr::new([0u8; 32]),
d: 222,
};
let mut serializer = SimpleSerializer::<Vec<u8>>::new();
assert!(bar.serialize(&mut serializer).is_err());
} | rust_cleaned_test_functions.jsonl/1868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
2022,
43618,
41427,
368,
341,
262,
442,
264,
7486,
5021,
1091,
4009,
480,
2088,
1265,
1102,
304,
7901,
198,
262,
1077,
3619,
284,
4716,
341,
286,
264,
25,
220,
16,
15,
15,
345,
286,
293... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq2_mul_nonresidue() {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
let mut nine = Fq::one();
nine.double();
nine.double();
nine.double();
nine.add_assign(&Fq::one());
let nqr = Fq2 {
c0: nine,
c1: Fq::one(),
};
for _ in 0..1000 {
let mut a = Fq2::rand(&mut rng);
let mut b = a;
a.mul_by_nonresidue();
b.mul_assign(&nqr);
assert_eq!(a, b);
}
} | rust_cleaned_test_functions.jsonl/100949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
17,
24944,
21637,
416,
60607,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
20,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inner_struct() {
let schema = r#"
{
"type":"record",
"name":"TestNested",
"fields":[
{
"name":"a",
"type":"int"
},
{
"name":"b",
"type":{
"type":"record",
"name":"TestAllSupportedBaseTypes",
"fields":[
{
"name":"a",
"type": "boolean"
},
{
"name":"b",
"type":"int"
},
{
"name":"c",
"type":"int"
},
{
"name":"d",
"type":"int"
},
{
"name":"e",
"type":"int"
},
{
"name":"f",
"type":"int"
},
{
"name":"g",
"type":"long"
},
{
"name":"h",
"type":"float"
},
{
"name":"i",
"type":"double"
},
{
"name":"j",
"type":"string"
}
]
}
}
]
}
"#;
let schema = Schema::parse_str(schema).unwrap();
assert_eq!(schema, TestNested::get_schema());
// TODO mgrigorov Use property based testing in the future
let all_basic = TestAllSupportedBaseTypes {
a: true,
b: 8_i8,
c: 16_i16,
d: 32_i32,
e: 8_u8,
f: 16_u16,
g: 64_i64,
h: 32.3333_f32,
i: 64.4444_f64,
j: "testing string".to_owned(),
};
let inner_struct = TestNested {
a: -1600,
b: all_basic,
};
serde_assert(inner_struct);
} | rust_cleaned_test_functions.jsonl/114072 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34345,
15126,
368,
341,
286,
1077,
10802,
284,
435,
2,
698,
286,
341,
310,
330,
1313,
3252,
8548,
756,
310,
330,
606,
3252,
2271,
71986,
756,
310,
330,
9007,
8899,
198,
394,
341,
503,
330,
606... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attribute_ref_with_wrong_type_fails() {
let storage = PerAttributeVecPointStorage::new(TestPointType::layout());
storage.iter_attribute_ref::<u32>(&attributes::INTENSITY);
} | rust_cleaned_test_functions.jsonl/73950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16791,
7793,
6615,
75198,
1819,
761,
6209,
368,
341,
286,
1077,
5819,
284,
3616,
3907,
10050,
2609,
5793,
486,
931,
31159,
2609,
929,
486,
8399,
1423,
286,
5819,
19471,
16791,
7793,
27638,
84,
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 |
#[test]
fn test_find_all_refs_decl_module() {
check(
r#"
//- /lib.rs
mod foo<|>;
use foo::Foo;
fn f() {
let i = Foo { n: 5 };
}
//- /foo.rs
pub struct Foo {
pub n: u32,
}
"#,
expect![[r#"
foo Module FileId(1) 0..35 Other
FileId(0) 14..17 Other
"#]],
);
} | rust_cleaned_test_functions.jsonl/47777 | {
"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,
21814,
5705,
60638,
35814,
10750,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
27,
91,
19421,
810,
15229,
486,
40923,
401,
8822,
282,
368,
341,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords_at_source_file_level() {
check(
r"m<|>",
expect![[r#"
kw const
kw enum
kw extern
kw fn
kw impl
kw mod
kw pub
kw pub(crate)
kw static
kw struct
kw trait
kw type
kw union
kw unsafe
kw use
"#]],
);
} | rust_cleaned_test_functions.jsonl/99571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
3752,
10347,
2458,
8274,
368,
341,
286,
1779,
1006,
310,
435,
1,
76,
27,
91,
35452,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
733,
198,
394,
29525,
7618,
198,
394,
29525,
15637,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symlink() {
let args = ["-c", DEV_FMTSTR, "/dev/cdrom"];
new_ucmd!().args(&args)
.run()
.stdout_is(expected_result(&args));
} | rust_cleaned_test_functions.jsonl/36724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58530,
44243,
368,
341,
262,
1077,
2827,
284,
4383,
12,
66,
497,
50895,
44332,
6666,
11,
3521,
3583,
2899,
67,
441,
6332,
262,
501,
68887,
2277,
0,
1005,
2116,
2099,
2116,
340,
286,
659,
6108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_matrix_scalar_multiplication() {
let input0: Vec<Vec<i32>> = vec![vec![3, 2, 2], vec![0, 2, 0], vec![5, 4, 1]];
let input1: Vec<Vec<i32>> = vec![vec![1, 0, 0], vec![0, 1, 0], vec![0, 0, 1]];
let exp_result1: Vec<Vec<i32>> = vec![vec![9, 6, 6], vec![0, 6, 0], vec![15, 12, 3]];
let exp_result2: Vec<Vec<i32>> = vec![vec![3, 0, 0], vec![0, 3, 0], vec![0, 0, 3]];
assert_eq!(matrix_scalar_multiplication(&input0, 3), exp_result1);
assert_eq!(matrix_scalar_multiplication(&input1, 3), exp_result2);
} | rust_cleaned_test_functions.jsonl/75905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
41652,
91802,
1693,
368,
341,
286,
1077,
1946,
15,
25,
11312,
50439,
21897,
18,
17,
2452,
284,
7486,
20703,
4083,
20703,
18,
11,
220,
17,
11,
220,
17,
1125,
7486,
20703,
15,
11,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unary_fn() {
use self::unary_fn::*;
assert_eq!( basic( 0 ), 1 );
assert_eq!( method( 1 ), 2 );
assert_eq!( func( 2 ), 3 );
assert_eq!( misc( 3 ), 19 );
} | rust_cleaned_test_functions.jsonl/931 | {
"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,
4907,
658,
15246,
368,
341,
286,
990,
656,
486,
359,
658,
15246,
79304,
286,
2060,
10714,
10297,
6770,
7,
220,
220,
15,
6882,
220,
16,
220,
1439,
286,
2060,
10714,
10297,
1714,
7,
220,
16,
688... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_save_load_tree() {
let data = vec![0.499, 0.49, 0.48, -0.49, 0.0];
let labels = vec![0, 0, 0, 1, 1];
let point_cloud = Arc::new(DefaultLabeledCloud::<L2>::new_simple(data, 1, labels));
let builder = CoverTreeBuilder {
scale_base: 2.0,
leaf_cutoff: 1,
min_res_index: -9,
use_singletons: false,
partition_type: PartitionType::Nearest,
verbosity: 0,
rng_seed: Some(0),
};
let tree = builder.build(Arc::clone(&point_cloud)).unwrap();
let reader = tree.reader();
let proto = tree.save();
assert_eq!(reader.layers.len(), proto.get_layers().len());
for (layer, proto_layer) in reader.layers.iter().zip(proto.get_layers()) {
assert_eq!(layer.len(), proto_layer.get_nodes().len());
}
let reconstructed_tree_writer =
CoverTreeWriter::load(&proto, Arc::clone(&point_cloud)).unwrap();
let reconstructed_tree = reconstructed_tree_writer.reader();
assert_eq!(reader.layers.len(), reconstructed_tree.layers.len());
for (layer, reconstructed_layer) in reader.layers.iter().zip(reconstructed_tree.layers) {
assert_eq!(layer.len(), reconstructed_layer.len());
layer.for_each_node(|pi, n| {
reconstructed_layer
.get_node_and(*pi, |rn| {
assert_eq!(n.address(), rn.address());
assert_eq!(n.parent_address(), rn.parent_address());
assert_eq!(n.singletons(), rn.singletons());
})
.unwrap();
})
}
} | rust_cleaned_test_functions.jsonl/76061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 875
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15376,
12411,
11663,
368,
341,
286,
1077,
821,
284,
7486,
20703,
15,
13,
19,
24,
24,
11,
220,
15,
13,
19,
24,
11,
220,
15,
13,
19,
23,
11,
481,
15,
13,
19,
24,
11,
220,
15,
13,
15,
935... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_values_mut() {
let mut a: BTreeMap<_, _> = (0..MIN_INSERTS_HEIGHT_2).map(|i| (i, i)).collect();
test_all_refs(&mut 13, a.values_mut());
a.check();
} | rust_cleaned_test_functions.jsonl/53930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9146,
29523,
368,
341,
262,
1077,
5206,
264,
25,
425,
6533,
2227,
27,
6878,
716,
29,
284,
320,
15,
496,
16413,
47924,
50,
17355,
62,
17,
568,
2186,
22428,
72,
91,
320,
72,
11,
600,
4579,
173... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_all_after_removal() {
let mut world = World::default();
world.insert(ImplementorA(3));
world.insert(ImplementorB(1));
let mut table = MetaTable::<dyn Object>::new();
table.register(&ImplementorA(125));
table.register(&ImplementorB(111_111));
{
let mut iter = table.iter(&world);
assert_eq!(iter.next().unwrap().method1(), 3);
assert_eq!(iter.next().unwrap().method1(), 1);
}
world.remove::<ImplementorA>().unwrap();
{
let mut iter = table.iter(&world);
assert_eq!(iter.next().unwrap().method1(), 1);
}
world.remove::<ImplementorB>().unwrap();
} | rust_cleaned_test_functions.jsonl/1291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
5705,
19844,
1288,
6355,
831,
368,
341,
286,
1077,
5206,
1879,
284,
4337,
486,
2258,
543,
286,
1879,
7030,
7,
62980,
269,
32,
7,
18,
1106,
286,
1879,
7030,
7,
62980,
269,
33,
7,
16,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_async_io_commit_without_leader_persist() {
let mut cluster = new_node_cluster(0, 3);
cluster.cfg.raft_store.cmd_batch_concurrent_ready_max_count = 0;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
let region = pd_client.get_region(b"k1").unwrap();
let peer_1 = find_peer(®ion, 1).cloned().unwrap();
cluster.must_put(b"k1", b"v1");
cluster.must_transfer_leader(region.get_id(), peer_1);
let raft_before_save_on_store_1_fp = "raft_before_save_on_store_1";
fail::cfg(raft_before_save_on_store_1_fp, "pause").unwrap();
for i in 2..10 {
cluster
.async_put(format!("k{}", i).as_bytes(), b"v1")
.unwrap();
}
must_get_equal(&cluster.get_engine(2), b"k9", b"v1");
must_get_equal(&cluster.get_engine(3), b"k9", b"v1");
must_get_none(&cluster.get_engine(1), b"k9");
fail::remove(raft_before_save_on_store_1_fp);
must_get_equal(&cluster.get_engine(3), b"k9", b"v1");
} | rust_cleaned_test_functions.jsonl/125818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
16939,
36346,
39904,
79991,
620,
4975,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
10652,
30481,
13,
2944,
14809,
25724,
14534,
3382,
3231,
35456,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_transaction() {
let options = sentry::ClientOptions {
traces_sample_rate: 1.0,
..Default::default()
};
let envelopes = sentry::test::with_captured_envelopes_options(
|| {
let ctx = sentry::TransactionContext::new("old name", "ye, whatever");
let trx = sentry::start_transaction(ctx);
let request = Request {
url: Some("https://honk.beep".parse().unwrap()),
method: Some("GET".to_string()),
..Request::default()
};
trx.set_request(request);
sentry::configure_scope(|scope| scope.set_span(Some(trx.clone().into())));
sentry::configure_scope(|scope| scope.set_transaction(Some("new name")));
trx.finish();
},
options,
);
assert_eq!(envelopes.len(), 1);
let envelope_item = envelopes[0].items().next().unwrap();
let transaction = match envelope_item {
sentry::protocol::EnvelopeItem::Transaction(t) => t,
_ => panic!("expected only a transaction item"),
};
assert_eq!(transaction.name.as_deref().unwrap(), "new name");
assert!(transaction.request.is_some());
} | rust_cleaned_test_functions.jsonl/50018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
28884,
368,
341,
262,
1077,
2606,
284,
3208,
884,
486,
2959,
3798,
341,
286,
34383,
17491,
9246,
25,
220,
16,
13,
15,
345,
286,
5241,
3675,
486,
2258,
741,
262,
3634,
262,
1077,
86606,
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... | 3 |
#[test]
fn test_zero_multiplier_warning() {
for arg in ["count", "seek", "skip"] {
new_ucmd!()
.args(&[format!("{}=0", arg).as_str(), "status=none"])
.pipe_in("")
.succeeds()
.no_stdout()
.no_stderr();
new_ucmd!()
.args(&[format!("{}=00x1", arg).as_str(), "status=none"])
.pipe_in("")
.succeeds()
.no_stdout()
.no_stderr();
new_ucmd!()
.args(&[format!("{}=0x1", arg).as_str(), "status=none"])
.pipe_in("")
.succeeds()
.no_stdout()
.stderr_contains("warning: '0x' is a zero multiplier; use '00x' if that is intended");
new_ucmd!()
.args(&[format!("{}=0x0x1", arg).as_str(), "status=none"])
.pipe_in("")
.succeeds()
.no_stdout()
.stderr_is("dd: warning: '0x' is a zero multiplier; use '00x' if that is intended\ndd: warning: '0x' is a zero multiplier; use '00x' if that is intended\n");
new_ucmd!()
.args(&[format!("{}=1x0x1", arg).as_str(), "status=none"])
.pipe_in("")
.succeeds()
.no_stdout()
.stderr_contains("warning: '0x' is a zero multiplier; use '00x' if that is intended");
}
} | rust_cleaned_test_functions.jsonl/99813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 766
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
51800,
38395,
368,
341,
262,
369,
1392,
304,
4383,
1830,
497,
330,
25713,
497,
330,
20599,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
2116,
2099,
58,
2243,
17223,
6257,
28,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_mint_to() {
let program_id = crate::id();
let account_key = Pubkey::new_unique();
let mut account_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let account2_key = Pubkey::new_unique();
let mut account2_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let account3_key = Pubkey::new_unique();
let mut account3_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let mismatch_key = Pubkey::new_unique();
let mut mismatch_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let owner_key = Pubkey::new_unique();
let mut owner_account = SolanaAccount::default();
let owner2_key = Pubkey::new_unique();
let mut owner2_account = SolanaAccount::default();
let mint_key = Pubkey::new_unique();
let mut mint_account =
SolanaAccount::new(mint_minimum_balance(), Mint::get_packed_len(), &program_id);
let mint2_key = Pubkey::new_unique();
let uninitialized_key = Pubkey::new_unique();
let mut uninitialized_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let mut rent_sysvar = rent_sysvar();
// create new mint with owner
do_process_instruction(
initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(),
vec![&mut mint_account, &mut rent_sysvar],
)
.unwrap();
// create account
do_process_instruction(
initialize_account(&program_id, &account_key, &mint_key, &owner_key).unwrap(),
vec![
&mut account_account,
&mut mint_account,
&mut owner_account,
&mut rent_sysvar,
],
)
.unwrap();
// create another account
do_process_instruction(
initialize_account(&program_id, &account2_key, &mint_key, &owner_key).unwrap(),
vec![
&mut account2_account,
&mut mint_account,
&mut owner_account,
&mut rent_sysvar,
],
)
.unwrap();
// create another account
do_process_instruction(
initialize_account(&program_id, &account3_key, &mint_key, &owner_key).unwrap(),
vec![
&mut account3_account,
&mut mint_account,
&mut owner_account,
&mut rent_sysvar,
],
)
.unwrap();
// create mismatch account
do_process_instruction(
initialize_account(&program_id, &mismatch_key, &mint_key, &owner_key).unwrap(),
vec![
&mut mismatch_account,
&mut mint_account,
&mut owner_account,
&mut rent_sysvar,
],
)
.unwrap();
let mut account = Account::unpack_unchecked(&mismatch_account.data).unwrap();
account.mint = mint2_key;
Account::pack(account, &mut mismatch_account.data).unwrap();
// mint to
do_process_instruction(
mint_to(&program_id, &mint_key, &account_key, &owner_key, &[], 42).unwrap(),
vec![&mut mint_account, &mut account_account, &mut owner_account],
)
.unwrap();
let mint = Mint::unpack_unchecked(&mint_account.data).unwrap();
assert_eq!(mint.supply, 42);
let account = Account::unpack_unchecked(&account_account.data).unwrap();
assert_eq!(account.amount, 42);
// mint to another account to test supply accumulation
do_process_instruction(
mint_to(&program_id, &mint_key, &account2_key, &owner_key, &[], 42).unwrap(),
vec![&mut mint_account, &mut account2_account, &mut owner_account],
)
.unwrap();
let mint = Mint::unpack_unchecked(&mint_account.data).unwrap();
assert_eq!(mint.supply, 84);
let account = Account::unpack_unchecked(&account2_account.data).unwrap();
assert_eq!(account.amount, 42);
// missing signer
let mut instruction =
mint_to(&program_id, &mint_key, &account2_key, &owner_key, &[], 42).unwrap();
instruction.accounts[2].is_signer = false;
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
do_process_instruction(
instruction,
vec![&mut mint_account, &mut account2_account, &mut owner_account],
)
);
// mismatch account
assert_eq!(
Err(TokenError::MintMismatch.into()),
do_process_instruction(
mint_to(&program_id, &mint_key, &mismatch_key, &owner_key, &[], 42).unwrap(),
vec![&mut mint_account, &mut mismatch_account, &mut owner_account],
)
);
// missing owner
assert_eq!(
Err(TokenError::OwnerMismatch.into()),
do_process_instruction(
mint_to(&program_id, &mint_key, &account2_key, &owner2_key, &[], 42).unwrap(),
vec![
&mut mint_account,
&mut account2_account,
&mut owner2_account,
],
)
);
// mint not owned by program
let not_program_id = Pubkey::new_unique();
mint_account.owner = not_program_id;
assert_eq!(
Err(ProgramError::IncorrectProgramId),
do_process_instruction(
mint_to(&program_id, &mint_key, &account_key, &owner_key, &[], 0).unwrap(),
vec![&mut mint_account, &mut account_account, &mut owner_account],
)
);
mint_account.owner = program_id;
// account not owned by program
let not_program_id = Pubkey::new_unique();
account_account.owner = not_program_id;
assert_eq!(
Err(ProgramError::IncorrectProgramId),
do_process_instruction(
mint_to(&program_id, &mint_key, &account_key, &owner_key, &[], 0).unwrap(),
vec![&mut mint_account, &mut account_account, &mut owner_account],
)
);
account_account.owner = program_id;
// uninitialized destination account
assert_eq!(
Err(ProgramError::UninitializedAccount),
do_process_instruction(
mint_to(
&program_id,
&mint_key,
&uninitialized_key,
&owner_key,
&[],
42
)
.unwrap(),
vec![
&mut mint_account,
&mut uninitialized_account,
&mut owner_account,
],
)
);
// unset mint_authority and test minting fails
do_process_instruction(
set_authority(
&program_id,
&mint_key,
None,
AuthorityType::MintTokens,
&owner_key,
&[],
)
.unwrap(),
vec![&mut mint_account, &mut owner_account],
)
.unwrap();
assert_eq!(
Err(TokenError::FixedSupply.into()),
do_process_instruction(
mint_to(&program_id, &mint_key, &account2_key, &owner_key, &[], 42).unwrap(),
vec![&mut mint_account, &mut account2_account, &mut owner_account],
)
);
} | rust_cleaned_test_functions.jsonl/64296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
2346,
368,
341,
286,
1077,
2025,
842,
284,
17717,
486,
307,
543,
286,
1077,
2692,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5206,
2692,
13500,
284,
11473,
3362,
7365,
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_mat_mult_identity() {
let mut mat1 = vec![vec![0.;3]; 3];
for i in 0..mat1.len() {
mat1[i][i] = 1.;
}
let mat2 = vec![vec![5.;3]; 3];
let result = mat_mult(&mat1, &mat2);
for i in 0..result.len() {
for j in 0..result[i].len() {
assert_eq!(result[i][j], mat2[i][j]);
}
}
} | rust_cleaned_test_functions.jsonl/21613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
26290,
46244,
368,
972,
262,
1077,
5206,
5517,
16,
284,
7486,
20703,
4083,
20703,
15,
15642,
18,
5265,
220,
18,
5960,
262,
369,
600,
304,
220,
15,
496,
8470,
16,
19406,
368,
972,
286,
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... | 4 |
#[test]
fn test_validate_membership_proofs_invalid_range_in_root_proof() {
let (tx, ledger) = create_test_tx();
let highest_indices = tx.get_membership_proof_highest_indices();
let mut root_proofs: Vec<TxOutMembershipProof> = adapt_hack(
&ledger
.get_tx_out_proof_of_memberships(&highest_indices)
.expect("failed getting proofs"),
);
// Modify a root proof to include an invalid Range.
let mut proof = root_proofs[0].clone();
let mut first_element = proof.elements[0].clone();
first_element.range = Range { from: 7, to: 3 };
proof.elements[0] = first_element;
root_proofs[0] = proof;
assert_eq!(
validate_membership_proofs(&tx.prefix, &root_proofs),
Err(TransactionValidationError::MembershipProofValidationError)
);
} | rust_cleaned_test_functions.jsonl/78551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
84635,
2540,
36081,
31433,
9698,
1243,
12993,
86757,
368,
341,
286,
1077,
320,
3998,
11,
46933,
8,
284,
1855,
4452,
17805,
1428,
286,
1077,
8426,
18333,
284,
9854,
670,
84635,
86757,
1523,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_module_3() {
let (_temp_dir, deno_dir) = test_setup();
let module_specifier_ =
deno_dir.deps.join("unpkg.com/liltest@0.0.5/index.ts");
let module_specifier = module_specifier_.to_str().unwrap();
let containing_file = ".";
let expected_module_name = "http://unpkg.com/liltest@0.0.5/index.ts";
let expected_filename = deno_fs::normalize_path(
deno_dir
.deps
.join("unpkg.com/liltest@0.0.5/index.ts")
.as_ref(),
);
let (module_name, filename) = deno_dir
.resolve_module(module_specifier, containing_file)
.unwrap();
assert_eq!(module_name, expected_module_name);
assert_eq!(filename, expected_filename);
} | rust_cleaned_test_functions.jsonl/42046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10750,
62,
18,
368,
341,
220,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
220,
1077,
4688,
13594,
3049,
62,
4035,
262,
3371,
78,
4334,
2285,
1690,
5446,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tautology() {
let a = VarRef::from(0usize);
let b = VarRef::from(1usize);
assert!(Disjunction::new(vec![leq(a, 0), !leq(a, 0)]).is_tautology());
// a <= 0 || a > -1
// a <= -1
assert!(Disjunction::new(vec![leq(a, 0), geq(a, 0)]).is_tautology());
assert!(Disjunction::new(vec![leq(a, 0), geq(a, 1)]).is_tautology());
assert!(Disjunction::new(vec![leq(a, 0), leq(b, 0), geq(b, 2), !leq(a, 0)]).is_tautology());
} | rust_cleaned_test_functions.jsonl/81398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2717,
2449,
368,
341,
286,
1077,
264,
284,
8735,
3945,
486,
1499,
7,
15,
51878,
317,
286,
1077,
293,
284,
8735,
3945,
486,
1499,
7,
16,
51878,
626,
286,
2060,
10297,
4839,
72428,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_data_buffer() {
let mut buf = super::DataBuffer::new();
assert_eq!(buf.add_struct(&(0u8, false)), super::DataPointer(0, 2));
assert_eq!(buf.add_vec(&[5i32, 6i32]), super::DataPointer(2, 8));
} | rust_cleaned_test_functions.jsonl/119599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
7776,
368,
341,
286,
1077,
5206,
6607,
284,
2256,
486,
1043,
4095,
486,
931,
543,
286,
2060,
10714,
10297,
5909,
1364,
15126,
29089,
15,
84,
23,
11,
895,
5731,
2256,
486,
1043,
9084,
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_get() {
#[rustfmt::skip]
let mut buf = Bytes::from_static(&[
0x26, 4, 4, 1, 0, 0, 0, 0xfe, 0, 0, 0xe0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]);
let type_info = TypeInfo::get(&mut buf).unwrap();
assert_eq!(type_info, TypeInfo::new(DataType::IntN, 4));
} | rust_cleaned_test_functions.jsonl/50212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
262,
11506,
35788,
12501,
486,
20599,
921,
262,
1077,
5206,
6607,
284,
30024,
486,
1499,
25360,
2099,
9640,
286,
220,
15,
87,
17,
21,
11,
220,
19,
11,
220,
19,
11,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_bit() {
use crate::consts::*;
use crate::Same;
type T1 = <GetBitOut<U2, U0> as Same<B0>>::Output;
type T2 = <GetBitOut<U2, U1> as Same<B1>>::Output;
type T3 = <GetBitOut<U2, U2> as Same<B0>>::Output;
<T1 as Bit>::to_bool();
<T2 as Bit>::to_bool();
<T3 as Bit>::to_bool();
} | rust_cleaned_test_functions.jsonl/116641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
13996,
368,
341,
262,
990,
17717,
486,
95773,
56162,
262,
990,
17717,
486,
19198,
280,
262,
943,
350,
16,
284,
366,
1949,
8344,
2662,
36397,
17,
11,
547,
15,
29,
438,
25739,
32519,
15,
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_json_codec_sorted() -> Result<()> {
let seed = literal!({ "snot": "badger" });
let mut codec = Json::<Sorted>::default();
let mut as_raw = codec.encode(&seed)?;
let as_json = codec.decode(as_raw.as_mut_slice(), 0);
let _ = dbg!(as_json);
Ok(())
} | rust_cleaned_test_functions.jsonl/81986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
51084,
41277,
368,
1464,
5714,
71698,
341,
286,
1077,
10320,
284,
23141,
0,
2306,
330,
82,
1921,
788,
330,
13855,
1389,
1,
3011,
286,
1077,
5206,
34647,
284,
8308,
27638,
51051,
6831,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_into_iter_drops() {
DROP_VECTOR.with(|v| {
*v.borrow_mut() = vec![0; 200];
});
let hm = {
let mut hm = HashMap::new();
DROP_VECTOR.with(|v| {
for i in 0..200 {
assert_eq!(v.borrow()[i], 0);
}
});
for i in 0..100 {
let d1 = Droppable::new(i);
let d2 = Droppable::new(i + 100);
hm.insert(d1, d2);
}
DROP_VECTOR.with(|v| {
for i in 0..200 {
assert_eq!(v.borrow()[i], 1);
}
});
hm
};
drop(hm.clone());
{
let mut half = hm.into_iter().take(50);
DROP_VECTOR.with(|v| {
for i in 0..200 {
assert_eq!(v.borrow()[i], 1);
}
});
for _ in half.by_ref() {}
DROP_VECTOR.with(|v| {
let nk = (0..100).filter(|&i| v.borrow()[i] == 1).count();
let nv = (0..100).filter(|&i| v.borrow()[i + 100] == 1).count();
assert_eq!(nk, 50);
assert_eq!(nv, 50);
});
};
DROP_VECTOR.with(|v| {
for i in 0..200 {
assert_eq!(v.borrow()[i], 0);
}
});
} | rust_cleaned_test_functions.jsonl/8498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 960
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
11723,
814,
3702,
368,
341,
286,
56942,
47993,
18164,
22428,
85,
91,
341,
310,
353,
85,
83640,
29523,
368,
284,
7486,
20703,
15,
26,
220,
17,
15,
15,
935,
286,
3011,
286,
1077,
49362,
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... | 7 |
#[test]
fn test_clone_into() {
let mut path_buf = PathBuf::from("supercalifragilisticexpialidocious");
let path = Path::new("short");
path.clone_into(&mut path_buf);
assert_eq!(path, path_buf);
assert!(path_buf.into_os_string().capacity() >= 15);
} | rust_cleaned_test_functions.jsonl/19661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
45514,
368,
341,
286,
1077,
5206,
1815,
10363,
284,
7933,
15064,
486,
1499,
445,
12776,
2962,
278,
333,
4101,
321,
4532,
4580,
530,
307,
77187,
797,
286,
1077,
1815,
284,
7933,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_cycle() {
let _guard = MUTEX.lock().unwrap();
async fn task(usb_in: UsbIn) -> UsbOut {
assert_eq!(usb_in, [1, 2, 3].to_vec());
[4, 5, 6, 7].to_vec()
}
fn assert_spawn_fails() {
assert_panics(|| spawn(task, &[1, 2, 3]));
}
// repeated task processing ok
for _ in 0..3 {
let mut response = [0; 100];
assert_eq!(
Err(CopyResponseErr::NotRunning),
copy_response(&mut response)
);
spawn(task, &[1, 2, 3]);
// Can't spawn: task already running.
assert_spawn_fails();
assert_eq!(Err(CopyResponseErr::NotReady), copy_response(&mut response));
spin();
// Can't spawn: result not fetched yet
assert_spawn_fails();
// Response buffer too short.
assert_panics(move || {
let _ = copy_response(&mut response[..1]);
});
assert_eq!(Ok(4), copy_response(&mut response));
// Response ok.
assert_eq!(&response[..4], &[4, 5, 6, 7]);
}
} | rust_cleaned_test_functions.jsonl/97882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 666
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
39079,
368,
341,
286,
1077,
716,
26098,
284,
87420,
3257,
21003,
1005,
15454,
1428,
286,
3312,
5168,
3383,
7,
24343,
1243,
25,
3985,
65,
641,
8,
1464,
3985,
65,
2662,
341,
310,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_literal() {
parse_macro(
r#"
macro_rules! foo {
($ type:ty , $ lit:literal) => { const VALUE: $ type = $ lit;};
}
"#,
)
.assert_expand_items(r#"foo!(u8,0);"#, r#"const VALUE : u8 = 0 ;"#);
parse_macro(
r#"
macro_rules! foo {
($ type:ty , $ lit:literal) => { const VALUE: $ type = $ lit;};
}
"#,
)
.assert_expand_items(r#"foo!(i32,-1);"#, r#"const VALUE : i32 = - 1 ;"#);
} | rust_cleaned_test_functions.jsonl/28755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34100,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
1060,
1711,
943,
25,
1881,
1154,
400,
13020,
25,
35785,
8,
589,
314,
733,
26827,
25,
400,
943,
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_parse_large_value() {
let value = vec![b'x'; 1025];
let mut data = b"First: ".to_vec();
data.extend(&value);
let resource = (Binding::Tight, Component::Normal("First".to_string()));
run_entry_test(&data, &[resource], &value);
} | rust_cleaned_test_functions.jsonl/113431 | {
"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,
21039,
45228,
3142,
368,
341,
286,
1077,
897,
284,
7486,
20703,
65,
6,
87,
6967,
220,
16,
15,
17,
20,
935,
286,
1077,
5206,
821,
284,
293,
1,
5338,
25,
5933,
983,
13251,
543,
286,
821,
15831... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_in_valid_blank() {
let params = Map::new();
let mut rules = BTreeMap::new();
rules.insert("in",
vec![Rule::NotIn(vec![Value::String("2".into()), Value::U64(1)])]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["in"]), None);
} | rust_cleaned_test_functions.jsonl/104860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
1243,
8337,
56103,
368,
341,
262,
1077,
3628,
284,
5027,
486,
931,
1428,
262,
1077,
5206,
5601,
284,
425,
6533,
2227,
486,
931,
543,
262,
5601,
7030,
445,
258,
756,
338,
7486,
20703,
11337... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_custom_encoding_format0() {
let data_format0 = [0, 3, 4, 5, 6];
let mut ctxt = ReadScope::new(&data_format0).ctxt();
let format0_encoding = ctxt.read::<CustomEncoding<'_>>().unwrap();
match format0_encoding {
CustomEncoding::Format0 { codes } => {
assert_eq!(codes.iter().collect_vec(), vec![4, 5, 6])
}
_ => panic!("expected CustomEncoding::Format0 got something else"),
}
} | rust_cleaned_test_functions.jsonl/85335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
15875,
37613,
8955,
15,
368,
341,
286,
1077,
821,
8955,
15,
284,
508,
15,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
286,
1077,
5206,
59162,
284,
4457,
10803,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_calculate_comparisons() {
assert_eq!(calculate_comparisons(vec![(2, 2), (2, 2), (2, 0)]), 22);
} | rust_cleaned_test_functions.jsonl/81352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
2965,
1732,
19379,
368,
341,
286,
2060,
10714,
10297,
35597,
2965,
1732,
19379,
25592,
0,
9697,
17,
11,
220,
17,
701,
320,
17,
11,
220,
17,
701,
320,
17,
11,
220,
15,
7252,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_insert_with_name_literal_2() {
let mut encoder = connect(false);
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// test the change capacity instruction.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
// insert "content-length: 1234
let res =
encoder
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
} | rust_cleaned_test_functions.jsonl/18408 | {
"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,
17678,
6615,
1269,
34100,
62,
17,
368,
341,
286,
1077,
5206,
23668,
284,
4564,
3576,
626,
286,
2060,
10297,
27008,
69042,
980,
6345,
35603,
7,
17,
15,
15,
568,
285,
19817,
1423,
286,
442,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.