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_is_mate_with_partial_state_and_old_banmen_and_opponent_move_sente() {
let mate_mvs:Vec<Move> = vec![
Move::Put(MochigomaKind::Kyou,KomaDstPutPosition(9-4,8+1)),
Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-4,1+1)),
Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-4,2+1)),
Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-4,1+1)),
];
let mvs:Vec<Move> = vec![
Move::Put(MochigomaKind::Fu,KomaDstPutPosition(9-4,1+1)),
Move::To(KomaSrcPosition(9-5,0+1),KomaDstToPosition(9-4,1+1,false)),
Move::To(KomaSrcPosition(9-3,0+1),KomaDstToPosition(9-3,1+1,false)),
Move::To(KomaSrcPosition(9-3,0+1),KomaDstToPosition(9-3,1+1,false))
];
let answer:Vec<bool> = vec![
false,
false,
false,
true
];
let mut banmen = Banmen([[Blank; 9]; 9]);
banmen.0[0][3] = GKin;
banmen.0[0][4] = GOu;
banmen.0[0][5] = GKin;
for ((m,answer),mm) in mvs.iter().zip(&answer).zip(&mate_mvs) {
let mut state = State::new(banmen.clone());
let mut ms:HashMap<MochigomaKind,u32> = HashMap::new();
let mg:HashMap<MochigomaKind,u32> = HashMap::new();
ms.insert(MochigomaKind::Fu, 1);
let mut mc = MochigomaCollections::Pair(ms,mg);
match Rule::apply_move_none_check(&state,Teban::Sente,&mc,mm.to_applied_move()) {
(next,nmc,_) => {
state = next;
mc = nmc;
}
}
let ps = Rule::apply_move_to_partial_state_none_check(&state,Teban::Gote,&mc,m.to_applied_move());
assert_eq!(*answer,
Rule::is_mate_with_partial_state_and_old_banmen_and_opponent_move(
Teban::Sente,state.get_banmen(),&ps,m.to_applied_move()));
}
} | rust_cleaned_test_functions.jsonl/72990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 840
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
717,
349,
6615,
52068,
4387,
8378,
21108,
880,
276,
5676,
8378,
10287,
1146,
17134,
643,
6817,
368,
972,
10217,
29176,
717,
11562,
25,
10050,
27,
9860,
29,
284,
7486,
20703,
319,
197,
9209,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_construct_subtree_at_bottom_found_leaf_node() {
// root root
// o o o o
// o existing_key => o subtree
// y placeholder
// x placeholder
// existing_key new_key
let existing_key = b"world".test_only_hash();
let existing_blob = AccountStateBlob::from(b"world".to_vec());
let existing_blob_hash = existing_blob.hash();
let new_key = b"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".test_only_hash();
let new_blob = AccountStateBlob::from(b"new_blob!!!!!".to_vec());
assert_eq!(existing_key[0], 0b0100_0010);
assert_eq!(new_key[0], 0b0100_1011);
let current_node = Arc::new(SparseMerkleNode::new_leaf(
existing_key,
LeafValue::BlobHash(existing_blob_hash),
));
let remaining_bits = {
let mut iter = new_key.iter_bits();
iter.next();
iter.next();
iter
};
let leaf = Some((existing_key, existing_blob_hash));
let siblings: Vec<_> = (0..2)
.map(|x| HashValue::new([x; HashValue::LENGTH]))
.collect();
let proof = SparseMerkleProof::new(leaf, siblings);
let proof_reader = ProofReader::new(vec![(new_key, proof)]);
let subtree = SparseMerkleTree::construct_subtree_at_bottom(
current_node,
new_key,
new_blob.clone(),
remaining_bits,
&proof_reader,
)
.unwrap();
let smt = SparseMerkleTree { root: subtree };
let existing_leaf_hash = hash_leaf(existing_key, existing_blob_hash);
let new_blob_hash = new_blob.hash();
let new_leaf_hash = hash_leaf(new_key, new_blob_hash);
let x_hash = hash_internal(existing_leaf_hash, new_leaf_hash);
let y_hash = hash_internal(x_hash, *SPARSE_MERKLE_PLACEHOLDER_HASH);
let root_hash = hash_internal(y_hash, *SPARSE_MERKLE_PLACEHOLDER_HASH);
assert_eq!(smt.root_hash(), root_hash);
} | rust_cleaned_test_functions.jsonl/15416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1021
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
5228,
9344,
3752,
25473,
21480,
38909,
5084,
368,
341,
262,
442,
286,
3704,
5968,
3704,
7213,
262,
442,
414,
297,
414,
297,
5180,
297,
414,
297,
7213,
262,
442,
262,
297,
256,
6350,
3097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_sized_no_alloc() {
let arena = TypedArena::default();
for _ in 0..5000 {
arena.alloc(());
}
assert!(arena.chunks.borrow().is_empty());
} | rust_cleaned_test_functions.jsonl/12324 | {
"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,
19359,
643,
1506,
6536,
14802,
368,
341,
262,
1077,
24902,
284,
50554,
93937,
486,
2258,
543,
262,
369,
716,
304,
220,
15,
496,
20,
15,
15,
15,
341,
414,
24902,
78224,
7,
1423,
262,
456,
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
] | 2 |
#[test]
fn test_none_or_up_to_none_large() {
let occurence: Occurences<u32> = Occurences::NoneOrUpTo(None);
occurence.check_count(u32::MAX).unwrap();
} | rust_cleaned_test_functions.jsonl/4442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31488,
8734,
8237,
2346,
31488,
45228,
368,
341,
286,
1077,
2983,
86937,
25,
19927,
552,
98162,
34837,
18,
17,
29,
284,
19927,
552,
98162,
486,
4064,
2195,
2324,
1249,
26717,
317,
286,
2983,
86937... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ex1() {
assert_eq!(
(25, 286),
Solver::run_on(
"
F10
N3
F7
R90
F11
"
)
);
} | rust_cleaned_test_functions.jsonl/110349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
16,
368,
341,
286,
2060,
10714,
33673,
310,
320,
17,
20,
11,
220,
17,
23,
21,
1326,
310,
68295,
486,
6108,
4470,
1006,
394,
6228,
286,
434,
16,
15,
198,
286,
451,
18,
198,
286,
434,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_withdraw_ix_no_acc_data_fail() {
assert_eq!(
process_nonce_instruction(&system_instruction::withdraw_nonce_account(
&Pubkey::default(),
&Pubkey::default(),
&Pubkey::default(),
1,
)),
Err(InstructionError::InvalidAccountData),
);
} | rust_cleaned_test_functions.jsonl/73064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
6615,
7633,
62686,
6536,
17737,
1769,
22121,
368,
341,
286,
2060,
10714,
33673,
310,
1882,
48508,
54923,
2099,
8948,
54923,
486,
62446,
48508,
13500,
1006,
394,
609,
29162,
792,
486,
2258,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aff_proj_sidh() {
fn aux(a_sk: MyASc) {
let a_sk = a_sk.0;
let e = (a(), b());
let ab = (paxy(), qaxy());
let bb = (pbxy(), qbxy());
let pab = (xpa(), xqa(), xra());
let pbb = (xpb(), xqb(), xrb());
let a_steps = 4; // EA/2;
let ap_steps = 2; // EA;
let (aff_e, ((_, _), (_, _))) = a_sidh_isogen(a_sk, e, ab, bb, a_steps);
let (x_p, x_q, x_r) = a_keygen(pbb, pab, a(), a24plus(), c24(), a_sk, ap_steps);
let a = get_a(x_p, x_q, x_r);
let jinv = j_inv((a, fp2zero())); // note that the j-invariant does not depend on b
let aff_jinv = j_inv(aff_e);
assert_eq!(jinv,aff_jinv);
}
QuickCheck::new()
.tests(1)
.quickcheck(aux as fn(MyASc));
} | rust_cleaned_test_functions.jsonl/11578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
49453,
53044,
71,
368,
341,
262,
5168,
10047,
2877,
33811,
25,
3017,
1911,
66,
8,
341,
10217,
264,
33811,
284,
264,
33811,
13,
15,
280,
10217,
384,
284,
320,
64,
1507,
293,
1423,
10217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lps() {
let pattern = b"ababaca";
let lps = lps(pattern);
assert_eq!(lps, [0, 0, 1, 2, 3, 0, 1]);
} | rust_cleaned_test_functions.jsonl/12993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
1690,
368,
341,
286,
1077,
5383,
284,
293,
1,
370,
370,
17106,
876,
286,
1077,
326,
1690,
284,
326,
1690,
30948,
317,
286,
2060,
10714,
10297,
75,
1690,
11,
508,
15,
11,
220,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find() {
let category = CategoryBuilder::<(), (), (), &str>::new()
.object("A", vec![], ())
.object("B", vec![], ())
.object("AxB", vec![ObjectTag::Product("A", "B")], ())
.morphism("p1", "AxB", "A", vec![], ())
.morphism("p2", "AxB", "B", vec![], ())
.morphism("id", "AxB", "AxB", vec![MorphismTag::Identity("AxB")], ())
.build();
let constraints = ConstraintsBuilder::<&str>::new()
.object("A", vec![])
.object("B", vec![])
.object("AxB", vec![ObjectTag::Product("A", "B")])
.morphism("p1", "AxB", "A", vec![])
.morphism("p2", "AxB", "B", vec![])
.object("C", vec![])
.morphism("f", "C", "A", vec![])
.morphism("g", "C", "B", vec![])
.morphism("m", "C", "AxB", vec![])
.equality(vec!["m", "p1"], vec!["f"])
.equality(vec!["m", "p2"], vec!["g"])
.build();
let candidates = category
.find_candidates(&constraints, &Bindings::new())
.unwrap()
.collect::<Vec<_>>();
println!("Candidates for:");
println!(" {constraints:?}");
println!("are:");
for (i, candidate) in candidates.iter().enumerate() {
println!("{i:4}) {candidate:?}");
}
assert_eq!(candidates.len(), 1);
} | rust_cleaned_test_functions.jsonl/0 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
262,
1077,
5582,
284,
10054,
3297,
27638,
1507,
38104,
38104,
609,
495,
6831,
931,
741,
286,
659,
1700,
445,
32,
497,
7486,
0,
12995,
58389,
286,
659,
1700,
445,
33,
497,
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... | 2 |
#[test]
fn test_code_blocks_in_comments_marked_as_rust() {
let comment = r#"```rust
fn main(){}
```
Some comment.
```
let a = 1;
```"#;
assert_eq!(
format_docs(comment),
"```rust\nfn main(){}\n```\nSome comment.\n```rust\nlet a = 1;\n```"
);
} | rust_cleaned_test_functions.jsonl/57092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
25201,
1243,
30359,
18924,
291,
11898,
1710,
590,
368,
341,
286,
1077,
3980,
284,
435,
55543,
73594,
35788,
198,
8822,
1887,
68379,
13874,
3989,
8373,
3980,
624,
13874,
3989,
1149,
264,
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_eval_list_pattern_matching() {
let source_code = "let a = 1 :: 2 :: 3 :: 4 :: 5 :: [] in let rec len x = match x with | [] -> 0 | head::tail -> 1 + len tail in len a;;";
let result = interpret(source_code, false, false);
assert_eq!(result, vec![ExprVal::I64(5)],);
} | rust_cleaned_test_functions.jsonl/41120 | {
"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,
21296,
2019,
21260,
70763,
368,
341,
286,
1077,
2530,
4136,
284,
330,
1149,
264,
284,
220,
16,
3504,
220,
17,
3504,
220,
18,
3504,
220,
19,
3504,
220,
20,
3504,
3056,
304,
1077,
1395,
2422,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bans() {
let route = Route::GetBans { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("guilds/{guild_id}/bans", guild_id = GUILD_ID)
);
} | rust_cleaned_test_functions.jsonl/119920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
880,
596,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
33,
596,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
3148,
310,
3561,
17223,
578... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_config() {
let msg = InstantiateMsg {
owner: h(OWNER),
nebula_token: h(NEB_TOKEN),
};
let info = mock_info(OWNER, &[]);
let mut deps = mock_dependencies(&[]);
let _res = instantiate(deps.as_mut(), mock_env(), info, msg)
.expect("contract successfully executes InstantiateMsg");
let info = mock_info("random", &[]);
let msg = ExecuteMsg::UpdateConfig {
owner: h("owner0001"),
};
let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap_err();
assert_eq!(res, ContractError::Unauthorized {});
let info = mock_info(OWNER, &[]);
let msg = ExecuteMsg::UpdateConfig {
owner: h("owner0001"),
};
let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
assert_eq!(0, res.messages.len());
let owner = read_owner(deps.as_mut().storage).unwrap();
assert_eq!(owner, h("owner0001"));
assert_eq!(
res.attributes,
vec![
attr("action", "update_config"),
attr("old_owner", OWNER),
attr("new_owner", "owner0001")
]
);
} | rust_cleaned_test_functions.jsonl/76315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5332,
368,
341,
262,
1077,
3750,
284,
32288,
6611,
341,
286,
6372,
25,
305,
7,
99031,
1326,
286,
80867,
5607,
6458,
25,
305,
7,
3944,
33,
18681,
1326,
262,
3634,
262,
1077,
3546,
284,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_seal_fr32_validation() {
let convertible_to_fr_bytes = [0; 32];
let out = bytes_into_fr(&convertible_to_fr_bytes);
assert!(out.is_ok(), "tripwire");
let not_convertible_to_fr_bytes = [255; 32];
let out = bytes_into_fr(¬_convertible_to_fr_bytes);
assert!(out.is_err(), "tripwire");
let arbitrary_porep_id = [87; 32];
{
let result = verify_seal::<DefaultOctLCTree>(
PoRepConfig {
sector_size: SectorSize(SECTOR_SIZE_2_KIB),
partitions: PoRepProofPartitions(
*POREP_PARTITIONS
.read()
.expect("POREP_PARTITIONS poisoned")
.get(&SECTOR_SIZE_2_KIB)
.expect("unknown sector size"),
),
porep_id: arbitrary_porep_id,
api_version: ApiVersion::V1_1_0,
},
not_convertible_to_fr_bytes,
convertible_to_fr_bytes,
[0; 32],
SectorId::from(0),
[0; 32],
[0; 32],
&[],
);
if let Err(err) = result {
let needle = "Invalid all zero commitment";
let haystack = format!("{}", err);
assert!(
haystack.contains(needle),
format!("\"{}\" did not contain \"{}\"", haystack, needle)
);
} else {
panic!("should have failed comm_r to Fr32 conversion");
}
}
{
let result = verify_seal::<DefaultOctLCTree>(
PoRepConfig {
sector_size: SectorSize(SECTOR_SIZE_2_KIB),
partitions: PoRepProofPartitions(
*POREP_PARTITIONS
.read()
.expect("POREP_PARTITIONS poisoned")
.get(&SECTOR_SIZE_2_KIB)
.expect("unknown sector size"),
),
porep_id: arbitrary_porep_id,
api_version: ApiVersion::V1_1_0,
},
convertible_to_fr_bytes,
not_convertible_to_fr_bytes,
[0; 32],
SectorId::from(0),
[0; 32],
[0; 32],
&[],
);
if let Err(err) = result {
let needle = "Invalid all zero commitment";
let haystack = format!("{}", err);
assert!(
haystack.contains(needle),
format!("\"{}\" did not contain \"{}\"", haystack, needle)
);
} else {
panic!("should have failed comm_d to Fr32 conversion");
}
}
} | rust_cleaned_test_functions.jsonl/58645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
3453,
278,
41537,
18,
17,
19416,
368,
341,
262,
1077,
67613,
2346,
41537,
12524,
284,
508,
15,
26,
220,
18,
17,
935,
262,
1077,
700,
284,
5820,
45514,
41537,
2099,
14166,
1238,
2346,
4153... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_urlencoded() {
let req = TestRequest::with_header(
header::CONTENT_TYPE,
"application/x-www-form-urlencoded",
)
.header(header::CONTENT_LENGTH, "11")
.set_payload(Bytes::from_static(b"hello=world"))
.finish();
let result = req.urlencoded::<Info>().poll().ok().unwrap();
assert_eq!(
result,
Async::Ready(Info {
hello: "world".to_owned()
})
);
let req = TestRequest::with_header(
header::CONTENT_TYPE,
"application/x-www-form-urlencoded; charset=utf-8",
)
.header(header::CONTENT_LENGTH, "11")
.set_payload(Bytes::from_static(b"hello=world"))
.finish();
let result = req.urlencoded().poll().ok().unwrap();
assert_eq!(
result,
Async::Ready(Info {
hello: "world".to_owned()
})
);
} | rust_cleaned_test_functions.jsonl/7654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
19329,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
4197,
8757,
1006,
310,
4247,
486,
67872,
4189,
345,
310,
330,
5132,
10776,
41242,
8460,
44557,
756,
286,
1727,
286,
659,
2708,
25534,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoder_invalid_boundary() {
let mut d = GB18030Encoding.decoder();
assert_feed_ok!(d, [], [0xe3], "");
assert_feed_err!(d, [], [], [0x32, 0x9a, 0x36], "");
assert_finish_ok!(d, "");
let mut d = GB18030Encoding.decoder();
assert_feed_ok!(d, [], [0xe3], "");
assert_feed_ok!(d, [], [0x32, 0x9a], "");
assert_feed_err!(d, -2, [], [], [0x32, 0x9a, 0x36], "");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/48116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
31433,
54004,
368,
341,
73363,
286,
1077,
5206,
294,
284,
18865,
16,
23,
15,
18,
15,
14690,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
10071,
508,
15,
8371,
18,
1125,
14498,
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_gc_userdata() -> Result<()> {
struct MyUserdata {
id: u8,
}
impl UserData for MyUserdata {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
methods.add_method("access", |_, this, ()| {
assert!(this.id == 123);
Ok(())
});
}
}
let lua = Lua::new();
lua.globals().set("userdata", MyUserdata { id: 123 })?;
assert!(lua
.load(
r#"
local tbl = setmetatable({
userdata = userdata
}, { __gc = function(self)
-- resurrect userdata
hatch = self.userdata
end })
tbl = nil
userdata = nil -- make table and userdata collectable
collectgarbage("collect")
hatch:access()
"#
)
.exec()
.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/40495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49423,
59315,
368,
1464,
5714,
71698,
341,
262,
2036,
3017,
1474,
691,
341,
286,
877,
25,
575,
23,
345,
262,
555,
262,
11605,
71294,
369,
3017,
1474,
691,
341,
286,
5168,
912,
36084,
18291,
2762... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec3mask_from() {
assert_eq!(
Into::<[u32; 3]>::into(Vec3Mask::new(false, false, false)),
[0, 0, 0]
);
assert_eq!(
Into::<[u32; 3]>::into(Vec3Mask::new(true, false, false)),
[!0, 0, 0]
);
assert_eq!(
Into::<[u32; 3]>::into(Vec3Mask::new(false, true, true)),
[0, !0, !0]
);
assert_eq!(
Into::<[u32; 3]>::into(Vec3Mask::new(false, true, false)),
[0, !0, 0]
);
assert_eq!(
Into::<[u32; 3]>::into(Vec3Mask::new(true, false, true)),
[!0, 0, !0]
);
assert_eq!(
Into::<[u32; 3]>::into(Vec3Mask::new(true, true, true)),
[!0, !0, !0]
);
} | rust_cleaned_test_functions.jsonl/75043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
11258,
5673,
368,
341,
262,
2060,
10714,
33673,
286,
31645,
27638,
58,
84,
18,
17,
26,
220,
18,
60,
6831,
18122,
49923,
18,
12686,
486,
931,
3576,
11,
895,
11,
895,
6965,
286,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_keys() {
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
let map: HashMap<_, _> = vec.into_iter().collect();
let keys: Vec<_> = map.into_keys().collect();
assert_eq!(keys.len(), 3);
assert!(keys.contains(&1));
assert!(keys.contains(&2));
assert!(keys.contains(&3));
} | rust_cleaned_test_functions.jsonl/26954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
12631,
368,
341,
286,
1077,
7486,
284,
7486,
0,
9697,
16,
11,
364,
64,
4567,
320,
17,
11,
364,
65,
4567,
320,
18,
11,
364,
66,
863,
935,
286,
1077,
2415,
25,
10528,
27,
6878,
716,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_char() {
let mut data = String::from_str("ประเทศไทย中");
data.push_char('华');
data.push_char('b'); // 1 byte
data.push_char('¢'); // 2 byte
data.push_char('€'); // 3 byte
data.push_char('𤭢'); // 4 byte
assert_eq!slice(), "ประเทศไทย中华b¢€𤭢");
} | rust_cleaned_test_functions.jsonl/113364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
9232,
368,
341,
286,
1077,
5206,
821,
284,
923,
486,
1499,
2895,
445,
130391,
15946,
797,
286,
821,
2552,
9232,
492,
85361,
1157,
286,
821,
2552,
9232,
492,
65,
4667,
442,
220,
16,
4922,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_to_vmm_config() {
// No mmds config.
{
let kernel_file = TempFile::new().unwrap();
let rootfs_file = TempFile::new().unwrap();
let json = format!(
r#"{{
"balloon": {{
"amount_mib": 0,
"deflate_on_oom": false,
"stats_polling_interval_s": 0
}},
"boot-source": {{
"kernel_image_path": "{}",
"boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
}},
"drives": [
{{
"drive_id": "rootfs",
"path_on_host": "{}",
"is_root_device": true,
"is_read_only": false
}}
],
"network-interfaces": [
{{
"iface_id": "netif1",
"host_dev_name": "hostname9"
}},
{{
"iface_id": "netif2",
"host_dev_name": "hostname10"
}}
],
"machine-config": {{
"vcpu_count": 2,
"mem_size_mib": 1024,
"smt": false
}}
}}"#,
kernel_file.as_path().to_str().unwrap(),
rootfs_file.as_path().to_str().unwrap(),
);
let resources =
VmResources::from_json(json.as_str(), &InstanceInfo::default(), None, None)
.unwrap();
let initial_vmm_config = serde_json::from_slice::<VmmConfig>(json.as_bytes()).unwrap();
let vmm_config: VmmConfig = (&resources).into();
assert_eq!(initial_vmm_config, vmm_config);
}
// Single interface for MMDS.
{
let kernel_file = TempFile::new().unwrap();
let rootfs_file = TempFile::new().unwrap();
let json = format!(
r#"{{
"balloon": {{
"amount_mib": 0,
"deflate_on_oom": false,
"stats_polling_interval_s": 0
}},
"boot-source": {{
"kernel_image_path": "{}",
"boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
}},
"drives": [
{{
"drive_id": "rootfs",
"path_on_host": "{}",
"is_root_device": true,
"is_read_only": false
}}
],
"network-interfaces": [
{{
"iface_id": "netif1",
"host_dev_name": "hostname9"
}},
{{
"iface_id": "netif2",
"host_dev_name": "hostname10"
}}
],
"machine-config": {{
"vcpu_count": 2,
"mem_size_mib": 1024,
"smt": false
}},
"mmds-config": {{
"network_interfaces": ["netif1"],
"ipv4_address": "169.254.1.1"
}}
}}"#,
kernel_file.as_path().to_str().unwrap(),
rootfs_file.as_path().to_str().unwrap(),
);
let resources =
VmResources::from_json(json.as_str(), &InstanceInfo::default(), None, None)
.unwrap();
let initial_vmm_config = serde_json::from_slice::<VmmConfig>(json.as_bytes()).unwrap();
let vmm_config: VmmConfig = (&resources).into();
assert_eq!(initial_vmm_config, vmm_config);
}
// Multiple interfaces configured for MMDS.
{
let kernel_file = TempFile::new().unwrap();
let rootfs_file = TempFile::new().unwrap();
let json = format!(
r#"{{
"balloon": {{
"amount_mib": 0,
"deflate_on_oom": false,
"stats_polling_interval_s": 0
}},
"boot-source": {{
"kernel_image_path": "{}",
"boot_args": "console=ttyS0 reboot=k panic=1 pci=off"
}},
"drives": [
{{
"drive_id": "rootfs",
"path_on_host": "{}",
"is_root_device": true,
"is_read_only": false
}}
],
"network-interfaces": [
{{
"iface_id": "netif1",
"host_dev_name": "hostname9"
}},
{{
"iface_id": "netif2",
"host_dev_name": "hostname10"
}}
],
"machine-config": {{
"vcpu_count": 2,
"mem_size_mib": 1024,
"smt": false
}},
"mmds-config": {{
"network_interfaces": ["netif1", "netif2"],
"ipv4_address": "169.254.1.1"
}}
}}"#,
kernel_file.as_path().to_str().unwrap(),
rootfs_file.as_path().to_str().unwrap(),
);
let resources =
VmResources::from_json(json.as_str(), &InstanceInfo::default(), None, None)
.unwrap();
let initial_vmm_config = serde_json::from_slice::<VmmConfig>(json.as_bytes()).unwrap();
let vmm_config: VmmConfig = (&resources).into();
assert_eq!(initial_vmm_config, vmm_config);
}
} | rust_cleaned_test_functions.jsonl/61584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
2346,
2273,
3821,
5332,
368,
341,
286,
442,
2308,
296,
2277,
82,
2193,
624,
286,
341,
310,
1077,
10001,
2458,
284,
19944,
1703,
486,
931,
1005,
15454,
543,
310,
1077,
3704,
3848,
2458,
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_initialize_vote_account() {
let vote_account_pubkey = solana_sdk::pubkey::new_rand();
let vote_account = Account::new_ref(100, VoteState::size_of(), &id());
let vote_account = KeyedAccount::new(&vote_account_pubkey, false, &vote_account);
let node_pubkey = solana_sdk::pubkey::new_rand();
let node_account = RefCell::new(Account::default());
let keyed_accounts = &[];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
let res = initialize_account(
&vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
);
assert_eq!(res, Err(InstructionError::MissingRequiredSignature));
let keyed_accounts = &[KeyedAccount::new(&node_pubkey, true, &node_account)];
let signers: HashSet<Pubkey> = get_signers(keyed_accounts);
//init should pass
let res = initialize_account(
&vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
);
assert_eq!(res, Ok(()));
// reinit should fail
let res = initialize_account(
&vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
&signers,
&Clock::default(),
);
assert_eq!(res, Err(InstructionError::AccountAlreadyInitialized));
} | rust_cleaned_test_functions.jsonl/43723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
54360,
13500,
368,
341,
286,
1077,
6910,
13500,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
6910,
13500,
284,
8615,
486,
931,
7793,
7,
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_kernel_filter_with_empty_image() {
let image = gray_image!();
let k = vec![2u8];
let kernel = Kernel::new(&k, 1, 1);
let filtered = kernel.filter(&image, |c, a| *c = a);
let expected = gray_image!();
assert_pixels_eq!(filtered, expected);
} | rust_cleaned_test_functions.jsonl/35611 | {
"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,
26876,
8727,
6615,
15124,
4954,
368,
341,
286,
1077,
2168,
284,
17545,
4954,
0,
1428,
286,
1077,
595,
284,
7486,
20703,
17,
84,
23,
935,
286,
1077,
10001,
284,
36603,
486,
931,
2099,
74,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request() {
use helix::*;
let req = GetChannelEditorsRequest::builder()
.broadcaster_id("44445592".to_string())
.build();
// From twitch docs
let data = br#"
{
"data": [
{
"user_id": "182891647",
"user_name": "mauerbac",
"created_at": "2019-02-15T21:19:50.380833Z"
},
{
"user_id": "135093069",
"user_name": "BlueLava",
"created_at": "2018-03-07T16:28:29.872937Z"
}
]
}
"#
.to_vec();
let http_response = http::Response::builder().body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/channels/editors?broadcaster_id=44445592"
);
dbg!(GetChannelEditorsRequest::parse_response(Some(req), &uri, http_response).unwrap());
} | rust_cleaned_test_functions.jsonl/73489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
2126,
9629,
21014,
1900,
486,
17850,
741,
286,
659,
65,
8546,
32020,
842,
445,
19,
19,
19,
19,
20,
20,
24,
17,
3263,
983,
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_render_context_promotion_and_demotion() {
use crate::value::to_json;
let mut render_context = RenderContext::new(None);
render_context.set_local_var("@index".to_string(), to_json(0));
render_context.promote_local_vars();
assert_eq!(
render_context
.get_local_var(&"@../index".to_string())
.unwrap(),
&to_json(0)
);
render_context.demote_local_vars();
assert_eq!(
render_context.get_local_var(&"@index".to_string()).unwrap(),
&to_json(0)
);
} | rust_cleaned_test_functions.jsonl/14265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
8467,
47877,
5956,
8378,
69403,
5956,
368,
341,
262,
990,
17717,
486,
957,
486,
983,
9455,
280,
262,
1077,
5206,
3141,
8467,
284,
13848,
1972,
486,
931,
26717,
626,
262,
3141,
8467,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comparison() {
let x = r#"
a {
b {
c {}
}
}
"#;
let y = r#"
a {
b {}
}
"#;
let against = load_css_paths(y.as_bytes());
let other = load_css_paths(x.as_bytes());
let mut ret = Vec::new();
get_differences(&against, &other, &mut ret);
assert!(ret.is_empty());
get_differences(&other, &against, &mut ret);
assert_eq!(ret, vec![" Missing \"c\" rule".to_owned()]);
} | rust_cleaned_test_functions.jsonl/106112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90797,
368,
341,
262,
1077,
856,
284,
435,
2,
698,
64,
341,
262,
293,
341,
286,
272,
5613,
262,
456,
532,
57676,
401,
262,
1077,
379,
284,
435,
2,
698,
64,
341,
262,
293,
5613,
532,
57676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_patch_vm() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(
b"PATCH /vm HTTP/1.1\r\n\
Content-Type: application/json\r\n\
Content-Length: 21\r\n\r\n{ \
\"state\": \"Paused\" \
}",
)
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/43152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
39643,
39008,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
626,
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_occ() {
let text = b"abcbbc\0";
let mut occ_correct = vec![0; 256 * text.len()];
occ_correct[0 * 256 + 'a' as usize] = 1;
occ_correct[1 * 256 + 'a' as usize] = 1;
occ_correct[1 * 256 + 'b' as usize] = 1;
occ_correct[2 * 256 + 'a' as usize] = 1;
occ_correct[2 * 256 + 'b' as usize] = 1;
occ_correct[2 * 256 + 'c' as usize] = 1;
occ_correct[3 * 256 + 'a' as usize] = 1;
occ_correct[3 * 256 + 'b' as usize] = 2;
occ_correct[3 * 256 + 'c' as usize] = 1;
occ_correct[4 * 256 + 'a' as usize] = 1;
occ_correct[4 * 256 + 'b' as usize] = 3;
occ_correct[4 * 256 + 'c' as usize] = 1;
occ_correct[5 * 256 + 'a' as usize] = 1;
occ_correct[5 * 256 + 'b' as usize] = 3;
occ_correct[5 * 256 + 'c' as usize] = 2;
occ_correct[6 * 256 + 0] = 1;
occ_correct[6 * 256 + 'a' as usize] = 1;
occ_correct[6 * 256 + 'b' as usize] = 3;
occ_correct[6 * 256 + 'c' as usize] = 2;
assert_eq!(occ(text), occ_correct);
} | rust_cleaned_test_functions.jsonl/51325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57291,
368,
341,
286,
1077,
1467,
284,
293,
1,
13683,
84185,
59,
15,
3302,
286,
1077,
5206,
2983,
31550,
284,
7486,
20703,
15,
26,
220,
17,
20,
21,
353,
1467,
19406,
33800,
286,
2983,
31550,
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_version_fromstr() {
assert_eq!(
Version::from_str("infallible").unwrap(),
Version::Nonconformant("infallible".to_string())
);
} | rust_cleaned_test_functions.jsonl/116490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
5673,
495,
368,
341,
286,
2060,
10714,
33673,
310,
6079,
486,
1499,
2895,
445,
258,
13464,
1238,
1827,
15454,
3148,
310,
6079,
486,
8121,
443,
627,
517,
445,
258,
13464,
1238,
3263,
983,
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 |
#[test]
fn test_user_error_display() {
assert_eq!(
format!(
"{}",
UserError::new(
ErrorCode::CanisterOutOfCycles,
"Canister 42 ran out of cycles"
)
),
"IC0501: Canister 42 ran out of cycles"
);
} | rust_cleaned_test_functions.jsonl/28539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
4096,
14825,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
33673,
394,
35503,
756,
394,
2657,
1454,
486,
931,
1006,
503,
60084,
486,
6713,
1571,
31731,
34,
15805,
345,
503,
330,
6713,
1571,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timespec() {
// Test valid conversions
assert_eq!(
parse_timespec("Thu, 1 Jan 1970 00:00:00 GMT").unwrap(),
Utc.ymd(1970, 1, 1).and_hms(0, 0, 0),
);
assert_eq!(
parse_timespec("Mon, 16 Apr 2018 04:33:50 GMT").unwrap(),
Utc.ymd(2018, 4, 16).and_hms(4, 33, 50),
);
// Test invalid conversion
assert!(parse_timespec("foo").is_err());
} | rust_cleaned_test_functions.jsonl/41481 | {
"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,
21039,
22353,
992,
368,
341,
286,
442,
3393,
2697,
48722,
198,
286,
2060,
10714,
33673,
310,
4715,
22353,
992,
445,
49922,
11,
220,
16,
4350,
220,
16,
24,
22,
15,
220,
15,
15,
25,
15,
15,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_vec_masking() {
let b = BitVec::from_elem(140, true);
let mut bs = BitSet::from_bit_vec(b);
assert!(bs.contains(&139));
assert!(!bs.contains(&140));
assert!(bs.insert(150));
assert!(!bs.contains(&140));
assert!(!bs.contains(&149));
assert!(bs.contains(&150));
assert!(!bs.contains(&151));
} | rust_cleaned_test_functions.jsonl/76224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
13251,
9999,
287,
368,
341,
286,
1077,
293,
284,
6495,
10050,
486,
1499,
28179,
7,
16,
19,
15,
11,
830,
317,
286,
1077,
5206,
17065,
284,
57227,
486,
1499,
13996,
13251,
1883,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_returns_err_when_invalid_col() {
let tp = TokenParser::new("1 2 3\n4 5 6");
assert!(tp.token::<u8>(1, 4).is_err());
} | rust_cleaned_test_functions.jsonl/96295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58900,
9266,
47636,
31433,
10211,
368,
341,
286,
1077,
18101,
284,
9660,
6570,
486,
931,
445,
16,
220,
17,
220,
18,
1699,
19,
220,
20,
220,
21,
3071,
286,
2060,
10297,
790,
14416,
27638,
84,
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 |
#[test]
fn test_unreliable() {
let mut test = TachyonTest::default();
test.connect();
// unreliable messages need to be body length + 1;
// send length error
let send = test.client_send_unreliable(0);
assert_eq!(SEND_ERROR_LENGTH, send.error);
let res = test.server_receive();
assert_eq!(0, res.length);
test.receive_buffer[0] = 1;
test.send_buffer[0] = 3;
test.send_buffer[1] = 4;
test.send_buffer[2] = 5;
test.send_buffer[3] = 6;
let sent = test.client_send_unreliable(4);
assert_eq!(0, sent.error);
assert_eq!(5, sent.sent_len as usize);
let res = test.server_receive();
assert_eq!(4, res.length);
assert_eq!(3, test.receive_buffer[0]);
assert_eq!(4, test.receive_buffer[1]);
assert_eq!(5, test.receive_buffer[2]);
assert_eq!(6, test.receive_buffer[3]);
} | rust_cleaned_test_functions.jsonl/114148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
265,
50330,
368,
341,
286,
1077,
5206,
1273,
284,
350,
610,
24990,
2271,
486,
2258,
543,
286,
1273,
10800,
1428,
286,
442,
66029,
6605,
1184,
311,
387,
2487,
3084,
488,
220,
16,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_cumulative_find() {
let input = CumulativeOffsets {
cumulative_offsets: vec![CumulativeOffset {
index: vec![0],
start_offset: 0,
}],
total_count: 0,
};
assert_eq!(input.find(0), (0, &input.cumulative_offsets[0]));
let input = CumulativeOffsets {
cumulative_offsets: vec![
CumulativeOffset {
index: vec![0],
start_offset: 0,
},
CumulativeOffset {
index: vec![1],
start_offset: 2,
},
],
total_count: 0,
};
assert_eq!(input.find(0), (0, &input.cumulative_offsets[0])); // = first start_offset
assert_eq!(input.find(1), (1, &input.cumulative_offsets[0])); // > first start_offset
assert_eq!(input.find(2), (0, &input.cumulative_offsets[1])); // = last start_offset
assert_eq!(input.find(3), (1, &input.cumulative_offsets[1])); // > last start_offset
} | rust_cleaned_test_functions.jsonl/94725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 606
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
91328,
22160,
21814,
368,
341,
286,
1077,
1946,
284,
31578,
22160,
81095,
341,
310,
39844,
56924,
25,
7486,
20703,
85805,
22160,
6446,
341,
394,
1922,
25,
7486,
20703,
15,
1259,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_feed_info() {
let iter: GTFSIterator<_, FeedInfo> =
GTFSIterator::from_path("./examples/good_feed/feed_info.txt").unwrap();
for result in iter {
assert!(result.is_ok(), format!("{}", result.err().unwrap()));
}
} | rust_cleaned_test_functions.jsonl/7512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
42390,
3109,
368,
341,
262,
1077,
5367,
25,
11911,
8485,
11951,
27,
6878,
28870,
1731,
29,
4035,
286,
11911,
8485,
11951,
486,
1499,
2638,
13988,
51668,
4846,
1386,
42390,
93730,
3109,
3909,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vector_2() {
let bobsk = Scalar([0x5d,0xab,0x08,0x7e,0x62,0x4a,0x8a,0x4b
,0x79,0xe1,0x7f,0x8b,0x83,0x80,0x0e,0xe6
,0x6f,0x3b,0xb1,0x29,0x26,0x18,0xb6,0xfd
,0x1c,0x2f,0x8b,0x27,0xff,0x88,0xe0,0xeb]);
let bobpk_expected = [0xde,0x9e,0xdb,0x7d,0x7b,0x7d,0xc1,0xb4
,0xd3,0x5b,0x61,0xc2,0xec,0xe4,0x35,0x37
,0x3f,0x83,0x43,0xc8,0x5b,0x78,0x67,0x4d
,0xad,0xfc,0x7e,0x14,0x6f,0x88,0x2b,0x4f];
let GroupElement(bobpk) = scalarmult_base(&bobsk);
assert!(bobpk == bobpk_expected);
} | rust_cleaned_test_functions.jsonl/99767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
17,
368,
341,
1789,
286,
1077,
35192,
4886,
284,
35176,
2561,
15,
87,
20,
67,
11,
15,
52616,
11,
15,
87,
15,
23,
11,
15,
87,
22,
68,
11,
15,
87,
21,
17,
11,
15,
87,
19,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsub_ack() {
let mut data: &[u8] = &[0b10110000, 2, 0, 10];
match decode_slice(&mut data) {
Ok(Some(Packet::Unsuback(p))) => {
assert_eq!(p.get(), 10);
}
other => panic!("Failed decode: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/77912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1966,
48447,
368,
341,
262,
1077,
5206,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
65,
16,
15,
16,
16,
15,
15,
15,
15,
11,
220,
17,
11,
220,
15,
11,
220,
16,
15,
935,
262,
2432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_image_in_image() {
let mut target = ImageBuffer::new(32, 32);
let source = ImageBuffer::from_pixel(16, 16, Rgb([255u8, 0, 0]));
overlay(&mut target, &source, 0, 0);
assert!(*target.get_pixel(0, 0) == Rgb([255u8, 0, 0]));
assert!(*target.get_pixel(15, 0) == Rgb([255u8, 0, 0]));
assert!(*target.get_pixel(16, 0) == Rgb([0u8, 0, 0]));
assert!(*target.get_pixel(0, 15) == Rgb([255u8, 0, 0]));
assert!(*target.get_pixel(0, 16) == Rgb([0u8, 0, 0]));
} | rust_cleaned_test_functions.jsonl/121626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
1243,
4954,
368,
341,
286,
1077,
5206,
2169,
284,
4654,
4095,
486,
931,
7,
18,
17,
11,
220,
18,
17,
317,
286,
1077,
2530,
284,
4654,
4095,
486,
1499,
29760,
7,
16,
21,
11,
220,
16,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_python_version_is_malformed() {
assert_eq!(
format_python_version("Python 3.7", "v${major}.${minor}.${patch}"),
Some("v3.7.".to_string())
);
} | rust_cleaned_test_functions.jsonl/99458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
55869,
9438,
6892,
717,
278,
10155,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
55869,
9438,
445,
30280,
220,
18,
13,
22,
497,
330,
85,
2365,
36505,
77197,
45670,
77197,
3400,
92,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_connect_sme_creation_fails() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
// Create an IfaceManager and drop its client
let test_values = test_setup(&mut exec);
let (mut iface_manager, _) = create_iface_manager_with_client(&test_values, true);
let _ = iface_manager.clients.pop();
// Drop the serving end of our device service proxy so that the request to create an SME
// proxy fails.
drop(test_values.device_service_stream);
// Update the saved networks with knowledge of the test SSID and credentials.
let network_id = NetworkIdentifier::new(TEST_SSID.as_bytes().to_vec(), SecurityType::Wpa);
let credential = Credential::Password(TEST_PASSWORD.as_bytes().to_vec());
exec.run_singlethreaded(test_values.saved_networks.store(network_id, credential))
.expect("failed to store a network password");
// Ask the IfaceManager to connect and make sure that it fails.
let config = create_connect_request(TEST_SSID, TEST_PASSWORD);
let connect_fut = iface_manager.connect(config);
pin_mut!(connect_fut);
assert_variant!(exec.run_until_stalled(&mut connect_fut), Poll::Ready(Err(_)));
} | rust_cleaned_test_functions.jsonl/62690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
643,
2660,
46163,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
442,
4230,
458,
1416,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop_char() {
let mut data = String::from_str("ประเทศไทย中华b¢€𤭢");
assert_eq!(data.pop_char().unwrap(), '𤭢'); // 4 bytes
assert_eq!(data.pop_char().unwrap(), '€'); // 3 bytes
assert_eq!(data.pop_char().unwrap(), '¢'); // 2 bytes
assert_eq!(data.pop_char().unwrap(), 'b'); // 1 bytes
assert_eq!(data.pop_char().unwrap(), '华');
assert_eq!(data.as_slice(), "ประเทศไทย中");
} | rust_cleaned_test_functions.jsonl/113365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
9232,
368,
341,
286,
1077,
5206,
821,
284,
923,
486,
1499,
2895,
445,
130391,
100849,
65,
56394,
15056,
101877,
255,
95,
797,
286,
2060,
10714,
10297,
691,
8288,
9232,
1005,
15454,
1507,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_list_to_vec_expr() -> Result<()> {
let item = Item::List(vec![
ListItem(vec![Item::Ident("a".to_owned())]),
ListItem(vec![Item::Ident("b".to_owned())]),
]);
let expr: Vec<Expr> = item.try_into()?;
assert_debug_snapshot!(expr, @r###"
[
Identifier(
Ident {
value: "a",
quote_style: None,
},
),
Identifier(
Ident {
value: "b",
quote_style: None,
},
),
]
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/64110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
2019,
2346,
13251,
21915,
368,
1464,
5714,
71698,
341,
286,
1077,
1509,
284,
5739,
486,
852,
25592,
90515,
310,
40924,
25592,
20703,
1234,
486,
28301,
445,
64,
3263,
983,
51973,
2140,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_peek_returns_head_element() {
let mut list: SimpleLinkedList<u32> = SimpleLinkedList::new();
assert_eq!(list.peek(), None, "No element should be contained in list");
list.push(2);
assert_eq!(list.peek(), Some(&2), "Element must be 2");
assert_eq!(list.peek(), Some(&2), "Element must be still 2");
} | rust_cleaned_test_functions.jsonl/78173 | {
"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,
62,
29107,
58900,
13138,
7894,
368,
341,
262,
1077,
5206,
1140,
25,
8993,
33915,
34837,
18,
17,
29,
284,
8993,
33915,
486,
931,
543,
262,
2060,
10714,
10297,
1607,
41249,
1507,
2240,
11,
330,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default() {
let lua_string = String::default();
assert_eq!(lua_string.len(), 0);
assert_eq!(&lua_string.to_string_lossy(), "");
} | rust_cleaned_test_functions.jsonl/101289 | {
"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,
9993,
368,
341,
286,
1077,
20357,
3904,
284,
923,
486,
2258,
1428,
286,
2060,
10714,
10297,
27623,
3904,
19406,
1507,
220,
15,
317,
286,
2060,
10714,
0,
2099,
27623,
3904,
2389,
3904,
11193,
88,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_table_add_consistency() {
let s = MemStorage::default();
let new_file = s.create("test").expect("file create should work");
let opt = Arc::new(Options::<BytewiseComparator>::default());
let mut tb = TableBuilder::new(new_file, BytewiseComparator::default(), &opt);
tb.add(b"222", b"").unwrap();
tb.add(b"1", b"").unwrap();
} | rust_cleaned_test_functions.jsonl/64694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
2891,
31971,
47094,
368,
341,
286,
1077,
274,
284,
13550,
5793,
486,
2258,
543,
286,
1077,
501,
2458,
284,
274,
2520,
445,
1944,
1827,
17119,
445,
1192,
1855,
1265,
975,
797,
286,
1077,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_iter_size_hint() {
let data = vec![5, 9];
let pq = BinaryHeap::from(data);
let mut it = pq.into_iter();
assert_eq!(it.size_hint(), (2, Some(2)));
assert_eq!(it.next(), Some(9));
assert_eq!(it.size_hint(), (1, Some(1)));
assert_eq!(it.next(), Some(5));
assert_eq!(it.size_hint(), (0, Some(0)));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/83201 | {
"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,
17134,
11723,
2368,
45825,
368,
341,
262,
1077,
821,
284,
7486,
20703,
20,
11,
220,
24,
935,
262,
1077,
39639,
284,
17718,
27909,
486,
1499,
2592,
626,
262,
1077,
5206,
432,
284,
39639,
39860,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_residential_process_make_credential() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
let make_credential_params = create_minimal_make_credential_parameters();
let make_credential_response =
ctap_state.process_make_credential(make_credential_params, DUMMY_CHANNEL_ID);
match make_credential_response.unwrap() {
ResponseData::AuthenticatorMakeCredential(make_credential_response) => {
let AuthenticatorMakeCredentialResponse {
fmt,
auth_data,
att_stmt,
} = make_credential_response;
// The expected response is split to only assert the non-random parts.
assert_eq!(fmt, "packed");
let mut expected_auth_data = vec![
0xA3, 0x79, 0xA6, 0xF6, 0xEE, 0xAF, 0xB9, 0xA5, 0x5E, 0x37, 0x8C, 0x11, 0x80,
0x34, 0xE2, 0x75, 0x1E, 0x68, 0x2F, 0xAB, 0x9F, 0x2D, 0x30, 0xAB, 0x13, 0xD2,
0x12, 0x55, 0x86, 0xCE, 0x19, 0x47, 0x41, 0x00, 0x00, 0x00, 0x00,
];
expected_auth_data.extend(&ctap_state.persistent_store.aaguid().unwrap());
expected_auth_data.extend(&[0x00, 0x20]);
assert_eq!(
auth_data[0..expected_auth_data.len()],
expected_auth_data[..]
);
assert_eq!(att_stmt.alg, SignatureAlgorithm::ES256 as i64);
}
_ => panic!("Invalid response type"),
}
} | rust_cleaned_test_functions.jsonl/35307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 951
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
11234,
11305,
28230,
666,
30320,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
17895,
43187,
36976,
284,
66091,
7622,
7,
1423,
286,
1077,
5206,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_config_from_spec() -> Result<()> {
let container_id = "sample";
let spec = Spec::default();
let config = YoukiConfig::from_spec(&spec, container_id)?;
assert_eq!(&config.hooks, spec.hooks());
dbg!(&config.cgroup_path);
assert_eq!(config.cgroup_path, PathBuf::from(container_id));
Ok(())
} | rust_cleaned_test_functions.jsonl/91274 | {
"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,
5332,
5673,
13594,
368,
1464,
5714,
71698,
341,
286,
1077,
5476,
842,
284,
330,
13611,
876,
286,
1077,
1398,
284,
10956,
486,
2258,
543,
286,
1077,
2193,
284,
1446,
6642,
2648,
486,
1499,
13594,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_spmm_csr_pattern() {
let a = DMatrix::from_row_slice(4, 5, &[1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1]);
let b = DMatrix::from_row_slice(5, 3, &[1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1]);
let c = DMatrix::from_row_slice(4, 3, &[2, 1, 3, 0, 0, 1, 0, 0, 0, 2, 1, 3]);
let a_pattern = CsrMatrix::from(&a).sparsity_pattern();
let b_pattern = CsrMatrix::from(&b).sparsity_pattern();
let c_pattern = spmm_csr_pattern(&a_pattern, &b_pattern);
let c_pattern_expected = CsrMatrix::from(&c).sparsity_pattern();
assert_eq!(&c_pattern, c_pattern_expected.as_ref());
assert_eq!(c_pattern.nnz(), 7);
} | rust_cleaned_test_functions.jsonl/33877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
3821,
666,
15094,
21260,
368,
341,
262,
1077,
264,
284,
422,
6689,
486,
1499,
8530,
26488,
7,
19,
11,
220,
20,
11,
44590,
16,
11,
220,
16,
11,
220,
15,
11,
220,
15,
11,
220,
16,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_anon_labels() {
let mut a = CodeAssembler::new(64).unwrap();
a.push(rcx).unwrap();
a.anonymous_label().unwrap();
a.xor(rcx, rdx).unwrap();
let anon = a.bwd().unwrap();
a.je(anon).unwrap();
let anon = a.fwd().unwrap();
a.js(anon).unwrap();
a.nop().unwrap();
a.anonymous_label().unwrap();
a.sub(eax, eax).unwrap();
let bytes = a.assemble(0x1234_5678_9ABC_DEF0).unwrap();
assert_eq!(bytes, b"\x51\x48\x31\xD1\x74\xFB\x78\x01\x90\x29\xC0");
} | rust_cleaned_test_functions.jsonl/71811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
263,
14547,
368,
341,
10217,
5206,
264,
284,
6119,
77858,
486,
931,
7,
21,
19,
568,
15454,
543,
11323,
2552,
35429,
87,
568,
15454,
543,
11323,
10752,
9757,
6106,
1005,
15454,
543,
11323,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contains() {
assert!("abcde".contains("bcd"));
assert!("abcde".contains("abcd"));
assert!("abcde".contains("bcde"));
assert!("abcde".contains(""));
assert!("".contains(""));
assert!(!"abcde".contains("def"));
assert!(!"".contains("a"));
let data = "ประเทศไทย中华Việt Nam";
assert!(data.contains("ประเ"));
assert!(data.contains("ะเ"));
assert!(data.contains("中华"));
assert!(!data.contains("ไท华"));
} | rust_cleaned_test_functions.jsonl/2456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
368,
341,
286,
2060,
17223,
13683,
450,
3263,
13372,
445,
91490,
4010,
286,
2060,
17223,
13683,
450,
3263,
13372,
445,
68644,
4010,
286,
2060,
17223,
13683,
450,
3263,
13372,
445,
8904,
450,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_float_expr() {
let code = String::from("
(2.0 * 2.0) * 3.14;
");
let mut lexer = Token::lexer(code.as_str());
let parser = Parser::new(code.clone());
let expr_res = parser.parse_expr(&mut lexer, &[Token::Semicolon]);
assert!(expr_res.is_ok());
let expr = expr_res.unwrap();
expr.print(0);
} | rust_cleaned_test_functions.jsonl/43205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17586,
21915,
368,
341,
262,
1077,
2038,
284,
923,
486,
1499,
70576,
286,
320,
17,
13,
15,
353,
220,
17,
13,
15,
8,
353,
220,
18,
13,
16,
19,
280,
262,
7318,
262,
1077,
5206,
53259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_download_sst() {
use grpcio::{Error, RpcStatus};
let (_cluster, ctx, tikv, import) = new_cluster_and_tikv_import_client();
let temp_dir = Builder::new()
.prefix("test_download_sst")
.tempdir()
.unwrap();
let sst_path = temp_dir.path().join("test.sst");
let sst_range = (0, 100);
let (mut meta, _) = gen_sst_file(sst_path, sst_range);
meta.set_region_id(ctx.get_region_id());
meta.set_region_epoch(ctx.get_region_epoch().clone());
// Checks that downloading a non-existing storage returns error.
let mut download = DownloadRequest::default();
download.set_sst(meta.clone());
download.set_storage_backend(external_storage::make_local_backend(temp_dir.path()));
download.set_name("missing.sst".to_owned());
let result = import.download(&download);
match &result {
Err(Error::RpcFailure(RpcStatus {
details: Some(msg), ..
})) if msg.contains("CannotReadExternalStorage") => {}
_ => panic!("unexpected download reply: {:?}", result),
}
download.set_name("test.sst".to_owned());
download.mut_sst().mut_range().set_start(vec![sst_range.1]);
download
.mut_sst()
.mut_range()
.set_end(vec![sst_range.1 + 1]);
let result = import.download(&download).unwrap();
assert!(result.get_is_empty());
// Now perform a proper download.
download.mut_sst().mut_range().set_start(Vec::new());
download.mut_sst().mut_range().set_end(Vec::new());
let result = import.download(&download).unwrap();
assert!(!result.get_is_empty());
assert_eq!(result.get_range().get_start(), &[sst_range.0]);
assert_eq!(result.get_range().get_end(), &[sst_range.1 - 1]);
// Do an ingest and verify the result is correct.
let mut ingest = IngestRequest::default();
ingest.set_context(ctx.clone());
ingest.set_sst(meta);
let resp = import.ingest(&ingest).unwrap();
assert!(!resp.has_error());
check_ingested_kvs(&tikv, &ctx, sst_range);
} | rust_cleaned_test_functions.jsonl/51202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 847
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35939,
643,
267,
368,
341,
262,
990,
47900,
815,
22964,
1454,
11,
79961,
2522,
2315,
262,
1077,
5453,
18855,
11,
5635,
11,
86172,
85,
11,
1159,
8,
284,
501,
28441,
8378,
528,
1579,
85,
18434,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parent() {
let mut output = String::new();
let method = StringMethod {
method: "parent",
variable: "\"/home/redox/file.txt\"",
pattern: "",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "/home/redox");
} | rust_cleaned_test_functions.jsonl/85276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15960,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
3765,
756,
310,
3890,
25,
220,
15898,
14,
5117,
77900,
5131,
239... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_address_mask_generator() {
assert_eq!(
Some(vec![
0b10010,
0b10011,
0b10110,
0b10111,
]),
address_mask_generator("0000010X1X")
);
assert_eq!(
Some(vec![
0b010010,
0b010011,
0b010110,
0b010111,
0b110010,
0b110011,
0b110110,
0b110111,
]),
address_mask_generator("0000X10X1X")
);
} | rust_cleaned_test_functions.jsonl/89718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
9999,
25813,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
25592,
90515,
394,
220,
15,
65,
16,
15,
15,
16,
15,
345,
394,
220,
15,
65,
16,
15,
15,
16,
16,
345,
394,
220,
15,
65,
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_fee_overage_is_refunded() {
let mut deps = mock_dependencies(&[]);
test_instantiate(
deps.as_mut(),
InstArgs {
fee_amount: 150,
fee_collection_address: "fee_bucket",
..Default::default()
},
)
.unwrap();
// Send 50 more than the required fee amount
let response = register_name(
deps.as_mut(),
mock_info("sender_wallet", &vec![coin(200, FEE_DENOMINATION)]),
"thebestnameever".into(),
)
.unwrap();
assert_eq!(
response.messages.len(),
3,
"three messages should be returned with an excess fee"
);
response.messages.into_iter().for_each(|msg| match msg.msg {
CosmosMsg::Custom(ProvenanceMsg { params, .. }) => {
verify_add_attribute_result(params, "wallet.pb", "thebestnameever");
}
CosmosMsg::Bank(BankMsg::Send { to_address, amount }) => {
let coin_amount_sent = validate_and_get_nhash_sent(amount);
match to_address.as_str() {
"fee_bucket" => {
assert_eq!(
coin_amount_sent, 150,
"expected the fee bucket to be sent the instantiated fee amount"
);
}
"sender_wallet" => {
assert_eq!(
coin_amount_sent, 50,
"expected the sender to be refunded the excess funds they added"
);
}
_ => panic!("unexpected to_address encountered"),
};
}
_ => panic!("unexpected message type"),
});
assert_eq!(
3,
response.attributes.len(),
"expected three attributes to be added when a refund occurs"
);
response
.attributes
.iter()
.find(|attr| attr.key.as_str() == "action")
.unwrap();
let name_attr = response
.attributes
.iter()
.find(|attr| attr.key.as_str() == "name")
.unwrap();
assert_eq!(name_attr.value.as_str(), "thebestnameever");
let excess_funds_attr = response
.attributes
.iter()
.find(|attr| attr.key.as_str() == "fee_refund")
.unwrap();
assert_eq!(excess_funds_attr.value.as_str(), "50nhash");
} | rust_cleaned_test_functions.jsonl/80119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34305,
15431,
424,
6892,
7793,
36053,
368,
341,
286,
1077,
5206,
48178,
284,
7860,
71841,
2099,
1294,
626,
286,
1273,
1243,
42251,
1006,
310,
48178,
5357,
29523,
3148,
310,
5984,
4117,
341,
394,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_file2() {
let path = "./src/graph/graph2.txt";
let g = Graph::read_from_file(path);
let dfs = depth_first_paths::DepthFirstPaths::new(0, &g);
println!(
"Has Path :: {:?}, Path:: {:?}",
dfs.has_path(7),
dfs.path(7)
);
} | rust_cleaned_test_functions.jsonl/112637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2458,
17,
368,
341,
286,
1077,
1815,
284,
5924,
3548,
72177,
72177,
17,
3909,
876,
286,
1077,
342,
284,
12165,
486,
878,
5673,
2458,
5581,
317,
286,
1077,
25792,
284,
7990,
12978,
24152,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_def_cfa_register() {
let cie = make_test_cie();
let mut ctx = UnwindContext::new();
ctx.set_cfa(CfaRule::RegisterAndOffset {
register: Register(3),
offset: 8,
});
let mut expected = ctx.clone();
expected.set_cfa(CfaRule::RegisterAndOffset {
register: Register(42),
offset: 8,
});
let instructions = [(
Ok(false),
CallFrameInstruction::DefCfaRegister {
register: Register(42),
},
)];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9349 | {
"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,
21296,
7844,
666,
3632,
14000,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5206,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
5635,
980,
666,
3632,
3025,
3632,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_amount_to_ui_amount() {
let program_id = crate::id();
let owner_key = Pubkey::new_unique();
let mint_key = Pubkey::new_unique();
let mut mint_account =
SolanaAccount::new(mint_minimum_balance(), Mint::get_packed_len(), &program_id);
let mut rent_sysvar = rent_sysvar();
// fail if an invalid mint is passed in
assert_eq!(
Err(TokenError::InvalidMint.into()),
do_process_instruction(
amount_to_ui_amount(&program_id, &mint_key, 110).unwrap(),
vec![&mut mint_account],
)
);
// create mint
do_process_instruction(
initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(),
vec![&mut mint_account, &mut rent_sysvar],
)
.unwrap();
set_expected_data("0.23".as_bytes().to_vec());
do_process_instruction(
amount_to_ui_amount(&program_id, &mint_key, 23).unwrap(),
vec![&mut mint_account],
)
.unwrap();
set_expected_data("1.1".as_bytes().to_vec());
do_process_instruction(
amount_to_ui_amount(&program_id, &mint_key, 110).unwrap(),
vec![&mut mint_account],
)
.unwrap();
set_expected_data("42".as_bytes().to_vec());
do_process_instruction(
amount_to_ui_amount(&program_id, &mint_key, 4200).unwrap(),
vec![&mut mint_account],
)
.unwrap();
set_expected_data("0".as_bytes().to_vec());
do_process_instruction(
amount_to_ui_amount(&program_id, &mint_key, 0).unwrap(),
vec![&mut mint_account],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/64312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 891
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13471,
2346,
22412,
13471,
368,
341,
286,
1077,
2025,
842,
284,
17717,
486,
307,
543,
286,
1077,
6372,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
28337,
3097,
284,
22611,
792,
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_wait_in_flight_responses() {
let path_to_socket = "/tmp/test_socket_http_server6.sock";
fs::remove_file(path_to_socket).unwrap_or_default();
let mut server = HttpServer::new(path_to_socket.to_string()).unwrap();
server.start_server().unwrap();
// Test a connection dropped and then a new one appearing
// before the user had a chance to send the response to the
// first one.
let mut first_socket = UnixStream::connect(path_to_socket).unwrap();
assert!(server.requests().unwrap().is_empty());
first_socket
.write_all(
b"PATCH /machine-config HTTP/1.1\r\n\
Content-Length: 13\r\n\
Content-Type: application/json\r\n\r\nwhatever body",
)
.unwrap();
let mut req_vec = server.requests().unwrap();
let server_request = req_vec.remove(0);
first_socket.shutdown(std::net::Shutdown::Both).unwrap();
assert!(server.requests().unwrap().is_empty());
let mut second_socket = UnixStream::connect(path_to_socket).unwrap();
second_socket.set_nonblocking(true).unwrap();
assert!(server.requests().unwrap().is_empty());
server
.enqueue_responses(vec![server_request.process(|_request| {
let mut response = Response::new(Version::Http11, StatusCode::OK);
let response_body = b"response body";
response.set_body(Body::new(response_body.to_vec()));
response
})])
.unwrap();
assert!(server.requests().unwrap().is_empty());
assert_eq!(server.connections.len(), 1);
let mut buf: [u8; 1024] = [0; 1024];
assert!(second_socket.read(&mut buf[..]).is_err());
second_socket
.write_all(
b"GET /machine-config HTTP/1.1\r\n\
Content-Length: 20\r\n\
Content-Type: application/json\r\n\r\nwhatever second body",
)
.unwrap();
let mut req_vec = server.requests().unwrap();
let second_server_request = req_vec.remove(0);
assert_eq!(
second_server_request.request,
Request::try_from(
b"GET /machine-config HTTP/1.1\r\n\
Content-Length: 20\r\n\
Content-Type: application/json\r\n\r\nwhatever second body"
)
.unwrap()
);
server
.respond(second_server_request.process(|_request| {
let mut response = Response::new(Version::Http11, StatusCode::OK);
let response_body = b"response second body";
response.set_body(Body::new(response_body.to_vec()));
response
}))
.unwrap();
assert!(server.requests().unwrap().is_empty());
let mut buf: [u8; 1024] = [0; 1024];
assert!(second_socket.read(&mut buf[..]).unwrap() > 0);
second_socket.shutdown(std::net::Shutdown::Both).unwrap();
assert!(server.requests().is_ok());
fs::remove_file(path_to_socket).unwrap();
} | rust_cleaned_test_functions.jsonl/2925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
1243,
90370,
81292,
368,
341,
286,
1077,
1815,
2346,
19555,
284,
3521,
5173,
12697,
19555,
25888,
12015,
21,
68171,
876,
286,
8619,
486,
5399,
2458,
5581,
2346,
19555,
568,
15454,
8734,
9993,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_already_received() {
let mut packet = Packet::default();
let slot = 1;
let index = 5;
let version = 0x40;
let shred = Shred::new_from_data(slot, index, 0, None, true, true, 0, version, 0);
shred.copy_to_packet(&mut packet);
let shreds_received = Arc::new(Mutex::new((LruCache::new(100), PacketHasher::default())));
assert_eq!(
check_if_already_received(&packet, &shreds_received),
Some(slot)
);
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
let shred = Shred::new_from_data(slot, index, 2, None, true, true, 0, version, 0);
shred.copy_to_packet(&mut packet);
assert_eq!(
check_if_already_received(&packet, &shreds_received),
Some(slot)
);
// then blocked
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
let shred = Shred::new_from_data(slot, index, 8, None, true, true, 0, version, 0);
shred.copy_to_packet(&mut packet);
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
let shred = Shred::new_empty_coding(slot, index, 0, 1, 1, version);
shred.copy_to_packet(&mut packet);
assert_eq!(
check_if_already_received(&packet, &shreds_received),
Some(slot)
);
// then blocked
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
let shred = Shred::new_empty_coding(slot, index, 2, 1, 1, version);
shred.copy_to_packet(&mut packet);
assert_eq!(
check_if_already_received(&packet, &shreds_received),
Some(slot)
);
// same again is blocked
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
let shred = Shred::new_empty_coding(slot, index, 3, 1, 1, version);
shred.copy_to_packet(&mut packet);
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
assert_eq!(check_if_already_received(&packet, &shreds_received), None);
} | rust_cleaned_test_functions.jsonl/2863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80772,
40783,
368,
341,
286,
1077,
5206,
10151,
284,
28889,
486,
2258,
543,
286,
1077,
9446,
284,
220,
16,
280,
286,
1077,
1922,
284,
220,
20,
280,
286,
1077,
2319,
284,
220,
15,
87,
19,
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_content_type() {
let resp = Response::build(StatusCode::OK)
.content_type("text/plain")
.body(Bytes::new());
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "text/plain");
let resp = Response::build(StatusCode::OK)
.content_type(mime::APPLICATION_JAVASCRIPT_UTF_8)
.body(Bytes::new());
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
"application/javascript; charset=utf-8"
);
} | rust_cleaned_test_functions.jsonl/102523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
1819,
368,
341,
286,
1077,
9039,
284,
5949,
486,
5834,
7,
15872,
486,
3925,
340,
310,
659,
1796,
1819,
445,
1318,
36971,
1138,
310,
659,
2599,
76423,
486,
931,
1423,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_naked_raw_str() {
check_raw_str(
r#""abc""#,
UnvalidatedRawStr {
n_start_hashes: 0,
n_end_hashes: 0,
valid_start: true,
possible_terminator_offset: None,
},
Ok(ValidatedRawStr { n_hashes: 0 }),
);
} | rust_cleaned_test_functions.jsonl/105522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
7741,
16067,
2895,
368,
341,
286,
1779,
16067,
2895,
1006,
310,
435,
2,
3014,
13683,
3014,
2,
345,
310,
1230,
59590,
20015,
2580,
341,
394,
308,
4906,
91616,
25,
220,
15,
345,
394,
308,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_fg_bg_add_attr() {
let content_style = ContentStyle::new()
.foreground(Color::Blue)
.background(Color::Red)
.attribute(Attribute::Reset);
assert_eq!(content_style.foreground_color, Some(Color::Blue));
assert_eq!(content_style.background_color, Some(Color::Red));
assert_eq!(content_style.attributes[0], Attribute::Reset);
} | rust_cleaned_test_functions.jsonl/80205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
69473,
23122,
2891,
10422,
368,
341,
286,
1077,
2213,
15117,
284,
8883,
2323,
486,
931,
741,
310,
659,
34919,
15028,
486,
10331,
340,
310,
659,
6742,
15028,
486,
6033,
340,
310,
659,
9116,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_proposal_record_is_final() {
let mut transaction_context = MockTransactionContext::default();
let receiving_agent_key = "receiving_agent_key";
transaction_context.add_agent(PUBLIC_KEY);
transaction_context.add_agent(receiving_agent_key);
transaction_context.add_finalized_record();
let mut state = TrackAndTraceState::new(&mut transaction_context);
let transaction_handler = TrackAndTraceTransactionHandler::new();
match transaction_handler._create_proposal(
&create_proposal_action(Role::Owner, receiving_agent_key),
&mut state,
PUBLIC_KEY,
TIMESTAMP,
) {
Ok(()) => panic!("Record is final, InvalidTransaction should be returned"),
Err(ApplyError::InvalidTransaction(err)) => {
assert!(err.contains(&format!("Record is final: {}", RECORD_ID)));
}
Err(err) => panic!("Should have gotten invalid error but got {}", err),
}
} | rust_cleaned_test_functions.jsonl/32560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
21663,
32556,
14192,
6892,
20676,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
12308,
25730,
3097,
284,
330,
265,
46344,
25730,
3097,
876,
286,
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... | 2 |
#[test]
fn test_verify_failure() {
let key = Vec::from_hex("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b").unwrap();
let data = "Hi There".as_bytes();
let expected = Vec::from_hex("9294727a3638bb1c13f48ef8158bfc9d").unwrap();
let hmac_md5 = HmacMd5 {};
let result = hmac_md5.verify(&key[..], data, &expected[..]);
assert!(result);
let not_expected = Vec::from_hex("deadbeef3638bb1c13f48ef8158bfc9d").unwrap();
let result = hmac_md5.verify(&key[..], data, ¬_expected[..]);
assert!(!result);
} | rust_cleaned_test_functions.jsonl/17345 | {
"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,
35638,
43618,
368,
341,
286,
1077,
1376,
284,
11312,
486,
1499,
32655,
445,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
15,
65,
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_classify_non_uniform_table() {
let classification = classify_table(
"tests/data/non_uniform_datatypes.csv",
char::from_str(",").unwrap(),
)
.unwrap();
let expected = HashMap::from([
(String::from("first"), ColumnType::String),
(String::from("last"), ColumnType::String),
(String::from("ccnumber"), ColumnType::Float),
(String::from("price"), ColumnType::Float),
]);
assert_eq!(classification, expected);
} | rust_cleaned_test_functions.jsonl/128565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
1437,
21637,
45066,
5237,
368,
341,
286,
1077,
23850,
284,
48129,
5237,
1006,
310,
330,
23841,
13167,
91130,
45066,
15353,
60913,
11219,
756,
310,
1161,
486,
1499,
2895,
47503,
568,
15454,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_internally_tagged_newtype_variant_containing_unit_struct() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Info;
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "topic")]
enum Message {
Info(Info),
}
assert_tokens(
&Message::Info(Info),
&[
Token::Map { len: Some(1) },
Token::Str("topic"),
Token::Str("Info"),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
932,
745,
9372,
3556,
5921,
1313,
46112,
10260,
2056,
14832,
15126,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
2036,
13074,
401,
262,
11506,
27098,
42618,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_size() {
let slots = vec![1; 32];
let vote = Vote::new(slots, Hash::default());
let keypair = Arc::new(Keypair::new());
// Create the biggest possible vote transaction
let vote_ix = vote_instruction::vote_switch(
&keypair.pubkey(),
&keypair.pubkey(),
vote,
Hash::default(),
);
let mut vote_tx = Transaction::new_with_payer(&[vote_ix], Some(&keypair.pubkey()));
vote_tx.partial_sign(&[keypair.as_ref()], Hash::default());
vote_tx.partial_sign(&[keypair.as_ref()], Hash::default());
let vote = CrdsVote {
from: keypair.pubkey(),
transaction: vote_tx,
wallclock: 0,
};
let vote = CrdsValue::new_signed(CrdsData::Vote(1, vote), &Keypair::new());
assert!(bincode::serialized_size(&vote).unwrap() <= MAX_PROTOCOL_PAYLOAD_SIZE);
} | rust_cleaned_test_functions.jsonl/28082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
2368,
368,
341,
286,
1077,
15711,
284,
7486,
20703,
16,
26,
220,
18,
17,
935,
286,
1077,
6910,
284,
34034,
486,
931,
55691,
2412,
11,
6531,
486,
2258,
1423,
286,
1077,
1376,
12670,
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_long_format_cz() {
assert_eq!(
parse_format_flags(&vec!["od".to_string(), "--format=cz".to_string()]).unwrap(),
vec![ParsedFormatterItemInfo::new(FORMAT_ITEM_C, true)]
);
} | rust_cleaned_test_functions.jsonl/112173 | {
"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,
17799,
8955,
666,
89,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2099,
4083,
0,
1183,
347,
3263,
983,
3904,
1507,
14482,
2243,
28,
13769,
3263,
983,
3904,
368,
10697,
15454,
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 |
#[test]
fn test_fr_pow() {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for i in 0..1000 {
// Exponentiate by various small numbers and ensure it consists with repeated
// multiplication.
let a = Fr::rand(&mut rng);
let target = a.pow(&[i]);
let mut c = Fr::one();
for _ in 0..i {
c.mul_assign(&a);
}
assert_eq!(c, target);
}
for _ in 0..1000 {
// Exponentiating by the modulus should have no effect in a prime field.
let a = Fr::rand(&mut rng);
assert_eq!(a, a.pow(Fr::char()));
}
} | rust_cleaned_test_functions.jsonl/66331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
56183,
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,
18,
16,
18,
67,
22,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_convert_from_uint() {
macro_rules! check {
($ty:ident, $max:expr) => {
assert_eq!(BigInt::from($ty::zero()), BigInt::zero());
assert_eq!(BigInt::from($ty::one()), BigInt::one());
assert_eq!(BigInt::from($ty::MAX - $ty::one()), $max - BigInt::one());
assert_eq!(BigInt::from($ty::MAX), $max);
}
}
check!(u8, BigInt::from_slice(Plus, &[u8::MAX as BigDigit]));
check!(u16, BigInt::from_slice(Plus, &[u16::MAX as BigDigit]));
check!(u32, BigInt::from_slice(Plus, &[u32::MAX as BigDigit]));
check!(u64, BigInt::from_slice(Plus, &[u32::MAX as BigDigit, u32::MAX as BigDigit]));
check!(usize, BigInt::from(usize::MAX as u64));
} | rust_cleaned_test_functions.jsonl/90163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
5673,
15807,
368,
341,
286,
18072,
21407,
0,
1779,
341,
310,
1711,
1881,
25,
1713,
11,
400,
2810,
96011,
8,
589,
341,
394,
2060,
10714,
10297,
87474,
486,
1499,
699,
1881,
486,
14154,
118... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_path_v2() {
let client = graph_serializer(GraphSON::V2);
drop_vertices(&client, "test_simple_path").unwrap();
drop_vertices(&client, "test_simple_path_child").unwrap();
let g = traversal().with_remote(client);
let v1 = g
.add_v("test_simple_path")
.property("name", "a")
.to_list()
.unwrap();
let e1 = g
.add_v("test_simple_path_child")
.property("name", "b")
.to_list()
.unwrap();
let e2 = g
.add_v("test_simple_path_child")
.property("name", "c")
.to_list()
.unwrap();
g.add_e("child").from(&v1[0]).to(&e1[0]).to_list().unwrap();
g.add_e("child").from(&e1[0]).to(&e2[0]).to_list().unwrap();
g.add_e("child").from(&e2[0]).to(&v1[0]).to_list().unwrap();
let results = g
.v(v1[0].id())
.repeat(__.out("child").simple_path())
.until(__.loops(()).is(2))
.to_list()
.unwrap();
assert_eq!(results.len(), 1);
assert_eq!(results[0], e2[0]);
} | rust_cleaned_test_functions.jsonl/26302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
2638,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
5943,
37720,
2099,
2972,
11,
330,
1944,
30015,
2638,
1827,
15454,
543,
262,
5943,
37720,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_operand() {
assert_eq!(operand(&b"product"[..]),
IResult::Done(&b""[..],Operand::Value("product".to_string())));
assert_eq!(operand(&b"1234"[..]),
IResult::Done(&b""[..],Operand::Number(1234f64)));
assert_eq!(operand(&b"true"[..]),
IResult::Done(&b""[..],Operand::Boolean(true)));
assert_eq!(operand(&b"false"[..]),
IResult::Done(&b""[..],Operand::Boolean(false)));
// half match?
assert_eq!(operand(&b"Hello world!"[..]),
IResult::Done(&b""[..],Operand::Value("Hello world!".to_string())));
assert_eq!(operand(&b"hello world!"[..]),
IResult::Done(&b""[..],Operand::Value("hello world!".to_string())));
} | rust_cleaned_test_functions.jsonl/114312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69259,
368,
341,
262,
2060,
10714,
10297,
40609,
2099,
65,
1,
3031,
36864,
496,
9719,
715,
286,
358,
2077,
486,
17453,
2099,
65,
3014,
95874,
1125,
29940,
486,
1130,
445,
3031,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_iterator_bits() {
let filter_values = (0..64).map(|i| i == 1).collect::<Vec<bool>>();
let filter = BooleanArray::from(filter_values);
let iter = SlicesIterator::new(&filter);
let filter_count = iter.filter_count;
let chunks = iter.collect::<Vec<_>>();
assert_eq!(chunks, vec![(1, 2)]);
assert_eq!(filter_count, 1);
} | rust_cleaned_test_functions.jsonl/28236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
13491,
20034,
368,
341,
286,
1077,
4051,
9146,
284,
320,
15,
496,
21,
19,
568,
2186,
22428,
72,
91,
600,
621,
220,
16,
568,
17384,
27638,
10050,
17028,
37038,
286,
1077,
4051,
284,
6992,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diff_identical_content() {
let s = "foo";
let res = diff_file_content(
"foo.el",
s.as_bytes(),
s.as_bytes(),
DEFAULT_NODE_LIMIT,
DEFAULT_BYTE_LIMIT,
);
assert_eq!(res.lhs_positions, vec![]);
assert_eq!(res.rhs_positions, vec![]);
} | rust_cleaned_test_functions.jsonl/17916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
38399,
938,
7495,
368,
341,
286,
1077,
274,
284,
330,
7975,
876,
286,
1077,
592,
284,
3638,
2458,
7495,
1006,
310,
330,
7975,
15851,
756,
310,
274,
5357,
12524,
3148,
310,
274,
5357,
1252... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_leving() {
with_externalities(&mut new_test_ext(), || {
let user = 0;
assert_err!(
Parking::leaving(Origin::signed(user)),
"User has not entered a parking lot"
);
})
} | rust_cleaned_test_functions.jsonl/105204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3449,
287,
368,
341,
286,
448,
47432,
1361,
2099,
6984,
501,
4452,
9927,
1507,
1369,
341,
310,
1077,
1196,
284,
220,
15,
280,
310,
2060,
9266,
33673,
394,
40182,
486,
273,
2317,
7,
13298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_scan() {
let path = Builder::new().prefix("var").tempdir().unwrap();
let cf = "cf";
let engine = RocksEngine::from_db(Arc::new(
raw_util::new_engine(path.path().to_str().unwrap(), None, &[cf], None).unwrap(),
));
engine.put(b"a1", b"v1").unwrap();
engine.put(b"a2", b"v2").unwrap();
engine.put_cf(cf, b"a1", b"v1").unwrap();
engine.put_cf(cf, b"a2", b"v22").unwrap();
let mut data = vec![];
engine
.scan(b"", &[0xFF, 0xFF], false, |key, value| {
data.push((key.to_vec(), value.to_vec()));
Ok(true)
})
.unwrap();
assert_eq!(
data,
vec![
(b"a1".to_vec(), b"v1".to_vec()),
(b"a2".to_vec(), b"v2".to_vec()),
]
);
data.clear();
engine
.scan_cf(cf, b"", &[0xFF, 0xFF], false, |key, value| {
data.push((key.to_vec(), value.to_vec()));
Ok(true)
})
.unwrap();
assert_eq!(
data,
vec![
(b"a1".to_vec(), b"v1".to_vec()),
(b"a2".to_vec(), b"v22".to_vec()),
]
);
data.clear();
let pair = engine.seek(b"a1").unwrap().unwrap();
assert_eq!(pair, (b"a1".to_vec(), b"v1".to_vec()));
assert!(engine.seek(b"a3").unwrap().is_none());
let pair_cf = engine.seek_cf(cf, b"a1").unwrap().unwrap();
assert_eq!(pair_cf, (b"a1".to_vec(), b"v1".to_vec()));
assert!(engine.seek_cf(cf, b"a3").unwrap().is_none());
let mut index = 0;
engine
.scan(b"", &[0xFF, 0xFF], false, |key, value| {
data.push((key.to_vec(), value.to_vec()));
index += 1;
Ok(index != 1)
})
.unwrap();
assert_eq!(data.len(), 1);
let snap = RocksSnapshot::new(engine.get_sync_db());
engine.put(b"a3", b"v3").unwrap();
assert!(engine.seek(b"a3").unwrap().is_some());
let pair = snap.seek(b"a1").unwrap().unwrap();
assert_eq!(pair, (b"a1".to_vec(), b"v1".to_vec()));
assert!(snap.seek(b"a3").unwrap().is_none());
data.clear();
snap.scan(b"", &[0xFF, 0xFF], false, |key, value| {
data.push((key.to_vec(), value.to_vec()));
Ok(true)
})
.unwrap();
assert_eq!(data.len(), 2);
} | rust_cleaned_test_functions.jsonl/23217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
368,
341,
286,
1077,
1815,
284,
20626,
486,
931,
1005,
11849,
445,
947,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
24111,
284,
330,
9792,
876,
286,
1077,
4712,
284,
68031,
4571,
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_place() {
let mut buf = vec![];
{
let mut encoder = BinEncoder::new(&mut buf);
let place = encoder.place::<u16>();
assert_eq!(place.size_of(), 2);
assert_eq!(encoder.len_since_place(&place), 0);
encoder.emit(42_u8).expect("failed 0");
assert_eq!(encoder.len_since_place(&place), 1);
encoder.emit(48_u8).expect("failed 1");
assert_eq!(encoder.len_since_place(&place), 2);
place
.replace(&mut encoder, 4_u16)
.expect("failed to replace");
drop(encoder);
}
assert_eq!(buf.len(), 4);
let mut decoder = BinDecoder::new(&buf);
let written = decoder.read_u16().expect("cound not read u16");
assert_eq!(written, 4);
} | rust_cleaned_test_functions.jsonl/62753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34548,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
15078,
286,
341,
310,
1077,
5206,
23668,
284,
29344,
19921,
486,
931,
2099,
6984,
6607,
317,
310,
1077,
1992,
284,
23668,
24457,
27638,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rmatch_indices() {
let haystack = "111 a 111b";
let needle = "1";
let mut m = haystack.rmatch_indices(needle);
assert_eq!(m.next(), Some((8, "1")));
assert_eq!(m.next(), Some((7, "1")));
assert_eq!(m.next(), Some((6, "1")));
assert_eq!(m.next(), Some((2, "1")));
assert_eq!(m.next(), Some((1, "1")));
assert_eq!(m.next(), Some((0, "1")));
assert_eq!(m.next(), None);
} | rust_cleaned_test_functions.jsonl/19420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
6347,
18333,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
876,
286,
1077,
30309,
284,
330,
16,
876,
286,
1077,
5206,
296,
284,
88447,
1746,
6347,
18333,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constant_eval() {
let dec = "1.1".parse::<Decimal>().unwrap();
let s = "你好".as_bytes().to_owned();
let dur = Duration::parse(&mut EvalContext::default(), b"01:00:00", 0).unwrap();
let tests = vec![
datum_expr(Datum::Null),
datum_expr(Datum::I64(-30)),
datum_expr(Datum::U64(u64::MAX)),
datum_expr(Datum::F64(124.32)),
datum_expr(Datum::Dec(dec)),
datum_expr(Datum::Bytes(s.clone())),
datum_expr(Datum::Dur(dur)),
];
let expecteds = vec![
EvalResults(None, None, None, None, None, None, None),
EvalResults(Some(-30), None, None, None, None, None, None),
EvalResults(Some(-1), None, None, None, None, None, None),
EvalResults(None, Some(124.32), None, None, None, None, None),
EvalResults(None, None, Some(dec), None, None, None, None),
EvalResults(None, None, None, Some(s), None, None, None),
EvalResults(None, None, None, None, None, Some(dur), None),
];
let mut ctx = EvalContext::default();
for (case, expected) in tests.into_iter().zip(expecteds.into_iter()) {
let expr = Expression::build(&mut ctx, case).unwrap();
let int = expr.eval_int(&mut ctx, &[]).unwrap_or(None);
let real = expr.eval_real(&mut ctx, &[]).unwrap_or(None);
let dec = expr
.eval_decimal(&mut ctx, &[])
.unwrap_or(None)
.map(|t| t.into_owned());
let string = expr
.eval_string(&mut ctx, &[])
.unwrap_or(None)
.map(|t| t.into_owned());
let time = expr
.eval_time(&mut ctx, &[])
.unwrap_or(None)
.map(|t| t.into_owned());
let dur = expr.eval_duration(&mut ctx, &[]).unwrap_or(None);
let json = expr
.eval_json(&mut ctx, &[])
.unwrap_or(None)
.map(|t| t.into_owned());
let result = EvalResults(int, real, dec, string, time, dur, json);
assert_eq!(expected, result);
}
} | rust_cleaned_test_functions.jsonl/5040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
21296,
368,
341,
286,
1077,
1622,
284,
330,
16,
13,
16,
3263,
6400,
27638,
11269,
10483,
15454,
543,
286,
1077,
274,
284,
330,
108386,
3263,
300,
12524,
1005,
983,
51973,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_encode_fqdn() {
let name_bytes: &[u8] = b"issueexample.com.";
let header: [u8; 2] = [128, 5];
let encoded: Vec<u8> = header.iter().chain(name_bytes.iter()).map(|b| *b).collect();
test_encode(
CAA::new_issue(
true,
Some(Name::parse("example.com.", None).unwrap()),
vec![],
),
&encoded,
);
} | rust_cleaned_test_functions.jsonl/24521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
761,
80,
17395,
368,
341,
286,
1077,
829,
12524,
25,
44590,
84,
23,
60,
284,
293,
1,
11159,
8687,
905,
15297,
286,
1077,
4247,
25,
508,
84,
23,
26,
220,
17,
60,
284,
508,
16,
17,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transcribes_adenine_uracil() {
assert_eq!(dna::RibonucleicAcid::new("U"), dna::DeoxyribonucleicAcid::new("A").to_rna());
} | rust_cleaned_test_functions.jsonl/36948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
55136,
10027,
268,
482,
64879,
580,
321,
368,
341,
262,
2060,
10714,
10297,
92877,
486,
98884,
263,
22147,
292,
11654,
307,
486,
931,
445,
52,
3975,
75334,
486,
1912,
60163,
1897,
263,
22147... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 datatypes = vec![
DataType::Int32,
DataType::Float64,
DataType::Utf8,
DataType::Binary,
DataType::List(Box::new(Field::new("a", DataType::Binary, true))),
];
let a = datatypes
.into_iter()
.all(|x| clone(new_null_array(x.clone(), 10).as_ref()) == new_null_array(x, 10));
assert!(a);
} | rust_cleaned_test_functions.jsonl/97520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
286,
1077,
3258,
60913,
284,
7486,
90515,
310,
33172,
486,
1072,
18,
17,
345,
310,
33172,
486,
5442,
21,
19,
345,
310,
33172,
486,
38980,
23,
345,
310,
33172,
486,
21338,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highlights_simple_main() -> Result<(), Error> {
let src = r#"package main
import "fmt"
func main() {
fmt.Println("Hello, world", 5)
}
"#;
let document = index_language("go", src)?;
insta::assert_snapshot!(dump_document(&document, src));
Ok(())
} | rust_cleaned_test_functions.jsonl/84246 | {
"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,
22680,
13826,
30015,
11027,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
2286,
284,
435,
55543,
1722,
1887,
198,
474,
330,
12501,
1837,
2830,
1887,
368,
341,
11009,
12419,
445,
9707,
11,
1879... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_openpty() {
let _m = crate::PTSNAME_MTX.lock();
let pty = openpty(None, None).unwrap();
assert!(pty.master > 0);
assert!(pty.slave > 0);
// Writing to one should be readable on the other one
let string = "foofoofoo\n";
let mut buf = [0u8; 10];
write(pty.master, string.as_bytes()).unwrap();
crate::read_exact(pty.slave, &mut buf);
assert_eq!(&buf, string.as_bytes());
// Read the echo as well
let echoed_string = "foofoofoo\r\n";
let mut buf = [0u8; 11];
crate::read_exact(pty.master, &mut buf);
assert_eq!(&buf, echoed_string.as_bytes());
let string2 = "barbarbarbar\n";
let echoed_string2 = "barbarbarbar\r\n";
let mut buf = [0u8; 14];
write(pty.slave, string2.as_bytes()).unwrap();
crate::read_exact(pty.master, &mut buf);
assert_eq!(&buf, echoed_string2.as_bytes());
close(pty.master).unwrap();
close(pty.slave).unwrap();
} | rust_cleaned_test_functions.jsonl/72582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
1595,
368,
341,
1066,
262,
1077,
716,
76,
284,
17717,
486,
73693,
7535,
1245,
22867,
21003,
1428,
262,
1077,
281,
1881,
284,
1787,
1595,
26717,
11,
2240,
568,
15454,
543,
262,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_eq1() {
let mut s = Stack::new();
s.push(Elt::Int(1)).unwrap();
s.push(Elt::Int(1)).unwrap();
assert!(s.eval(Op::Eq).is_ok());
assert_eq!(s.pop().unwrap(), Elt::Bool(true));
} | rust_cleaned_test_functions.jsonl/34520 | {
"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,
21296,
10714,
16,
368,
341,
286,
1077,
5206,
274,
284,
14284,
486,
931,
543,
286,
274,
2552,
10722,
4832,
486,
1072,
7,
16,
4579,
15454,
543,
286,
274,
2552,
10722,
4832,
486,
1072,
7,
16,
457... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skipping_containers() -> IonResult<()> {
let ion_data = r#"
0 [1, 2, 3] (4 5) 6
"#;
let reader = &mut RawTextReader::new(ion_data);
next_type(reader, IonType::Integer, false);
assert_eq!(reader.read_i64()?.unwrap(), 0);
next_type(reader, IonType::List, false);
reader.step_in()?;
next_type(reader, IonType::Integer, false);
assert_eq!(reader.read_i64()?.unwrap(), 1);
reader.step_out()?;
next_type(reader, IonType::SExpression, false);
next_type(reader, IonType::Integer, false);
assert_eq!(reader.read_i64()?.unwrap(), 6);
Ok(())
} | rust_cleaned_test_functions.jsonl/6503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
5654,
10260,
20568,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
27672,
1769,
284,
435,
2,
698,
310,
220,
15,
508,
16,
11,
220,
17,
11,
220,
18,
60,
320,
19,
220,
20,
8,
220,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_write_too_many_bytes() {
let mut b = BufferBuilder::<i32>::new(0);
let bytes = [8, 16, 32, 64].to_byte_slice();
b.write_bytes(bytes, 4).unwrap();
} | rust_cleaned_test_functions.jsonl/127622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
2346,
78,
22101,
12524,
368,
341,
286,
1077,
5206,
293,
284,
10312,
3297,
27638,
72,
18,
17,
6831,
931,
7,
15,
317,
286,
1077,
5820,
284,
508,
23,
11,
220,
16,
21,
11,
220,
18,
17,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_authorize_url_with_one_scope() {
let (url, _) = new_client()
.authorize_url(|| CsrfToken::new("csrf_token".to_string()))
.add_scope(Scope::new("read".to_string()))
.url();
assert_eq!(
Url::parse(
"https://example.com/auth\
?response_type=code\
&client_id=aaa\
&state=csrf_token\
&scope=read"
)
.unwrap(),
url
);
} | rust_cleaned_test_functions.jsonl/18587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
2903,
6615,
11667,
23199,
368,
341,
262,
1077,
320,
1085,
11,
27439,
284,
501,
8179,
741,
286,
659,
52022,
2903,
79453,
67332,
8052,
3323,
486,
931,
445,
24102,
6458,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_init() {
let dir = tempfile::tempdir().unwrap();
assert!(!dir.path().join(".protovend.yml").exists());
let status = command(&dir).arg("update").status().unwrap();
assert!(!status.success());
assert!(!dir.path().join(".protovend.yml").exists());
} | rust_cleaned_test_functions.jsonl/11210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
6536,
6137,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
2060,
0,
3471,
3741,
3875,
1005,
5987,
5680,
4391,
859,
408,
33936,
1827,
16304,
5231,
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_low_char_vec() {
let l = Line::from("FOOBAR");
for (i, c) in l.low_char_vec {
assert_eq!(
match i {
0 => 'f',
3 => 'b',
4 => 'a',
5 => 'r',
_ => 'o',
},
c
);
}
} | rust_cleaned_test_functions.jsonl/76067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23767,
9232,
13251,
368,
341,
286,
1077,
326,
284,
7083,
486,
1499,
445,
3788,
20608,
934,
797,
286,
369,
320,
72,
11,
272,
8,
304,
326,
56553,
9232,
13251,
341,
310,
2060,
10714,
33673,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error_info() {
let mut c = Compiler::new();
c.set_file("hello.html");
c.set_line(1);
c.add(Instruction::EmitRaw("<h1>Hello</h1>\n"));
c.set_line(2);
c.add(Instruction::Lookup("a_string"));
c.add(Instruction::Lookup("an_int"));
c.add(Instruction::Add);
let mut ctx = std::collections::BTreeMap::new();
ctx.insert("a_string", Value::from("foo"));
ctx.insert("an_int", Value::from(42));
let err = simple_eval(&c.finish().0, ctx, &mut String::new()).unwrap_err();
assert_eq!(err.name(), Some("hello.html"));
assert_eq!(err.line(), Some(2));
} | rust_cleaned_test_functions.jsonl/72125 | {
"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,
4096,
3109,
368,
341,
262,
1077,
5206,
272,
284,
45631,
486,
931,
543,
262,
272,
980,
2458,
445,
14990,
2564,
797,
262,
272,
980,
6528,
7,
16,
317,
262,
272,
1364,
7,
16664,
486,
36,
1763,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dont_need_username_password_if_pushurl_ssh() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path: &RepoPath =
&root.as_os_str().to_str().unwrap().into();
repo.remote(DEFAULT_REMOTE_NAME, "http://user@github.com")
.unwrap();
repo.remote_set_pushurl(
DEFAULT_REMOTE_NAME,
Some("git@github.com:user/repo"),
)
.unwrap();
assert_eq!(need_username_password(repo_path).unwrap(), false);
} | rust_cleaned_test_functions.jsonl/101755 | {
"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,
814,
544,
71506,
21588,
10122,
11119,
14218,
1085,
82805,
368,
341,
197,
10217,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
197,
10217,
3704,
284,
15867,
3875,
1005,
3765,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_demo_1() {
let network = create_cave_network(vec![
"start-A",
"start-b",
"A-c",
"A-b",
"b-d",
"A-end",
"b-end"
]);
let start_cave = network["start"].clone();
let end_cave = network["end"].clone();
let paths = find_paths(&network, start_cave.clone(), end_cave.clone());
assert_eq!(36, paths.len());
} | rust_cleaned_test_functions.jsonl/70741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
47830,
62,
16,
368,
341,
286,
1077,
3922,
284,
1855,
666,
523,
20966,
25592,
90515,
310,
330,
2468,
6691,
756,
310,
330,
2468,
1455,
756,
310,
330,
32,
1786,
756,
310,
330,
32,
1455,
756... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_band_add_entry() {
let mut band = banded::Band::new(10, 10);
band.add_entry((3u32, 3u32), 3usize);
assert_eq!(
band.ranges,
[
0..7,
0..7,
0..7,
0..7,
0..7,
0..7,
0..7,
11..0,
11..0,
11..0,
11..0,
]
);
band.add_entry((9u32, 9u32), 2usize);
assert_eq!(
band.ranges,
[
0..7,
0..7,
0..7,
0..7,
0..7,
0..7,
0..7,
7..11,
7..11,
7..11,
7..11,
]
);
band.add_entry((7u32, 5u32), 2usize);
assert_eq!(
band.ranges,
[
0..7,
0..7,
0..7,
0..10,
0..10,
0..10,
0..10,
5..11,
7..11,
7..11,
7..11,
]
);
let mut band = banded::Band::new(10, 10);
band.add_entry((0u32, 0u32), 2usize);
assert_eq!(
band.ranges,
[
0..3,
0..3,
0..3,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
]
);
let mut band = banded::Band::new(10, 10);
band.add_entry((10u32, 10u32), 2usize);
assert_eq!(
band.ranges,
[
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
8..11,
8..11,
8..11,
]
);
let mut band = banded::Band::new(10, 10);
band.add_entry((10u32, 0u32), 2usize);
assert_eq!(
band.ranges,
[
8..11,
8..11,
8..11,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
]
);
let mut band = banded::Band::new(10, 10);
band.add_entry((0u32, 10u32), 2usize);
assert_eq!(
band.ranges,
[
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
11..0,
0..3,
0..3,
0..3,
]
);
band.stat();
} | rust_cleaned_test_functions.jsonl/126724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45344,
2891,
9078,
368,
341,
286,
1077,
5206,
7055,
284,
293,
6465,
486,
33744,
486,
931,
7,
16,
15,
11,
220,
16,
15,
317,
286,
7055,
1364,
9078,
1188,
18,
84,
18,
17,
11,
220,
18,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_path() {
assert_eq!(map_path("/".into()), Utf8Path::new("/"));
assert_eq!(
map_path("./usr/etc/blah".into()),
Utf8Path::new("./etc/blah")
);
} | rust_cleaned_test_functions.jsonl/42840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
2638,
368,
341,
286,
2060,
10714,
10297,
2186,
2638,
4283,
3263,
18122,
11858,
43432,
23,
1820,
486,
931,
4283,
4010,
286,
2060,
10714,
33673,
310,
2415,
2638,
13988,
7063,
47047,
14,
70614,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_attribute_refaddr_version2() {
let buf = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x99, 0x99];
let mut unit = test_parse_attribute_unit(4, Format::Dwarf32, LittleEndian);
unit.encoding.version = 2;
let form = constants::DW_FORM_ref_addr;
let value = AttributeValue::DebugInfoRef(DebugInfoOffset(0x0403_0201));
test_parse_attribute(&buf, 4, &unit, form, value);
} | rust_cleaned_test_functions.jsonl/102037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16791,
7793,
6214,
9438,
17,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
19,
11,
220,
15,
87,
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_move_prefix() {
TestExternalities::new_empty().execute_with(|| {
OldStorageValue::put(3);
OldStorageMap::insert(1, 2);
OldStorageMap::insert(3, 4);
move_prefix(&Twox128::hash(b"my_old_pallet"), &Twox128::hash(b"my_new_pallet"));
assert_eq!(OldStorageValue::get(), None);
assert_eq!(OldStorageMap::iter().collect::<Vec<_>>(), vec![]);
assert_eq!(NewStorageValue::get(), Some(3));
assert_eq!(NewStorageMap::iter().collect::<Vec<_>>(), vec![(1, 2), (3, 4)]);
})
} | rust_cleaned_test_functions.jsonl/68267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
13974,
368,
341,
197,
73866,
25913,
1361,
486,
931,
15124,
1005,
10257,
6615,
79453,
341,
298,
197,
18284,
5793,
1130,
486,
628,
7,
18,
317,
298,
197,
18284,
5793,
2227,
486,
4208,
7,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.