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_doc_url_fn() {
check(
r#"
pub fn fo$0o() {}
"#,
expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]],
);
} | rust_cleaned_test_functions.jsonl/61956 | {
"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,
18869,
2903,
15246,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9585,
5168,
11756,
3,
15,
78,
368,
5613,
57676,
345,
310,
1720,
0,
15505,
81,
565,
1,
2428,
1110,
14120,
25638,
12697,
91537,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_4_isog() {
let _phi_pb_x = fp2from_hexes("1113975d6d50082b5aa386422cbb191749ac238b19d7717d775cd71f7228420f635722f790ff97a3044e693a0eaf0d07a2328452cec76", "0"); // form sage
let dbl_pa_proj = xdbl_e(paxz(), a24plus(), c24(), EA - 2);
let (_, _, cs) = get_4_isog(dbl_pa_proj);
let phi_pb_proj = eval_4_isog(pbxz(), cs);
let phi_pb_proj_z_inv = fp2inv(phi_pb_proj.1);
let _phi_pb_proj_x = fp2mul(phi_pb_proj.0, phi_pb_proj_z_inv);
// this is not correct and i am not sure why. I think it is
// because is uses a different isogeny than the fp2one sage generates
// an isomorphism)
} | rust_cleaned_test_functions.jsonl/11575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
62,
19,
6892,
538,
368,
341,
262,
1077,
716,
16827,
31409,
3212,
284,
12007,
17,
1499,
32655,
288,
445,
16,
16,
16,
18,
24,
22,
20,
67,
21,
67,
20,
15,
15,
23,
17,
65,
20,
5305,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_eq() {
cmp_i64!(
eq,
vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
vec![false, false, true, false, false, false, false, true, false, false]
);
} | rust_cleaned_test_functions.jsonl/36013 | {
"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,
84087,
3858,
10714,
368,
341,
286,
26089,
5318,
21,
19,
33673,
310,
8939,
345,
310,
7486,
20703,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
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_rpath_relative() {
if cfg!(target_os = "macos") {
let config = &mut RPathConfig {
used_crates: Vec::new(),
has_rpath: true,
is_like_osx: true,
out_filename: PathBuf::from("bin/rustc"),
get_install_prefix_lib_path: &mut || panic!(),
realpath: &mut |p| Ok(p.to_path_buf()),
};
let res = get_rpath_relative_to_output(config,
Path::new("lib/libstd.so"));
assert_eq!(res, "@loader_path/../lib");
} else {
let config = &mut RPathConfig {
used_crates: Vec::new(),
out_filename: PathBuf::from("bin/rustc"),
get_install_prefix_lib_path: &mut || panic!(),
has_rpath: true,
is_like_osx: false,
realpath: &mut |p| Ok(p.to_path_buf()),
};
let res = get_rpath_relative_to_output(config,
Path::new("lib/libstd.so"));
assert_eq!(res, "$ORIGIN/../lib");
}
} | rust_cleaned_test_functions.jsonl/20104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
2343,
29286,
368,
341,
286,
421,
13286,
10297,
5657,
29387,
284,
330,
11948,
436,
899,
341,
310,
1077,
2193,
284,
609,
6984,
431,
1820,
2648,
341,
394,
1483,
32331,
973,
25,
11312,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_zip_nth_side_effects() {
let mut a = Vec::new();
let mut b = Vec::new();
let value = [1, 2, 3, 4, 5, 6]
.iter()
.cloned()
.map(|n| {
a.push(n);
n * 10
})
.zip([2, 3, 4, 5, 6, 7, 8].iter().cloned().map(|n| {
b.push(n * 100);
n * 1000
}))
.skip(1)
.nth(3);
assert_eq!(value, Some((50, 6000)));
assert_eq!(a, vec![1, 2, 3, 4, 5]);
assert_eq!(b, vec![200, 300, 400, 500, 600]);
} | rust_cleaned_test_functions.jsonl/8959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
78342,
30862,
83171,
368,
341,
262,
1077,
5206,
264,
284,
11312,
486,
931,
543,
262,
1077,
5206,
293,
284,
11312,
486,
931,
543,
262,
1077,
897,
284,
508,
16,
11,
220,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mock_wait_error() {
let client = Client::new_num(1);
let mut creator = MockCommandCreator::new(&client);
creator.next_command_spawns(Ok(MockChild::with_error(io::Error::new(
io::ErrorKind::Other,
"error",
))));
let e = spawn_wait_command(&mut creator, "foo").err().unwrap();
assert_eq!("error", e.to_string());
} | rust_cleaned_test_functions.jsonl/89708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34134,
18760,
4096,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
4273,
7,
16,
317,
286,
1077,
5206,
19919,
284,
14563,
4062,
31865,
486,
931,
2099,
2972,
317,
286,
19919,
4529,
10811,
10123,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_209() {
assert_eq!(Solution::min_sub_array_len(7, vec![2,3,1,2,4,3]), 2);
assert_eq!(Solution::min_sub_array_len(4, vec![1,4,4]), 1);
} | rust_cleaned_test_functions.jsonl/21727 | {
"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,
17,
15,
24,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
1065,
5228,
3858,
6043,
7,
22,
11,
7486,
20703,
17,
11,
18,
11,
16,
11,
17,
11,
19,
11,
18,
9719,
220,
17,
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... | 1 |
#[test]
fn test_object_dynamic_access() {
let mut object = HashMap::new();
object.insert("foo", "Foo, hello world!");
object.insert("bar", "Bar, hello world!");
assert_eq!(
Expr::new("object['foo'] == 'Foo, hello world!'")
.value("object", object)
.exec(),
Ok(to_value(true))
);
} | rust_cleaned_test_functions.jsonl/28437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
45992,
12759,
368,
341,
286,
1077,
5206,
1633,
284,
10528,
486,
931,
543,
286,
1633,
7030,
445,
7975,
497,
330,
40923,
11,
23811,
1879,
11142,
286,
1633,
7030,
445,
2257,
497,
330,
3428,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_current_time() {
let _pool = ConstPool::new();
let text = r"
/// current_time: 100
script {
use 0x1::Time;
fun main() {
assert(false, Time::now());
}
}
";
let res = execute_script(
MoveFile::with_content(script_path(), text),
vec![stdlib_mod("time.move")],
"libra",
"0x1",
vec![],
)
.unwrap()
.last()
.unwrap();
assert_eq!(
res.error(),
"Execution aborted with code 100 in transaction script"
);
} | rust_cleaned_test_functions.jsonl/43934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
11080,
3009,
368,
341,
262,
1077,
716,
10285,
284,
24522,
10551,
486,
931,
1428,
262,
1077,
1467,
284,
435,
698,
2575,
1482,
3009,
25,
220,
16,
15,
15,
198,
2282,
341,
262,
990,
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_iter_emoji_ids() {
let mut iter = Id::<EmojiMarker>::iter("some <:name:123> emojis <:emoji:456>");
assert_eq!(Id::new(123), iter.next().unwrap().0);
assert_eq!(Id::new(456), iter.next().unwrap().0);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/99684 | {
"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,
11723,
62,
37523,
8077,
368,
341,
286,
1077,
5206,
5367,
284,
5223,
27638,
92731,
20613,
6831,
2015,
445,
14689,
47926,
606,
25,
16,
17,
18,
29,
99066,
47926,
37523,
25,
19,
20,
21,
15084,
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_addition_vs_multiplication() {
let p = EdwardsPoint::basepoint();
let p_plus_p = &p + &p;
let two = Scalar::from_bytes(&[
2u8, 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,
]);
let two_times_p = &two * &p;
assert_eq!(p_plus_p, two_times_p);
} | rust_cleaned_test_functions.jsonl/36537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
680,
42434,
91802,
1693,
368,
1476,
286,
1077,
281,
284,
36763,
2609,
486,
3152,
2768,
543,
286,
1077,
281,
28043,
620,
284,
609,
79,
488,
609,
79,
280,
286,
1077,
1378,
284,
35176,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_game_not_found() {
let mut machine = Machine::new(TestContext::new());
assert_eq!(
machine.load_game("ping").err().unwrap().to_string(),
"Game ping not included".to_string()
);
} | rust_cleaned_test_functions.jsonl/127947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18547,
7913,
21480,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
2060,
10714,
33673,
286,
5662,
5104,
18547,
445,
9989,
1827,
615,
1005,
15454,
1005,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_plain_decode_byte_array() {
let mut data = vec![ByteArray::new(); 2];
data[0].set_data(ByteBufferPtr::new(String::from("hello").into_bytes()));
data[1].set_data(ByteBufferPtr::new(String::from("parquet").into_bytes()));
let data_bytes = ByteArrayType::to_byte_array(&data[..]);
let mut buffer = vec![ByteArray::new(); 2];
test_plain_decode::<ByteArrayType>(
ByteBufferPtr::new(data_bytes),
2,
-1,
&mut buffer[..],
&data[..],
);
} | rust_cleaned_test_functions.jsonl/38511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41015,
15227,
19737,
3858,
368,
341,
286,
1077,
5206,
821,
284,
7486,
20703,
18394,
486,
931,
2129,
220,
17,
935,
286,
821,
58,
15,
936,
746,
1769,
55823,
4095,
5348,
486,
931,
2242,
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_poh_recorder_record_at_min_passes() {
let ledger_path = get_tmp_ledger_path!();
{
let blocktree =
Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger");
let GenesisBlockInfo { genesis_block, .. } = create_genesis_block(2);
let bank = Arc::new(Bank::new(&genesis_block));
let prev_hash = bank.last_blockhash();
let (mut poh_recorder, entry_receiver) = PohRecorder::new(
0,
prev_hash,
0,
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blocktree),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
);
let working_bank = WorkingBank {
bank: bank.clone(),
min_tick_height: 1,
max_tick_height: 2,
};
poh_recorder.set_working_bank(working_bank);
poh_recorder.tick();
assert_eq!(poh_recorder.tick_cache.len(), 1);
assert_eq!(poh_recorder.tick_height, 1);
let tx = test_tx();
let h1 = hash(b"hello world!");
assert!(poh_recorder
.record(bank.slot(), h1, vec![tx.clone()])
.is_ok());
assert_eq!(poh_recorder.tick_cache.len(), 0);
//tick in the cache + entry
let (_b, e) = entry_receiver.recv().expect("recv 1");
assert_eq!(e.len(), 1);
assert!(e[0].0.is_tick());
let (_b, e) = entry_receiver.recv().expect("recv 2");
assert!(!e[0].0.is_tick());
}
Blocktree::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/31723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1016
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
7080,
1358,
14192,
3752,
7260,
15464,
288,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
9344,
4035,
394,
8362,
9344,
486,
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_host_localhost_open_write() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
// Create temp file
let file: tempfile::NamedTempFile = create_sample_file();
assert!(host.open_file_write(file.path()).is_ok());
} | rust_cleaned_test_functions.jsonl/53627 | {
"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,
12848,
62,
8301,
11311,
9165,
368,
341,
286,
1077,
3468,
25,
8774,
3790,
284,
8774,
3790,
486,
931,
33030,
15064,
486,
1499,
4283,
3583,
15197,
562,
1005,
15454,
543,
286,
442,
4230,
2730,
1034,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_label() {
let mut masm = MacroAssembler::new();
assert_eq!(Label(0), masm.create_label());
assert_eq!(Label(1), masm.create_label());
} | rust_cleaned_test_functions.jsonl/67127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6106,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
1428,
286,
2060,
10714,
10297,
2476,
7,
15,
701,
9243,
76,
2520,
6106,
1423,
286,
2060,
10714,
10297,
2476,
7,
16,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_iter_moved() -> Result<()> {
// When
let moved_entry_1_from = Entry {
path: PathBuf::from("moved_1_from.txt"),
hash: String::from("moved file 1 hash"),
len: 123,
modified: 123,
};
let moved_entry_1a_to = Entry {
path: PathBuf::from("moved_1a_to.txt"),
hash: String::from("moved file 1 hash"),
len: 123,
modified: 123,
};
let moved_entry_1b_to = Entry {
path: PathBuf::from("moved_1b_to.txt"),
hash: String::from("moved file 1 hash"),
len: 123,
modified: 123,
};
let moved_entry_2a_from = Entry {
path: PathBuf::from("moved_2a_from.txt"),
hash: String::from("moved file 2 hash"),
len: 123,
modified: 123,
};
let moved_entry_2b_from = Entry {
path: PathBuf::from("moved_2b_from.txt"),
hash: String::from("moved file 2 hash"),
len: 123,
modified: 123,
};
let moved_entry_2_to = Entry {
path: PathBuf::from("moved_2_to.txt"),
hash: String::from("moved file 2 hash"),
len: 123,
modified: 123,
};
let events = vec![
Event::REMOVED { old: &moved_entry_2b_from },
Event::REMOVED { old: &moved_entry_2a_from },
Event::ADDED {
new: &moved_entry_1a_to
},
Event::ADDED {
new: &moved_entry_1b_to
},
Event::ADDED {
new: &moved_entry_2_to
},
Event::REMOVED { old: &moved_entry_1_from },
];
// When
let stats = Stats::from_iter(events);
// Then
assert_eq!(stats.total, 3);
assert_eq!(stats.moved.len(), 2);
assert_eq!(stats.moved.get(moved_entry_1_from.path.as_path()), Some(&&moved_entry_1a_to));
assert_eq!(stats.moved.get(moved_entry_2a_from.path.as_path()), Some(&&moved_entry_2_to));
assert_eq!(stats.added, vec![&moved_entry_1b_to]);
assert_eq!(stats.removed, vec![&moved_entry_2b_from]);
Ok(())
} | rust_cleaned_test_functions.jsonl/4109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
11723,
717,
4941,
368,
1464,
5714,
71698,
341,
286,
442,
3197,
198,
286,
1077,
7726,
9078,
62,
16,
5673,
284,
15788,
341,
310,
1815,
25,
7933,
15064,
486,
1499,
445,
94818,
62,
16,
5673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_metrics_report_update_check_failure_reason_network() {
block_on(async {
let mut metrics_reporter = MockMetricsReporter::new();
let mut state_machine = StateMachineBuilder::new_stub()
.http(MockHttpRequest::empty())
.metrics_reporter(&mut metrics_reporter)
.build()
.await;
state_machine.run_once().await;
assert!(metrics_reporter
.metrics
.contains(&Metrics::UpdateCheckFailureReason(UpdateCheckFailureReason::Network)));
});
} | rust_cleaned_test_functions.jsonl/59690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37686,
14813,
8882,
7200,
43618,
38229,
20966,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5206,
16734,
14813,
261,
284,
14563,
27328,
52766,
486,
931,
543,
310,
1077,
5206,
1584,
38695,
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_genaddr_wc() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("genaddr")
.arg("tests/samples/wallet.tvc")
.arg("tests/samples/wallet.abi.json")
.arg("--wc")
.arg("-1");
cmd.assert()
.success()
.stdout(predicate::str::contains("Raw address: -1"))
.stdout(predicate::str::contains("Succeeded"));
Ok(())
} | rust_cleaned_test_functions.jsonl/118316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
6214,
75871,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
5349,
687,
4708,
40007,
262,
5439,
21186,
445,
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... | 2 |
#[test]
fn test_encode_publish_packets() {
assert_encode_packet(
&Packet::Publish(Publish {
dup: true,
retain: true,
qos: QoS::ExactlyOnce,
topic: ByteString::from_static("topic"),
packet_id: Some(packet_id(0x4321)),
payload: Bytes::from_static(b"data"),
properties: PublishProperties::default(),
}),
b"\x3d\x0E\x00\x05topic\x43\x21\x00data",
);
assert_encode_packet(
&Packet::Publish(Publish {
dup: false,
retain: false,
qos: QoS::AtMostOnce,
topic: ByteString::from_static("topic"),
packet_id: None,
payload: Bytes::from_static(b"data"),
properties: PublishProperties::default(),
}),
b"\x30\x0c\x00\x05topic\x00data",
);
assert_encode_packet(
&Packet::Publish(Publish {
dup: false,
retain: false,
qos: QoS::AtMostOnce,
topic: ByteString::from_static("topic"),
packet_id: None,
payload: Bytes::from_static(b"data"),
properties: PublishProperties {
subscription_ids: Some(vec![NonZeroU32::new(1).unwrap()]),
..Default::default()
},
}),
b"\x30\x0e\x00\x05topic\x02\x0b\x01data",
);
} | rust_cleaned_test_functions.jsonl/93710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 923
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
58779,
63569,
368,
341,
286,
2060,
11224,
21078,
1006,
310,
609,
16679,
486,
50145,
5304,
2538,
341,
394,
22737,
25,
830,
345,
394,
14060,
25,
830,
345,
394,
92973,
25,
1207,
72743,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unicode_filenames() {
let tname = "😎💚🦊";
let test_fn = format!("{}.txt", tname);
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
assert_fixture_exists!(test_fn);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&["status=none", inf!(test_fn), of!(tmp_fn)])
.run()
.no_stderr()
.no_stdout()
.success();
cmp_file!(
File::open(fixture_path!(&test_fn)).unwrap(),
fix.open(&tmp_fn)
);
} | rust_cleaned_test_functions.jsonl/59403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54662,
80632,
368,
341,
262,
1077,
259,
606,
284,
330,
144848,
145055,
147440,
876,
262,
1077,
1273,
15246,
284,
3561,
17223,
46391,
8586,
497,
259,
606,
317,
262,
1077,
4174,
15246,
284,
3561,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmdline_write_end() {
let gm = create_guest_mem();
let mut cmdline_address = GuestAddress(45);
let mut cmdline = Cmdline::new(10);
cmdline.insert_str("1234").unwrap();
let cmdline = cmdline.as_cstring().unwrap();
assert_eq!(Ok(()), load_cmdline(&gm, cmdline_address, &cmdline));
let val: u8 = gm.read_obj(cmdline_address).unwrap();
assert_eq!(val, b'1');
cmdline_address = cmdline_address.unchecked_add(1);
let val: u8 = gm.read_obj(cmdline_address).unwrap();
assert_eq!(val, b'2');
cmdline_address = cmdline_address.unchecked_add(1);
let val: u8 = gm.read_obj(cmdline_address).unwrap();
assert_eq!(val, b'3');
cmdline_address = cmdline_address.unchecked_add(1);
let val: u8 = gm.read_obj(cmdline_address).unwrap();
assert_eq!(val, b'4');
cmdline_address = cmdline_address.unchecked_add(1);
let val: u8 = gm.read_obj(cmdline_address).unwrap();
assert_eq!(val, b'\0');
} | rust_cleaned_test_functions.jsonl/88252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
1056,
9165,
6213,
368,
341,
286,
1077,
37879,
284,
1855,
62739,
12976,
543,
286,
1077,
5206,
94106,
6744,
284,
26215,
4286,
7,
19,
20,
317,
286,
1077,
5206,
94106,
284,
40210,
1056,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
let interface_aidl = r#"
package com.bwa.aidl_test;
import com.bwa.aidl_test.MyParcelable;
import com.bwa.aidl_test.MyParcelable;
import com.bwa.aidl_test.NonExisting;
import com.bwa.aidl_test.UnusedEnum;
interface MyInterface {
void method1(in MyParcelable);
String method2();
}
"#;
let parcelable_aidl = r#"
package com.bwa.aidl_test;
parcelable MyParcelable {
String name;
byte[] data;
}
"#;
let enum_aidl = r#"
package com.bwa.aidl_test;
enum UnusedEnum {
VALUE1 = 1,
VALUE2 = 2,
}
"#;
// Parse AIDL files
let mut parser = aidl_parser::Parser::new();
parser.add_content("id1", interface_aidl);
parser.add_content("id2", parcelable_aidl);
parser.add_content("id3", enum_aidl);
let res = parser.validate();
assert_eq!(res.len(), 3);
// Check AIDL 1
let ast1 = res.get("id1").expect("result").ast.as_ref().expect("ast");
let interface = ast1.item.as_interface().expect("interface");
assert_eq!(interface.name, "MyInterface");
// Check AIDL 2
let ast2 = res.get("id2").expect("result").ast.as_ref().expect("ast");
let parcelable = ast2.item.as_parcelable().expect("parcelable");
assert_eq!(parcelable.name, "MyParcelable");
// Check AIDL 3
let ast3 = res.get("id3").expect("result").ast.as_ref().expect("ast");
let enum_ = ast3.item.as_enum().expect("enum");
assert_eq!(enum_.name, "UnusedEnum");
// Check diagnostics
assert_eq!(res["id1"].diagnostics.len(), 3);
assert!(res["id1"].diagnostics[0]
.message
.contains("Duplicated import"));
assert!(res["id1"].diagnostics[1]
.message
.contains("Unresolved import"));
assert!(res["id1"].diagnostics[2].message.contains("Unused import"));
assert!(res["id2"].diagnostics.is_empty());
assert!(res["id3"].diagnostics.is_empty());
// Traverse AST
let mut methods = Vec::new();
aidl_parser::traverse::walk_methods(ast1, |m| methods.push(m));
assert_eq!(methods.len(), 2);
assert_eq!(methods[0].name, "method1");
assert_eq!(methods[1].name, "method2");
} | rust_cleaned_test_functions.jsonl/120062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1076
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
262,
1077,
3749,
62,
3779,
75,
284,
435,
2,
698,
286,
6328,
469,
948,
9991,
13,
3779,
75,
4452,
280,
1066,
286,
1159,
469,
948,
9991,
13,
3779,
75,
4452,
27054,
67267,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_push() {
let mut contact_info_table = ContactInfoTable::default();
let mut push = NodeTbleGspPush::default();
let value = ContInfTblValue::ContactInfo(ContactInfo::new_localhost(&BvmAddr::new_rand(), 0));
let label = value.label();
// push a new message
assert_eq!(
push.process_push_message(&mut contact_info_table, value.clone(), 0),
Ok(None)
);
assert_eq!(contact_info_table.lookup(&label), Some(&value));
// push it again
assert_eq!(
push.process_push_message(&mut contact_info_table, value.clone(), 0),
Err(NodeTbleErr::PushMessagePrune)
);
} | rust_cleaned_test_functions.jsonl/120868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14218,
368,
341,
286,
1077,
5206,
3645,
3109,
5237,
284,
9180,
1731,
2556,
486,
2258,
543,
286,
1077,
5206,
4484,
284,
6018,
51,
891,
38,
2154,
16644,
486,
2258,
543,
286,
1077,
897,
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_stake_account_lifetime() {
let stake_keypair = Keypair::new();
let stake_pubkey = stake_keypair.pubkey();
let vote_keypair = Keypair::new();
let vote_pubkey = vote_keypair.pubkey();
let node_pubkey = Pubkey::new_rand();
let GenesisConfigInfo {
mut genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(100_000_000_000, &Pubkey::new_rand(), 1_000_000);
genesis_config
.native_instruction_processors
.push(solana_stake_program::solana_stake_program!());
let bank = Bank::new(&genesis_config);
let mint_pubkey = mint_keypair.pubkey();
let mut bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
// Create Vote Account
let message = Message::new(vote_instruction::create_account(
&mint_pubkey,
&vote_pubkey,
&VoteInit {
node_pubkey,
authorized_voter: vote_pubkey,
authorized_withdrawer: vote_pubkey,
commission: std::u8::MAX / 2,
},
10,
));
bank_client
.send_message(&[&mint_keypair, &vote_keypair], message)
.expect("failed to create vote account");
let authorized = stake_state::Authorized::auto(&stake_pubkey);
// Create stake account and delegate to vote account
let message = Message::new(stake_instruction::create_stake_account_and_delegate_stake(
&mint_pubkey,
&stake_pubkey,
&vote_pubkey,
&authorized,
1_000_000,
));
bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.expect("failed to create and delegate stake account");
// Test that correct lamports are staked
let account = bank.get_account(&stake_pubkey).expect("account not found");
let stake_state = account.state().expect("couldn't unpack account data");
if let StakeState::Stake(_meta, stake) = stake_state {
assert_eq!(stake.delegation.stake, 1_000_000);
} else {
assert!(false, "wrong account type found")
}
// Test that we cannot withdraw anything until deactivation
let message = Message::new_with_payer(
vec![stake_instruction::withdraw(
&stake_pubkey,
&stake_pubkey,
&Pubkey::new_rand(),
1,
)],
Some(&mint_pubkey),
);
assert!(bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.is_err());
// Test that lamports are still staked
let account = bank.get_account(&stake_pubkey).expect("account not found");
let stake_state = account.state().expect("couldn't unpack account data");
if let StakeState::Stake(_meta, stake) = stake_state {
assert_eq!(stake.delegation.stake, 1_000_000);
} else {
assert!(false, "wrong account type found")
}
// Reward redemption
// Submit enough votes to generate rewards
bank = fill_epoch_with_votes(&bank, &vote_keypair, &mint_keypair);
// Test that votes and credits are there
let account = bank.get_account(&vote_pubkey).expect("account not found");
let vote_state: VoteState = account.state().expect("couldn't unpack account data");
assert_eq!(vote_state.votes.len(), 31);
assert_eq!(vote_state.credits(), 1);
bank = fill_epoch_with_votes(&bank, &vote_keypair, &mint_keypair);
loop {
if warmed_up(&bank, &stake_pubkey) {
break;
}
// Cycle thru banks until we're fully warmed up
bank = next_epoch(&bank);
}
// Test that rewards are there
let rewards_account = bank
.get_account(&sysvar::rewards::id())
.expect("account not found");
assert_matches!(Rewards::from_account(&rewards_account), Some(_));
let pre_staked = get_staked(&bank, &stake_pubkey);
// Redeem the credit
let bank_client = BankClient::new_shared(&bank);
let message = Message::new_with_payer(
vec![stake_instruction::redeem_vote_credits(
&stake_pubkey,
&vote_pubkey,
)],
Some(&mint_pubkey),
);
assert_matches!(bank_client.send_message(&[&mint_keypair], message), Ok(_));
let staked = get_staked(&bank, &stake_pubkey);
let lamports = bank.get_balance(&stake_pubkey);
assert!(staked > pre_staked);
assert!(lamports > 1_000_000);
// split the stake
let split_stake_keypair = Keypair::new();
let split_stake_pubkey = split_stake_keypair.pubkey();
// Test split
let message = Message::new_with_payer(
stake_instruction::split(
&stake_pubkey,
&stake_pubkey,
lamports / 2,
&split_stake_pubkey,
),
Some(&mint_pubkey),
);
assert!(bank_client
.send_message(
&[&mint_keypair, &stake_keypair, &split_stake_keypair],
message
)
.is_ok());
// Deactivate the split
let message = Message::new_with_payer(
vec![stake_instruction::deactivate_stake(
&split_stake_pubkey,
&stake_pubkey,
)],
Some(&mint_pubkey),
);
assert!(bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.is_ok());
let split_staked = get_staked(&bank, &split_stake_pubkey);
// Test that we cannot withdraw above what's staked
let message = Message::new_with_payer(
vec![stake_instruction::withdraw(
&split_stake_pubkey,
&stake_pubkey,
&Pubkey::new_rand(),
lamports / 2 - split_staked + 1,
)],
Some(&mint_pubkey),
);
assert!(bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.is_err());
let mut bank = next_epoch(&bank);
let bank_client = BankClient::new_shared(&bank);
// assert we're still cooling down
let split_staked = get_staked(&bank, &split_stake_pubkey);
assert!(split_staked > 0);
// withdrawal in cooldown
let message = Message::new_with_payer(
vec![stake_instruction::withdraw(
&split_stake_pubkey,
&stake_pubkey,
&Pubkey::new_rand(),
lamports / 2,
)],
Some(&mint_pubkey),
);
assert!(bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.is_err());
// but we can withdraw unstaked
let message = Message::new_with_payer(
vec![stake_instruction::withdraw(
&split_stake_pubkey,
&stake_pubkey,
&Pubkey::new_rand(),
lamports / 2 - split_staked,
)],
Some(&mint_pubkey),
);
// assert we can withdraw unstaked tokens
assert!(bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.is_ok());
// finish cooldown
loop {
if get_staked(&bank, &split_stake_pubkey) == 0 {
break;
}
bank = next_epoch(&bank);
}
let bank_client = BankClient::new_shared(&bank);
// Test that we can withdraw everything else out of the split
let message = Message::new_with_payer(
vec![stake_instruction::withdraw(
&split_stake_pubkey,
&stake_pubkey,
&Pubkey::new_rand(),
split_staked,
)],
Some(&mint_pubkey),
);
assert!(bank_client
.send_message(&[&mint_keypair, &stake_keypair], message)
.is_ok());
// verify all the math sums to zero
assert_eq!(bank.get_balance(&split_stake_pubkey), 0);
assert_eq!(bank.get_balance(&stake_pubkey), lamports - lamports / 2);
} | rust_cleaned_test_functions.jsonl/63949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3434
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
13500,
98827,
368,
341,
262,
1077,
18279,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
18279,
34014,
792,
284,
18279,
3097,
12670,
47773,
792,
543,
262,
1077,
6910,
309... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_is_can_running() -> AnyResult<()> {
use super::{Frequency, Task, TaskBuilder};
use crate::utils::convenience::functions::create_default_delay_task_handler;
let mut task_builder = TaskBuilder::default();
//The third run returns to an invalid state.
task_builder.set_frequency(Frequency::CountDown(3, "* * * * * * *"));
let mut task: Task = task_builder.spawn(|_context| create_default_delay_task_handler())?;
assert!(task.is_can_running());
task.set_cylinder_line(1);
assert!(!task.is_can_running());
assert!(task.check_arrived());
Ok(())
} | rust_cleaned_test_functions.jsonl/79308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
27421,
37333,
368,
1464,
5765,
2077,
71698,
341,
286,
990,
2256,
22964,
38614,
11,
5430,
11,
5430,
3297,
2440,
286,
990,
17717,
486,
6031,
486,
443,
39547,
486,
21409,
486,
3182,
9993,
22198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_set_options() {
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let path = TempDir::new("_rust_rocksdb_set_option").expect("");
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
let cf = db.cf_handle("default").unwrap();
let db_opts = db.get_db_options();
assert_eq!(db_opts.get_max_background_jobs(), 2);
db.set_db_options(&[("max_background_jobs", "8")]).unwrap();
let db_opts = db.get_db_options();
assert_eq!(db_opts.get_max_background_jobs(), 8);
let cf_opts = db.get_options_cf(cf);
assert_eq!(cf_opts.get_disable_auto_compactions(), false);
db.set_options_cf(cf, &[("disable_auto_compactions", "true")])
.unwrap();
let cf_opts = db.get_options_cf(cf);
assert_eq!(cf_opts.get_disable_auto_compactions(), true);
} | rust_cleaned_test_functions.jsonl/99622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
8743,
368,
341,
286,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
543,
286,
12185,
2520,
11119,
40447,
3715,
317,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
26608,
14553,
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_anonymous_vars() {
let mut p = Polar::new();
qeval(&mut p, "[1,2,3] = [_,_,_]");
qnull(&mut p, "[1,2,3] = [__,__,__]");
} | rust_cleaned_test_functions.jsonl/97643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
9757,
11168,
368,
341,
262,
1077,
5206,
281,
284,
55896,
486,
931,
543,
262,
2804,
14170,
2099,
6984,
281,
11,
10545,
16,
11,
17,
11,
18,
60,
284,
508,
6878,
6878,
62,
37389,
262,
2804,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_process_authenticate_bad_key_handle() {
let application = [0x0A; 32];
let key_handle = vec![0x00; CREDENTIAL_ID_SIZE];
let message =
create_authenticate_message(&application, Ctap1Flags::EnforceUpAndSign, &key_handle);
let mut rng = ThreadRng256 {};
let dummy_user_presence = |_| panic!("Unexpected user presence check in CTAP1");
let mut ctap_state = CtapState::new(&mut rng, dummy_user_presence, START_CLOCK_VALUE);
ctap_state.u2f_up_state.consume_up(START_CLOCK_VALUE);
ctap_state.u2f_up_state.grant_up(START_CLOCK_VALUE);
let response = Ctap1Command::process_command(&message, &mut ctap_state, START_CLOCK_VALUE);
assert_eq!(response, Err(Ctap1StatusCode::SW_WRONG_DATA));
} | rust_cleaned_test_functions.jsonl/55447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14014,
22661,
34199,
3097,
10630,
368,
341,
286,
1077,
3766,
284,
508,
15,
87,
15,
32,
26,
220,
18,
17,
935,
286,
1077,
1376,
10630,
284,
7486,
20703,
15,
87,
15,
15,
26,
356,
81509,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ordering_of_governance_transactions() {
let (mut pool, mut consensus) = setup_mempool();
let txn1 = TestTransaction::new(0, 0, 100);
let txn2 = TestTransaction::new(1, 0, 200);
let mut gov_txn1 = TestTransaction::new(2, 0, 2);
let mut gov_txn2 = TestTransaction::new(3, 0, 1);
gov_txn1.is_governance_txn = true;
gov_txn2.is_governance_txn = true;
let _ = add_txns_to_mempool(
&mut pool,
vec![
txn1.clone(),
txn2.clone(),
gov_txn1.clone(),
gov_txn2.clone(),
],
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(gov_txn1.make_signed_transaction())
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(gov_txn2.make_signed_transaction())
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(txn2.make_signed_transaction())
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(txn1.make_signed_transaction())
);
} | rust_cleaned_test_functions.jsonl/14060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7869,
287,
3575,
1889,
6706,
681,
68182,
368,
341,
262,
1077,
320,
6984,
7314,
11,
5206,
23869,
8,
284,
6505,
717,
3262,
1749,
1428,
262,
1077,
49721,
16,
284,
3393,
8070,
486,
931,
7,
15,
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_scalar_subquery() {
let mut model = Model::default();
let g_ids = (0..=1)
.map(|id| {
let g_id = model.make_box(qgm::get(id).into());
let mut b = model.get_mut_box(g_id);
b.add_column(exp::base(0, typ::int32(false)));
b.add_column(exp::base(0, typ::bool(false)));
g_id
})
.collect::<Vec<_>>();
let s_id = model.make_box(Select::default().into());
let q_ids = vec![
model.make_quantifier(QuantifierType::Foreach, g_ids[0], s_id),
model.make_quantifier(QuantifierType::Scalar, g_ids[1], s_id),
];
{
let mut b = model.get_mut_box(s_id);
// C0: Q0.0
b.add_column(exp::cref(q_ids[0], 0));
// C0: Q0.1
b.add_column(exp::cref(q_ids[0], 1));
// C0: Q1.0
b.add_column(exp::cref(q_ids[1], 0));
// C0: Q1.1
b.add_column(exp::cref(q_ids[1], 1));
}
for g_id in g_ids {
RejectedNulls.derive(&mut model, g_id);
RelationType.derive(&mut model, g_id);
}
RejectedNulls.derive(&mut model, s_id);
RelationType.derive(&mut model, s_id);
{
let b = model.get_box(s_id);
let act_value = b.attributes.get::<RelationType>();
let exp_value = &vec![
typ::int32(false),
typ::bool(false),
typ::int32(true),
typ::bool(true),
];
assert_eq!(act_value, exp_value);
}
} | rust_cleaned_test_functions.jsonl/6659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1011
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
5228,
1631,
368,
341,
286,
1077,
5206,
1614,
284,
4903,
486,
2258,
1428,
286,
1077,
342,
8077,
284,
320,
15,
496,
28,
16,
340,
310,
659,
2186,
22428,
307,
91,
341,
394,
1077,
342,
842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_matrix()
{
let y = Y::new();
let z = crate::cmatrix::COMPLEX_ZERO;
let i = crate::cmatrix::COMPLEX_I;
assert_complex_matrix_eq!(y.matrix(), array![[z, -i], [i, z]]);
} | rust_cleaned_test_functions.jsonl/21201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
741,
262,
341,
286,
1077,
379,
284,
809,
486,
931,
543,
286,
1077,
1147,
284,
17717,
486,
6226,
2555,
486,
8696,
42136,
39370,
280,
286,
1077,
600,
284,
17717,
486,
6226,
2555,
486,
8696,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fixed_string() {
assert_eq!(parse_fixed_string("FixedString(8)"), Some(8_usize));
assert_eq!(parse_fixed_string("FixedString(zz)"), None);
assert_eq!(parse_fixed_string("Int8"), None);
} | rust_cleaned_test_functions.jsonl/69774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37839,
3904,
368,
341,
286,
2060,
10714,
10297,
6400,
37839,
3904,
445,
13520,
703,
7,
23,
8,
3975,
4329,
7,
23,
11306,
551,
1106,
286,
2060,
10714,
10297,
6400,
37839,
3904,
445,
13520,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_corrupted_data() {
const TABLE_ID: i64 = 5;
let columns_info = vec![
{
let mut ci = ColumnInfo::default();
ci.as_mut_accessor().set_tp(FieldTypeTp::LongLong);
ci.set_pk_handle(true);
ci.set_column_id(1);
ci
},
{
let mut ci = ColumnInfo::default();
ci.as_mut_accessor().set_tp(FieldTypeTp::LongLong);
ci.set_column_id(2);
ci
},
{
let mut ci = ColumnInfo::default();
ci.as_mut_accessor().set_tp(FieldTypeTp::LongLong);
ci.set_column_id(3);
ci
},
];
let schema = vec![
FieldTypeTp::LongLong.into(),
FieldTypeTp::LongLong.into(),
FieldTypeTp::LongLong.into(),
];
let mut ctx = EvalContext::default();
let mut kv = vec![];
{
let key = table::encode_row_key(TABLE_ID, 0);
let value =
table::encode_row(&mut ctx, vec![Datum::I64(5), Datum::I64(7)], &[2, 3]).unwrap();
kv.push((key, value));
}
{
let key = table::encode_row_key(TABLE_ID, 1);
let value = vec![];
kv.push((key, value));
}
{
let key = table::encode_row_key(TABLE_ID, 2);
let mut value =
table::encode_row(&mut ctx, vec![Datum::I64(5), Datum::I64(7)], &[2, 3]).unwrap();
// resize the value to make it partially corrupted
value.truncate(value.len() - 3);
kv.push((key, value));
}
{
let key = table::encode_row_key(TABLE_ID, 3);
// this datum flag does not exist
let value = vec![255];
kv.push((key, value));
}
{
let key = table::encode_row_key(TABLE_ID, 4);
let value = datum::encode_value(&mut ctx, &[Datum::I64(2)]).unwrap(); // col_id = 2
kv.push((key, value));
}
let key_range_point: Vec<_> = kv
.iter()
.enumerate()
.map(|(index, _)| {
let mut r = KeyRange::default();
r.set_start(table::encode_row_key(TABLE_ID, index as i64));
r.set_end(r.get_start().to_vec());
convert_to_prefix_next(r.mut_end());
r
})
.collect();
let store = FixtureStorage::from(kv);
for corrupted_row_index in 2..=4 {
let mut executor = BatchTableScanExecutor::new(
store.clone(),
Arc::new(EvalConfig::default()),
columns_info.clone(),
vec![
key_range_point[0].clone(),
key_range_point[1].clone(),
key_range_point[corrupted_row_index].clone(),
],
vec![],
false,
false,
vec![],
)
.unwrap();
let mut result = executor.next_batch(10);
assert!(result.is_drained.is_err());
assert_eq!(result.physical_columns.columns_len(), 3);
assert_eq!(result.physical_columns.rows_len(), 2);
assert!(result.physical_columns[0].is_decoded());
assert_eq!(
result.physical_columns[0].decoded().to_int_vec(),
&[Some(0), Some(1)]
);
assert!(result.physical_columns[1].is_raw());
result.physical_columns[1]
.ensure_all_decoded_for_test(&mut ctx, &schema[1])
.unwrap();
assert_eq!(
result.physical_columns[1].decoded().to_int_vec(),
&[Some(5), None]
);
assert!(result.physical_columns[2].is_raw());
result.physical_columns[2]
.ensure_all_decoded_for_test(&mut ctx, &schema[2])
.unwrap();
assert_eq!(
result.physical_columns[2].decoded().to_int_vec(),
&[Some(7), None]
);
}
} | rust_cleaned_test_functions.jsonl/10380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14734,
85954,
1769,
368,
341,
286,
733,
14363,
3450,
25,
600,
21,
19,
284,
220,
20,
401,
286,
1077,
8147,
3109,
284,
7486,
90515,
310,
341,
394,
1077,
5206,
11825,
284,
9332,
1731,
486,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tuple_chains() {
let thing = Thing { x: 8 }.set((ModifyX(5), ModifyX(112)));
assert_eq!(thing.x, 112);
} | rust_cleaned_test_functions.jsonl/19260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
4138,
1735,
368,
341,
286,
1077,
3166,
284,
37200,
314,
856,
25,
220,
23,
16908,
746,
1188,
44427,
55,
7,
20,
701,
49370,
55,
7,
16,
16,
17,
4945,
286,
2060,
10714,
10297,
1596,
1993,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_remove_no_op_labelled_statement() {
test("a: break a;", "");
test("a: { break a; }", "");
test("a: { break a; console.log('unreachable'); }", "");
test(
"a: { break a; var x = 1; } x = 2;",
"a: { var x; break a; } x = 2; ",
);
test("b: { var x = 1; } x = 2;", "b: var x = 1; x = 2;");
test("a: b: { var x = 1; } x = 2;", "a: b: var x = 1; x = 2;");
} | rust_cleaned_test_functions.jsonl/366 | {
"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,
18193,
6536,
10287,
6106,
832,
37404,
368,
341,
262,
1273,
445,
64,
25,
1438,
264,
32503,
14498,
262,
1273,
445,
64,
25,
314,
1438,
264,
26,
335,
497,
50970,
262,
1273,
445,
64,
25,
314,
1438,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_cloudformation_describe_stacks() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudformation-describe-stacks.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudFormationClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = DescribeStacksInput::default();
let result = client.describe_stacks(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/28695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
37356,
1627,
15768,
3114,
1261,
7821,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
12361,
1627... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_naive() {
assert_eq!(subarray_sum(vec![1, 1, 1], 2), 2);
assert_eq!(subarray_sum(vec![1, 1, 3], 3), 2);
assert_eq!(subarray_sum(vec![1, -1, 0], 0), 3);
} | rust_cleaned_test_functions.jsonl/53484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58631,
533,
368,
341,
262,
2060,
10714,
10297,
1966,
1653,
10160,
25592,
20703,
16,
11,
220,
16,
11,
220,
16,
1125,
220,
17,
701,
220,
17,
317,
262,
2060,
10714,
10297,
1966,
1653,
10160,
25592,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ambiguous() {
match_tokens(
"-->> ->-> >== <<= !=",
vec![
Token::Sub,
Token::Ret,
Token::Gt,
Token::Ret,
Token::Ret,
Token::Gte,
Token::Assign,
Token::Lt,
Token::Lte,
Token::Neq
]
);
} | rust_cleaned_test_functions.jsonl/47913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
90213,
368,
341,
286,
2432,
28838,
1006,
310,
14482,
2452,
1464,
405,
861,
418,
51178,
753,
428,
345,
310,
7486,
90515,
394,
9660,
486,
3136,
345,
394,
9660,
486,
12020,
345,
394,
9660,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fieldnorm_no_docs_with_field() {
let mut schema_builder = Schema::builder();
let title_field = schema_builder.add_text_field("title", TEXT);
let text_field = schema_builder.add_text_field("text", TEXT);
let index = Index::create_in_ram(schema_builder.build());
{
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
{
let doc = doc!(text_field=>"a b c");
index_writer.add_document(doc);
}
index_writer.commit().unwrap();
}
{
let index_reader = index.reader().unwrap();
let searcher = index_reader.searcher();
let reader = searcher.segment_reader(0);
{
let fieldnorm_reader = reader.get_fieldnorms_reader(text_field);
assert_eq!(fieldnorm_reader.fieldnorm(0), 3);
}
{
let fieldnorm_reader = reader.get_fieldnorms_reader(title_field);
assert_eq!(fieldnorm_reader.fieldnorm_id(0), 0);
}
}
} | rust_cleaned_test_functions.jsonl/41943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
20011,
6536,
49692,
6615,
5013,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
2265,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
2102,
497,
15762,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_fixed_bases() -> Result<(), PlonkError> {
test_compute_fixed_bases_helper::<FqEd354, Param254>()?;
test_compute_fixed_bases_helper::<FqEd377, Param377>()?;
test_compute_fixed_bases_helper::<FqEd381, Param381>()?;
test_compute_fixed_bases_helper::<FqEd381b, Param381b>()?;
test_compute_fixed_bases_helper::<Fq377, Param761>()
} | rust_cleaned_test_functions.jsonl/33784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
37839,
96290,
368,
1464,
5714,
68843,
1818,
263,
74,
1454,
29,
341,
286,
1273,
57028,
37839,
96290,
10418,
27638,
37,
80,
2715,
18,
20,
19,
11,
6991,
17,
20,
19,
13555,
37445,
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,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_genres_iter() {
let genres = make_genres();
let mut iter = genres.iter();
assert_eq!(iter.next(), Some(Genre::Adventure));
assert_eq!(iter.next(), Some(Genre::Music));
assert_eq!(iter.next(), Some(Genre::War));
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/78957 | {
"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,
16322,
416,
11723,
368,
341,
262,
1077,
35644,
284,
1281,
16322,
416,
543,
262,
1077,
5206,
5367,
284,
35644,
19471,
543,
262,
2060,
10714,
10297,
2015,
4529,
1507,
4329,
6699,
268,
265,
486,
8909... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_local_syntax_ptr() {
use crate::{ast, AstNode, SourceFile};
let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap();
let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap();
let ptr = SyntaxNodePtr::new(field.syntax());
let field_syntax = ptr.to_node(file.syntax());
assert_eq!(field.syntax(), &field_syntax);
} | rust_cleaned_test_functions.jsonl/102105 | {
"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,
13564,
78894,
4348,
368,
341,
262,
990,
17717,
22964,
559,
11,
20113,
1955,
11,
8748,
1703,
2315,
262,
1077,
1034,
284,
8748,
1703,
486,
6400,
445,
1235,
33428,
314,
282,
25,
575,
18,
17,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_json() {
let run = Run {
children: vec![
RunChild::Tab(Tab::new()),
RunChild::Text(Text::new("Hello")),
RunChild::Break(Break::new(BreakType::Page)),
RunChild::DeleteText(DeleteText::new("deleted")),
],
run_property: RunProperty {
sz: Some(Sz::new(30)),
sz_cs: Some(SzCs::new(30)),
color: Some(Color::new("C9211E")),
highlight: Some(Highlight::new("yellow")),
underline: Some(Underline::new("single")),
bold: Some(Bold::new()),
bold_cs: Some(BoldCs::new()),
italic: Some(Italic::new()),
italic_cs: Some(ItalicCs::new()),
vanish: Some(Vanish::new()),
character_spacing: Some(CharacterSpacing::new(100)),
..RunProperty::default()
},
};
assert_eq!(
serde_json::to_string(&run).unwrap(),
r#"{"runProperty":{"sz":30,"szCs":30,"color":"C9211E","highlight":"yellow","underline":"single","bold":true,"boldCs":true,"italic":true,"italicCs":true,"vanish":true,"characterSpacing":100},"children":[{"type":"tab"},{"type":"text","data":{"preserveSpace":true,"text":"Hello"}},{"type":"break","data":{"breakType":"page"}},{"type":"deleteText","data":{"text":"deleted","preserveSpace":true}}]}"#,
);
} | rust_cleaned_test_functions.jsonl/34416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 745
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
9455,
368,
341,
286,
1077,
1598,
284,
6452,
341,
310,
2841,
25,
7486,
90515,
394,
6452,
3652,
486,
8582,
4140,
370,
486,
931,
14702,
394,
6452,
3652,
486,
1178,
34082,
486,
931,
445,
9707... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_node_read_result() {
let mut builder = ConfigurationBuilder::default();
builder.add(
InMemorySource::from_string_slice(TEST_JSON.trim()),
Json::default(),
);
let configuration = builder.build().unwrap().merge_owned().unwrap();
assert_eq!(
Some(true),
configuration.get_result("map:entry:value1").unwrap()
);
assert_eq!(
Some("true"),
configuration.get_result("map:entry:value1").unwrap()
);
assert_eq!(
Some(1),
configuration
.get_result("map:entry:value2:array:[0]")
.unwrap()
);
let error: Result<Option<i32>, ConfigurationError> = configuration.get_result("droid");
assert!(std::matches!(
error.unwrap_err().get_code(),
ErrorCode::KeyNotFound(..)
));
} | rust_cleaned_test_functions.jsonl/20034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
5084,
6443,
5287,
368,
341,
262,
1077,
5206,
7363,
284,
12221,
3297,
486,
2258,
543,
262,
7363,
1364,
1006,
286,
758,
10642,
3608,
486,
1499,
3904,
26488,
50320,
25356,
16419,
14702,
286,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logger() {
// Configure logger with max level to allow all codepaths
let config = LoggerConfig {
debug: true,
trace: true,
no_color: false,
no_emoji: false,
};
SimpleLogger::init(&config);
error!("test: error");
warn!("test: warning");
info!("test: info");
debug!("test: debug");
trace!("test: trace");
let logger = SimpleLogger::get_mut();
logger.emoji_enabled = false;
error!("test: error");
warn!("test: warning");
info!("test: info");
debug!("test: debug");
trace!("test: trace");
logger.color_enabled = false;
error!("test: error");
warn!("test: warning");
info!("test: info");
debug!("test: debug");
trace!("test: trace");
} | rust_cleaned_test_functions.jsonl/32883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27413,
368,
341,
286,
442,
22169,
5925,
448,
1932,
2188,
311,
2138,
678,
2038,
21623,
198,
286,
1077,
2193,
284,
9514,
2648,
341,
310,
7390,
25,
830,
345,
310,
11655,
25,
830,
345,
310,
902,
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_word_access() {
for i in 0..4 {
let mut mem = Ram::new(0);
mem.write_word(0 + i, 0xCAFEBABE);
assert_eq!(0xCAFEBABE, mem.read_word(0 + i))
}
} | rust_cleaned_test_functions.jsonl/40988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13533,
12759,
368,
341,
286,
369,
600,
304,
220,
15,
496,
19,
341,
310,
1077,
5206,
1833,
284,
15152,
486,
931,
7,
15,
626,
310,
1833,
3836,
13533,
7,
15,
488,
600,
11,
220,
15,
87,
81318,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cardinal_1d() -> Result<()> {
use splinify::CubicSplineFit1D;
let (x,y) = read_csv_xy("tests/data/leds4000.csv")? ;
let d = CubicSplineFit1D::new(x.clone(), y.clone())?;
let tc = d.cardinal_spline(10.0)?;
println!("knots {:?}", tc.t);
println!("number of knots: {}", tc.t.len());
tc.plot("fit.png", (1600,800))?;
Ok(())
} | rust_cleaned_test_functions.jsonl/93160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16888,
977,
62,
16,
67,
368,
1464,
5714,
71698,
341,
262,
990,
12503,
258,
1437,
486,
34,
41181,
50,
31439,
23346,
16,
35,
280,
262,
1077,
320,
87,
7358,
8,
284,
220,
1349,
14020,
40920,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_serialize_deserialize() {
let uuid_str = "f9168c5e-ceb2-4faa-b6bf-329bf39fa1e4";
let u = Uuid::parse_str(uuid_str).unwrap();
let mut serializer = AlignedSerializer::new(AlignedVec::new());
serializer
.serialize_value(&u)
.expect("failed to archive uuid");
let buf = serializer.into_inner();
let archived = unsafe { archived_root::<Uuid>(buf.as_ref()) };
assert_eq!(&u, archived);
let deserialized = archived
.deserialize(&mut Infallible)
.expect("failed to deserialize uuid");
assert_eq!(u, deserialized);
} | rust_cleaned_test_functions.jsonl/6740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15768,
9050,
368,
341,
286,
1077,
16040,
2895,
284,
330,
69,
24,
16,
21,
23,
66,
20,
68,
53212,
65,
17,
12,
19,
3632,
64,
1455,
21,
13233,
12,
18,
17,
24,
13233,
18,
24,
3632,
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_starts_with_failing() {
let mut output = String::new();
let method = StringMethod {
method: "starts_with",
variable: "$FOO",
pattern: "\"OO\"",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "0");
} | rust_cleaned_test_functions.jsonl/85272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86552,
6615,
761,
14277,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
65876,
6615,
756,
310,
3890,
25,
220,
5201,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pathstep_to_json() {
let json: Vec<IndexMap<String, String>> = serde_json::from_str(PATH_TEST).expect("");
for map in json {
let pathstep = PathStep::try_from(map.clone()).unwrap();
assert_eq!(
serde_json::to_string(&pathstep).unwrap(),
serde_json::to_string(&map).expect(""),
);
}
} | rust_cleaned_test_functions.jsonl/77247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
9520,
2346,
9455,
368,
341,
286,
1077,
2951,
25,
11312,
27,
1552,
2227,
3464,
11,
923,
2452,
284,
61570,
9455,
486,
1499,
2895,
72791,
11641,
568,
17119,
56141,
286,
369,
2415,
304,
2951,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seek_to_first_single_entry() {
let date = DateTime::parse_from_rfc3339("2021-04-02T00:00:00Z").unwrap();
let r = Cursor::new(Vec::from(
"2021-04-02T20:05:39.428673666+00:00,\"\"\"Hello world\"\"\"\n".as_bytes(),
));
let mut entries = Entries::new(r);
entries.seek_to_first(&date).unwrap();
let message = entries
.next_entry()
.unwrap()
.map(|e| e.message().to_owned());
assert_eq!(message, Some("Hello world".to_string()));
} | rust_cleaned_test_functions.jsonl/63152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
2346,
12978,
19487,
9078,
368,
341,
286,
1077,
2400,
284,
6520,
486,
6400,
5673,
1710,
8316,
18,
18,
18,
24,
445,
17,
15,
17,
16,
12,
15,
19,
12,
15,
17,
51,
15,
15,
25,
15,
15,
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_new_number() {
assert_eq!(Number::new(&TEST_INPUT_0),
Number::Compound {
left: Box::new(Number::Regular(1)),
right: Box::new(Number::Regular(2))
}
);
assert_eq!(Number::new(&TEST_INPUT_1),
Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(1)),
right: Box::new(Number::Regular(2))
} ),
right: Box::new(Number::Regular(3))
}
);
assert_eq!(Number::new(&TEST_INPUT_2),
Number::Compound {
left: Box::new(Number::Regular(9)),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(8)),
right: Box::new(Number::Regular(7))
})
}
);
assert_eq!(Number::new(&TEST_INPUT_3),
Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(1)),
right: Box::new(Number::Regular(9))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(8)),
right: Box::new(Number::Regular(5))
})
}
);
assert_eq!(Number::new(&TEST_INPUT_4),
Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(1)),
right: Box::new(Number::Regular(2))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(3)),
right: Box::new(Number::Regular(4))
})
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(5)),
right: Box::new(Number::Regular(6))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(7)),
right: Box::new(Number::Regular(8))
})
}),
}),
right: Box::new(Number::Regular(9))
}
);
assert_eq!(Number::new(&TEST_INPUT_5),
Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(9)),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(3)),
right: Box::new(Number::Regular(8))
})
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(0)),
right: Box::new(Number::Regular(9))
}),
right: Box::new(Number::Regular(6))
})
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(3)),
right: Box::new(Number::Regular(7))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(4)),
right: Box::new(Number::Regular(9))
}),
}),
right: Box::new(Number::Regular(3))
}),
}
);
assert_eq!(Number::new(&TEST_INPUT_6),
Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(1)),
right: Box::new(Number::Regular(3))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(5)),
right: Box::new(Number::Regular(3))
})
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(1)),
right: Box::new(Number::Regular(3))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(8)),
right: Box::new(Number::Regular(7))
})
})
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(4)),
right: Box::new(Number::Regular(9))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(6)),
right: Box::new(Number::Regular(9))
})
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Compound {
left: Box::new(Number::Regular(8)),
right: Box::new(Number::Regular(2))
}),
right: Box::new(Number::Compound {
left: Box::new(Number::Regular(7)),
right: Box::new(Number::Regular(3))
})
})
}),
}
);
} | rust_cleaned_test_functions.jsonl/100415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4846
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5500,
368,
341,
286,
2060,
10714,
10297,
2833,
486,
931,
2099,
10033,
21022,
62,
15,
1326,
310,
5624,
486,
43134,
341,
394,
2115,
25,
8261,
486,
931,
42999,
486,
30404,
7,
16,
6965,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_1() {
let n_of_rounds = 2;
let n_of_clients = 2;
let settings = FederatedLearningSettings {
rounds: n_of_rounds,
participants_ratio: 1.0,
min_clients: n_of_clients,
heartbeat_timeout: 15,
};
let mut protocol = Protocol::new(settings);
let mut clients = Vec::new();
for _ in 0..n_of_clients {
clients.push((create_participant(&mut protocol), ClientState::Waiting))
}
for round in 0..n_of_rounds {
select_and_start_training(&mut protocol, clients.clone());
let counters = protocol.counters();
let expected = Counters {
selected: 2,
..Default::default()
};
assert_eq!(counters, expected);
end_training(&mut protocol, clients.clone());
let counters = protocol.counters();
let expected = Counters {
waiting: 2,
..Default::default()
};
assert_eq!(counters, expected);
assert_eq!(protocol.current_round, round);
protocol.end_aggregation(true);
assert_eq!(protocol.current_round, round + 1);
}
let try_start_after_last_round = protocol.start_training(ClientState::Selected);
assert_eq!(try_start_after_last_round, StartTrainingResponse::Reject);
} | rust_cleaned_test_functions.jsonl/97794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
16,
368,
341,
286,
1077,
308,
3575,
29896,
82,
284,
220,
17,
280,
286,
1077,
308,
3575,
56899,
284,
220,
17,
401,
286,
1077,
5003,
284,
21099,
657,
47467,
6086,
341,
310,
19531,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_auto_check_sbp_bootload_msg_bootloader_handshake_resp() {
{
let mut payload = Cursor::new(vec![
85, 180, 0, 0, 0, 9, 0, 0, 0, 0, 118, 49, 46, 50, 10, 201, 1,
]);
// Test the round trip payload parsing
let sbp_msg = {
let mut msgs = iter_messages(&mut payload);
msgs.next()
.expect("no message found")
.expect("failed to parse message")
};
match &sbp_msg {
sbp::messages::Sbp::MsgBootloaderHandshakeResp(msg) => {
assert_eq!(
msg.message_type(),
0xb4,
"Incorrect message type, expected 0xb4, is {}",
msg.message_type()
);
let sender_id = msg.sender_id().unwrap();
assert_eq!(
sender_id, 0x0,
"incorrect sender id, expected 0x0, is {}",
sender_id
);
assert_eq!(
msg.flags, 0,
"incorrect value for flags, expected 0, is {}",
msg.flags
);
assert_eq!(
msg.version.to_string(),
"v1.2
"
.to_string(),
"incorrect value for msg.version, expected string '{}', is '{}'",
"v1.2
"
.to_string(),
msg.version
);
}
_ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeResp"),
};
let frame = sbp::to_vec(&sbp_msg).unwrap();
assert_eq!(frame, payload.into_inner());
}
{
let mut payload = Cursor::new(vec![85, 176, 0, 195, 4, 4, 118, 49, 46, 50, 1, 206]);
// Test the round trip payload parsing
let sbp_msg = {
let mut msgs = iter_messages(&mut payload);
msgs.next()
.expect("no message found")
.expect("failed to parse message")
};
match &sbp_msg {
sbp::messages::Sbp::MsgBootloaderHandshakeDepA(msg) => {
assert_eq!(
msg.message_type(),
0xb0,
"Incorrect message type, expected 0xb0, is {}",
msg.message_type()
);
let sender_id = msg.sender_id().unwrap();
assert_eq!(
sender_id, 0x4c3,
"incorrect sender id, expected 0x4c3, is {}",
sender_id
);
assert_eq!(
msg.handshake[0], 118,
"incorrect value for handshake[0], expected 118, is {}",
msg.handshake[0]
);
assert_eq!(
msg.handshake[1], 49,
"incorrect value for handshake[1], expected 49, is {}",
msg.handshake[1]
);
assert_eq!(
msg.handshake[2], 46,
"incorrect value for handshake[2], expected 46, is {}",
msg.handshake[2]
);
assert_eq!(
msg.handshake[3], 50,
"incorrect value for handshake[3], expected 50, is {}",
msg.handshake[3]
);
}
_ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeDepA"),
};
let frame = sbp::to_vec(&sbp_msg).unwrap();
assert_eq!(frame, payload.into_inner());
}
} | rust_cleaned_test_functions.jsonl/33389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
7200,
643,
17808,
52062,
1078,
6483,
52062,
8355,
23194,
29661,
35160,
368,
341,
262,
341,
286,
1077,
5206,
7729,
284,
28067,
486,
931,
25592,
90515,
310,
220,
23,
20,
11,
220,
16,
23,
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... | 3 |
#[test]
fn test_classify() {
assert_eq!(Float::NaN::<f32>().classify(), FPNaN);
assert_eq!(Float::infinity::<f32>().classify(), FPInfinite);
assert_eq!(Float::neg_infinity::<f32>().classify(), FPInfinite);
assert_eq!(Zero::zero::<f32>().classify(), FPZero);
assert_eq!(Float::neg_zero::<f32>().classify(), FPZero);
assert_eq!(1f32.classify(), FPNormal);
assert_eq!(1e-37f32.classify(), FPNormal);
assert_eq!(1e-38f32.classify(), FPSubnormal);
} | rust_cleaned_test_functions.jsonl/101569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
1437,
368,
341,
286,
2060,
10714,
10297,
5442,
486,
22831,
27638,
69,
18,
17,
10483,
94290,
1507,
33551,
22831,
317,
286,
2060,
10714,
10297,
5442,
486,
80016,
27638,
69,
18,
17,
10483,
9429... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xbegin_label() {
test_instr(
16,
|a| {
let lbl = create_and_emit_label(a);
a.xbegin(lbl).unwrap()
},
assign_label(Instruction::with_xbegin(16, FIRST_LABEL_ID).unwrap(), FIRST_LABEL_ID),
TestInstrFlags::BRANCH,
DecoderOptions::NONE,
);
test_instr(
32,
|a| {
let lbl = create_and_emit_label(a);
a.xbegin(lbl).unwrap()
},
assign_label(Instruction::with_xbegin(32, FIRST_LABEL_ID).unwrap(), FIRST_LABEL_ID),
TestInstrFlags::BRANCH | TestInstrFlags::IGNORE_CODE,
DecoderOptions::NONE,
);
test_instr(
64,
|a| {
let lbl = create_and_emit_label(a);
a.xbegin(lbl).unwrap()
},
assign_label(Instruction::with_xbegin(64, FIRST_LABEL_ID).unwrap(), FIRST_LABEL_ID),
TestInstrFlags::BRANCH | TestInstrFlags::IGNORE_CODE,
DecoderOptions::NONE,
);
} | rust_cleaned_test_functions.jsonl/71837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
7265,
6106,
368,
341,
18185,
62574,
1006,
197,
197,
16,
21,
345,
197,
197,
91,
64,
91,
341,
298,
10217,
16421,
284,
1855,
8378,
69082,
6106,
2877,
317,
298,
11323,
1993,
7265,
70491,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_change_formula_adds_cells() {
let mut sheet = Spreadsheet::new();
sheet.set_formula(&CellRef::new('A', 1), "= 42");
assert_eq!(sheet.cells.len(), 1);
sheet.set_formula(&CellRef::new('A', 1), "=B2");
assert_eq!(sheet.cells.len(), 2);
let cell_a1 = sheet.cells.get(&CellRef::new('A', 1)).unwrap();
assert_eq!(cell_a1.get_dependencies().len(), 1);
assert_eq!(cell_a1.get_dependent_cells().len(), 0);
let cell_b2 = sheet.cells.get(&CellRef::new('B', 2)).unwrap();
assert_eq!(cell_b2.get_dependencies().len(), 0);
assert_eq!(cell_b2.get_dependent_cells().len(), 1);
} | rust_cleaned_test_functions.jsonl/83547 | {
"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,
15947,
63869,
2891,
82,
37796,
368,
341,
286,
1077,
5206,
10834,
284,
98501,
486,
931,
1428,
286,
10834,
980,
63869,
2099,
3599,
3945,
486,
931,
492,
32,
516,
220,
16,
701,
37827,
220,
19,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_process_or_forward_packets() {
let my_pubkey = Pubkey::new_rand();
let my_pubkey1 = Pubkey::new_rand();
assert_eq!(
BankingStage::consume_or_forward_packets(None, true, false, &my_pubkey),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(None, false, false, &my_pubkey),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(None, false, false, &my_pubkey1),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(
Some(my_pubkey1.clone()),
false,
false,
&my_pubkey
),
BufferedPacketsDecision::Forward
);
assert_eq!(
BankingStage::consume_or_forward_packets(
Some(my_pubkey1.clone()),
false,
true,
&my_pubkey
),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(
Some(my_pubkey1.clone()),
true,
false,
&my_pubkey
),
BufferedPacketsDecision::Consume
);
assert_eq!(
BankingStage::consume_or_forward_packets(
Some(my_pubkey1.clone()),
false,
false,
&my_pubkey1
),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(
Some(my_pubkey1.clone()),
true,
false,
&my_pubkey1
),
BufferedPacketsDecision::Consume
);
} | rust_cleaned_test_functions.jsonl/53035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
11305,
8734,
32121,
63569,
368,
341,
286,
1077,
847,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
847,
34014,
792,
16,
284,
22611,
792,
486,
931,
33864,
1428,
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... | 1 |
#[test]
fn test_parse_fstring_not_equals() {
let source = String::from("{1 != 2}");
let parse_ast = parse_fstring(&source);
assert!(parse_ast.is_ok());
} | rust_cleaned_test_functions.jsonl/10409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
761,
917,
7913,
61664,
368,
341,
286,
1077,
2530,
284,
923,
486,
1499,
13976,
16,
961,
220,
17,
20305,
286,
1077,
4715,
48019,
284,
4715,
761,
917,
2099,
2427,
317,
286,
2060,
10297,
6400... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_used_letters() {
assert_eq!(used_chars_count(&["hi", "ih gitt"]), 4);
assert_eq!(used_chars_count(&["peter"]), 4);
assert_eq!(used_chars_count(&["p e t e r", "barbara"]), 6);
} | rust_cleaned_test_functions.jsonl/51112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
67330,
368,
341,
262,
2060,
10714,
10297,
2591,
37418,
3180,
2099,
1183,
6023,
497,
330,
6996,
342,
1442,
63624,
220,
19,
317,
262,
2060,
10714,
10297,
2591,
37418,
3180,
2099,
1183,
79,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_pattern() -> anyhow::Result<()> {
assert_eq!(
match_pattern("I-*", "I-nominated")?,
MatchPatternResult::Allow
);
assert_eq!(
match_pattern("!I-no*", "I-nominated")?,
MatchPatternResult::Deny
);
assert_eq!(
match_pattern("I-*", "T-infra")?,
MatchPatternResult::NoMatch
);
assert_eq!(
match_pattern("!I-no*", "T-infra")?,
MatchPatternResult::NoMatch
);
Ok(())
} | rust_cleaned_test_functions.jsonl/73115 | {
"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,
10708,
21260,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
2060,
10714,
33673,
310,
2432,
21260,
445,
40,
44903,
497,
330,
40,
5279,
49515,
899,
36474,
310,
14152,
15760,
2077,
486,
18605,
198,
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... | 5 |
#[test]
fn test_starting_with() {
assert!(starting_with(
Some(to_value("helloworld").unwrap()),
vec![to_value("hello").unwrap()],
)
.unwrap());
assert!(!starting_with(Some(to_value("hello").unwrap()), vec![to_value("hi").unwrap()],)
.unwrap());
} | rust_cleaned_test_functions.jsonl/132428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
287,
6615,
368,
341,
286,
2060,
10297,
39289,
6615,
1006,
310,
4329,
12186,
3142,
445,
71,
95292,
1827,
15454,
14702,
310,
7486,
20703,
983,
3142,
445,
14990,
1827,
15454,
73845,
286,
1727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_kernel_module() {
let mut m = protocols::agent::KernelModule::default();
// case 1: module not exists
m.name = "module_not_exists".to_string();
let result = load_kernel_module(&m);
assert!(result.is_err(), "load module should failed");
// case 2: module name is empty
m.name = "".to_string();
let result = load_kernel_module(&m);
assert!(result.is_err(), "load module should failed");
// case 3: normal module.
m.name = "bridge".to_string();
let result = load_kernel_module(&m);
assert!(result.is_ok(), "load module should success");
} | rust_cleaned_test_functions.jsonl/16648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
26876,
10750,
368,
341,
286,
1077,
5206,
296,
284,
31785,
486,
8092,
486,
26343,
3332,
486,
2258,
1428,
286,
442,
1142,
220,
16,
25,
4688,
537,
6724,
198,
286,
296,
2644,
284,
330,
4352,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_mock_matching_exact_query() {
let mock = mock("GET", "/test?hello=world");
assert_eq!("\r\nGET /test?hello=world\r\n", format!("{}", mock));
} | rust_cleaned_test_functions.jsonl/82419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
34134,
70763,
71084,
5738,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
1944,
30,
14990,
28,
14615,
3071,
262,
2060,
10714,
0,
4921,
81,
1699,
3806,
608,
1944,
30,
14990,
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 |
#[test]
fn test_dup_names() {
#[derive(Deserialize, JsonSchema)]
struct AStruct {}
#[allow(dead_code)]
#[derive(Deserialize, JsonSchema)]
struct TheThing {
thing: String,
}
#[endpoint {
method = PUT,
path = "/testing/{thing}"
}]
async fn test_dup_names_handler(
_: Arc<RequestContext<()>>,
_: Query<TheThing>,
_: Path<TheThing>,
) -> Result<Response<Body>, HttpError> {
unimplemented!();
}
let mut api = ApiDescription::new();
let error = api.register(test_dup_names_handler).unwrap_err();
assert_eq!(
error,
"the parameter 'thing' is specified for both query and path \
parameters",
);
} | rust_cleaned_test_functions.jsonl/17573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51932,
9187,
368,
341,
286,
11506,
27098,
7,
64465,
11,
8308,
8632,
5563,
286,
2036,
362,
9422,
10086,
286,
11506,
7183,
83207,
4136,
5563,
286,
11506,
27098,
7,
64465,
11,
8308,
8632,
5563,
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_virtual_fns() {
let hdr = indoc! {"
#include <cstdint>
class A {
public:
A(uint32_t num) : b(num) {}
virtual uint32_t foo(uint32_t a) { return a+1; };
virtual ~A() {}
uint32_t b;
};
class B: public A {
public:
B() : A(3), c(4) {}
virtual uint32_t foo(uint32_t a) { return a+2; };
uint32_t c;
};
"};
let rs = quote! {
let mut a = ffi::A::make_unique(12);
assert_eq!(a.pin_mut().foo(2), 3);
let mut b = ffi::B::make_unique();
assert_eq!(b.pin_mut().foo(2), 4);
};
run_test("", hdr, rs, &["A", "B"], &[]);
} | rust_cleaned_test_functions.jsonl/9857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58730,
761,
4412,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
536,
362,
341,
286,
584,
510,
310,
362,
8488,
18,
17,
528,
1629,
8,
549,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_include_directive_success() {
let mut c = Compiler::new().unwrap();
let mut options = CompileOptions::new().unwrap();
options.set_include_callback(|name, type_, _, _| {
if name == "foo.glsl" && type_ == IncludeType::Relative {
Ok(ResolvedInclude {
resolved_name: "std/foo.glsl".to_string(),
content: r#"
#ifndef FOO_H
#define FOO_H
void main() {}
#endif
"#
.to_string(),
})
} else {
Err(format!("Couldn't find header \"{}\"", name))
}
});
let result = c.compile_into_spirv_assembly(
r#"
#version 400
#include "foo.glsl"
#include "foo.glsl"
"#,
ShaderKind::Vertex,
"shader.glsl",
"main",
Some(&options),
);
assert_matches!(result.err(), None);
} | rust_cleaned_test_functions.jsonl/41060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
32871,
533,
18632,
368,
341,
286,
1077,
5206,
272,
284,
45631,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2606,
284,
54467,
3798,
486,
931,
1005,
15454,
543,
286,
2606,
980,
37878,
12519,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_renaming_of_assign_instruction() {
// Given: x := x
let mut instruction =
il::Instruction::assign(0, il::scalar("x", 64), il::expr_scalar("x", 64));
let mut versioning = ScalarVersioning::new();
versioning.start_new_scope();
versioning.new_version(&il::scalar("x", 64));
instruction.rename_scalars(&mut versioning).unwrap();
// Expected: x_2 := x_1
assert_eq!(
instruction,
il::Instruction::assign(0, scalar_ssa("x", 64, 2), expr_scalar_ssa("x", 64, 1),)
);
} | rust_cleaned_test_functions.jsonl/60302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
77,
6469,
3575,
20688,
54923,
368,
341,
286,
442,
16246,
25,
856,
1669,
856,
198,
286,
1077,
5206,
7600,
4035,
310,
3815,
486,
16664,
486,
6983,
7,
15,
11,
3815,
486,
35342,
445,
87,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_boolean() {
assert_eq!(None, super::parse_boolean(""));
assert_eq!(Some(true), super::parse_boolean("1"));
assert_eq!(Some(true), super::parse_boolean("yes"));
assert_eq!(Some(true), super::parse_boolean("on"));
assert_eq!(Some(true), super::parse_boolean("true"));
assert_eq!(Some(false), super::parse_boolean("0"));
assert_eq!(Some(false), super::parse_boolean("no"));
assert_eq!(Some(false), super::parse_boolean("off"));
assert_eq!(Some(false), super::parse_boolean("false"));
} | rust_cleaned_test_functions.jsonl/10845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
46642,
368,
341,
286,
2060,
10714,
10297,
4064,
11,
2256,
486,
6400,
46642,
89744,
286,
2060,
10714,
10297,
8373,
3715,
701,
2256,
486,
6400,
46642,
445,
16,
4010,
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_unignore() {
check_assist(
toggle_ignore,
r#"
#[test$0]
#[ignore]
fn test() {}
"#,
r#"
#[test]
fn test() {}
"#,
)
} | rust_cleaned_test_functions.jsonl/49062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
13130,
368,
341,
286,
1779,
12083,
380,
1006,
310,
14999,
58493,
345,
310,
435,
2,
698,
310,
11506,
1944,
3,
15,
921,
310,
11506,
13130,
921,
310,
5168,
1273,
368,
5613,
310,
5869,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dimensions() {
let rect = Rect::with_size(0, 0, 10, 10);
assert!(rect.width() == 10);
assert!(rect.height() == 10);
} | rust_cleaned_test_functions.jsonl/92887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59699,
368,
341,
286,
1077,
7608,
284,
11920,
486,
4197,
2368,
7,
15,
11,
220,
15,
11,
220,
16,
15,
11,
220,
16,
15,
317,
286,
2060,
10297,
2851,
5441,
368,
621,
220,
16,
15,
317,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_id_wrong_sigil() {
assert_eq!(
&ParseMentionErrorType::Sigil {
expected: &["@"],
found: Some('#'),
},
super::parse_mention("<#123>", &["@"]).unwrap_err().kind(),
);
assert_eq!(
&ParseMentionErrorType::Sigil {
expected: &["#"],
found: None,
},
super::parse_mention("<", &["#"]).unwrap_err().kind(),
);
assert_eq!(
&ParseMentionErrorType::Sigil {
expected: &["#"],
found: None,
},
super::parse_mention("<", &["#"]).unwrap_err().kind(),
);
} | rust_cleaned_test_functions.jsonl/3594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
842,
75198,
29252,
321,
368,
341,
286,
2060,
10714,
33673,
310,
609,
14463,
44,
2939,
1454,
929,
486,
47246,
321,
341,
394,
3601,
25,
609,
1183,
3676,
1259,
394,
1730,
25,
4329,
3515,
329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pipeline_variables() {
let var: PipelineVariable = read_test_file("pipeline_variable");
assert_eq!(var.key, "RUN_NIGHTLY_BUILD");
assert_eq!(var.variable_type, PipelineVariableType::EnvVar);
assert_eq!(var.value, "true");
} | rust_cleaned_test_functions.jsonl/12959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
45187,
28182,
368,
341,
262,
1077,
762,
25,
40907,
7827,
284,
1349,
4452,
2458,
445,
51258,
14635,
3071,
262,
2060,
10714,
10297,
947,
4735,
11,
330,
47390,
1604,
4631,
8932,
37491,
797,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_naive_tf_make_term_vector_is_consistent() {
let idx = create_test_index();
let mdl = naive_tf::from_index(&idx);
let docs = idx.get_documents();
let doc_terms = tokenizer::tokenize_whitespace(docs[0].text.clone());
let query_vec = naive_tf::make_term_vector(&mdl.terms, &doc_terms);
assert_eq!(mdl.word_bag[0], query_vec)
} | rust_cleaned_test_functions.jsonl/74637 | {
"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,
58631,
533,
47719,
28230,
17464,
12247,
6892,
31971,
18128,
368,
341,
262,
1077,
7187,
284,
1855,
4452,
3560,
543,
262,
1077,
51700,
284,
49665,
47719,
486,
1499,
3560,
2099,
6361,
317,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_error_debug() {
for (e, expected) in [
(
ParseError::new(ParseErrorKind::InvalidValue),
"ParseError { kind: InvalidValue }",
),
(
ParseError::new(ParseErrorKind::InvalidValue)
.add_location(ParseLocation::Field("Abc::123")),
"ParseError { kind: InvalidValue, location: [\"Abc::123\"] }",
),
]
.iter()
{
assert_eq!(&format!("{:?}", e), expected)
}
} | rust_cleaned_test_functions.jsonl/40817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4096,
15446,
368,
341,
286,
369,
320,
68,
11,
3601,
8,
304,
2278,
310,
2399,
394,
14775,
1454,
486,
931,
71812,
1454,
10629,
486,
7928,
1130,
1326,
394,
330,
14463,
1454,
314,
3093,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_do_stop_early_sanity() {
let mut factorial_worker = FactorialWorker::new();
let a_factorial = factorial_worker.get_factorial(6);
let b_factorial = factorial_worker.get_factorial(7);
let c: u64 = 10;
let c_factorial = factorial_worker.get_factorial(c);
// test
let result = do_stop_early(&a_factorial, &b_factorial, &c_factorial, c);
assert_eq!(result, false);
} | rust_cleaned_test_functions.jsonl/90812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26309,
19039,
62,
22140,
643,
38270,
368,
341,
286,
1077,
5206,
52962,
40385,
284,
37729,
530,
21936,
486,
931,
543,
286,
1077,
264,
18588,
530,
284,
52962,
40385,
670,
18588,
530,
7,
21,
317,
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_simplify_simplify_arithmetic_expr() {
let expr_plus = binary_expr(lit(1), Operator::Plus, lit(1));
let expr_eq = binary_expr(lit(1), Operator::Eq, lit(1));
assert_eq!(simplify(expr_plus), lit(2));
assert_eq!(simplify(expr_eq), lit(true));
} | rust_cleaned_test_functions.jsonl/77803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
643,
70206,
25842,
25922,
21915,
368,
341,
286,
1077,
15169,
28043,
284,
7868,
21915,
2333,
275,
7,
16,
701,
28498,
486,
21807,
11,
13020,
7,
16,
1106,
286,
1077,
15169,
10714,
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_dot() {
assert_eq!(vec3(1.0, 2.0, 3.0).dot(vec3(4.0, 5.0, 6.0)), 32.0);
assert_eq!(vec3(1, 2, 3).dot(vec3(4, 5, 6)), 32);
} | rust_cleaned_test_functions.jsonl/39601 | {
"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,
30941,
368,
341,
310,
2060,
10714,
10297,
4083,
18,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
568,
16119,
25592,
18,
7,
19,
13,
15,
11,
220,
20,
13,
15,
11,
220,
21,
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_three_wss_tls_nodes_basic_suite() {
enable_logging_for_test(true);
for (test_fn, can_setup) in THREE_NODES_BASIC_TEST_FNS.iter() {
launch_three_wss_nodes_test(*test_fn, TlsConfig::FakeServer, *can_setup).unwrap();
}
} | rust_cleaned_test_functions.jsonl/59658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50016,
1670,
778,
71262,
14896,
34729,
57239,
368,
341,
262,
7283,
59982,
5478,
4452,
3715,
317,
262,
369,
320,
1944,
15246,
11,
646,
21363,
8,
304,
14040,
92948,
71068,
11641,
1400,
2448,
19471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fee_rate_governor_burn() {
let mut fee_rate_governor = FeeRateGovernor::default();
assert_eq!(fee_rate_governor.burn(2), (1, 1));
fee_rate_governor.burn_percent = 0;
assert_eq!(fee_rate_governor.burn(2), (2, 0));
fee_rate_governor.burn_percent = 100;
assert_eq!(fee_rate_governor.burn(2), (0, 2));
} | rust_cleaned_test_functions.jsonl/3391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34305,
9246,
1889,
6706,
269,
880,
399,
368,
341,
286,
1077,
5206,
11060,
9246,
1889,
6706,
269,
284,
40458,
11564,
77606,
269,
486,
2258,
543,
286,
2060,
10714,
10297,
30017,
9246,
1889,
6706,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reference_impl_add_root_dir_should_append_posix_directories() {
let temp_dir = tempdir().unwrap();
fs::create_dir_all(temp_dir.path().join("bin")).unwrap();
fs::create_dir_all(temp_dir.path().join("lib")).unwrap();
let mut original_env = Env::new();
original_env.insert("PATH", "some");
original_env.insert("LD_LIBRARY_PATH", "some-ld");
original_env.insert("LIBRARY_PATH", "some-library");
let layer_env = LayerEnv::read_from_layer_dir(temp_dir.path()).unwrap();
let modified_env = layer_env.apply(TargetLifecycle::Build, &original_env);
assert_eq!(
vec![
(
"LD_LIBRARY_PATH",
format!("{}:some-ld", temp_dir.path().join("lib").to_str().unwrap()).as_str()
),
(
"LIBRARY_PATH",
format!(
"{}:some-library",
temp_dir.path().join("lib").to_str().unwrap()
)
.as_str()
),
(
"PATH",
format!("{}:some", temp_dir.path().join("bin").to_str().unwrap()).as_str()
)
],
environment_as_sorted_vector(&modified_env)
);
} | rust_cleaned_test_functions.jsonl/36431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25433,
21007,
2891,
12993,
4334,
43378,
26041,
6479,
941,
32871,
2433,
368,
341,
286,
1077,
2730,
4334,
284,
2730,
3741,
1005,
15454,
543,
286,
8619,
486,
3182,
4334,
5705,
9758,
4334,
3875,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_outcome_tie() {
let p1 = UUID::random();
let p2 = UUID::random();
let p3 = UUID::random();
let p4 = UUID::random();
let p5 = UUID::random();
let state = TallyingState::new(
vec![
(VoteTarget::Player { uuid: p1 }, vec![p1, p2]),
(VoteTarget::Player { uuid: p2 }, vec![p3, p4]),
(VoteTarget::Skip, vec![p5]),
]
.into_iter()
.collect(),
);
assert_eq!(state.determine_outcome_of_election(), VoteOutcome::Tie);
} | rust_cleaned_test_functions.jsonl/58284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
6068,
2020,
528,
645,
368,
341,
262,
1077,
281,
16,
284,
23698,
486,
11463,
543,
262,
1077,
281,
17,
284,
23698,
486,
11463,
543,
262,
1077,
281,
18,
284,
23698,
486,
11463,
543,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_or() {
let cases = vec![
(Some(123), Some(321), Some(379)),
(Some(-123), Some(321), Some(-59)),
(None, Some(1), None),
(Some(1), None, None),
(None, None, None),
];
for (lhs, rhs, expected) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::BitOrSig)
.unwrap();
assert_eq!(output, expected);
}
} | rust_cleaned_test_functions.jsonl/29754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
8734,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
8373,
7,
16,
17,
18,
701,
4329,
7,
18,
17,
16,
701,
4329,
7,
18,
22,
24,
6965,
310,
320,
8373,
4080,
16,
17,
18,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_choose_option() {
let mut r = task_rng();
let v: &[int] = &[];
assert!(r.choose_option(v).is_none());
let i = 1;
let v = [1,1,1];
assert_eq!(r.choose_option(v), Some(&i));
} | rust_cleaned_test_functions.jsonl/46780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77433,
9672,
368,
341,
286,
1077,
5206,
435,
284,
3383,
66849,
543,
286,
1077,
348,
25,
44590,
396,
60,
284,
609,
15078,
286,
2060,
10297,
81,
78824,
9672,
3747,
568,
285,
31488,
5231,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_localhost() {
let ips = lookup_host("localhost").unwrap();
assert!(ips.contains(&IpAddr::V4("127.0.0.1".parse().unwrap())));
assert!(!ips.contains(&IpAddr::V4("10.0.0.1".parse().unwrap())));
} | rust_cleaned_test_functions.jsonl/40381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
8301,
368,
341,
220,
1077,
59022,
284,
18615,
12848,
445,
8301,
1827,
15454,
543,
220,
2060,
10297,
3077,
8786,
2099,
23378,
13986,
486,
53,
19,
445,
16,
17,
22,
13,
15,
13,
15,
13,
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_well_known_types() {
let msg = Foo {
null: ::prost_types::NullValue::NullValue.into(),
timestamp: Some(::prost_types::Timestamp {
seconds: 99,
nanos: 42,
}),
double: Some(42.0_f64),
float: Some(42.0_f32),
int64: Some(42_i64),
uint64: Some(42_u64),
int32: Some(42_i32),
uint32: Some(42_u32),
bool: Some(false),
string: Some("value".into()),
bytes: Some(b"value".to_vec()),
};
crate::check_message(&msg);
} | rust_cleaned_test_functions.jsonl/28033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
613,
71690,
9763,
368,
341,
262,
1077,
3750,
284,
33428,
341,
286,
845,
25,
3504,
776,
267,
9763,
486,
3280,
1130,
486,
3280,
1130,
39860,
3148,
286,
11441,
25,
4329,
38732,
776,
267,
9763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_capitalization() {
let bank0 = Arc::new(Bank::new_for_tests(&GenesisConfig {
accounts: (0..42)
.map(|_| {
(
solana_sdk::pubkey::new_rand(),
Account::new(42, 0, &Pubkey::default()),
)
})
.collect(),
cluster_type: ClusterType::MainnetBeta,
..GenesisConfig::default()
}));
let sysvar_and_native_program_delta0 = 11;
assert_eq!(
bank0.capitalization(),
42 * 42 + sysvar_and_native_program_delta0
);
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
let sysvar_and_native_program_delta1 = 2;
assert_eq!(
bank1.capitalization(),
42 * 42 + sysvar_and_native_program_delta0 + sysvar_and_native_program_delta1,
);
} | rust_cleaned_test_functions.jsonl/68571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
16388,
2174,
2022,
368,
341,
286,
1077,
6073,
15,
284,
19689,
486,
931,
5349,
1180,
486,
931,
5478,
32509,
2099,
84652,
2648,
341,
310,
9618,
25,
320,
15,
496,
19,
17,
340,
394,
659,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_stats_for_chain() {
let stats = StatsMap::new();
let funding_txid =
hex::decode("0000000000000000000000000000000000000000000000000000000000000000")
.unwrap();
let spending_txid =
hex::decode("0000000000000000000000000000000000000000000000000000000000000001")
.unwrap();
let blockhash1 = deserialize(
&hex::decode("0000000000000000000000000000000000000000000000000000000000000011")
.unwrap(),
)
.unwrap();
let blockhash2 = deserialize(
&hex::decode("0000000000000000000000000000000000000000000000000000000000000012")
.unwrap(),
)
.unwrap();
let funding = (
TxHistoryInfo::Funding(FundingInfo {
txid: full_hash(&funding_txid),
vout: 0,
color_id: ColorIdentifier::default(),
value: 100,
open_asset: None,
}),
Some(BlockId {
height: 1,
hash: blockhash1,
time: 0,
}),
);
let spending = (
TxHistoryInfo::Spending(SpendingInfo {
txid: full_hash(&spending_txid),
vin: 0,
prev_txid: full_hash(&funding_txid),
prev_vout: 0,
color_id: ColorIdentifier::default(),
value: 100,
}),
Some(BlockId {
height: 2,
hash: blockhash2,
time: 0,
}),
);
let (newstats, latestblock) = update_stats(stats, &vec![funding, spending]);
assert_eq!(newstats.len(), 1);
let stat: &ScriptStats = newstats.values().nth(0).unwrap();
assert_eq!(stat.tx_count, 2);
assert_eq!(stat.funded_txo_count, 1);
assert_eq!(stat.funded_txo_sum, 100);
assert_eq!(stat.spent_txo_count, 1);
assert_eq!(stat.spent_txo_sum, 100);
assert_eq!(latestblock, Some(blockhash2));
} | rust_cleaned_test_functions.jsonl/115374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
15381,
5478,
30583,
368,
341,
286,
1077,
10472,
284,
29927,
2227,
486,
931,
1428,
286,
1077,
10773,
17805,
307,
4035,
310,
12371,
486,
18196,
445,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitfields_fourth() {
let mut fourth: bindings::bitfields::Fourth = unsafe { mem::zeroed() };
assert!(unsafe { fourth.assert(bindings::bitfields::MyEnum::ONE, 0) });
fourth.set_tag(bindings::bitfields::MyEnum::THREE);
fourth.set_ptr(0xdeadbeef);
assert!(unsafe {
fourth.assert(bindings::bitfields::MyEnum::THREE, 0xdeadbeef)
});
} | rust_cleaned_test_functions.jsonl/28000 | {
"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,
13996,
9007,
56142,
339,
368,
341,
262,
1077,
5206,
11737,
25,
35700,
486,
4489,
9007,
486,
88603,
284,
19860,
314,
1833,
486,
14154,
291,
368,
2605,
262,
2060,
10297,
38157,
314,
11737,
3713,
715... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bug_reproduce_range_query() -> crate::Result<()> {
let mut schema_builder = Schema::builder();
schema_builder.add_text_field("title", TEXT);
schema_builder.add_i64_field("year", INDEXED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema.clone());
let mut index_writer = index.writer_for_tests()?;
let title = schema.get_field("title").unwrap();
let year = schema.get_field("year").unwrap();
index_writer.add_document(doc!(
title => "hemoglobin blood",
year => 1990 as i64
));
index_writer.commit()?;
let reader = index.reader()?;
let searcher = reader.searcher();
let query_parser = QueryParser::for_index(&index, vec![title]);
let query = query_parser.parse_query("hemoglobin AND year:[1970 TO 1990]")?;
let top_docs = searcher.search(&query, &TopDocs::with_limit(10))?;
assert_eq!(top_docs.len(), 1);
Ok(())
} | rust_cleaned_test_functions.jsonl/107882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73232,
1288,
97274,
9698,
5738,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
10802,
28532,
1364,
4326,
5013,
445,
2102,
497,
15762,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_fq2_sqrt() {
use super::fq::FqRepr;
use PrimeField;
assert_eq!(
Fq2 {
c0: Fq::from_repr(FqRepr([
0x476b4c309720e227,
0x34c2d04faffdab6,
0xa57e6fc1bab51fd9,
0xdb4a116b5bf74aa1,
0x1e58b2159dfe10e2,
0x7ca7da1f13606ac
])).unwrap(),
c1: Fq::from_repr(FqRepr([
0xfa8de88b7516d2c3,
0x371a75ed14f41629,
0x4cec2dca577a3eb6,
0x212611bca4e99121,
0x8ee5394d77afb3d,
0xec92336650e49d5
])).unwrap(),
}.sqrt()
.unwrap(),
Fq2 {
c0: Fq::from_repr(FqRepr([
0x40b299b2704258c5,
0x6ef7de92e8c68b63,
0x6d2ddbe552203e82,
0x8d7f1f723d02c1d3,
0x881b3e01b611c070,
0x10f6963bbad2ebc5
])).unwrap(),
c1: Fq::from_repr(FqRepr([
0xc099534fc209e752,
0x7670594665676447,
0x28a20faed211efe7,
0x6b852aeaf2afcb1b,
0xa4c93b08105d71a9,
0x8d7cfff94216330
])).unwrap(),
}
);
assert_eq!(
Fq2 {
c0: Fq::from_repr(FqRepr([
0xb9f78429d1517a6b,
0x1eabfffeb153ffff,
0x6730d2a0f6b0f624,
0x64774b84f38512bf,
0x4b1ba7b6434bacd7,
0x1a0111ea397fe69a
])).unwrap(),
c1: Fq::zero(),
}.sqrt()
.unwrap(),
Fq2 {
c0: Fq::zero(),
c1: Fq::from_repr(FqRepr([
0xb9fefffffd4357a3,
0x1eabfffeb153ffff,
0x6730d2a0f6b0f624,
0x64774b84f38512bf,
0x4b1ba7b6434bacd7,
0x1a0111ea397fe69a
])).unwrap(),
}
);
} | rust_cleaned_test_functions.jsonl/130071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
17,
92199,
368,
341,
262,
990,
2256,
486,
63919,
486,
37,
80,
693,
649,
280,
262,
990,
12518,
1877,
401,
262,
2060,
10714,
33673,
286,
434,
80,
17,
341,
310,
272,
15,
25,
434,
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... | 1 |
#[test]
fn test_pathinfo_ends_with() {
let p = PathBuf::from("foo/bar");
assert_eq!(
<PathBuf as PathInfo>::ends_with(&p, Path::new("foo")),
false,
);
assert_eq!(<PathBuf as PathInfo>::ends_with(&p, Path::new("bar")), true,);
} | rust_cleaned_test_functions.jsonl/14050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
2733,
90729,
6615,
368,
341,
310,
1077,
281,
284,
7933,
15064,
486,
1499,
445,
7975,
49513,
3071,
310,
2060,
10714,
33673,
394,
366,
1820,
15064,
438,
7933,
1731,
6831,
1412,
6615,
2099,
79,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let req_object = Request::Array(vec![b"TEST1".as_ref().into(), b"TEST2".as_ref().into()]);
let mut bytes = BytesMut::new();
let codec = Codec;
codec.encode(req_object.clone(), &mut bytes).unwrap();
assert_eq!(
b"*2\r\n$5\r\nTEST1\r\n$5\r\nTEST2\r\n".to_vec(),
bytes.to_vec()
);
let resp = Response::Array(vec![
Response::Bytes(Bytes::from_static(b"TEST1")),
Response::Bytes(Bytes::from_static(b"TEST2")),
]);
let deserialized = codec.decode(&mut bytes).unwrap().unwrap();
assert_eq!(deserialized, resp);
} | rust_cleaned_test_functions.jsonl/78673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
368,
341,
286,
1077,
4232,
5314,
284,
6145,
486,
1857,
25592,
20703,
65,
1,
10033,
16,
3263,
300,
7793,
1005,
18122,
1507,
293,
1,
10033,
17,
3263,
300,
7793,
1005,
18122,
57887,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strict_mode_reserved_name() {
// Checks that usage of a reserved keyword for an identifier name is
let test_cases = [
"var implements = 10;",
"var interface = 10;",
"var package = 10;",
"var private = 10;",
"var protected = 10;",
"var public = 10;",
"var static = 10;",
"var eval = 10;",
"var arguments = 10;",
"var let = 10;",
"var yield = 10;",
];
for case in test_cases.iter() {
let mut context = Context::new();
let scenario = format!("'use strict'; \n {}", case);
let string = dbg!(forward(&mut context, &scenario));
assert!(string.starts_with("Uncaught \"SyntaxError\": "));
}
} | rust_cleaned_test_functions.jsonl/39565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
849,
7302,
74913,
1269,
368,
341,
262,
442,
24843,
429,
10431,
315,
264,
4591,
16174,
369,
458,
12816,
829,
374,
87079,
262,
1077,
1273,
41427,
284,
2278,
286,
330,
947,
5169,
284,
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... | 4 |
#[test]
fn test_bitpacking_reader_byte_aligned() {
// Check that bitpacking readers work with "normal" byte aligned types:
let test_arr = &[0x00, 0x00, 0x00, 0x00, 0x01];
let mut cur = BitpackCursor::new(test_arr);
assert_eq!(cur.read_dyn_u32(32).unwrap(), 0);
assert_eq!(cur.read_dyn_u8(8).unwrap(), 1);
// We not just check here whether it works for byte aligned
let test_arr = &[0x09, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01];
let mut cur = BitpackCursor::new(test_arr);
assert_eq!(cur.read_u1().unwrap(), 1);
assert_eq!(cur.read_u7().unwrap(), 4);
assert_eq!(cur.read_i8().unwrap(), 2);
assert_eq!(cur.read_u32().unwrap(), 0);
assert_eq!(cur.read_u8().unwrap(), 1);
} | rust_cleaned_test_functions.jsonl/33434 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
95124,
22306,
19737,
66385,
368,
341,
197,
322,
4248,
429,
2699,
95124,
12726,
975,
448,
330,
8252,
1,
4922,
26118,
4494,
510,
10217,
1273,
11210,
284,
44590,
15,
87,
15,
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_function_expression_defaults_and_pipes() {
let b = ast::BaseNode::default();
let piped = FunctionParameter {
loc: b.location.clone(),
is_pipe: true,
key: Identifier {
loc: b.location.clone(),
name: "a".to_string(),
},
default: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 0,
})),
};
let default1 = FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: "b".to_string(),
},
default: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 1,
})),
};
let default2 = FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: "c".to_string(),
},
default: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 2,
})),
};
let no_default = FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: "d".to_string(),
},
default: None,
};
let defaults = vec![&piped, &default1, &default2];
let f = FunctionExpr {
loc: b.location.clone(),
typ: type_info(),
params: vec![
piped.clone(),
default1.clone(),
default2.clone(),
no_default.clone(),
],
body: Block::Return(ReturnStmt {
loc: b.location.clone(),
argument: Expression::Binary(Box::new(BinaryExpr {
loc: b.location.clone(),
typ: type_info(),
operator: ast::Operator::AdditionOperator,
left: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "a".to_string(),
}),
right: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "b".to_string(),
}),
})),
}),
};
assert_eq!(defaults, f.defaults());
assert_eq!(Some(&piped), f.pipe());
} | rust_cleaned_test_functions.jsonl/30452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
28068,
42290,
8378,
620,
8923,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
23626,
291,
284,
5712,
4971,
341,
310,
1329,
25,
293,
8219,
15997,
3148,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_leaf() {
let root = tree!('T');
println!("Input: {:?}", root);
let splitted = root.split();
let expected = tree!('T');
assert_eq!(splitted, expected);
} | rust_cleaned_test_functions.jsonl/9208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
38909,
368,
341,
197,
10217,
3704,
284,
4916,
0,
492,
51,
1157,
197,
81168,
17223,
2505,
25,
71964,
3704,
317,
197,
10217,
84889,
284,
3704,
5289,
543,
197,
10217,
3601,
284,
4916,
0,
492... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_run() -> Result<()> {
let test_filter = TestFilterBuilder::any(RunIgnored::Default);
let test_bins: Vec<_> = FIXTURE_TARGETS.values().cloned().collect();
let test_list = TestList::new(test_bins, &test_filter)?;
let config =
NextestConfig::from_sources(&workspace_root(), None).expect("loaded fixture config");
let profile = config
.profile(NextestConfig::DEFAULT_PROFILE)
.expect("default config is valid");
let runner = TestRunnerBuilder::default().build(&test_list, &profile, SignalHandler::noop());
let (instance_statuses, run_stats) = execute_collect(&runner);
for (name, expected) in &*EXPECTED_TESTS {
let test_binary = FIXTURE_TARGETS
.get(*name)
.unwrap_or_else(|| panic!("unexpected test name {}", name));
for fixture in expected {
let instance_value =
&instance_statuses[&(test_binary.binary_path.as_path(), fixture.name)];
let valid = match &instance_value.status {
InstanceStatus::Skipped(_) => fixture.status.is_ignored(),
InstanceStatus::Finished(run_statuses) => {
// This test should not have been retried since retries aren't configured.
assert_eq!(
run_statuses.len(),
1,
"test {} should have been run exactly once",
fixture.name
);
let run_status = run_statuses.last_status();
run_status.result == fixture.status.to_test_status(1)
}
};
if !valid {
panic!(
"for test {}, mismatch in status: expected {:?}, actual {:?}",
fixture.name, fixture.status, instance_value.status
);
}
}
}
assert!(!run_stats.is_success(), "run should be marked failed");
Ok(())
} | rust_cleaned_test_functions.jsonl/79770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 963
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
368,
1464,
5714,
71698,
341,
262,
1077,
1273,
8727,
284,
3393,
5632,
3297,
486,
3767,
2785,
359,
43337,
3018,
486,
3675,
317,
262,
1077,
1273,
44912,
25,
11312,
32399,
29,
284,
20151,
41486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_backward_compat() {
let address = IpAddr::from([
525u16, 524u16, 523u16, 522u16, 521u16, 520u16, 519u16, 518u16,
]);
let response = IpEchoServerResponse {
address,
shred_version: Some(42),
};
let mut data = vec![0u8; IP_ECHO_SERVER_RESPONSE_LENGTH];
bincode::serialize_into(&mut data[HEADER_LENGTH..], &response).unwrap();
data.truncate(HEADER_LENGTH + 20);
assert_eq!(
bincode::deserialize::<IpAddr>(&data[HEADER_LENGTH..]).unwrap(),
address
);
} | rust_cleaned_test_functions.jsonl/43703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70477,
89602,
368,
341,
286,
1077,
2621,
284,
35033,
13986,
486,
1499,
8956,
310,
220,
20,
17,
20,
84,
16,
21,
11,
220,
20,
17,
19,
84,
16,
21,
11,
220,
20,
17,
18,
84,
16,
21,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.