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_type() {
assert_eq!(
runner().err(
"@use \'sass:color\';\
\na {b: color.hwb(0 30% \"foo\")}\n"
),
"Error: $blackness: \"foo\" is not a number.\
\n ,\
\n2 | a {b: color.hwb(0 30% \"foo\")}\
\n | ^^^^^^^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 2:7 root stylesheet",
);
} | rust_cleaned_test_functions.jsonl/84815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
368,
341,
286,
2060,
10714,
33673,
310,
22259,
1005,
615,
1006,
394,
8428,
810,
27152,
60326,
25,
3423,
59,
6967,
5661,
1797,
1124,
3376,
314,
65,
25,
1894,
860,
20211,
7,
15,
220,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tmp_files_deleted_on_sigint() {
use std::{fs::read_dir, time::Duration};
use nix::{sys::signal, unistd::Pid};
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("tmp_dir");
ucmd.args(&[
"ext_sort.txt",
"--buffer-size=1", // with a small buffer size `sort` will be forced to create a temporary directory very soon.
"--temporary-directory=tmp_dir",
]);
let mut child = ucmd.run_no_wait();
// wait a short amount of time so that `sort` can create a temporary directory.
std::thread::sleep(Duration::from_millis(100));
// `sort` should have created a temporary directory.
assert!(read_dir(at.plus("tmp_dir")).unwrap().next().is_some());
// kill sort with SIGINT
signal::kill(Pid::from_raw(child.id() as i32), signal::SIGINT).unwrap();
// wait for `sort` to exit
assert_eq!(child.wait().unwrap().code(), Some(2));
// `sort` should have deleted the temporary directory again.
assert!(read_dir(at.plus("tmp_dir")).unwrap().next().is_none());
} | rust_cleaned_test_functions.jsonl/20550 | {
"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,
16125,
10931,
39418,
4470,
29252,
396,
368,
341,
262,
990,
1460,
22964,
3848,
486,
878,
4334,
11,
882,
486,
12945,
2315,
262,
990,
308,
941,
22964,
7791,
486,
26622,
11,
650,
380,
67,
486,
32339... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_index_expression() {
let exp = statement_expression("myArray[1 + 1]");
let (array, index) = match exp {
Expression::Index {
container, index, ..
} => (*container, *index),
other => panic!("Not an array: {:?}", other),
};
match array {
Expression::Identifier(..) => {}
other => panic!("Expected array literal, but got: {:?}", other),
}
match index {
Expression::Infix { .. } => {}
other => panic!("Expected infix, but got: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/64076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
3560,
28068,
368,
341,
286,
1077,
1343,
284,
5114,
28068,
445,
2408,
1857,
58,
16,
488,
220,
16,
60,
3071,
286,
1077,
320,
1653,
11,
1922,
8,
284,
2432,
1343,
341,
310,
16378,
486,
1552,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_split_100_percent_of_source() {
let stake_pubkey = Pubkey::new_rand();
let stake_lamports = 42;
let rent_exempt_reserve = 10;
let split_stake_pubkey = Pubkey::new_rand();
let signers = vec![stake_pubkey].into_iter().collect();
let meta = Meta {
authorized: Authorized::auto(&stake_pubkey),
rent_exempt_reserve,
..Meta::default()
};
// test splitting both an Initialized stake and a Staked stake
for state in &[
StakeState::Initialized(meta),
StakeState::Stake(
meta,
Stake::just_stake(stake_lamports - rent_exempt_reserve),
),
] {
let split_stake_account = Account::new_ref_data_with_space(
0,
&StakeState::Uninitialized,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let split_stake_keyed_account =
KeyedAccount::new(&split_stake_pubkey, true, &split_stake_account);
let stake_account = Account::new_ref_data_with_space(
stake_lamports,
state,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.split(stake_lamports, &split_stake_keyed_account, &signers),
Ok(())
);
// no lamport leakage
assert_eq!(
stake_keyed_account.account.borrow().lamports
+ split_stake_keyed_account.account.borrow().lamports,
stake_lamports
);
match state {
StakeState::Initialized(_) => {
assert_eq!(Ok(*state), split_stake_keyed_account.state());
assert_eq!(Ok(*state), stake_keyed_account.state());
}
StakeState::Stake(meta, stake) => {
assert_eq!(
Ok(StakeState::Stake(
*meta,
Stake {
delegation: Delegation {
stake: stake_lamports - rent_exempt_reserve,
..stake.delegation
},
..*stake
}
)),
split_stake_keyed_account.state()
);
assert_eq!(
Ok(StakeState::Stake(
*meta,
Stake {
delegation: Delegation {
stake: 0,
..stake.delegation
},
..*stake
}
)),
stake_keyed_account.state()
);
}
_ => unreachable!(),
}
// reset
stake_keyed_account.account.borrow_mut().lamports = stake_lamports;
}
} | rust_cleaned_test_functions.jsonl/39456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
62,
16,
15,
15,
29883,
3575,
10347,
368,
341,
286,
1077,
18279,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
1077,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encode() {
// Given
let vocab = generate_test_vocab();
let merges = generate_test_merges();
let openai_gpt_tokenizer: OpenAiGptTokenizer =
OpenAiGptTokenizer::from_existing_vocab_and_merges(vocab, merges, true);
let truncation_strategy = TruncationStrategy::LongestFirst;
let test_tuples = [
(
"the earth",
TokenizedInput {
token_ids: vec![8, 10, 9],
segment_ids: vec![0, 0, 0],
special_tokens_mask: vec![0, 0, 0],
overflowing_tokens: vec![],
num_truncated_tokens: 0,
token_offsets: vec![
Some(Offset { begin: 0, end: 3 }),
Some(Offset { begin: 4, end: 6 }),
Some(Offset { begin: 6, end: 9 }),
],
reference_offsets: vec![vec![0, 1, 2], vec![4, 5], vec![6, 7, 8]],
mask: vec![Mask::None, Mask::Begin, Mask::Continuation],
},
),
(
" ",
TokenizedInput {
token_ids: vec![],
segment_ids: vec![],
special_tokens_mask: vec![],
overflowing_tokens: vec![],
num_truncated_tokens: 0,
token_offsets: vec![],
reference_offsets: vec![],
mask: vec![],
},
),
(
"",
TokenizedInput {
token_ids: vec![],
segment_ids: vec![],
special_tokens_mask: vec![],
overflowing_tokens: vec![],
num_truncated_tokens: 0,
token_offsets: vec![],
reference_offsets: vec![],
mask: vec![],
},
),
];
let source_texts: Vec<&str> = test_tuples.iter().map(|v| v.0).collect();
let expected_results: Vec<TokenizedInput> =
test_tuples.iter().map(|v| v.1.clone()).collect();
for (source_text, expected_result) in test_tuples.iter() {
assert_eq!(
openai_gpt_tokenizer.encode(source_text, None, 128, &truncation_strategy, 0),
*expected_result
);
}
assert_eq!(
MultiThreadedTokenizer::encode_list(
&openai_gpt_tokenizer,
&source_texts,
128,
&truncation_strategy,
0
),
expected_results
);
} | rust_cleaned_test_functions.jsonl/114296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
368,
341,
286,
442,
286,
16246,
198,
286,
1077,
23820,
284,
6923,
4452,
52823,
543,
286,
1077,
80953,
284,
6923,
4452,
717,
2375,
288,
543,
286,
1077,
1787,
2143,
1889,
417,
6458,
3135,
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_convert_str_indices_non_ascii() {
assert_eq!(
Some(StrIndices {
start: CharIndex(6),
haystack: "под",
}),
convert_str_indices("Город под подошвой", NoneOr::Other(6), NoneOr::Other(9))
)
} | rust_cleaned_test_functions.jsonl/101241 | {
"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,
34910,
2895,
18333,
21637,
50238,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
92084,
31941,
341,
394,
1191,
25,
4864,
1552,
7,
21,
1326,
394,
88447,
25,
330,
127287,
756,
310,
11973,
310,
5508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_terminated_syntax() {
new_ucmd!()
.args(&["-z", "-n", "1"])
.pipe_in("x\0y")
.run()
.stdout_is("x\0");
} | rust_cleaned_test_functions.jsonl/32766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
62,
68659,
78894,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
89,
497,
6523,
77,
497,
330,
16,
14108,
286,
659,
13768,
1243,
445,
87,
59,
15,
88,
1138,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sending_snapshot_set_pending_snapshot() {
let l = default_logger();
let mut sm = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
sm.restore(testing_snap());
sm.persist();
sm.become_candidate();
sm.become_leader();
// node 1 needs a snapshot
sm.mut_prs().get_mut(2).unwrap().next_idx = sm.raft_log.first_index();
let mut m = new_message(2, 1, MessageType::MsgAppendResponse, 0);
{
let voter_2 = sm.prs().get(2).unwrap();
m.index = voter_2.next_idx - 1;
m.reject = true;
};
sm.step(m).expect("");
assert_eq!(sm.prs().get(2).unwrap().pending_snapshot, 11);
} | rust_cleaned_test_functions.jsonl/43881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2459,
53265,
2602,
37861,
53265,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
1525,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ixdyn_iterate() {
for &rev in &[false, true] {
let mut a = Array::zeros((2, 3, 4).set_f(rev));
let dim = a.shape().to_vec();
for (i, elt) in a.iter_mut().enumerate() {
*elt = i;
}
println!("{:?}", a.dim());
let mut a = a.into_shape(dim).unwrap();
println!("{:?}", a.dim());
let mut c = 0;
for (i, elt) in a.iter_mut().enumerate() {
assert_eq!(i, *elt);
c += 1;
}
assert_eq!(c, a.len());
}
} | rust_cleaned_test_functions.jsonl/44832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62686,
43085,
11723,
349,
368,
341,
262,
369,
609,
7282,
304,
44590,
3849,
11,
830,
60,
341,
286,
1077,
5206,
264,
284,
2910,
486,
35716,
1188,
17,
11,
220,
18,
11,
220,
19,
568,
746,
761,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_polytope_add() {
let mut simplex = vec![
sup(3., -3., -1.),
sup(-3., -3., -1.),
sup(0., 3., -1.),
sup(0., 0., 5.),
];
let mut polytope = Polytope::new(&mut simplex);
polytope.add(sup(0., 0., -2.));
assert_eq!(5, polytope.vertices.len());
assert_eq!(6, polytope.faces.len());
assert_eq!([4, 2, 0], polytope.faces[3].vertices);
assert_eq!([4, 0, 1], polytope.faces[4].vertices);
assert_eq!([4, 1, 2], polytope.faces[5].vertices);
} | rust_cleaned_test_functions.jsonl/5109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36133,
983,
375,
2891,
368,
341,
286,
1077,
5206,
91651,
284,
7486,
90515,
310,
1026,
7,
18,
2572,
481,
18,
2572,
481,
16,
13,
1326,
310,
1026,
4080,
18,
2572,
481,
18,
2572,
481,
16,
13,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_literal_for_tuple() {
check(
r#"
struct Foo<|>(i32);
fn main() {
let f: Foo;
f = Foo(1);
}
"#,
expect![[r#"
Foo Struct FileId(0) 0..16 7..10 Other
FileId(0) 54..57 StructLiteral
"#]],
);
} | rust_cleaned_test_functions.jsonl/47764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
34100,
5478,
21773,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
33428,
27,
91,
2235,
72,
18,
17,
626,
8822,
1887,
368,
341,
262,
1077,
282,
25,
33428,
280,
262,
282,
284,
33428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_range_expr() {
// Test that the generated predicate is correct
let range = TimestampRange::new(101, 202);
let ts_predicate_expr = make_range_expr(&range);
let expected_string = "Int64(101) LtEq #time And #time Lt Int64(202)";
let actual_string = format!("{:?}", ts_predicate_expr);
assert_eq!(actual_string, expected_string);
} | rust_cleaned_test_functions.jsonl/44584 | {
"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,
28230,
9698,
21915,
368,
341,
286,
442,
3393,
429,
279,
7907,
24283,
374,
4396,
271,
286,
1077,
2088,
284,
32758,
6046,
486,
931,
7,
16,
15,
16,
11,
220,
17,
15,
17,
626,
286,
1077,
10591,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pong_frame() {
let frame = Frame::message(Vec::from("data"), OpCode::Pong, true, false);
let mut v = vec![138u8, 4u8];
v.extend(b"data");
assert_eq!(frame.0, v.into());
} | rust_cleaned_test_functions.jsonl/55895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
59102,
8929,
368,
341,
286,
1077,
4034,
284,
16321,
486,
1994,
49923,
486,
1499,
445,
691,
3975,
97779,
486,
47,
644,
11,
830,
11,
895,
626,
286,
1077,
5206,
348,
284,
7486,
20703,
16,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rtrim() {
let test_cases = vec![
(None, None),
(Some(" bar "), Some(" bar")),
(Some("bar"), Some("bar")),
(Some("ba r"), Some("ba r")),
(Some(" "), Some("")),
(Some(" bar\t "), Some(" bar\t")),
(Some(" bar \t"), Some(" bar \t")),
(Some("bar \r"), Some("bar \r")),
(Some("bar \n"), Some("bar \n")),
(Some(""), Some("")),
(Some(" 你好 "), Some(" 你好")),
(Some(" 你 好 "), Some(" 你 好")),
(Some(" 분산 데이터베이스 "), Some(" 분산 데이터베이스")),
(
Some(" あなたのことが好きです "),
Some(" あなたのことが好きです"),
),
];
for (arg, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg.map(|s| s.as_bytes().to_vec()))
.evaluate(ScalarFuncSig::RTrim)
.unwrap();
assert_eq!(output, expect_output.map(|s| s.as_bytes().to_vec()));
}
} | rust_cleaned_test_functions.jsonl/10161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
10666,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
1326,
310,
320,
8373,
445,
256,
3619,
256,
59312,
4329,
445,
256,
3619,
30154,
310,
320,
8373,
445,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_copied_file() {
let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(GIT_DIFF_WITH_COPIED_FILE, &config);
let output = strip_ansi_codes(&output);
assert!(test_utils::contains_once(
&output,
"\ncopied: first_file ⟶ copied_file\n"
));
} | rust_cleaned_test_functions.jsonl/70039 | {
"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,
666,
453,
1122,
2458,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
56703,
286,
1077,
2550,
284,
17590,
4452,
17309,
486,
6108,
26710,
6699,
952,
53984,
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_sorting_large() -> Result<()> {
let size = 20;
let address_bits = 20;
let timestamp_bits = 20;
test_sorting(size, address_bits, timestamp_bits)
} | rust_cleaned_test_functions.jsonl/114791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
287,
45228,
368,
1464,
5714,
71698,
341,
286,
1077,
1379,
284,
220,
17,
15,
280,
286,
1077,
2621,
20034,
284,
220,
17,
15,
280,
286,
1077,
11441,
20034,
284,
220,
17,
15,
401,
286,
1273... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iterate_string_vec() {
let words = vec!["hello", "world"];
let capitalized_words: Vec<String> = capitalize_first_1(words);
assert_eq!(capitalized_words, ["Hello", "World"]);
} | rust_cleaned_test_functions.jsonl/129564 | {
"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,
11723,
349,
3904,
13251,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
11312,
3464,
29,
284,
52725,
12978,
62,
16,
36289,
317,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_metadata_full_empty() {
let mut buffer = buffer();
assert_eq!(buffer.is_empty(), true);
assert_eq!(buffer.is_full(), false);
assert!(buffer.enqueue(1, ()).is_ok());
assert_eq!(buffer.is_empty(), false);
assert!(buffer.enqueue(1, ()).is_ok());
assert!(buffer.enqueue(1, ()).is_ok());
assert_eq!(buffer.is_full(), false);
assert_eq!(buffer.is_empty(), false);
assert!(buffer.enqueue(1, ()).is_ok());
assert_eq!(buffer.is_full(), true);
assert_eq!(buffer.is_empty(), false);
assert_eq!(buffer.metadata_ring.len(), 4);
assert_eq!(buffer.enqueue(1, ()), Err(Error::Exhausted));
} | rust_cleaned_test_functions.jsonl/109628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
16372,
15124,
368,
341,
286,
1077,
5206,
4147,
284,
4147,
543,
286,
2060,
10714,
10297,
7573,
2079,
15124,
1507,
830,
317,
286,
2060,
10714,
10297,
7573,
2079,
16372,
1507,
895,
317,
286,
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_line_buffer() {
let mut writer = LineBufferedWriter::new(MemWriter::new());
writer.write([0]).unwrap();
assert_eq!(writer.get_ref().get_ref(), &[]);
writer.write([1]).unwrap();
assert_eq!(writer.get_ref().get_ref(), &[]);
writer.flush().unwrap();
assert_eq!(writer.get_ref().get_ref(), &[0, 1]);
writer.write([0, '\n' as u8, 1, '\n' as u8, 2]).unwrap();
assert_eq!(writer.get_ref().get_ref(),
&[0, 1, 0, '\n' as u8, 1, '\n' as u8]);
writer.flush().unwrap();
assert_eq!(writer.get_ref().get_ref(),
&[0, 1, 0, '\n' as u8, 1, '\n' as u8, 2]);
writer.write([3, '\n' as u8]).unwrap();
assert_eq!(writer.get_ref().get_ref(),
&[0, 1, 0, '\n' as u8, 1, '\n' as u8, 2, 3, '\n' as u8]);
} | rust_cleaned_test_functions.jsonl/115536 | {
"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,
6528,
7776,
368,
341,
286,
1077,
5206,
6916,
284,
7083,
4095,
291,
6492,
486,
931,
3189,
336,
6492,
486,
931,
1423,
286,
6916,
3836,
2561,
15,
10697,
15454,
543,
286,
2060,
10714,
10297,
18189,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_with_nested_integer_map() {
let data = vec![0x81, 0xA1, 0x01, 0xA1, 0x02, 0x03];
let parsed: ParsedArray<super::ParsedArraySize1> =
ParsedArray::deserialize_data(&data).expect("Failed to parse");
assert_eq!(
parsed.raw_values(),
vec![vec![0xA1, 0x01, 0xA1, 0x02, 0x03]]
);
assert_eq!(
parsed.get::<HashMap<u8, HashMap<u8, u8>>>(0).unwrap(),
maplit::hashmap! {1 => maplit::hashmap! {2 => 3}}
);
assert_eq!(parsed.tag(), None);
let serialized = parsed.serialize_data().expect("Failed to serialize");
assert_eq!(serialized, data);
} | rust_cleaned_test_functions.jsonl/10827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
6615,
66279,
31725,
5376,
368,
341,
286,
1077,
821,
284,
7486,
20703,
15,
87,
23,
16,
11,
220,
15,
14673,
16,
11,
220,
15,
87,
15,
16,
11,
220,
15,
14673,
16,
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_address_allowed() {
let public_key = KeyPair::random().public_key();
let address = "127.0.0.1:80".to_owned();
let mut connect_list = ConnectList::default();
assert!(connect_list
.peers
.values()
.all(|peer_addr| *peer_addr != address));
connect_list.add(ConnectInfo {
public_key,
address: address.clone(),
});
assert!(connect_list
.peers
.values()
.any(|peer_addr| *peer_addr == address));
} | rust_cleaned_test_functions.jsonl/28575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
42155,
368,
341,
286,
1077,
584,
3097,
284,
5309,
12443,
486,
11463,
1005,
888,
3097,
543,
286,
1077,
2621,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
23,
15,
3263,
983,
51973,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_bytes() {
assert_eq!(
Scalar::from_bytes_le(&[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0
])
.unwrap(),
Scalar::zero()
);
assert_eq!(
Scalar::from_bytes_le(&[
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0
])
.unwrap(),
Scalar::one()
);
assert_eq!(
Scalar::from_bytes_le(&[
254, 255, 255, 255, 1, 0, 0, 0, 2, 72, 3, 0, 250, 183, 132, 88, 245, 79, 188, 236,
239, 79, 140, 153, 111, 5, 197, 172, 89, 177, 36, 24
])
.unwrap(),
Scalar::from_repr(R2).unwrap(),
);
// -1 should work
assert!(Scalar::from_bytes_le(&[
0, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, 5, 216, 161, 9, 8,
216, 57, 51, 72, 125, 157, 41, 83, 167, 237, 115
])
.is_some());
// modulus is invalid
assert!(Scalar::from_bytes_le(&[
1, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, 5, 216, 161, 9, 8,
216, 57, 51, 72, 125, 157, 41, 83, 167, 237, 115
])
.is_none());
// Anything larger than the modulus is invalid
assert!(Scalar::from_bytes_le(&[
2, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, 5, 216, 161, 9, 8,
216, 57, 51, 72, 125, 157, 41, 83, 167, 237, 115
])
.is_none());
assert!(Scalar::from_bytes_le(&[
1, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, 5, 216, 161, 9, 8,
216, 58, 51, 72, 125, 157, 41, 83, 167, 237, 115
])
.is_none());
assert!(Scalar::from_bytes_le(&[
1, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, 5, 216, 161, 9, 8,
216, 57, 51, 72, 125, 157, 41, 83, 167, 237, 116
])
.is_none());
} | rust_cleaned_test_functions.jsonl/56376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
368,
341,
286,
2060,
10714,
33673,
310,
35176,
486,
1499,
12524,
11751,
2099,
9640,
394,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_irc_entry() {
let entry = IrcEntry::new("Kuu".to_string(), "nya nya!".to_string());
assert!(entry.nickname == "Kuu");
assert!(entry.message == "nya nya!");
} | rust_cleaned_test_functions.jsonl/33847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2437,
9078,
368,
341,
286,
1077,
4343,
284,
358,
1287,
5874,
486,
931,
445,
42,
30072,
3263,
983,
3904,
1507,
330,
22891,
75189,
92993,
983,
3904,
5231,
286,
2060,
10297,
4085,
67521,
621,
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 |
#[test]
fn test_metrics() {
// This is just a check that metrics work and actually notice requests.
// Need to send a cassandra query that will produce a positive number for the min_us metric
// so that they don't fail if this test is repeated.
let query1 = stmt!(
"CREATE KEYSPACE IF NOT EXISTS cycling WITH REPLICATION = {
'class' : 'SimpleStrategy',
'replication_factor' : 1
};"
);
let query2 = stmt!(
"CREATE TABLE IF NOT EXISTS cycling.cyclist_name (
id UUID PRIMARY KEY,
lastname text,
firstname text );"
); //create table
let query3 = stmt!(
"INSERT INTO cycling.cyclist_name (id, lastname, firstname)
VALUES (6ab09bec-e68e-48d9-a5f8-97e6fb4c9b47, 'KRUIKSWIJK','Steven')
USING TTL 86400 AND TIMESTAMP 123456789;"
);
let session = help::create_test_session();
session.execute(&query1).wait().unwrap();
session.execute(&query2).wait().unwrap();
session.execute(&query3).wait().unwrap();
let metrics = session.get_metrics();
assert_eq!(metrics.total_connections, 1);
assert!(metrics.min_us > 0);
} | rust_cleaned_test_functions.jsonl/39937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37686,
368,
341,
262,
442,
1096,
374,
1101,
264,
1779,
429,
16734,
975,
323,
3520,
5293,
7388,
624,
262,
442,
14656,
311,
3624,
264,
44224,
23274,
3239,
429,
686,
8193,
264,
6785,
1372,
369,
279... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_local_after_snapshpot_replace_peer() {
let mut cluster = new_node_cluster(0, 3);
configure_for_lease_read(&mut cluster, Some(50), None);
cluster.cfg.raft_store.raft_log_gc_threshold = 12;
cluster.cfg.raft_store.raft_log_gc_count_limit = 12;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
let region_id = cluster.run_conf_change();
pd_client.must_add_peer(region_id, new_peer(2, 2));
pd_client.must_add_peer(region_id, new_peer(3, 3));
cluster.must_transfer_leader(1, new_peer(1, 1));
cluster.must_put(b"k1", b"v1");
for i in 1..=3 {
must_get_equal(&cluster.get_engine(i), b"k1", b"v1");
}
// it is okey only send one request because the read pool thread count is 1
let r = cluster.get_region(b"k1");
// wait applying snapshot finish
sleep_ms(100);
let resp = async_read_on_peer(&mut cluster, new_peer(3, 3), r, b"k1", true, true);
let resp = resp.recv_timeout(Duration::from_secs(1)).unwrap();
assert_eq!(resp.get_responses()[0].get_get().get_value(), b"v1");
// trigger leader send snapshot to peer 3
cluster.add_send_filter(IsolationFilterFactory::new(3));
for i in 0..12 {
cluster.must_put(format!("k2{}", i).as_bytes(), b"v2");
}
cluster.clear_send_filters();
// wait peer 3 apply snapshot and replace the `ReadDelegate` on `StoreMeta`
must_get_equal(&cluster.get_engine(3), b"k20", b"v2");
// replace peer 3 with peer 1003
cluster
.pd_client
.must_remove_peer(region_id, new_peer(3, 3));
cluster
.pd_client
.must_add_peer(region_id, new_peer(3, 1003));
cluster.must_put(b"k3", b"v3");
// wait peer 1003 apply snapshot
must_get_equal(&cluster.get_engine(3), b"k3", b"v3");
// value can be readed from `engine` doesn't mean applying snapshot is finished
// wait little more time
sleep_ms(100);
let r = cluster.get_region(b"k1");
let resp = async_read_on_peer(&mut cluster, new_peer(3, 1003), r, b"k3", true, true);
let resp = resp.recv_timeout(Duration::from_secs(1)).unwrap();
// should not have `mismatch peer id` error
if resp.get_header().has_error() {
panic!("unexpect err: {:?}", resp.get_header().get_error());
}
let exp_value = resp.get_responses()[0].get_get().get_value();
assert_eq!(exp_value, b"v3");
} | rust_cleaned_test_functions.jsonl/100491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1017
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
13564,
19844,
74175,
927,
19099,
10633,
45159,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
62,
1623,
6443,
2099,
6984,
10652,
11,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_create_ovpn_conf() -> Result<()> {
let mut output = vec![];
let res = create_openvpn_config::<BufReader<File>, Vec<u8>>(
&vec![Ipv4Addr::new(108, 59, 0, 40)],
&ConnectionProtocol::UDP,
&vec![1134],
None,
&mut output,
)?;
Ok(res)
} | rust_cleaned_test_functions.jsonl/102212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
83981,
19958,
16059,
368,
1464,
5714,
71698,
341,
197,
10217,
5206,
2550,
284,
7486,
0,
40901,
197,
10217,
592,
284,
1855,
11311,
59589,
5332,
27638,
15064,
5062,
52014,
8066,
11312,
34837,
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... | 2 |
#[test]
fn test_ill_drop() {
let mut x = 10u32;
{
Gn::<u32>::new(|| {
x = 5;
// here we got None from drop
x = get_yield().unwrap_or(0);
});
}
assert!(x == 10);
} | rust_cleaned_test_functions.jsonl/91419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
483,
29584,
368,
341,
262,
1077,
5206,
856,
284,
220,
16,
15,
84,
18,
17,
280,
262,
341,
286,
95151,
27638,
84,
18,
17,
6831,
931,
79453,
341,
310,
856,
284,
220,
20,
280,
310,
442,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_split_horizontally() {
let drawing_area = create_mocked_drawing_area(1024, 768, |m| {
m.check_draw_rect(|c, _, f, u, d| {
assert_eq!(c, RED.to_rgba());
assert_eq!(f, true);
assert_eq!(u, (0, 0));
assert_eq!(d, (345 - 1, 768 - 1));
});
m.check_draw_rect(|c, _, f, u, d| {
assert_eq!(c, BLUE.to_rgba());
assert_eq!(f, true);
assert_eq!(u, (345, 0));
assert_eq!(d, (1024 - 1, 768 - 1));
});
m.drop_check(|b| {
assert_eq!(b.num_draw_rect_call, 2);
assert_eq!(b.draw_count, 2);
});
});
let (left, right) = drawing_area.split_horizontally(345);
left.fill(&RED).expect("Drawing Error");
right.fill(&BLUE).expect("Drawing Error");
} | rust_cleaned_test_functions.jsonl/81494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
58046,
50401,
368,
341,
286,
1077,
13330,
15030,
284,
1855,
34134,
291,
814,
1696,
15030,
7,
16,
15,
17,
19,
11,
220,
22,
21,
23,
11,
760,
76,
91,
341,
310,
296,
9093,
23021,
16979,
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_rpc_get_fee_rate_governor() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let RpcHandler { io, meta, .. } = start_rpc_handler_with_tx(&bob_pubkey);
let req = r#"{"jsonrpc":"2.0","id":1,"method":"getFeeRateGovernor"}"#;
let res = io.handle_request_sync(req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": {
"context":{"slot":0},
"value":{
"feeRateGovernor": {
"burnPercent": DEFAULT_BURN_PERCENT,
"maxLamportsPerSignature": 0,
"minLamportsPerSignature": 0,
"targetLamportsPerSignature": 0,
"targetSignaturesPerSlot": 0
}
}},
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/3040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
34305,
9246,
1889,
6706,
269,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
79961,
3050,
314,
6399,
11,
8823,
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_to_base64_crlf_line_break() {
assert!(![08; 1000].to_base64(Config {line_length: None, ..STANDARD})
.contains("\r\n"));
assert_eq!(b"foobar".to_base64(Config {line_length: Some(4),
..STANDARD}),
"Zm9v\r\nYmFy");
} | rust_cleaned_test_functions.jsonl/5186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
7651,
21,
19,
666,
2381,
69,
6528,
39494,
368,
341,
286,
2060,
0,
3471,
58,
15,
23,
26,
220,
16,
15,
15,
15,
936,
983,
7651,
21,
19,
33687,
314,
1056,
5118,
25,
2240,
11,
5241,
784,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_view_mut_from_shape_ptr_deny_neg_strides() {
let mut data = [0, 1, 2, 3, 4, 5];
let _view = unsafe {
RawArrayViewMut::from_shape_ptr((2, 3).strides((-3isize as usize, 1)), data.as_mut_ptr())
};
} | rust_cleaned_test_functions.jsonl/92631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
7122,
29523,
5673,
13597,
4348,
814,
32395,
28209,
2895,
3341,
368,
341,
262,
1077,
5206,
821,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_global_command() {
let route = Route::UpdateGlobalCommand {
application_id: 1,
command_id: 2,
};
assert_eq!("applications/1/commands/2", route.display().to_string());
} | rust_cleaned_test_functions.jsonl/90489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
19296,
10811,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4289,
11646,
4062,
341,
310,
3766,
842,
25,
220,
16,
345,
310,
3210,
842,
25,
220,
17,
345,
286,
3634,
286,
2060,
10714,
17223,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_read_subtype() -> io::Result<()> {
let data = [b'i'];
let mut reader = &data[..];
assert_eq!(read_subtype(&mut reader)?, Subtype::Int32);
let data = [b'n'];
let mut reader = &data[..];
assert!(matches!(
read_subtype(&mut reader),
Err(ref e) if e.kind() == io::ErrorKind::InvalidData
));
Ok(())
} | rust_cleaned_test_functions.jsonl/32080 | {
"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,
6443,
96228,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
508,
65,
62550,
3860,
286,
1077,
5206,
6604,
284,
609,
691,
95874,
935,
286,
2060,
10714,
10297,
878,
96228,
2099,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sender_comp_id() {
define_fixt_message!(TestMessage: b"9999" => {
NOT_REQUIRED, text: Text [FIX50..],
});
define_dictionary!(Logon, Reject, TestMessage,);
{
//Connect and logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon_with_ver(
FIXVersion::FIXT_1_1,
MessageVersion::FIX50,
build_dictionary(),
);
//Accept when SenderCompID is the fourth tag.
let target_comp_id_fifth_tag_message = b"8=FIXT.1.1\x019=48\x0135=9999\x0149=TX\x0156=TEST\x0134=2\x0152=20170105-01:01:01\x0110=236\x01";
let bytes_written = test_server
.stream
.write(target_comp_id_fifth_tag_message)
.unwrap();
assert_eq!(bytes_written, target_comp_id_fifth_tag_message.len());
let message = engine_poll_message!(client, connection, TestMessage);
assert_eq!(message.msg_seq_num, 2);
assert_eq!(message.sender_comp_id, SERVER_SENDER_COMP_ID);
//Reject when SenderCompID is the fifth tag.
let sender_comp_id_fifth_tag_message = b"8=FIXT.1.1\x019=48\x0135=9999\x0156=TEST\x0149=TX\x0134=3\x0152=20170105-01:01:01\x0110=012\x01";
let bytes_written = test_server
.stream
.write(sender_comp_id_fifth_tag_message)
.unwrap();
assert_eq!(bytes_written, sender_comp_id_fifth_tag_message.len());
let message = test_server.recv_message::<Reject>();
assert_eq!(message.msg_seq_num, 2);
assert_eq!(
message
.session_reject_reason
.expect("SessionRejectReason must be provided"),
SessionRejectReason::TagSpecifiedOutOfRequiredOrder
);
assert_eq!(message.text, b"SenderCompID must be the 4th tag".to_vec());
engine_poll_event!(client,EngineEvent::MessageReceivedGarbled(msg_connection,parse_error) => {
assert_eq!(msg_connection,connection);
assert!(if let ParseError::SenderCompIDNotFourthTag = parse_error { true } else { false });
});
//Reject when SenderCompID is missing.
let missing_sender_comp_id_tag_message = b"8=FIXT.1.1\x019=50\x0135=9999\x0156=TEST\x0134=10\x0152=20170105-01:01:01\x0110=086\x01";
let bytes_written = test_server
.stream
.write(missing_sender_comp_id_tag_message)
.unwrap();
assert_eq!(bytes_written, missing_sender_comp_id_tag_message.len());
let message = test_server.recv_message::<Reject>();
assert_eq!(message.msg_seq_num, 3);
assert_eq!(
message
.session_reject_reason
.expect("SessionRejectReason must be provided"),
SessionRejectReason::TagSpecifiedOutOfRequiredOrder
);
assert_eq!(message.text, b"SenderCompID must be the 4th tag".to_vec());
engine_poll_event!(client,EngineEvent::MessageReceivedGarbled(msg_connection,parse_error) => {
assert_eq!(msg_connection,connection);
assert!(if let ParseError::SenderCompIDNotFourthTag = parse_error { true } else { false });
});
}
{
//Connect and logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon_with_ver(
FIXVersion::FIX_4_0,
MessageVersion::FIX40,
build_dictionary(),
);
//Accept when SenderCompID is the fourth tag.
let target_comp_id_fifth_tag_message = b"8=FIX.4.0\x019=48\x0135=9999\x0149=TX\x0156=TEST\x0134=2\x0152=20170105-01:01:01\x0110=154\x01";
let bytes_written = test_server
.stream
.write(target_comp_id_fifth_tag_message)
.unwrap();
assert_eq!(bytes_written, target_comp_id_fifth_tag_message.len());
let message = engine_poll_message!(client, connection, TestMessage);
assert_eq!(message.msg_seq_num, 2);
assert_eq!(message.sender_comp_id, SERVER_SENDER_COMP_ID);
//Accept when SenderCompID is the fifth tag.
let sender_comp_id_fifth_tag_message = b"8=FIX.4.0\x019=48\x0135=9999\x0156=TEST\x0149=TX\x0134=3\x0152=20170105-01:01:01\x0110=155\x01";
let bytes_written = test_server
.stream
.write(sender_comp_id_fifth_tag_message)
.unwrap();
assert_eq!(bytes_written, sender_comp_id_fifth_tag_message.len());
let message = engine_poll_message!(client, connection, TestMessage);
assert_eq!(message.msg_seq_num, 3);
assert_eq!(message.sender_comp_id, SERVER_SENDER_COMP_ID);
//Reject when SenderCompID is missing.
let missing_sender_comp_id_tag_message = b"8=FIX.4.0\x019=42\x0135=9999\x0156=TEST\x0134=4\x0152=20170105-01:01:01\x0110=063\x01";
let bytes_written = test_server
.stream
.write(missing_sender_comp_id_tag_message)
.unwrap();
assert_eq!(bytes_written, missing_sender_comp_id_tag_message.len());
let message = test_server.recv_message::<Reject>();
assert_eq!(message.msg_seq_num, 2);
assert_eq!(message.text, b"Required tag missing".to_vec());
engine_poll_event!(client,EngineEvent::MessageReceivedGarbled(msg_connection,parse_error) => {
assert_eq!(msg_connection,connection);
assert!(if let ParseError::MissingRequiredTag(ref tag,_) = parse_error { *tag == SenderCompID::tag() } else { false });
});
}
} | rust_cleaned_test_functions.jsonl/26 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2700
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54356,
18177,
842,
368,
341,
262,
6979,
36060,
83,
6462,
10297,
2271,
2052,
25,
293,
1,
24,
24,
24,
24,
1,
589,
341,
286,
4183,
53912,
11,
1467,
25,
2918,
508,
39690,
20,
15,
496,
1259,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_hex_serializations_timeline_id() {
let original_struct = TestStruct {
field: Some(ZTimelineId::from_array(hex!(
"AA223344556677881122334455667788"
))),
};
let serialized_string = serde_json::to_string(&original_struct).unwrap();
assert_eq!(
serialized_string,
r#"{"field":"aa223344556677881122334455667788"}"#
);
let deserialized_struct: TestStruct<FromHexError, ZTimelineId> =
serde_json::from_str(&serialized_string).unwrap();
assert_eq!(original_struct, deserialized_struct);
} | rust_cleaned_test_functions.jsonl/124099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
25602,
8040,
77560,
842,
368,
341,
286,
1077,
4024,
15126,
284,
3393,
9422,
341,
310,
2070,
25,
4329,
27855,
59641,
764,
486,
1499,
3858,
44660,
33673,
394,
330,
6029,
17,
17,
18,
18,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmp_mem_imm_i32_for_i8() {
let mut buf = MacroAssembler::new();
emit_cmp_mem_imm(&mut buf, MachineMode::Int8, R15, 256, 256);
} | rust_cleaned_test_functions.jsonl/85475 | {
"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,
35193,
12976,
71370,
5318,
18,
17,
5478,
5318,
23,
368,
341,
286,
1077,
5206,
6607,
284,
53317,
77858,
486,
931,
543,
286,
16691,
35193,
12976,
71370,
2099,
6984,
6607,
11,
12960,
3636,
486,
1072,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_derive_public_key() {
let mut vrf = ECVRF::from_suite(CipherSuite::P256_SHA256_TAI).unwrap();
let secret_key = BigNum::from_slice(&[0x01]).unwrap();
let public_key = vrf.derive_public_key_point(&secret_key).unwrap();
let public_key_bytes = public_key
.to_bytes(&vrf.group, PointConversionForm::COMPRESSED, &mut vrf.bn_ctx)
.unwrap();
let expected_point_bytes = vec![
0x03, 0x6B, 0x17, 0xD1, 0xF2, 0xE1, 0x2C, 0x42, 0x47, 0xF8, 0xBC, 0xE6, 0xE5, 0x63,
0xA4, 0x40, 0xF2, 0x77, 0x03, 0x7D, 0x81, 0x2D, 0xEB, 0x33, 0xA0, 0xF4, 0xA1, 0x39,
0x45, 0xD8, 0x98, 0xC2, 0x96,
];
assert_eq!(public_key_bytes, expected_point_bytes);
} | rust_cleaned_test_functions.jsonl/112451 | {
"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,
35345,
533,
27074,
3097,
368,
341,
286,
1077,
5206,
348,
8052,
284,
468,
19589,
17612,
486,
1499,
57239,
3025,
10558,
28000,
486,
47,
17,
20,
21,
38096,
17,
20,
21,
1139,
15469,
568,
15454,
1428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_oscillator() {
let osc: Oscillator = Oscillator::default();
assert_eq!(osc.get_wave_type(), 0);
assert_eq!(osc.get_wave_type_text(), "Sine".to_string());
assert_eq!(osc.get_volume(), 1.0);
assert_eq!(osc.get_pitch_bend(), 0);
} | rust_cleaned_test_functions.jsonl/114581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
62,
23469,
70084,
368,
341,
286,
1077,
30947,
25,
55636,
70084,
284,
55636,
70084,
486,
2258,
543,
286,
2060,
10714,
10297,
23469,
670,
60063,
1819,
1507,
220,
15,
317,
286,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_sourcemap() {
let input: &[_] = b"{
\"version\":3,
\"sources\":[\"coolstuff.js\"],
\"names\":[\"x\",\"alert\"],
\"mappings\":\"AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM\"
}";
let sm = SourceMap::from_reader(input).unwrap();
let mut iter = sm.tokens().filter(Token::has_name);
assert_eq!(
iter.next().unwrap().to_tuple(),
("coolstuff.js", 0, 4, Some("x"))
);
assert_eq!(
iter.next().unwrap().to_tuple(),
("coolstuff.js", 1, 4, Some("x"))
);
assert_eq!(
iter.next().unwrap().to_tuple(),
("coolstuff.js", 2, 2, Some("alert"))
);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/79091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
643,
413,
66,
42040,
368,
341,
262,
1077,
1946,
25,
609,
13496,
60,
284,
293,
1,
515,
286,
7245,
4366,
11693,
18,
345,
286,
7245,
39651,
59,
8899,
2105,
42196,
57304,
2857,
2105,
1259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_response() {
let mut builder = http::response::Builder::new();
builder.status(http::StatusCode::OK);
builder.header(http::header::DATE, "Thu, 01 Jan 1970 00:00:00 GMT");
builder.header(http::header::CONTENT_TYPE, "text/plain".as_bytes());
let mut output = vec![];
let _ = write_response(builder.body("Hello rust".as_bytes()).unwrap(), &mut output).unwrap();
let expected = b"HTTP/1.1 200 OK\r\n\
connection: close\r\n\
content-length: 10\r\n\
date: Thu, 01 Jan 1970 00:00:00 GMT\r\n\
content-type: text/plain\r\n\
\r\n\
Hello rust";
assert_eq!(&expected[..], &output[..]);
} | rust_cleaned_test_functions.jsonl/89137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
9655,
368,
341,
262,
1077,
5206,
7363,
284,
1758,
486,
2322,
486,
3297,
486,
931,
543,
262,
7363,
4299,
19886,
486,
15872,
486,
3925,
317,
262,
7363,
17093,
19886,
486,
2708,
486,
7097,
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_include_redundant() -> anyhow::Result<()> {
let code = r#"
include "./resources/include_test.sarus"
include "./resources/include_test2.sarus" //Should be skipped
fn main() -> () {
a = 5.0
b = 6.0
c = add(a, b)
c.println()
}
"#;
let (ast, file_index_table) = parse_with_context(code, &get_test_dir().join("test.sarus"))?;
only_run_func_with_importer(ast, Some(file_index_table), |_, _| {})
} | rust_cleaned_test_functions.jsonl/56962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
1288,
1054,
303,
517,
368,
1464,
88964,
486,
2077,
71698,
341,
1066,
262,
1077,
2038,
284,
435,
2,
698,
997,
5924,
12745,
26393,
4452,
514,
50319,
698,
997,
5924,
12745,
26393,
4452,
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... | 2 |
#[test]
fn test_link_parsing_errors() {
let link_a = b"http://example.com/TheBook/chapter2; \
rel=\"previous\"; rev=next; title=\"previous chapter\"";
let r: Raw = vec![link_a.to_vec()].into();
let mut err: Result<Link, _> = Header::parse_header(&r);
assert_eq!(err.is_err(), true);
let link_b = b"<http://example.com/TheBook/chapter2>; \
=\"previous\"; rev=next; title=\"previous chapter\"";
let r: Raw = vec![link_b.to_vec()].into();
err = Header::parse_header(&r);
assert_eq!(err.is_err(), true);
let link_c = b"<http://example.com/TheBook/chapter2>; \
rel=; rev=next; title=\"previous chapter\"";
let r: Raw = vec![link_c.to_vec()].into();
err = Header::parse_header(&r);
assert_eq!(err.is_err(), true);
let link_d = b"<http://example.com/TheBook/chapter2>; \
rel=\"previous\"; rev=next; title=";
let r: Raw = vec![link_d.to_vec()].into();
err = Header::parse_header(&r);
assert_eq!(err.is_err(), true);
let link_e = b"<http://example.com/TheBook/chapter2>; \
rel=\"previous\"; rev=next; attr=unknown";
let r: Raw = vec![link_e.to_vec()].into();
err = Header::parse_header(&r);
assert_eq!(err.is_err(), true);
} | rust_cleaned_test_functions.jsonl/46351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 653
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
620,
28598,
20196,
368,
341,
286,
1077,
2656,
4306,
220,
284,
293,
76932,
1110,
8687,
905,
47748,
7134,
21284,
2873,
17,
26,
3044,
310,
1351,
4070,
19702,
2105,
26,
5772,
28,
3600,
26,
226... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_close_frame() {
let mut buf = BytesMut::new();
let reason = (CloseCode::Normal, "data");
Parser::write_close(&mut buf, Some(reason.into()), false);
let mut v = vec![136u8, 6u8, 3u8, 232u8];
v.extend(b"data");
assert_eq!(&buf[..], &v[..]);
} | rust_cleaned_test_functions.jsonl/86812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12704,
8929,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
931,
543,
286,
1077,
2874,
284,
320,
7925,
2078,
486,
12206,
11,
330,
691,
797,
286,
21102,
486,
4934,
12704,
2099,
6984,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nixpkgs_repository_bad_good_tests() {
let test_data = {
let dir = env!("CARGO_MANIFEST_DIR");
PathBuf::from(dir).join("test_data/nixpkgs_repository")
};
let tests = TestCase::collect_from_dir(&test_data);
run(&tests);
} | rust_cleaned_test_functions.jsonl/58655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
941,
20819,
5857,
47301,
34199,
44781,
32509,
368,
341,
286,
1077,
1273,
1769,
284,
341,
310,
1077,
5419,
284,
6105,
17223,
34,
7581,
46,
25143,
91120,
8291,
797,
310,
7933,
15064,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() -> Result<()> {
assert_eq!(
fcos::StreamID::Stable.url(),
"https://builds.coreos.fedoraproject.org/streams/stable.json"
);
let un = nix::sys::utsname::uname();
let myarch = un.machine();
let st: Stream = serde_json::from_slice(STREAM_DATA)?;
assert_eq!(st.stream, "stable");
let a = st.architectures.get("x86_64").unwrap();
if myarch == "x86_64" {
assert!(st.this_architecture().is_some());
assert_eq!(
st.query_thisarch_single("qemu").unwrap().sha256,
"a7e93e32665086d4a07a14dbe6c125177402f04603fc5bb575035028701afa5b"
);
}
assert_eq!(
a.artifacts
.get("metal")
.unwrap()
.formats
.get("raw.xz")
.unwrap()
.get("disk")
.unwrap()
.sha256,
"2848b111a6917455686f38a3ce64d2321c33809b9cf796c5f6804b1c02d79d9d"
);
assert_eq!(
st.query_disk("x86_64", "metal", "raw.xz").unwrap().sha256,
"2848b111a6917455686f38a3ce64d2321c33809b9cf796c5f6804b1c02d79d9d"
);
assert_eq!(
a.images
.as_ref()
.unwrap()
.aws
.as_ref()
.unwrap()
.regions
.get("us-east-1")
.unwrap(),
&AwsRegionImage {
image: "ami-037a0ba6d14ca2e05".to_string(),
release: "33.20201201.3.0".to_string(),
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/40451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 881
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
1464,
5714,
71698,
341,
262,
2060,
10714,
33673,
286,
282,
9407,
486,
3027,
915,
486,
623,
480,
7315,
3148,
286,
330,
2428,
1110,
5834,
82,
4871,
436,
833,
24358,
58848,
583,
2659,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fibonacci() {
let fibb = fibonacci();
assert_eq!(fibb.len(), 5);
for window in fibb.windows(3) {
assert_eq!(window[0] + window[1], window[2]);
}
} | rust_cleaned_test_functions.jsonl/67398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
579,
39345,
368,
341,
286,
1077,
15801,
65,
284,
75698,
543,
286,
2060,
10714,
10297,
75326,
65,
19406,
1507,
220,
20,
317,
286,
369,
3241,
304,
15801,
65,
68113,
7,
18,
8,
341,
310,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_read_objects()
{
let mmaps = mmap_obj_files(["test_data/func_a.o", "test_data/func_b.o"].iter()).unwrap();
let object_files = object_files_from_mmaps(&mmaps).unwrap();
assert_eq!(object_files.len(), 2);
assert_eq!(object_files[0].sections.len(), 3);
assert_eq!(object_files[1].sections.len(), 6);
} | rust_cleaned_test_functions.jsonl/124779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
24873,
741,
515,
262,
1077,
296,
17640,
284,
70866,
7328,
10931,
19065,
1944,
1769,
14,
2830,
4306,
14439,
497,
330,
1944,
1769,
14,
2830,
880,
14439,
5521,
2015,
6011,
15454,
543,
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_unify_external_not_supported() -> oso::Result<()> {
common::setup();
#[derive(PolarClass)]
struct Foo(pub i64);
let mut oso = OsoTest::new();
oso.oso.register_class(Foo::get_polar_class())?;
oso.load_str("unify(x, y) if x = y;");
// Type that doesn't support unification.
let mut query = oso.oso.query_rule("unify", (Foo(1), Foo(1)))?;
let error = query.next().unwrap().unwrap_err();
assert!(
matches!(
&error,
OsoError::UnsupportedOperation {
operation,
type_name
} if operation == "equals" && type_name == "Foo"),
"{} doesn't match expected error",
error
);
// Type that does support unification with a type that doesn't.
#[derive(PolarClass, PartialEq)]
struct EqFoo(i64);
impl PartialEq<Foo> for EqFoo {
fn eq(&self, other: &Foo) -> bool {
self.0 == other.0
}
}
let eq_foo_class = EqFoo::get_polar_class_builder()
.with_equality_check()
.build();
oso.oso.register_class(eq_foo_class)?;
let mut query = oso.oso.query_rule("unify", (EqFoo(1), Foo(1)))?;
let error = query.next().unwrap().unwrap_err();
// otherwise.
assert!(
matches!(
&error,
OsoError::TypeError(oso::errors::TypeError {
expected,
got
}) if expected == "EqFoo" && got.as_deref() == Some("Foo")),
"{} doesn't match expected error",
error
);
//assert!(
//matches!(
//OsoError::TypeError(oso::errors::TypeError {
//got
//error
Ok(())
} | rust_cleaned_test_functions.jsonl/12264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 860
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1437,
47432,
7913,
57885,
368,
1464,
297,
704,
486,
2077,
71698,
341,
262,
4185,
486,
15188,
1428,
262,
11506,
27098,
5304,
7417,
1957,
5563,
262,
2036,
33428,
74186,
600,
21,
19,
626,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mount() {
#[derive(Debug)]
struct TestData<'a> {
test_user: TestUserType,
src: &'a str,
dest: &'a str,
fs_type: &'a str,
flags: MsFlags,
options: &'a str,
// else assume no error.
// successful mount.
error_contains: &'a str,
}
let dir = tempdir().expect("failed to create tmpdir");
let drain = slog::Discard;
let logger = slog::Logger::root(drain, o!());
let tests = &[
TestData {
test_user: TestUserType::Any,
src: "",
dest: "",
fs_type: "",
flags: MsFlags::empty(),
options: "",
error_contains: "need mount source",
},
TestData {
test_user: TestUserType::Any,
src: "from",
dest: "",
fs_type: "",
flags: MsFlags::empty(),
options: "",
error_contains: "need mount destination",
},
TestData {
test_user: TestUserType::Any,
src: "from",
dest: "to",
fs_type: "",
flags: MsFlags::empty(),
options: "",
error_contains: "need mount FS type",
},
TestData {
test_user: TestUserType::NonRootOnly,
src: "from",
dest: "to",
fs_type: "bind",
flags: MsFlags::empty(),
options: "bind",
error_contains: "Operation not permitted",
},
TestData {
test_user: TestUserType::NonRootOnly,
src: "from",
dest: "to",
fs_type: "bind",
flags: MsFlags::MS_BIND,
options: "",
error_contains: "Operation not permitted",
},
TestData {
test_user: TestUserType::RootOnly,
src: "from",
dest: "to",
fs_type: "bind",
flags: MsFlags::MS_BIND,
options: "",
error_contains: "",
},
];
for (i, d) in tests.iter().enumerate() {
let msg = format!("test[{}]: {:?}", i, d);
if d.test_user == TestUserType::RootOnly {
skip_loop_if_not_root!(msg);
} else if d.test_user == TestUserType::NonRootOnly {
skip_loop_if_root!(msg);
}
let src: PathBuf;
let dest: PathBuf;
let src_filename: String;
let dest_filename: String;
if !d.src.is_empty() {
src = dir.path().join(d.src.to_string());
src_filename = src
.to_str()
.expect("failed to convert src to filename")
.to_string();
} else {
src_filename = "".to_owned();
}
if !d.dest.is_empty() {
dest = dir.path().join(d.dest.to_string());
dest_filename = dest
.to_str()
.expect("failed to convert dest to filename")
.to_string();
} else {
dest_filename = "".to_owned();
}
// Create the mount directories
for d in [src_filename.clone(), dest_filename.clone()].iter() {
if d.is_empty() {
continue;
}
std::fs::create_dir_all(d).expect("failed to created directory");
}
let result = baremount(
&src_filename,
&dest_filename,
d.fs_type,
d.flags,
d.options,
&logger,
);
let msg = format!("{}: result: {:?}", msg, result);
if d.error_contains.is_empty() {
assert!(result.is_ok(), "{}", msg);
// Cleanup
nix::mount::umount(dest_filename.as_str()).unwrap();
continue;
}
let err = result.unwrap_err();
let error_msg = format!("{}", err);
assert!(error_msg.contains(d.error_contains), "{}", msg);
}
} | rust_cleaned_test_functions.jsonl/32166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2756
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57593,
368,
341,
286,
11506,
27098,
42618,
5563,
286,
2036,
93200,
18291,
64,
29,
341,
3374,
310,
1273,
3317,
25,
3393,
1474,
929,
3554,
310,
2286,
25,
30136,
64,
607,
345,
310,
3201,
25,
30136,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intern() {
let s0_1 = Symbol::intern("s0");
let s0_2 = Symbol::intern("s0");
assert_eq!(s0_1, s0_2);
let s1 = Symbol::intern("s1");
assert_ne!(s0_1, s1);
} | rust_cleaned_test_functions.jsonl/93223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
932,
368,
341,
286,
1077,
274,
15,
62,
16,
284,
19612,
486,
55444,
445,
82,
15,
797,
286,
1077,
274,
15,
62,
17,
284,
19612,
486,
55444,
445,
82,
15,
797,
286,
2060,
10714,
10297,
82,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_hint() {
let res = derive_hint_impl(quote::quote! {
#[hint(key1="val1",key2="val2",)]
struct S { a: u8, b: String, c: bool }
});
assert!(res.is_ok());
ts_assert_eq(
res.unwrap(),
quote::quote! {
impl Hint for S {
fn hints(&self) -> ::std::collections::HashMap<String, String> {
let mut hm = ::std::collections::HashMap::with_capacity(2usize);
hm.insert("key1".to_string(), "val1".to_string());
hm.insert("key2".to_string(), "val2".to_string());
hm
}
}
},
);
let res = derive_hint_impl(quote::quote! {
enum E {
#[hint(key1="val1",key2="val2",)]
S { a: u8, b: String, c: bool },
#[hint(key3="val3")]
X,
Y
}
});
assert!(res.is_ok());
ts_assert_eq(
res.unwrap(),
quote::quote! {
impl Hint for E {
fn hints(&self) -> ::std::collections::HashMap<String, String> {
match self {
E::S { .. } => {
let mut hm = ::std::collections::HashMap::with_capacity(2usize);
hm.insert("key1".to_string(), "val1".to_string());
hm.insert("key2".to_string(), "val2".to_string());
hm
}
E::X { .. } => {
let mut hm = ::std::collections::HashMap::with_capacity(1usize);
hm.insert("key3".to_string(), "val3".to_string());
hm
}
E::Y { .. } => {
let mut hm = ::std::collections::HashMap::with_capacity(0usize);
hm
}
}
}
}
},
);
let res = derive_hint_impl(quote::quote! {
union NoHint {}
});
assert!(res.is_ok());
ts_assert_eq(
res.unwrap(),
quote::quote! {
impl Hint for NoHint {
fn hints(&self) -> ::std::collections::HashMap<String, String> {
let mut hm = ::std::collections::HashMap::with_capacity(0usize);
hm
}
}
},
);
let res = derive_hint_impl(quote::quote! {
#[hint(a="1", a="2")]
struct S;
});
assert!(res.is_err());
let res = derive_hint_impl(quote::quote! {
#[hint(a="1")]
#[hint(b="2")]
struct S;
});
assert!(res.is_ok());
ts_assert_eq(
res.unwrap(),
quote::quote! {
impl Hint for S {
fn hints(&self) -> ::std::collections::HashMap<String, String> {
let mut hm = ::std::collections::HashMap::with_capacity(2usize);
hm.insert("a".to_string(), "1".to_string());
hm.insert("b".to_string(), "2".to_string());
hm
}
}
},
)
} | rust_cleaned_test_functions.jsonl/37355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
45825,
368,
341,
197,
10217,
592,
284,
42430,
45825,
21007,
7,
2949,
486,
2949,
0,
341,
298,
197,
13353,
46125,
4857,
16,
428,
831,
16,
497,
792,
17,
428,
831,
17,
497,
5563,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_event()
{
test_parse("event e1;");
test_parse("event e1,;");
test_parse("event e1, e2;");
test_parse("event e1, e2,;");
test_parse("event ,e1;");
test_parse("event ,e1,;");
test_parse("event e1;");
test_parse("event e1|;");
test_parse("event e1| e2;");
test_parse("event e1| e2|;");
test_parse("event |e1;");
test_parse("event |e1|;");
test_parse("event e;");
test_parse("event e@(summary);");
test_parse("event e@(-summary-);");
test_parse("event e(param:Type);");
test_parse("event e@{-description-};");
test_parse("event e@(summ)(p1:T1)@{-desc-};");
test_parse("event e p;");
test_parse("event e p p;");
test_parse("event e p p p;");
test_parse("event e (p:T);");
test_parse("event e (p q:T U);");
test_parse("event e (p:T) (p:T);");
test_parse("event e (p:T) (p:T) (p:T);");
} | rust_cleaned_test_functions.jsonl/91397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
741,
515,
18185,
21039,
445,
3087,
384,
16,
34649,
18185,
21039,
445,
3087,
384,
16,
11,
34649,
18185,
21039,
445,
3087,
384,
16,
11,
384,
17,
34649,
18185,
21039,
445,
3087,
384,
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_fr_sqrt() {
use ff::SqrtField;
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
assert_eq!(Fr::zero().sqrt().unwrap(), Fr::zero());
for _ in 0..1000 {
let a = Fr::random(&mut rng);
let nega = a.neg();
let b = a.square();
let b = b.sqrt().unwrap();
assert!(a == b || nega == b);
}
for _ in 0..1000 {
let a = Fr::random(&mut rng);
let tmp = a.sqrt();
if tmp.is_some().into() {
assert_eq!(a, tmp.unwrap().square());
}
}
} | rust_cleaned_test_functions.jsonl/100655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
92199,
368,
341,
262,
990,
25539,
486,
50,
8140,
1877,
401,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
286,
220,
15,
87,
20,
24,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_scans_dynamic_variable() {
let mut scanner = Scanner::new("<?php $$$$$$a = 1;");
scanner.scan().unwrap();
assert_eq!(token_list!(scanner.tokens), "<?php $ $ $ $ $ $a = 1 ; ");
} | rust_cleaned_test_functions.jsonl/52940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
596,
45992,
14635,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
98276,
1208,
400,
69502,
3,
64,
284,
220,
16,
26,
3071,
286,
20775,
47949,
1005,
15454,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_item_set_header() {
let mut item = Item::new(ItemType::Event);
item.set_header("custom", 42u64);
assert_eq!(item.get_header("custom"), Some(&Value::from(42u64)));
assert_eq!(item.get_header("anything"), None);
} | rust_cleaned_test_functions.jsonl/103604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5634,
2602,
8757,
368,
341,
286,
1077,
5206,
1509,
284,
5739,
486,
931,
29771,
929,
486,
1556,
317,
286,
1509,
980,
8757,
445,
9163,
497,
220,
19,
17,
84,
21,
19,
626,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_force_checkout_delete_of_modified_blob() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
modify!(repo: "foo");
bit_checkout!(repo: --force &rev!(commit! {}))?;
assert!(!exists!(repo: "foo"));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40739,
68186,
11353,
3575,
37749,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
5602,
10297,
23476,
25,
330,
7975,
797,
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... | 2 |
#[test]
fn test_packed_point_de() {
let packed = vec![
0x0b, 0x0a, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x02, 0x02, 0x02,
];
let expected = PackedPoints {
points: Some(vec![0, 3, 4, 7, 8, 11, 12, 15, 17, 19, 21]),
};
let deserialized: PackedPoints = otspec::de::from_bytes(&packed).unwrap();
assert_eq!(deserialized, expected);
} | rust_cleaned_test_functions.jsonl/88253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
11191,
6085,
2259,
368,
341,
286,
1077,
19375,
284,
7486,
90515,
310,
220,
15,
87,
15,
65,
11,
220,
15,
87,
15,
64,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
18,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bank_record_transactions() {
analog_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let (poh_recorder, entry_receiver, record_receiver) = PohRecorder::new(
// TODO use record_receiver
bank.tick_height(),
bank.last_blockhash(),
bank.clone(),
None,
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
let recorder = poh_recorder.recorder();
let poh_recorder = Arc::new(Mutex::new(poh_recorder));
let poh_simulator = simulate_poh(record_receiver, &poh_recorder);
poh_recorder.lock().unwrap().set_bank(&bank);
let pubkey = analog_sdk::pubkey::new_rand();
let keypair2 = Keypair::new();
let pubkey2 = analog_sdk::pubkey::new_rand();
let txs = sanitize_transactions(vec![
system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_config.hash()),
system_transaction::transfer(&keypair2, &pubkey2, 1, genesis_config.hash()),
]);
let mut results = vec![(Ok(()), None), (Ok(()), None)];
let _ = BankingStage::record_transactions(bank.slot(), &txs, &results, &recorder);
let (_bank, (entry, _tick_height)) = entry_receiver.recv().unwrap();
assert_eq!(entry.transactions.len(), txs.len());
// InstructionErrors should still be recorded
results[0] = (
Err(TransactionError::InstructionError(
1,
SystemError::ResultWithNegativeLamports.into(),
)),
None,
);
let (res, retryable) =
BankingStage::record_transactions(bank.slot(), &txs, &results, &recorder);
res.unwrap();
assert!(retryable.is_empty());
let (_bank, (entry, _tick_height)) = entry_receiver.recv().unwrap();
assert_eq!(entry.transactions.len(), txs.len());
// Other TransactionErrors should not be recorded
results[0] = (Err(TransactionError::AccountNotFound), None);
let (res, retryable) =
BankingStage::record_transactions(bank.slot(), &txs, &results, &recorder);
res.unwrap();
assert!(retryable.is_empty());
let (_bank, (entry, _tick_height)) = entry_receiver.recv().unwrap();
assert_eq!(entry.transactions.len(), txs.len() - 1);
// record_transactions should throw MaxHeightReached and return the set of retryable
// txs
let next_slot = bank.slot() + 1;
let (res, retryable) =
BankingStage::record_transactions(next_slot, &txs, &results, &recorder);
assert_matches!(res, Err(PohRecorderError::MaxHeightReached));
// so it should be marked as retryable
assert_eq!(retryable, vec![1]);
// Should receive nothing from PohRecorder b/c record failed
assert!(entry_receiver.try_recv().is_err());
poh_recorder
.lock()
.unwrap()
.is_exited
.store(true, Ordering::Relaxed);
let _ = poh_simulator.join();
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/4985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
14192,
68182,
368,
341,
286,
23400,
27413,
486,
15188,
1428,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_dlc_parameter_negotiation_command() {
let buf = [
0b10000011,
0b00010001,
0b00000000, // Data Octet1: DLCI of 0 is OK.
0b11110000, // Data Octet2: SupportedRequest.
0b00001100, // Data Octet3: Priority = 12.
0b00000000, // Data Octet4: Ignored.
0b00010100, // Data Octet5: Max Frame Size Octet 1 = 20.
0b00000000, // Data Octet6: Max Frame Size Octet 2 = 0.
0b00000000, // Data Octet7: Ignored
0b00000001, // Data Octet8: Initial Credits = 1.
];
let expected = MuxCommand {
params: MuxCommandParams::ParameterNegotiation(ParameterNegotiationParams {
dlci: DLCI::try_from(0).unwrap(),
credit_based_flow_handshake: CreditBasedFlowHandshake::SupportedRequest,
priority: 12,
max_frame_size: 20,
initial_credits: 1,
}),
command_response: CommandResponse::Command,
};
assert_eq!(MuxCommand::decode(&buf[..]).unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/107772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
814,
17257,
24899,
28209,
354,
7101,
10811,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
65,
16,
15,
15,
15,
15,
15,
16,
16,
11,
715,
310,
220,
15,
65,
15,
15,
15,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ElfMut_from_hdr_bad_class() {
let mut buf = ELF32_DYNAMIC_ELF_HDR_BAD_CLASS.clone();
let elf: Result<ElfMut<'_, LittleEndian, Elf32>, ElfError> =
ElfMut::try_from(&mut buf[0..]);
assert!(elf.is_err());
assert_eq!(elf.err(), Some(ElfError::BadClass(0x05)));
} | rust_cleaned_test_functions.jsonl/119511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2089,
11008,
51440,
5673,
28238,
34199,
4790,
368,
341,
262,
1077,
5206,
6607,
284,
72568,
18,
17,
57356,
2089,
22609,
55765,
30666,
13735,
15997,
543,
262,
1077,
40745,
25,
5714,
27,
75832,
51440,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keepalive() {
let f = Keepalive::builder(1234, Frame::FLAG_RESPOND)
.set_last_received_position(123)
.set_data(Bytes::from("foobar"))
.build();
try_codec(f);
} | rust_cleaned_test_functions.jsonl/41410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50293,
50961,
368,
341,
262,
1077,
282,
284,
13655,
50961,
486,
17850,
7,
16,
17,
18,
19,
11,
16321,
486,
22542,
28980,
37439,
340,
286,
659,
746,
12195,
40783,
9661,
7,
16,
17,
18,
340,
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 |
#[test]
fn test_split_check() {
let path = Builder::new().prefix("test-raftstore").tempdir().unwrap();
let path_str = path.path().to_str().unwrap();
let db_opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
let f = Box::new(RangePropertiesCollectorFactory::default());
cf_opts.add_table_properties_collector_factory("tikv.range-properties-collector", f);
let cfs_opts = ALL_CFS
.iter()
.map(|cf| CFOptions::new(cf, cf_opts.clone()))
.collect();
let engine = Arc::new(new_engine_opt(path_str, db_opts, cfs_opts).unwrap());
let mut region = Region::default();
region.set_id(1);
region.set_start_key(vec![]);
region.set_end_key(vec![]);
region.mut_peers().push(Peer::default());
region.mut_region_epoch().set_version(2);
region.mut_region_epoch().set_conf_ver(5);
let (tx, rx) = mpsc::sync_channel(100);
let mut cfg = Config::default();
cfg.region_max_keys = 100;
cfg.region_split_keys = 80;
cfg.batch_split_limit = 5;
let mut runnable = SplitCheckRunner::new(
engine.c().clone(),
tx.clone(),
CoprocessorHost::new(tx),
cfg,
);
// so split key will be z0080
put_data(&engine, 0, 90, false);
runnable.run(SplitCheckTask::split_check(
region.clone(),
true,
CheckPolicy::Scan,
));
// keys has not reached the max_keys 100 yet.
match rx.try_recv() {
Ok((region_id, CasualMessage::RegionApproximateSize { .. }))
| Ok((region_id, CasualMessage::RegionApproximateKeys { .. })) => {
assert_eq!(region_id, region.get_id());
}
others => panic!("expect recv empty, but got {:?}", others),
}
put_data(&engine, 90, 160, true);
runnable.run(SplitCheckTask::split_check(
region.clone(),
true,
CheckPolicy::Scan,
));
must_split_at(
&rx,
®ion,
vec![Key::from_raw(b"0080").append_ts(2.into()).into_encoded()],
);
put_data(&engine, 160, 300, false);
runnable.run(SplitCheckTask::split_check(
region.clone(),
true,
CheckPolicy::Scan,
));
must_split_at(
&rx,
®ion,
vec![
Key::from_raw(b"0080").append_ts(2.into()).into_encoded(),
Key::from_raw(b"0160").append_ts(2.into()).into_encoded(),
Key::from_raw(b"0240").append_ts(2.into()).into_encoded(),
],
);
put_data(&engine, 300, 500, false);
runnable.run(SplitCheckTask::split_check(
region.clone(),
true,
CheckPolicy::Scan,
));
must_split_at(
&rx,
®ion,
vec![
Key::from_raw(b"0080").append_ts(2.into()).into_encoded(),
Key::from_raw(b"0160").append_ts(2.into()).into_encoded(),
Key::from_raw(b"0240").append_ts(2.into()).into_encoded(),
Key::from_raw(b"0320").append_ts(2.into()).into_encoded(),
Key::from_raw(b"0400").append_ts(2.into()).into_encoded(),
],
);
drop(rx);
// It should be safe even the result can't be sent back.
runnable.run(SplitCheckTask::split_check(region, true, CheckPolicy::Scan));
} | rust_cleaned_test_functions.jsonl/33884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1885
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
7200,
368,
341,
286,
1077,
1815,
284,
20626,
486,
931,
1005,
11849,
445,
1944,
12,
2944,
4314,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
1815,
2895,
284,
1815,
3875,
1005,
983,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multi_union_schema() {
let schema = Schema::parse_str(r#"["null", "int", "float", "string", "bytes"]"#);
assert!(schema.is_ok());
let schema = schema.unwrap();
assert_eq!(SchemaKind::from(&schema), SchemaKind::Union);
let union_schema = match schema {
Schema::Union(u) => u,
_ => unreachable!(),
};
assert_eq!(union_schema.variants().len(), 5);
let mut variants = union_schema.variants().iter();
assert_eq!(SchemaKind::from(variants.next().unwrap()), SchemaKind::Null);
assert_eq!(SchemaKind::from(variants.next().unwrap()), SchemaKind::Int);
assert_eq!(
SchemaKind::from(variants.next().unwrap()),
SchemaKind::Float
);
assert_eq!(
SchemaKind::from(variants.next().unwrap()),
SchemaKind::String
);
assert_eq!(
SchemaKind::from(variants.next().unwrap()),
SchemaKind::Bytes
);
assert_eq!(variants.next(), None);
} | rust_cleaned_test_functions.jsonl/26530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
51621,
25371,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
2601,
55543,
1183,
2921,
497,
330,
396,
497,
330,
3649,
497,
330,
917,
497,
330,
9651,
1341,
57676,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_attributes_with_wrong_type_fails() {
let storage = InterleavedVecPointStorage::new(TestPointType::layout());
attributes!(
&attributes::INTENSITY => u32,
&attributes::GPS_TIME => f32,
&storage
);
} | rust_cleaned_test_functions.jsonl/73952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18240,
6615,
75198,
1819,
761,
6209,
368,
341,
286,
1077,
5819,
284,
5665,
273,
4141,
10050,
2609,
5793,
486,
931,
31159,
2609,
929,
486,
8399,
1423,
286,
8201,
33673,
310,
609,
12340,
486,
3221,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mark_seen_and_persisted() {
let late_arrival_period = Duration::from_secs(100);
let mut w = make_windows(late_arrival_period);
let mut sequencer_numbers1 = BTreeMap::new();
sequencer_numbers1.insert(1, OptionalMinMaxSequence::new(Some(1), 2));
let ckpt1 = PartitionCheckpoint::new(
Arc::from("foo"),
Arc::from("bar"),
sequencer_numbers1,
Utc::now(),
);
w.mark_seen_and_persisted(&ckpt1);
let mut sequencer_numbers2 = BTreeMap::new();
sequencer_numbers2.insert(1, OptionalMinMaxSequence::new(Some(0), 1));
sequencer_numbers2.insert(2, OptionalMinMaxSequence::new(None, 3));
let ckpt2 = PartitionCheckpoint::new(
Arc::from("foo"),
Arc::from("bar"),
sequencer_numbers2,
Utc::now(),
);
w.mark_seen_and_persisted(&ckpt2);
let actual = w.sequencer_numbers();
let mut expected = BTreeMap::new();
expected.insert(1, OptionalMinMaxSequence::new(None, 2));
expected.insert(2, OptionalMinMaxSequence::new(None, 3));
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/133355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
60668,
8378,
620,
4975,
291,
368,
341,
286,
1077,
3309,
11210,
3936,
20818,
284,
21045,
486,
1499,
68718,
7,
16,
15,
15,
317,
286,
1077,
5206,
289,
284,
1281,
58220,
2333,
349,
11210,
393... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input_mouse_relative() {
use super::super::Motion;
let e: Event = Motion::MouseRelative([0.0, 0.0]).into();
let a: Option<Event> = MouseRelativeEvent::from_pos([1.0, 0.0], &e);
let b: Option<Event> = a
.clone()
.unwrap()
.mouse_relative(|pos| MouseRelativeEvent::from_pos(pos, a.as_ref().unwrap()))
.unwrap();
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/54697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
39203,
29286,
368,
341,
286,
990,
2256,
486,
9522,
486,
40338,
401,
286,
1077,
384,
25,
3665,
284,
26562,
486,
10493,
28442,
2561,
15,
13,
15,
11,
220,
15,
13,
15,
10697,
18122,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lifecycle() {
let (schema_index, schema) = build_min_max_sum_schema();
let key: Vec<Pointer> = vec!["/key/1".into(), "/key/0".into()];
let key: Rc<[Pointer]> = key.into();
let docs = vec![
(
false,
json!({"key": ["key", "one"], "min": 3, "max": 3.3, "lww": 1}),
),
(
true,
json!({"key": ["key", "two"], "min": 4, "max": 4.4, "lww": 2}),
),
(
false,
json!({"key": ["key", "two"], "min": 2, "max": 2.2, "lww": 3}),
),
(
true,
json!({"key": ["key", "one"], "min": 5, "max": 5.5, "lww": 4}),
),
(
false,
json!({"key": ["key", "three"], "min": 6, "max": 6.6, "lww": 5}),
),
];
let mut validator = Validator::new(schema_index);
let mut combiner = Combiner::new(schema.clone(), key.clone());
for (left, doc) in docs {
if left {
combiner.reduce_left(doc, &mut validator)
} else {
combiner.combine_right(doc, &mut validator)
}
.unwrap();
}
assert_eq!(combiner.entries.len(), 3);
// the left vs right ordering of applications.
assert_eq!(
combiner.into_entries("/foo").collect::<Vec<_>>(),
vec![
(
json!({"foo": UUID_PLACEHOLDER, "key": ["key", "one"], "min": 3, "max": 5.5, "lww": 1}),
true
),
(
json!({"foo": UUID_PLACEHOLDER, "key": ["key", "three"], "min": 6, "max": 6.6, "lww": 5}),
false
),
(
json!({"foo": UUID_PLACEHOLDER, "key": ["key", "two"], "min": 2, "max": 4.4, "lww": 3}),
true
),
]
);
} | rust_cleaned_test_functions.jsonl/78591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
19517,
368,
341,
286,
1077,
320,
17349,
3560,
11,
10802,
8,
284,
1936,
7260,
6345,
10160,
25371,
543,
286,
1077,
1376,
25,
11312,
27,
9084,
29,
284,
7486,
0,
1183,
14,
792,
14,
16,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_from_slice() {
fn check(slice: &[BigDigit], data: &[BigDigit]) {
assert!(BigUint::from_slice(slice).data == data);
}
check(&[1], &[1]);
check(&[0, 0, 0], &[]);
check(&[1, 2, 0, 0], &[1, 2]);
check(&[0, 0, 1, 2], &[0, 0, 1, 2]);
check(&[0, 0, 1, 2, 0, 0], &[0, 0, 1, 2]);
check(&[-1i32 as BigDigit], &[-1i32 as BigDigit]);
} | rust_cleaned_test_functions.jsonl/90109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
26488,
368,
341,
286,
5168,
1779,
75282,
25,
44590,
15636,
36420,
1125,
821,
25,
44590,
15636,
36420,
2467,
341,
310,
2060,
10297,
15636,
21570,
486,
1499,
26488,
75282,
568,
691,
621,
821,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bits() {
let bit8 = Bits::strict_decode(&[0x01][..]).unwrap();
let bit16 = Bits::strict_decode(&[0x02][..]).unwrap();
let bit32 = Bits::strict_decode(&[0x04][..]).unwrap();
let bit64 = Bits::strict_decode(&[0x08][..]).unwrap();
assert_eq!(bit8, Bits::Bit8);
assert_eq!(bit16, Bits::Bit16);
assert_eq!(bit32, Bits::Bit32);
assert_eq!(bit64, Bits::Bit64);
assert_eq!(bit8.max_value(), core::u8::MAX as u128);
assert_eq!(bit16.max_value(), core::u16::MAX as u128);
assert_eq!(bit32.max_value(), core::u32::MAX as u128);
assert_eq!(bit64.max_value(), core::u64::MAX as u128);
assert_eq!(bit8.bit_len(), 8 as usize);
assert_eq!(bit8.byte_len(), 1 as usize);
assert_eq!(bit16.bit_len(), 16 as usize);
assert_eq!(bit16.byte_len(), 2 as usize);
assert_eq!(bit32.bit_len(), 32 as usize);
assert_eq!(bit32.byte_len(), 4 as usize);
assert_eq!(bit64.bit_len(), 64 as usize);
assert_eq!(bit64.byte_len(), 8 as usize);
} | rust_cleaned_test_functions.jsonl/45942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20034,
368,
341,
286,
1077,
2699,
23,
284,
49457,
486,
6627,
15227,
2099,
58,
15,
87,
15,
16,
1457,
496,
10697,
15454,
543,
286,
1077,
2699,
16,
21,
284,
49457,
486,
6627,
15227,
2099,
58,
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_get_repeated_file_path_from_diff_line() {
assert_eq!(
get_repeated_file_path_from_diff_line("diff --git a/src/main.rs b/src/main.rs"),
Some("src/main.rs".to_string())
);
assert_eq!(
get_repeated_file_path_from_diff_line("diff --git a/a b/a"),
Some("a".to_string())
);
assert_eq!(
get_repeated_file_path_from_diff_line("diff --git a/a b b/a b"),
Some("a b".to_string())
);
assert_eq!(
get_repeated_file_path_from_diff_line("diff --git a/a b/aa"),
None
);
assert_eq!(
get_repeated_file_path_from_diff_line("diff --git a/.config/Code - Insiders/User/settings.json b/.config/Code - Insiders/User/settings.json"),
Some(".config/Code - Insiders/User/settings.json".to_string())
);
} | rust_cleaned_test_functions.jsonl/72336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1288,
41954,
2458,
2638,
5673,
15850,
6528,
368,
341,
286,
2060,
10714,
33673,
310,
633,
1288,
41954,
2458,
2638,
5673,
15850,
6528,
445,
13490,
1177,
12882,
264,
13437,
15351,
25638,
293,
134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_join() -> io::Result<()> {
let mut reader = make_reader(vec![vec![1, 2], vec![3, 4]]);
let out = do_read(&mut reader, 4)?;
assert_eq!(out, vec![1, 2, 3, 4]);
Ok(())
} | rust_cleaned_test_functions.jsonl/8707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
31017,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
6604,
284,
1281,
22306,
25592,
20703,
4083,
20703,
16,
11,
220,
17,
1125,
7486,
20703,
18,
11,
220,
19,
49854,
286,
1077,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_hash() {
let a = "Ted".to_string();
assert_eq!(2646829031758483623, get_hash(&a));
} | rust_cleaned_test_functions.jsonl/130315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8950,
368,
341,
286,
1077,
264,
284,
330,
78653,
3263,
983,
3904,
1428,
286,
2060,
10714,
10297,
17,
21,
19,
21,
23,
17,
24,
15,
18,
16,
22,
20,
23,
19,
23,
18,
21,
17,
18,
11,
633... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_raw_node_start() {
setup_for_test();
let cc = conf_change(ConfChangeType::AddNode, 1);
let ccdata = protobuf::Message::write_to_bytes(&cc).unwrap();
let store = new_storage();
let mut raw_node = new_raw_node(1, vec![], 10, 1, store.clone(), vec![new_peer(1)]);
let rd = raw_node.ready();
info!("rd {:?}", &rd);
assert!(cmp_ready(
&rd,
&None,
&Some(hard_state(1, 1, 0)),
&[entry(
EntryType::EntryConfChange,
1,
1,
Some(ccdata.clone()),
)],
vec![entry(
EntryType::EntryConfChange,
1,
1,
Some(ccdata.clone()),
)],
true,
));
store.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
let rd = raw_node.ready();
store.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
raw_node.campaign().expect("");
let rd = raw_node.ready();
store.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
raw_node.propose(vec![], b"foo".to_vec()).expect("");
let rd = raw_node.ready();
assert!(cmp_ready(
&rd,
&None,
&Some(hard_state(2, 3, 1)),
&[new_entry(2, 3, Some("foo"))],
vec![new_entry(2, 3, Some("foo"))],
false,
));
store.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
assert!(!raw_node.has_ready());
} | rust_cleaned_test_functions.jsonl/2060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
4906,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
12527,
284,
2335,
15947,
7,
15578,
4072,
929,
486,
2212,
1955,
11,
220,
16,
317,
262,
1077,
12527,
691,
284,
69634,
486,
2052,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_folds() {
let a = [1, 2, 3, 4, 5]; // len>4 so the unroll is used
assert_eq!(a.iter().fold(0, |acc, &x| 2*acc + x), 57);
assert_eq!(a.iter().rfold(0, |acc, &x| 2*acc + x), 129);
let fold = |acc: i32, &x| acc.checked_mul(2)?.checked_add(x);
assert_eq!(a.iter().try_fold(0, &fold), Some(57));
assert_eq!(a.iter().try_rfold(0, &fold), Some(129));
let a = [0, 1, 2, 3, 5, 5, 5, 7, 8, 9];
let mut iter = a.iter();
assert_eq!(iter.position(|&x| x == 3), Some(3));
assert_eq!(iter.rfind(|&&x| x == 5), Some(&5));
assert_eq!(iter.len(), 2);
} | rust_cleaned_test_functions.jsonl/4151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
761,
18431,
368,
341,
262,
1077,
264,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
5265,
442,
2422,
29,
19,
773,
279,
650,
1100,
374,
1483,
198,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_is_empty() {
with_default_globals(|| {
let test0: TokenStream = Vec::<TokenTree>::new().into_iter().collect();
let test1: TokenStream =
TokenTree::Token(sp(0, 1), Token::Ident(Ident::from_str("a"), false)).into();
let test2 = string_to_ts("foo(bar::baz)");
assert_eq!(test0.is_empty(), true);
assert_eq!(test1.is_empty(), false);
assert_eq!(test2.is_empty(), false);
})
} | rust_cleaned_test_functions.jsonl/12431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
15124,
368,
341,
286,
448,
9993,
58775,
79453,
341,
310,
1077,
1273,
15,
25,
9660,
3027,
284,
11312,
27638,
3323,
6533,
6831,
931,
1005,
18122,
11723,
1005,
17384,
543,
310,
1077,
1273,
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 |
#[test]
fn test_touch_set_both() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_touch_set_both";
ucmd.args(&["-t", "201501011234", "-a", "-m", file])
.succeeds()
.no_stderr();
assert!(at.file_exists(file));
let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000");
let (atime, mtime) = get_file_times(&at, file);
assert_eq!(atime, mtime);
assert_eq!(atime.unix_seconds() - start_of_year.unix_seconds(), 45240);
assert_eq!(mtime.unix_seconds() - start_of_year.unix_seconds(), 45240);
} | rust_cleaned_test_functions.jsonl/41030 | {
"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,
60840,
2602,
88819,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1944,
60840,
2602,
88819,
3302,
262,
575,
8710,
16365,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debits_before_credits() {
let (genesis_block, mint_keypair) = GenesisBlock::new(2);
let bank = Bank::new(&genesis_block);
let keypair = Keypair::new();
let tx0 = system_transaction::create_user_account(
&mint_keypair,
&keypair.pubkey(),
2,
genesis_block.hash(),
0,
);
let tx1 = system_transaction::create_user_account(
&keypair,
&mint_keypair.pubkey(),
1,
genesis_block.hash(),
0,
);
let txs = vec![tx0, tx1];
let results = bank.process_transactions(&txs);
assert!(results[1].is_err());
// Assert bad transactions aren't counted.
assert_eq!(bank.transaction_count(), 1);
} | rust_cleaned_test_functions.jsonl/41892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
11516,
23708,
666,
29502,
368,
341,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
7,
17,
317,
286,
1077,
6073,
284,
8547,
486,
931,
2099,
77894,
7113,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_from_hms_micro() {
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, 0),
Some(NaiveTime::from_hms_nano(3, 5, 7, 0)));
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, 333),
Some(NaiveTime::from_hms_nano(3, 5, 7, 333_000)));
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, 777_777),
Some(NaiveTime::from_hms_nano(3, 5, 7, 777_777_000)));
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, 1_999_999),
Some(NaiveTime::from_hms_nano(3, 5, 7, 1_999_999_000)));
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, 2_000_000), None);
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, 5_000_000), None); // overflow check
assert_eq!(NaiveTime::from_hms_micro_opt(3, 5, 7, u32::MAX), None);
} | rust_cleaned_test_functions.jsonl/32330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
5673,
1523,
1011,
73003,
368,
341,
286,
2060,
10714,
10297,
16193,
533,
1462,
486,
1499,
1523,
1011,
73003,
15032,
7,
18,
11,
220,
20,
11,
220,
22,
11,
220,
15,
1326,
4293,
4329,
8204,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spaced_name() -> Result<()> {
let name = SqlName::new("spaced name").safe();
assert_eq!(&name, "`spaced name`");
let name = SqlName::new("spaced name").alias("s n").safe();
assert_eq!(&name, "`spaced name` AS `s n`");
let name = name!("spaced name");
assert_eq!(&name, "`spaced name`");
let name = name!("spaced name"; "s n");
assert_eq!(&name, "`spaced name` AS `s n`");
Ok(())
} | rust_cleaned_test_functions.jsonl/74806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
4435,
1269,
368,
1464,
5714,
71698,
341,
286,
1077,
829,
284,
7224,
675,
486,
931,
445,
2154,
4435,
829,
1827,
18675,
543,
286,
2060,
10714,
0,
2099,
606,
11,
35973,
2154,
4435,
829,
63,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_file() {
let mut content:String = String::new();
let filename:String;
filename = "../temp/temp.txt".to_string();
filehandler::write_file(filename, content);
} | rust_cleaned_test_functions.jsonl/61936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
2458,
368,
341,
220,
1077,
5206,
2213,
15816,
284,
923,
486,
931,
543,
220,
1077,
3899,
15816,
280,
220,
3899,
284,
7005,
3888,
70445,
3909,
3263,
983,
3904,
543,
220,
1034,
17905,
486,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_output_stream_write_int32_no_tag() {
test_write("ff ff ff ff ff ff ff ff ff 01", |os| {
os.write_int32_no_tag(-1)
});
} | rust_cleaned_test_functions.jsonl/104516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
12673,
9165,
4042,
18,
17,
6536,
9372,
368,
341,
286,
1273,
9165,
445,
542,
25539,
25539,
25539,
25539,
25539,
25539,
25539,
25539,
220,
15,
16,
497,
760,
436,
91,
341,
310,
2643,
3836,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_empty() {
let key = Keypair::new();
let index = AccountsIndex::<bool>::default();
let ancestors = HashMap::new();
assert!(index.get(&key.pubkey(), Some(&ancestors), None).is_none());
assert!(index.get(&key.pubkey(), None, None).is_none());
let mut num = 0;
index.scan_accounts(&ancestors, |_pubkey, _index| num += 1);
assert_eq!(num, 0);
} | rust_cleaned_test_functions.jsonl/56016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
15124,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
543,
286,
1077,
37518,
284,
10528,
486,
931,
543,
286,
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_file_map_dbu64() {
let db_name = "target/tmp/test_iter-u.abyssiniandb";
let _ = std::fs::remove_dir_all(db_name);
let db = abyssiniandb::open_file(db_name).unwrap();
let mut db_map = db.db_map_u64("some_u64_1").unwrap();
iter_test_map_empty_iter(&mut db_map);
basic_test_map_dbint(&mut db_map);
medium_test_map_dbint(&mut db_map);
} | rust_cleaned_test_functions.jsonl/7244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
5376,
8685,
84,
21,
19,
368,
341,
286,
1077,
2927,
1269,
284,
330,
5657,
57008,
12697,
11723,
45381,
13,
6115,
778,
6591,
437,
65,
876,
286,
1077,
716,
284,
1460,
486,
3848,
486,
5399,
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_bindingtester() {
test_serde("NEW_TRANSACTION".to_string(), b"\x02NEW_TRANSACTION\x00");
test_serde(
vec!["NEW_TRANSACTION".to_string()],
b"\x02NEW_TRANSACTION\x00",
);
test_serde(
vec![
Element::String(Cow::Borrowed("PUSH")),
Element::Bytes(Bytes::from(
b"\x01tester_output\x00\x01results\x00\x14".as_ref(),
)),
],
b"\x02PUSH\x00\x01\x01tester_output\x00\xff\x01results\x00\xff\x14\x00",
);
test_serde(
vec![Element::String(Cow::Borrowed("PUSH")), Element::Nil],
b"\x02PUSH\x00\x00",
);
test_serde(
vec![
Element::String(Cow::Borrowed("PUSH")),
Element::Tuple(vec![
Element::Nil,
Element::Float(3299069000000.0),
Element::Float(-0.000000000000000000000000000000000000011883096),
]),
],
b"\x02PUSH\x00\x05\x00\xff \xd4@\x07\xf5 \x7f~\x9a\xc2\x00",
);
test_serde(
vec![
Element::String(Cow::Borrowed("PUSH")),
Element::Int(-133525682914243904),
],
b"\x02PUSH\x00\x0c\xfe%\x9f\x19M\x81J\xbf",
);
test_serde(
Element::Tuple(vec![Element::Nil, Element::Nil]),
b"\x00\x00",
);
} | rust_cleaned_test_functions.jsonl/33094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60815,
73358,
368,
341,
286,
1273,
75861,
450,
445,
20594,
78509,
3263,
983,
3904,
1507,
293,
11934,
87,
15,
17,
20594,
78509,
3462,
15,
15,
797,
286,
1273,
75861,
450,
1006,
310,
7486,
0,
1183,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_snapshot_with_no_committed_entries_ready() {
let mut cluster = new_node_cluster(0, 3);
configure_for_snapshot(&mut cluster);
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
let on_raft_gc_log_tick_fp = "on_raft_gc_log_tick";
fail::cfg(on_raft_gc_log_tick_fp, "return()").unwrap();
let before_no_ready_gen_snap_task_fp = "before_no_ready_gen_snap_task";
fail::cfg(before_no_ready_gen_snap_task_fp, "return()").unwrap();
cluster.run();
cluster.add_send_filter(IsolationFilterFactory::new(3));
for i in 1..10 {
cluster.must_put(format!("k{}", i).as_bytes(), b"v1");
}
fail::remove(on_raft_gc_log_tick_fp);
sleep_ms(100);
cluster.clear_send_filters();
// Snapshot should be generated and sent after leader 1 receives the heartbeat
// response from peer 3.
must_get_equal(&cluster.get_engine(3), b"k9", b"v1");
} | rust_cleaned_test_functions.jsonl/68044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
53265,
6615,
6536,
2965,
5483,
26092,
35456,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
53265,
2099,
6984,
10652,
626,
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... | 2 |
#[test]
fn test_column_u64() {
let mut fields = vec![
field_type(FieldTypeTp::Tiny),
field_type(FieldTypeTp::Short),
field_type(FieldTypeTp::Int24),
field_type(FieldTypeTp::Long),
field_type(FieldTypeTp::LongLong),
field_type(FieldTypeTp::Year),
];
for field in &mut fields {
field.set_flag(FieldTypeFlag::UNSIGNED.bits());
}
let data = vec![
Datum::Null,
Datum::U64(1),
Datum::U64(u64::MIN),
Datum::U64(u64::MAX),
];
test_colum_datum(fields, data);
} | rust_cleaned_test_functions.jsonl/24362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
7300,
21,
19,
368,
341,
286,
1077,
5206,
5043,
284,
7486,
90515,
310,
2070,
1819,
57788,
929,
62241,
486,
85693,
1326,
310,
2070,
1819,
57788,
929,
62241,
486,
12472,
1326,
310,
2070,
1819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_args_dsub() {
let mut args = Args::new();
assert_eq!(2, args.dsub());
args.set_dsub(5);
assert_eq!(5, args.dsub());
} | rust_cleaned_test_functions.jsonl/118632 | {
"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,
8384,
814,
1966,
368,
341,
286,
1077,
5206,
2827,
284,
17693,
486,
931,
543,
286,
2060,
10714,
10297,
17,
11,
2827,
950,
1966,
5231,
286,
2827,
980,
814,
1966,
7,
20,
317,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_encode_variable_length() {
let mut v = BytesMut::new();
write_variable_length(123, &mut v);
assert_eq!(v, [123].as_ref());
v.clear();
write_variable_length(129, &mut v);
assert_eq!(v, b"\x81\x01".as_ref());
v.clear();
write_variable_length(16_383, &mut v);
assert_eq!(v, b"\xff\x7f".as_ref());
v.clear();
write_variable_length(2_097_151, &mut v);
assert_eq!(v, b"\xff\xff\x7f".as_ref());
v.clear();
write_variable_length(268_435_455, &mut v);
assert_eq!(v, b"\xff\xff\xff\x7f".as_ref());
} | rust_cleaned_test_functions.jsonl/19657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
14635,
5118,
368,
341,
286,
1077,
5206,
348,
284,
30024,
51440,
486,
931,
1428,
286,
3270,
14635,
5118,
7,
16,
17,
18,
11,
609,
6984,
348,
317,
286,
2060,
10714,
10297,
85,
11,
508,
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_keys_with_options_blanks_end() {
let input = "a b
a b
a b
";
new_ucmd!()
.args(&["-k", "1,2.1b", "-s"])
.pipe_in(input)
.succeeds()
.stdout_only(
"a b
a b
a b
",
);
} | rust_cleaned_test_functions.jsonl/20512 | {
"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,
12631,
6615,
8743,
13141,
4039,
6213,
368,
341,
262,
1077,
1946,
284,
330,
64,
220,
293,
198,
64,
293,
198,
64,
256,
293,
198,
876,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rng_64_rand_seeded() {
let s = ::test::rng().gen_iter::<u64>().take(256).collect::<Vec<u64>>();
let mut ra: Isaac64Rng = SeedableRng::from_seed(&s[..]);
let mut rb: Isaac64Rng = SeedableRng::from_seed(&s[..]);
assert!(order::equals(ra.gen_ascii_chars().take(100),
rb.gen_ascii_chars().take(100)));
} | rust_cleaned_test_functions.jsonl/94702 | {
"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,
66849,
62,
21,
19,
33864,
3453,
29935,
368,
341,
286,
1077,
274,
284,
3504,
1944,
486,
69890,
1005,
4370,
11723,
27638,
84,
21,
19,
10483,
22769,
7,
17,
20,
21,
568,
17384,
27638,
10050,
34837,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_item() {
let gil = Python::acquire_gil();
let py = gil.python();
let v = vec![2, 3, 5, 7];
let list = v.to_py_object(py);
let val = 42i32.to_py_object(py).into_object();
assert_eq!(2, list.get_item(py, 0).extract::<i32>(py).unwrap());
list.set_item(py, 0, val);
assert_eq!(42, list.get_item(py, 0).extract::<i32>(py).unwrap());
} | rust_cleaned_test_functions.jsonl/4742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
5634,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
284,
7486,
20703,
17,
11,
220,
18,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finite_recursion_objects() {
#[derive(Deserialize, Debug)]
struct S {
x: Option<Box<S>>,
}
let yaml = "{x:".repeat(1_000) + &"}".repeat(1_000);
let expected = "recursion limit exceeded at line 1 column 766";
test_error::<i32>(&yaml, expected);
} | rust_cleaned_test_functions.jsonl/45581 | {
"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,
761,
15856,
7080,
34280,
24873,
368,
341,
262,
11506,
27098,
7,
64465,
11,
11091,
5563,
262,
2036,
328,
341,
286,
856,
25,
6959,
79852,
18858,
61340,
262,
555,
262,
1077,
32246,
284,
13868,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_advance_loc() {
let cie = make_test_cie();
let mut ctx = UnwindContext::new();
ctx.row_mut().start_address = 3;
let mut expected = ctx.clone();
expected.row_mut().end_address = 3 + 2 * cie.code_alignment_factor;
let instructions = [(Ok(true), CallFrameInstruction::AdvanceLoc { delta: 2 })];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
98093,
13400,
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,
11547,
29523,
1005,
2468,
6744,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_typical_file() {
let mut file = File::open("tests/js/jquery.js").unwrap();
let mut s = String::new();
file.read_to_string(&mut s).unwrap();
js_parser_rs::parse(OwningChars::new(s)).unwrap();
} | rust_cleaned_test_functions.jsonl/61529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
42111,
938,
2458,
368,
341,
262,
1077,
5206,
1034,
284,
2887,
486,
2508,
445,
23841,
9113,
9576,
2857,
1827,
15454,
543,
262,
1077,
5206,
274,
284,
923,
486,
931,
543,
262,
1034,
4125,
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_derive_decode_fixed_size_multi() {
use binstruct_codegen::BinDecode;
#[derive(Debug, BinDecode, PartialEq)]
#[binstruct(mod_path = "crate::serialize")]
struct T {
_1: u32,
_2: u16,
_3: u8,
}
assert_eq!(
T::MIN_SIZE,
size_of::<u32>() + size_of::<u16>() + size_of::<u8>()
);
assert!(T::FIXED_SIZE);
let mut buf = BytesMut::new();
buf.put_u32_le(1);
buf.put_u16_le(2);
buf.put_u8(3);
let t = T::decode(&mut buf).unwrap();
assert_eq!(
t,
T {
_1: 1,
_2: 2,
_3: 3,
}
);
assert!(!buf.has_remaining());
} | rust_cleaned_test_functions.jsonl/101523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
15227,
37839,
2368,
25133,
368,
341,
220,
990,
9544,
1235,
32018,
486,
28794,
32564,
280,
220,
11506,
27098,
42618,
11,
29344,
32564,
11,
55039,
5563,
220,
11506,
6863,
1235,
23351,
2638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_direction_to_coord2() {
let path = Path::parse("esew");
assert_eq!(path.directions, vec![Direction::East, Direction::Southeast, Direction::West]);
assert_eq!(path.follow(&Coordinate::start()), Coordinate::new(1, 0, -1));
} | rust_cleaned_test_functions.jsonl/94628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25438,
2346,
30096,
17,
368,
341,
286,
1077,
1815,
284,
7933,
486,
6400,
445,
288,
365,
797,
286,
2060,
10714,
10297,
2343,
27621,
82,
11,
7486,
20703,
9268,
486,
36340,
11,
18904,
486,
57432,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accumulate_execute_units_and_time() {
let mut execute_timings = ExecuteTimings::default();
let mut expected_units = 0;
let mut expected_us = 0;
for n in 0..10 {
execute_timings.details.per_program_timings.insert(
Pubkey::new_unique(),
ProgramTiming {
accumulated_us: n * 100,
accumulated_units: n * 1000,
count: n as u32,
errored_txs_compute_consumed: vec![],
total_errored_units: 0,
},
);
expected_us += n * 100;
expected_units += n * 1000;
}
let (units, us) = BankingStage::accumulate_execute_units_and_time(&execute_timings);
assert_eq!(expected_units, units);
assert_eq!(expected_us, us);
} | rust_cleaned_test_functions.jsonl/15502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75837,
6334,
44329,
28345,
8378,
3009,
368,
341,
286,
1077,
5206,
9026,
29087,
819,
284,
20848,
20217,
819,
486,
2258,
543,
286,
1077,
5206,
3601,
28345,
284,
220,
15,
280,
286,
1077,
5206,
3601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_PoK_sig_with_verify_proof_error() {
let count_msgs = 5;
let params = Params::new("test".as_bytes());
let (vk, sk) = keygen(count_msgs, ¶ms);
let msgs = FieldElementVector::random(count_msgs);
let sig = Signature::new(msgs.as_slice(), &sk, ¶ms).unwrap();
let pok = PoKOfSignature::init(&sig, &vk, ¶ms, msgs.as_slice(), None, HashSet::new())
.unwrap();
let chal_prover = FieldElement::from_msg_hash(&pok.to_bytes());
let proof = pok.gen_proof(&chal_prover).unwrap();
// The verifier generates the challenge on its own.
let chal_bytes = proof.get_bytes_for_challenge(HashSet::new(), &vk, ¶ms);
let chal_verifier = FieldElement::from_msg_hash(&chal_bytes);
// Verification fails with bad verkey
let mut vk_1 = vk.clone();
vk_1.Y_tilde.push(OtherGroup::new());
assert!(proof
.verify(&vk_1, ¶ms, HashMap::new(), &chal_verifier)
.is_err());
// Verification passes with correct verkey
assert!(proof
.verify(&vk, ¶ms, HashMap::new(), &chal_verifier)
.unwrap());
} | rust_cleaned_test_functions.jsonl/62471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1088,
78,
42,
29252,
6615,
35638,
86757,
4096,
368,
341,
286,
1077,
1760,
20777,
284,
220,
20,
280,
286,
1077,
3628,
284,
34352,
486,
931,
445,
1944,
3263,
300,
12524,
1423,
286,
1077,
320,
4836... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_acos() {
let a = Angle::acos(0.5).unwrap();
assert_approx_eq!(a.degrees(), 60.0);
let a = Angle::acos(-f32::sqrt(3.0)/2.0).unwrap();
assert_approx_eq!(a.degrees(), 150.0);
} | rust_cleaned_test_functions.jsonl/109962 | {
"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,
14718,
436,
368,
341,
286,
1077,
264,
284,
36237,
486,
41647,
7,
15,
13,
20,
568,
15454,
543,
286,
2060,
90425,
10714,
10297,
64,
70417,
7858,
1507,
220,
21,
15,
13,
15,
626,
286,
1077,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reference_vector_l3_nonstandard_compl_sideinfo_bigvalues() {
let test_vector = include_bytes!("../vectors/l3-nonstandard-compl-sideinfo-bigvalues.bit");
test_vs_minimp3(test_vector);
} | rust_cleaned_test_functions.jsonl/69847 | {
"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,
25433,
12247,
907,
18,
21637,
20270,
2965,
500,
30862,
2733,
36386,
3661,
368,
341,
262,
1077,
1273,
12247,
284,
2924,
12524,
17223,
1244,
85,
10605,
13328,
18,
98700,
20270,
11476,
500,
24067,
2733... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.