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_milliliters() {
let expected = vec![
("330ml bottle".to_string(), 1),
("Twelve ounce bottle".to_string(), 1),
("Groish bottle".to_string(), 1),
("Half liter bottle".to_string(), 1),
("Pint".to_string(), 1),
("Graft bottle".to_string(), 1),
("Wine bottle".to_string(), 1),
("Grenade jug".to_string(), 1),
("Growler jug".to_string(), 1),
("Gallon jug".to_string(), 1),
("5 liter mini keg".to_string(), 1),
("50 liter keg".to_string(), 1),
];
assert_eq!(expected, calculate_num_bottles(330.0));
} | rust_cleaned_test_functions.jsonl/81448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
483,
3664,
388,
368,
341,
286,
1077,
3601,
284,
7486,
90515,
310,
3489,
18,
18,
15,
1014,
16486,
3263,
983,
3904,
1507,
220,
16,
1326,
310,
3489,
22816,
21210,
53708,
16486,
3263,
983,
3904... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dsu() {
let mut d = DisjointSetUnion::new(4);
d.unite(0, 1);
assert!(d.is_same(0, 1));
d.unite(1, 2);
assert!(d.is_same(0, 2));
assert_eq!(d.size(0), 3);
assert!(!d.is_same(0, 3));
} | rust_cleaned_test_functions.jsonl/57492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
27051,
368,
341,
286,
1077,
5206,
294,
284,
4093,
32850,
1649,
32658,
486,
931,
7,
19,
317,
286,
294,
6307,
632,
7,
15,
11,
220,
16,
317,
286,
2060,
10297,
67,
2079,
33574,
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_advent_of_code_2020_day_17() {
// https://adventofcode.com/2020/day/17
let example_pattern = "
.#.
..#
###
";
let puzzle_pattern = "
#.#..###
.#....##
.###...#
..####..
....###.
##.#.#.#
..#..##.
#.....##
";
test_pattern::<Dim3D>(example_pattern, 5, 112);
test_pattern::<Dim3D>(puzzle_pattern, 30, 391);
test_pattern::<Dim4D>(example_pattern, 5, 848);
test_pattern::<Dim4D>(puzzle_pattern, 30, 2264);
} | rust_cleaned_test_functions.jsonl/106038 | {
"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,
10027,
684,
3575,
4136,
62,
17,
15,
17,
15,
16763,
62,
16,
22,
368,
341,
262,
442,
3703,
1110,
329,
684,
1055,
1851,
905,
14,
17,
15,
17,
15,
44739,
14,
16,
22,
271,
262,
1077,
3110,
21260... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_random_wallet_testnet_no_entropy() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let wallet = generate_random(&mut jscontext, None, true).unwrap();
assert!(!wallet.mnemonic.is_empty());
assert!(!wallet.wallet.address.unwrap().is_empty());
} | rust_cleaned_test_functions.jsonl/118733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
22644,
62308,
4452,
4711,
6536,
50374,
368,
341,
286,
1077,
700,
4334,
284,
1460,
486,
3160,
486,
947,
445,
3656,
8291,
1827,
15454,
543,
286,
1077,
5206,
6994,
2147,
284,
12914,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_with_fail_fast() {
let r = flags_from_vec(svec!["deno", "test", "--fail-fast=3"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Test {
no_run: false,
doc: false,
fail_fast: Some(3),
filter: None,
allow_none: false,
quiet: false,
shuffle: None,
include: None,
concurrent_jobs: 1,
},
..Flags::default()
}
);
} | rust_cleaned_test_functions.jsonl/2031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
22121,
35743,
368,
341,
262,
1077,
435,
284,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
330,
1944,
497,
14482,
18403,
73668,
28,
18,
15049,
262,
2060,
10714,
33673,
414,
435,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_cmp_non_null() {
// i64
assert_eq_fold_eq(I64(1), I64(1), Bool(true));
assert_eq_fold_eq(I64(1), I64(-1), Bool(false));
assert_eq_fold_gt(I64(1), I64(1), Bool(false));
assert_eq_fold_gt(I64(1), I64(-1), Bool(true));
assert_eq_fold_ge(I64(1), I64(1), Bool(true));
assert_eq_fold_ge(I64(1), I64(-1), Bool(true));
assert_eq_fold_ge(I64(-1), I64(1), Bool(false));
assert_eq_fold_lt(I64(1), I64(1), Bool(false));
assert_eq_fold_lt(I64(-1), I64(1), Bool(true));
assert_eq_fold_le(I64(1), I64(1), Bool(true));
assert_eq_fold_le(I64(-1), I64(1), Bool(true));
assert_eq_fold_le(I64(1), I64(-1), Bool(false));
assert_eq_fold_ne(I64(1), I64(1), Bool(false));
assert_eq_fold_ne(I64(1), I64(-1), Bool(true));
// u64
assert_eq_fold_eq(U64(1), U64(1), Bool(true));
assert_eq_fold_eq(U64(1), U64(0), Bool(false));
assert_eq_fold_gt(U64(1), U64(1), Bool(false));
assert_eq_fold_gt(U64(1), U64(0), Bool(true));
assert_eq_fold_ge(U64(1), U64(1), Bool(true));
assert_eq_fold_ge(U64(1), U64(0), Bool(true));
assert_eq_fold_ge(U64(0), U64(1), Bool(false));
assert_eq_fold_lt(U64(1), U64(1), Bool(false));
assert_eq_fold_lt(U64(0), U64(1), Bool(true));
assert_eq_fold_le(U64(1), U64(1), Bool(true));
assert_eq_fold_le(U64(0), U64(1), Bool(true));
assert_eq_fold_le(U64(1), U64(0), Bool(false));
assert_eq_fold_ne(U64(1), U64(1), Bool(false));
assert_eq_fold_ne(U64(1), U64(0), Bool(true));
// f64
assert_eq_fold_eq(new_f64(1.0), new_f64(1.0), Bool(true));
assert_eq_fold_eq(new_f64(1.0), new_f64(0.0), Bool(false));
assert_eq_fold_gt(new_f64(1.0), new_f64(1.0), Bool(false));
assert_eq_fold_gt(new_f64(1.0), new_f64(0.0), Bool(true));
assert_eq_fold_ge(new_f64(1.0), new_f64(1.0), Bool(true));
assert_eq_fold_ge(new_f64(1.0), new_f64(0.0), Bool(true));
assert_eq_fold_ge(new_f64(0.0), new_f64(1.0), Bool(false));
assert_eq_fold_lt(new_f64(1.0), new_f64(1.0), Bool(false));
assert_eq_fold_lt(new_f64(0.0), new_f64(1.0), Bool(true));
assert_eq_fold_le(new_f64(1.0), new_f64(1.0), Bool(true));
assert_eq_fold_le(new_f64(0.0), new_f64(1.0), Bool(true));
assert_eq_fold_le(new_f64(1.0), new_f64(0.0), Bool(false));
assert_eq_fold_ne(new_f64(1.0), new_f64(1.0), Bool(false));
assert_eq_fold_ne(new_f64(1.0), new_f64(0.0), Bool(true));
// decimal
assert_eq_fold_eq(new_decimal("1.0"), new_decimal("1.0"), Bool(true));
assert_eq_fold_eq(new_decimal("1.0"), new_decimal("0.0"), Bool(false));
assert_eq_fold_gt(new_decimal("1.0"), new_decimal("1.0"), Bool(false));
assert_eq_fold_gt(new_decimal("1.0"), new_decimal("0.0"), Bool(true));
assert_eq_fold_ge(new_decimal("1.0"), new_decimal("1.0"), Bool(true));
assert_eq_fold_ge(new_decimal("1.0"), new_decimal("0.0"), Bool(true));
assert_eq_fold_ge(new_decimal("0.0"), new_decimal("1.0"), Bool(false));
assert_eq_fold_lt(new_decimal("1.0"), new_decimal("1.0"), Bool(false));
assert_eq_fold_lt(new_decimal("0.0"), new_decimal("1.0"), Bool(true));
assert_eq_fold_le(new_decimal("1.0"), new_decimal("1.0"), Bool(true));
assert_eq_fold_le(new_decimal("0.0"), new_decimal("1.0"), Bool(true));
assert_eq_fold_le(new_decimal("1.0"), new_decimal("0.0"), Bool(false));
assert_eq_fold_ne(new_decimal("1.0"), new_decimal("1.0"), Bool(false));
assert_eq_fold_ne(new_decimal("1.0"), new_decimal("0.0"), Bool(true));
// bool
assert_eq_fold_eq(Bool(true), Bool(true), Bool(true));
assert_eq_fold_eq(Bool(true), Bool(false), Bool(false));
assert_eq_fold_gt(Bool(true), Bool(true), Bool(false));
assert_eq_fold_gt(Bool(true), Bool(false), Bool(true));
assert_eq_fold_ge(Bool(true), Bool(true), Bool(true));
assert_eq_fold_ge(Bool(true), Bool(false), Bool(true));
assert_eq_fold_ge(Bool(false), Bool(true), Bool(false));
assert_eq_fold_lt(Bool(true), Bool(true), Bool(false));
assert_eq_fold_lt(Bool(false), Bool(true), Bool(true));
assert_eq_fold_le(Bool(true), Bool(true), Bool(true));
assert_eq_fold_le(Bool(false), Bool(true), Bool(true));
assert_eq_fold_le(Bool(true), Bool(false), Bool(false));
assert_eq_fold_ne(Bool(true), Bool(true), Bool(false));
assert_eq_fold_ne(Bool(true), Bool(false), Bool(true));
// string
assert_eq_fold_eq(new_str("1"), new_str("1"), Bool(true));
assert_eq_fold_eq(new_str("1"), new_str("0"), Bool(false));
assert_eq_fold_gt(new_str("1"), new_str("1"), Bool(false));
assert_eq_fold_gt(new_str("1"), new_str("0"), Bool(true));
assert_eq_fold_ge(new_str("1"), new_str("1"), Bool(true));
assert_eq_fold_ge(new_str("1"), new_str("0"), Bool(true));
assert_eq_fold_ge(new_str("0"), new_str("1"), Bool(false));
assert_eq_fold_lt(new_str("1"), new_str("1"), Bool(false));
assert_eq_fold_lt(new_str("0"), new_str("1"), Bool(true));
assert_eq_fold_le(new_str("1"), new_str("1"), Bool(true));
assert_eq_fold_le(new_str("0"), new_str("1"), Bool(true));
assert_eq_fold_le(new_str("1"), new_str("0"), Bool(false));
assert_eq_fold_ne(new_str("1"), new_str("1"), Bool(false));
assert_eq_fold_ne(new_str("1"), new_str("0"), Bool(true));
// bytes
assert_eq_fold_eq(new_bytes(b"1"), new_bytes(b"1"), Bool(true));
assert_eq_fold_eq(new_bytes(b"1"), new_bytes(b"0"), Bool(false));
assert_eq_fold_gt(new_bytes(b"1"), new_bytes(b"1"), Bool(false));
assert_eq_fold_gt(new_bytes(b"1"), new_bytes(b"0"), Bool(true));
assert_eq_fold_ge(new_bytes(b"1"), new_bytes(b"1"), Bool(true));
assert_eq_fold_ge(new_bytes(b"1"), new_bytes(b"0"), Bool(true));
assert_eq_fold_ge(new_bytes(b"0"), new_bytes(b"1"), Bool(false));
assert_eq_fold_lt(new_bytes(b"1"), new_bytes(b"1"), Bool(false));
assert_eq_fold_lt(new_bytes(b"0"), new_bytes(b"1"), Bool(true));
assert_eq_fold_le(new_bytes(b"1"), new_bytes(b"1"), Bool(true));
assert_eq_fold_le(new_bytes(b"0"), new_bytes(b"1"), Bool(true));
assert_eq_fold_le(new_bytes(b"1"), new_bytes(b"0"), Bool(false));
assert_eq_fold_ne(new_bytes(b"1"), new_bytes(b"1"), Bool(false));
assert_eq_fold_ne(new_bytes(b"1"), new_bytes(b"0"), Bool(true));
} | rust_cleaned_test_functions.jsonl/23349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
35193,
21637,
15162,
368,
341,
286,
442,
600,
21,
19,
198,
286,
2060,
10714,
61187,
10714,
8972,
21,
19,
7,
16,
701,
358,
21,
19,
7,
16,
701,
12608,
3715,
1106,
286,
2060,
10714,
61187,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_missing_data_indexes() {
let slot = 0;
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
// Write entries
let gap: u64 = 10;
assert!(gap > 3);
// Create enough entries to ensure there are at least two shreds created
let num_entries = max_ticks_per_n_shreds(1, None) + 1;
let entries = create_ticks(num_entries, 0, Hash::default());
let mut shreds = entries_to_test_shreds(entries, slot, 0, true, 0);
let num_shreds = shreds.len();
assert!(num_shreds > 1);
for (i, s) in shreds.iter_mut().enumerate() {
s.set_index(i as u32 * gap as u32);
s.set_slot(slot);
}
blockstore.insert_shreds(shreds, None, false).unwrap();
// Index of the first shred is 0
// Index of the second shred is "gap"
let expected: Vec<u64> = (1..gap).collect();
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, 0, gap, gap as usize),
expected
);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, 1, gap, (gap - 1) as usize),
expected,
);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, 0, gap - 1, (gap - 1) as usize),
&expected[..expected.len() - 1],
);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, gap - 2, gap, gap as usize),
vec![gap - 2, gap - 1],
);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, gap - 2, gap, 1),
vec![gap - 2],
);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, 0, gap, 1),
vec![1],
);
// Test with a range that encompasses a shred with index == gap which was
// already inserted.
let mut expected: Vec<u64> = (1..gap).collect();
expected.push(gap + 1);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, 0, gap + 2, (gap + 2) as usize),
expected,
);
assert_eq!(
blockstore.find_missing_data_indexes(slot, 0, 0, gap + 2, (gap - 1) as usize),
&expected[..expected.len() - 1],
);
for i in 0..num_shreds as u64 {
for j in 0..i {
let expected: Vec<u64> = (j..i)
.flat_map(|k| {
let begin = k * gap + 1;
let end = (k + 1) * gap;
begin..end
})
.collect();
assert_eq!(
blockstore.find_missing_data_indexes(
slot,
0,
j * gap,
i * gap,
((i - j) * gap) as usize
),
expected,
);
}
}
} | rust_cleaned_test_functions.jsonl/9545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
40447,
1769,
50161,
368,
341,
286,
1077,
9446,
284,
220,
15,
280,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_assert_dir() {
let tmpdir = assert_setup!();
let temp_dir = tmpdir.mash("foo");
assert_no_dir!(&temp_dir);
assert!(!sys::is_dir(&temp_dir));
sys::mkdir(&temp_dir).unwrap();
assert_dir!(&temp_dir);
assert!(sys::is_dir(&temp_dir));
assert_remove_all!(&tmpdir);
} | rust_cleaned_test_functions.jsonl/92821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
4334,
368,
341,
286,
1077,
4174,
3741,
284,
2060,
21363,
0,
1428,
286,
1077,
2730,
4334,
284,
4174,
3741,
744,
988,
445,
7975,
797,
286,
2060,
6536,
4334,
0,
2099,
3888,
4334,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_large_num_coding() {
solana_logger::setup();
let slot = 1;
let (_data_shreds, mut coding_shreds, leader_schedule_cache) =
setup_erasure_shreds(slot, 0, 100);
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
coding_shreds[1].coding_header.num_coding_shreds = u16::MAX;
blockstore
.insert_shreds(
vec![coding_shreds[1].clone()],
Some(&leader_schedule_cache),
false,
)
.unwrap();
// Check no coding shreds are inserted
let res = blockstore.get_coding_shreds_for_slot(slot, 0).unwrap();
assert!(res.is_empty());
} | rust_cleaned_test_functions.jsonl/9583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
4273,
666,
3700,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
9446,
284,
220,
16,
280,
286,
1077,
5453,
691,
3712,
53369,
11,
5206,
10822,
3712,
53369,
11,
7653,
34530,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mandali() {
run_test(
&TEST_DATA,
"directwrite/good-mandali.te",
"telugu/Mandali-Regular.ttf",
&[JOINER_GLYPH_INDEX],
0,
);
} | rust_cleaned_test_functions.jsonl/91214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
437,
7956,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
19798,
4934,
4846,
1386,
1448,
437,
7956,
31853,
756,
503,
330,
22924,
29785,
10270,
437,
7956,
87591,
45192,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_macro_empty() {
let array: Vec<u8> = vec![];
let bytes: Vec<u8> = to_bytes![array].unwrap();
assert_eq!(&bytes, &[]);
assert_eq!(bytes.len(), 0);
} | rust_cleaned_test_functions.jsonl/64713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58810,
15124,
368,
341,
286,
1077,
1334,
25,
11312,
34837,
23,
29,
284,
7486,
0,
15078,
286,
1077,
5820,
25,
11312,
34837,
23,
29,
284,
311,
12524,
20703,
1653,
936,
15454,
543,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_partial_eq() {
let s: ByteString = ByteString::from_static("test");
assert_eq!(s, "test");
assert_eq!(s, *"test");
assert_eq!(s, "test".to_string());
} | rust_cleaned_test_functions.jsonl/129999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
10714,
368,
341,
286,
1077,
274,
25,
95302,
284,
95302,
486,
1499,
25360,
445,
1944,
797,
286,
2060,
10714,
10297,
82,
11,
330,
1944,
797,
286,
2060,
10714,
10297,
82,
11,
91204,
1944,
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 |
#[test]
fn test_doc_as_description() {
let attrs: ParamAttrs = syn::parse_quote!(
/// DOC-DESC-1
#[param(name = "NAME")]
);
assert_eq!(attrs.desc, Some("DOC-DESC-1".to_string()));
let attrs: ParamAttrs = syn::parse_quote!(
/// DOC-DESC-2
);
assert_eq!(attrs.desc, Some("DOC-DESC-2".to_string()));
} | rust_cleaned_test_functions.jsonl/22303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
11898,
11448,
368,
341,
286,
1077,
16204,
25,
6991,
53671,
284,
6782,
486,
6400,
45236,
33673,
310,
1048,
60355,
12,
30910,
12,
16,
198,
310,
11506,
903,
3153,
284,
330,
7535,
5422,
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_wpubkey_hash() {
let pk = PublicKey::from_str("032e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af").unwrap();
let upk = PublicKey::from_str("042e58afe51f9ed8ad3cc7897f634d881fdbe49a81564629ded8156bebd2ffd1af191923a2964c177f5b5923ae500fca49e99492d534aa3759d6b25a8bc971b133").unwrap();
assert_eq!(pk.wpubkey_hash().unwrap().to_hex(), "9511aa27ef39bbfa4e4f3dd15f4d66ea57f475b4");
assert_eq!(upk.wpubkey_hash(), None);
} | rust_cleaned_test_functions.jsonl/41456 | {
"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,
1670,
9585,
792,
8950,
368,
341,
286,
1077,
22458,
284,
70280,
486,
1499,
2895,
445,
15,
18,
17,
68,
20,
23,
5645,
20,
16,
69,
24,
291,
23,
329,
18,
638,
22,
23,
24,
22,
69,
21,
18,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_info_field_value_with_string_array_value() -> io::Result<()> {
use vcf::record::info::field;
fn t(buf: &mut Vec<u8>, value: Option<&field::Value>, expected: &[u8]) -> io::Result<()> {
buf.clear();
write_info_field_value(buf, value)?;
assert_eq!(buf, expected);
Ok(())
}
let mut buf = Vec::new();
let value =
field::Value::StringArray(vec![Some(String::from("nd")), Some(String::from("ls"))]);
t(
&mut buf,
Some(&value),
&[0x57, 0x6e, 0x64, 0x2c, 0x6c, 0x73],
)?;
let value = field::Value::StringArray(vec![Some(String::from("nd")), None]);
t(&mut buf, Some(&value), &[0x47, 0x6e, 0x64, 0x2c, 0x2e])?;
Ok(())
} | rust_cleaned_test_functions.jsonl/6253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
3109,
5013,
3142,
6615,
3904,
3858,
3142,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
990,
348,
9792,
486,
8548,
486,
2733,
486,
2566,
401,
286,
5168,
259,
10731,
25,
609,
6984,
11312,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_epoch_hash_rate_dampening() {
let cellbase = TransactionBuilder::default()
.witness(Script::default().into_witness())
.input(CellInput::new(OutPoint::null(), 0))
.build();
let dao = genesis_dao_data(vec![&cellbase]).unwrap();
let genesis_block = BlockBuilder::default()
.compact_target(difficulty_to_compact(U256::from(1000u64)).pack())
.transaction(cellbase)
.dao(dao)
.build();
// last_difficulty 1000
// last_uncles_count 25
// last_epoch_length 400
// last_duration 7980
let mut consensus = ConsensusBuilder::default()
.genesis_block(genesis_block.clone())
.build();
consensus.genesis_epoch_ext.set_length(400);
consensus
.genesis_epoch_ext
.set_previous_epoch_hash_rate(U256::from(10u64));
let (_chain_controller, shared, _genesis, _last_epoch) =
prepare_context_chain(consensus.clone(), 26, 20_000);
{
let snapshot = shared.snapshot();
let tip = snapshot.tip_header().clone();
let total_uncles_count = snapshot
.get_block_ext(&tip.hash())
.unwrap()
.total_uncles_count;
assert_eq!(total_uncles_count, 25);
let epoch = snapshot
.next_epoch_ext(shared.consensus(), snapshot.epoch_ext(), &tip)
.unwrap();
// last_epoch_previous_epoch_hash_rate 10
// TAU = 2
assert_eq!(
epoch.previous_epoch_hash_rate(),
&U256::from(20u64),
"previous_epoch_hash_rate {}",
epoch.previous_epoch_hash_rate()
);
}
let mut consensus = ConsensusBuilder::default()
.genesis_block(genesis_block)
.build();
consensus.genesis_epoch_ext.set_length(400);
consensus
.genesis_epoch_ext
.set_previous_epoch_hash_rate(U256::from(200u64));
let (_chain_controller, shared, _genesis, _last_epoch) =
prepare_context_chain(consensus.clone(), 26, 20_000);
{
let snapshot = shared.snapshot();
let tip = snapshot.tip_header().clone();
let total_uncles_count = snapshot
.get_block_ext(&tip.hash())
.unwrap()
.total_uncles_count;
assert_eq!(total_uncles_count, 25);
let epoch = snapshot
.next_epoch_ext(shared.consensus(), snapshot.epoch_ext(), &tip)
.unwrap();
// last_epoch_previous_epoch_hash_rate 200
// TAU = 2
assert_eq!(
epoch.previous_epoch_hash_rate(),
&U256::from(100u64),
"previous_epoch_hash_rate {}",
epoch.previous_epoch_hash_rate()
);
}
} | rust_cleaned_test_functions.jsonl/105199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20682,
8950,
9246,
814,
1121,
6019,
368,
341,
262,
1077,
2779,
3152,
284,
17869,
3297,
486,
2258,
741,
286,
659,
86,
8091,
3759,
1228,
486,
2258,
1005,
18122,
1670,
8091,
2398,
286,
659,
1355,
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_eval_def_cfa_register_invalid_context() {
let cie = make_test_cie();
let mut ctx = UnwindContext::new();
ctx.set_cfa(CfaRule::Expression(Expression(EndianSlice::new(
&[],
LittleEndian,
))));
let expected = ctx.clone();
let instructions = [(
Err(Error::CfiInstructionInInvalidContext),
CallFrameInstruction::DefCfaRegister {
register: Register(42),
},
)];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
7844,
666,
3632,
14000,
31433,
8467,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5206,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
5635,
980,
666,
3632... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rwlock() {
use crate::sync::RwLock;
use crate::wait::Waiter;
async fn test_share_read() {
let lock = Arc::new(RwLock::new(1));
let c_lock = lock.clone();
let n = lock.read().await;
assert_eq!(*n, 1);
crate::task::spawn(async move {
let r = c_lock.read().await;
assert_eq!(*r, 1);
})
.await;
// Drop the guard after the spawned task finishes.
drop(n);
}
async fn test_write() {
let lock = Arc::new(RwLock::new(1));
let c_lock = lock.clone();
let n = lock.write().await;
assert_eq!(*n, 1);
crate::task::spawn(async move {
// Can't get lock in another task
assert!(c_lock.try_write().is_err());
assert!(c_lock.try_read().is_err());
})
.await;
assert_eq!(*n, 1);
drop(n);
}
async fn test_wake_readers() {
let rwlock = Arc::new(RwLock::new(1));
let c_rwlock = rwlock.clone();
let counter = Arc::new(AtomicU32::new(1));
let mut n = rwlock.write().await;
for i in 0..3 {
let rwlock = c_rwlock.clone();
let counter = counter.clone();
crate::task::spawn(async move {
let n = rwlock.read().await;
assert_eq!(*n, 2);
counter.fetch_add(1, Ordering::Relaxed);
});
}
// hold the lock for a while
let waiter = Waiter::new();
let mut duration = Duration::from_millis(300);
waiter.wait_timeout(Some(&mut duration)).await;
*n = 2;
drop(n);
loop {
// All three tasks should be woken up.
if counter.load(Ordering::Relaxed) == 3 {
break;
}
}
}
async fn test_into_inner() {
let rwlock_a = RwLock::new(1);
let mut rwlock_b = RwLock::new(1);
assert!(rwlock_a.into_inner() == 1);
let mut_inner = rwlock_b.get_mut();
*mut_inner = 2;
assert!(*rwlock_b.read().await == 2);
assert!(rwlock_b.into_inner() == 2);
}
crate::task::block_on(test_share_read());
crate::task::block_on(test_write());
crate::task::block_on(test_wake_readers());
crate::task::block_on(test_into_inner());
} | rust_cleaned_test_functions.jsonl/22989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
368,
341,
286,
990,
17717,
486,
12996,
486,
49,
86,
11989,
280,
286,
990,
17717,
486,
11489,
486,
14190,
261,
401,
286,
3312,
5168,
1273,
38272,
6443,
368,
341,
310,
1077,
5296,
284,
1968... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_ip_address() {
let mut test_config = create_test_config_no_paths();
test_config.device_config = Some(build_full_config());
let intfs = build_full_config().device.interfaces.unwrap();
let subif = &intfs[0].interface.subinterfaces.as_ref().unwrap()[0];
let expected_addr = &subif.ipv4.as_ref().unwrap().addresses[0];
match test_config.get_ip_address(&intfs[0].interface) {
Ok((Some(v4addr), None)) => {
assert_eq!(*v4addr, *expected_addr);
}
Ok(e) => panic!("Got unexpected result pair: {:?}", e),
Err(e) => panic!("Got unexpected result pair: {:?}", e),
}
} | rust_cleaned_test_functions.jsonl/83817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
10385,
6744,
368,
341,
286,
1077,
5206,
1273,
5332,
284,
1855,
4452,
5332,
6536,
24152,
543,
286,
1273,
5332,
18355,
5332,
284,
4329,
43333,
16372,
5332,
1423,
286,
1077,
526,
3848,
284,
193... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_to_end_capacity() -> io::Result<()> {
let input = &b"foo"[..];
// and so that it can distinguish EOF. Assert that this is the case
// implementation of read_to_end. Even though vec1 is allocated with
// space here.
let mut vec1 = Vec::with_capacity(input.len());
ExampleSliceReader { slice: input }.read_to_end(&mut vec1)?;
assert_eq!(vec1.len(), input.len());
assert!(vec1.capacity() > input.len(), "allocated more");
// that will not allocate when the limit has already been reached. In
let mut vec2 = Vec::with_capacity(input.len());
ExampleSliceReader { slice: input }.take(input.len() as u64).read_to_end(&mut vec2)?;
assert_eq!(vec2.len(), input.len());
assert_eq!(vec2.capacity(), input.len(), "did not allocate more");
Ok(())
} | rust_cleaned_test_functions.jsonl/8687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2346,
6213,
35603,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
1946,
284,
609,
65,
1,
7975,
36864,
496,
4821,
1789,
286,
442,
323,
773,
429,
432,
646,
32037,
29457,
13,
5319,
429,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_struct_array_builder_from_schema_unsupported_type() {
let mut fields = vec![Field::new("f1", DataType::Int16, false)];
let list_type =
DataType::List(Box::new(Field::new("item", DataType::Int64, true)));
fields.push(Field::new("f2", list_type, false));
let _ = StructBuilder::from_fields(fields, 5);
} | rust_cleaned_test_functions.jsonl/87818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
3858,
28532,
5673,
25371,
4907,
18216,
1819,
368,
341,
286,
1077,
5206,
5043,
284,
7486,
20703,
1877,
486,
931,
445,
69,
16,
497,
33172,
486,
1072,
16,
21,
11,
895,
12587,
286,
1077,
1140... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kyou_nari_7_squares_gote() {
test_legal_moves_banmen_with_kin_7_squares_gote_impl(GKyouN)
} | rust_cleaned_test_functions.jsonl/81275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
9330,
1089,
2780,
62,
22,
643,
40856,
1889,
1272,
368,
972,
18185,
82324,
45390,
880,
276,
5676,
6615,
4698,
258,
62,
22,
643,
40856,
1889,
1272,
21007,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unsupported_expression() {
let expr = datafusion::logical_plan::Expr::Not(Box::new(
datafusion::logical_plan::Expr::BinaryExpr {
left: Box::new(datafusion::logical_plan::Expr::Column(
datafusion::logical_plan::Column {
relation: None,
name: "foo".to_string(),
},
)),
op: datafusion::logical_plan::Operator::Eq,
right: Box::new(datafusion::logical_plan::Expr::Literal(
datafusion::scalar::ScalarValue::Utf8(Some("x".to_string())),
)),
},
));
let res = df_to_expr(expr);
assert_contains!(res.unwrap_err().to_string(), "unsupported expression:");
} | rust_cleaned_test_functions.jsonl/106782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18216,
28068,
368,
341,
286,
1077,
15169,
284,
821,
54565,
486,
30256,
26564,
486,
16041,
486,
2623,
67758,
486,
931,
1006,
310,
821,
54565,
486,
30256,
26564,
486,
16041,
486,
21338,
16041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0xaa_tax_move_a_to_x() {
let bus = Bus::new();
let mut cpu = CPU::new(bus);
cpu.register_a = 10;
cpu.load(vec![0xa9, 0x0A, 0xaa, 0x00]);
cpu.reset();
cpu.program_counter = 0x0600;
cpu.run();
assert_eq!(cpu.register_x, 10)
} | rust_cleaned_test_functions.jsonl/56541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
43300,
24579,
17134,
4306,
2346,
3212,
368,
341,
286,
1077,
5828,
284,
18598,
486,
931,
543,
286,
1077,
5206,
17319,
284,
13940,
486,
931,
60872,
317,
286,
17319,
9929,
4306,
284,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tt_group() {
check(
r#"
macro_rules! m { ($($tt:tt)*) => { $($tt)* } }
m! { fn foo() {} }"
"#,
expect![[r#"
macro_rules! m { ($($tt:tt)*) => { $($tt)* } }
fn foo() {}"
"#]],
);
} | rust_cleaned_test_functions.jsonl/85240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66740,
6288,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
314,
1711,
699,
5566,
25,
5566,
8,
3764,
589,
314,
93977,
5566,
4806,
335,
456,
76,
0,
314,
5168,
15229,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_example() {
let ref a = LpInteger::new("a").lower_bound(1.0);
let ref b = LpInteger::new("b").upper_bound(10.0);
let ref c = LpInteger::new("c").lower_bound(2.0).upper_bound(8.5);
let ref d = LpBinary::new("d");
let ref e = LpContinuous::new("e");
let mut problem = LpProblem::new("One Problem", LpObjective::Maximize);
problem += a + b + c + d + e;
problem += (a + b + c + d + e).le(100.0);
let solver = CbcSolver::new();
match solver.run(&problem) {
Ok((status, res)) => {
println!("Status {:?}", status);
for (name, value) in res.iter() {
println!("value of {} = {}", name, value);
}
}
Err(msg) => println!("{}", msg),
}
let output1 = problem.to_lp_file_format();
for expr in vec!("e free", "1 <= a", "2 <= c <= 8.5", "b <= 10") {
assert!(output1.contains(expr), format!("{} is not present",expr));
}
} | rust_cleaned_test_functions.jsonl/19664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
39304,
368,
341,
262,
1077,
2053,
264,
284,
444,
79,
3486,
486,
931,
445,
64,
1827,
14772,
19447,
7,
16,
13,
15,
317,
262,
1077,
2053,
293,
284,
444,
79,
3486,
486,
931,
445,
65,
1827... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_split_lines_number() {
// Test if stdout/stderr for '--lines' option is correct
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("file");
scene
.ucmd()
.args(&["--lines", "2", "file"])
.succeeds()
.no_stderr()
.no_stdout();
scene
.ucmd()
.args(&["--lines", "2fb", "file"])
.fails()
.code_is(1)
.stderr_only("split: invalid number of lines: '2fb'");
} | rust_cleaned_test_functions.jsonl/25862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
18323,
5500,
368,
341,
262,
442,
3393,
421,
20075,
21546,
615,
369,
17304,
7969,
6,
2999,
374,
4396,
198,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_bytes_default() {
let mut r = StepRng::new(0x11_22_33_44_55_66_77_88, 0);
let lengths = [0, 1, 2, 3, 4, 5, 6, 7, 80, 81, 82, 83, 84, 85, 86, 87];
for &n in lengths.iter() {
let mut buffer = [0u8; 87];
let v = &mut buffer[0..n];
r.fill_bytes(v);
// use this to get nicer error messages.
for (i, &byte) in v.iter().enumerate() {
if byte == 0 {
panic!("byte {} of {} is zero", i, n)
}
}
}
} | rust_cleaned_test_functions.jsonl/10494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
12524,
9993,
368,
341,
286,
1077,
5206,
435,
284,
14822,
49,
968,
486,
931,
7,
15,
87,
16,
16,
62,
17,
17,
62,
18,
18,
62,
19,
19,
62,
20,
20,
62,
21,
21,
62,
22,
22,
62,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_fork_merge_true() {
let mut ds = DataStack::new();
let cs = TestConstraintSystem::<Bn256>::new();
let value = Scalar::new_constant_usize(42, zinc_types::ScalarType::Field);
ds.set(4, Cell::Value(value))
.expect(zinc_const::panic::TEST_DATA_VALID);
ds.fork();
assert_cell_eq(
ds.get(4).expect(zinc_const::panic::TEST_DATA_VALID),
BigInt::from(42),
);
let value2 = Scalar::new_constant_usize(13, zinc_types::ScalarType::Field);
ds.set(4, Cell::Value(value2))
.expect(zinc_const::panic::TEST_DATA_VALID);
assert_cell_eq(
ds.get(4).expect(zinc_const::panic::TEST_DATA_VALID),
BigInt::from(13),
);
let condition = Scalar::new_constant_bool(true);
ds.merge(cs, condition)
.expect(zinc_const::panic::TEST_DATA_VALID);
assert_cell_eq(
ds.get(4).expect(zinc_const::panic::TEST_DATA_VALID),
BigInt::from(13),
);
} | rust_cleaned_test_functions.jsonl/106057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
669,
20888,
16082,
368,
341,
262,
1077,
5206,
11472,
284,
2885,
4336,
486,
931,
543,
262,
1077,
10532,
284,
3393,
17890,
2320,
27638,
33,
77,
17,
20,
21,
6831,
931,
543,
262,
1077,
897,
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_inet6_ntoa() {
let test_cases = vec![
(Some(hex("00000000")), Some(b"0.0.0.0".to_vec())),
(Some(hex("0A000509")), Some(b"10.0.5.9".to_vec())),
(
Some(hex("00000000000000000000000001020304")),
Some(b"::1.2.3.4".to_vec()),
),
(
Some(hex("00000000000000000000FFFF01020304")),
Some(b"::ffff:1.2.3.4".to_vec()),
),
(
Some(hex("000000000000FDFE5A55CAFFFEFA9089")),
Some(b"::fdfe:5a55:caff:fefa:9089".to_vec()),
),
(
Some(hex("FDFE0000000000005A55CAFFFEFA9089")),
Some(b"fdfe::5a55:caff:fefa:9089".to_vec()),
),
(
Some(hex("20010db885a3123456788a2e03707334")),
Some(b"2001:db8:85a3:1234:5678:8a2e:370:7334".to_vec()),
),
// missing bytes
(Some(b"".to_vec()), None),
// missing a byte ipv4
(Some(hex("20010d")), None),
// missing a byte ipv6
(Some(hex("00000000000000000000FFFFFFFFFF")), None),
(None, None),
];
for (input, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(input)
.evaluate::<Bytes>(ScalarFuncSig::Inet6Ntoa)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/59414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 935
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
295,
21,
38945,
19533,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
8373,
44660,
445,
15,
15,
15,
15,
15,
15,
15,
15,
35674,
4329,
1883,
1,
15,
13,
15,
13,
15,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_panic() {
let mut rng = SmallRng::seed_from_u64(0);
Totro::generate(5, 3, &mut rng);
} | rust_cleaned_test_functions.jsonl/65543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31270,
368,
341,
286,
1077,
5206,
28422,
284,
14994,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
15,
317,
286,
38020,
299,
486,
19366,
7,
20,
11,
220,
18,
11,
609,
6984,
28422,
317,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_which_extension() {
let f = TestFixture::new();
let b = Path::new(&BIN_NAME).with_extension("");
assert_eq!(_which(&f, &b).unwrap(), f.bins[0])
} | rust_cleaned_test_functions.jsonl/13397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
8206,
31035,
368,
341,
262,
1077,
282,
284,
3393,
18930,
486,
931,
543,
262,
1077,
293,
284,
7933,
486,
931,
2099,
58531,
4708,
568,
4197,
31035,
13056,
262,
2060,
10714,
0,
2490,
8206,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_lookup_line() {
let lines = &[BytePos(3), BytePos(17), BytePos(28)];
assert_eq!(lookup_line(lines, BytePos(0)), -1);
assert_eq!(lookup_line(lines, BytePos(3)), 0);
assert_eq!(lookup_line(lines, BytePos(4)), 0);
assert_eq!(lookup_line(lines, BytePos(16)), 0);
assert_eq!(lookup_line(lines, BytePos(17)), 1);
assert_eq!(lookup_line(lines, BytePos(18)), 1);
assert_eq!(lookup_line(lines, BytePos(28)), 2);
assert_eq!(lookup_line(lines, BytePos(29)), 2);
} | rust_cleaned_test_functions.jsonl/4489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
6528,
368,
341,
286,
1077,
5128,
284,
44590,
7153,
4859,
7,
18,
701,
10906,
4859,
7,
16,
22,
701,
10906,
4859,
7,
17,
23,
73663,
286,
2060,
10714,
10297,
21020,
6528,
33152,
11,
10906,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json() {
assert_eq!(json(&true).unwrap().unsafe_string(), "true");
assert_eq!(json(&"foo").unwrap().unsafe_string(), r#""foo""#);
assert_eq!(
json(&vec!["foo", "bar"]).unwrap().unsafe_string(),
r#"[
"foo",
"bar"
]"#
);
} | rust_cleaned_test_functions.jsonl/23109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
368,
341,
286,
2060,
10714,
10297,
2236,
2099,
1866,
568,
15454,
1005,
38157,
3904,
1507,
330,
1866,
797,
286,
2060,
10714,
10297,
2236,
2099,
1,
7975,
1827,
15454,
1005,
38157,
3904,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_local_msg() {
let tests = vec![
(MessageType::MsgHup, true),
(MessageType::MsgBeat, true),
(MessageType::MsgUnreachable, true),
(MessageType::MsgSnapStatus, true),
(MessageType::MsgCheckQuorum, true),
(MessageType::MsgPropose, false),
(MessageType::MsgAppend, false),
(MessageType::MsgAppendResponse, false),
(MessageType::MsgRequestVote, false),
(MessageType::MsgRequestVoteResponse, false),
(MessageType::MsgSnapshot, false),
(MessageType::MsgHeartbeat, false),
(MessageType::MsgHeartbeatResponse, false),
(MessageType::MsgTransferLeader, false),
(MessageType::MsgTimeoutNow, false),
(MessageType::MsgReadIndex, false),
(MessageType::MsgReadIndexResp, false),
(MessageType::MsgRequestPreVote, false),
(MessageType::MsgRequestPreVoteResponse, false),
];
for (msg_type, result) in tests {
assert_eq!(is_local_msg(msg_type), result);
}
} | rust_cleaned_test_functions.jsonl/8381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
13564,
6483,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
82107,
486,
6611,
39,
454,
11,
830,
1326,
310,
320,
82107,
486,
6611,
43658,
11,
830,
1326,
310,
320,
82107,
486,
6611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vdpa_kern_new_device() {
let m = GuestMemoryMmap::<()>::from_ranges(&[(GuestAddress(0), 0x10_0000)]).unwrap();
let vdpa = unwrap_not_found!(VhostKernVdpa::new(VHOST_VDPA_PATH, &m));
assert!(vdpa.as_raw_fd() >= 0);
assert!(vdpa.mem().find_region(GuestAddress(0x100)).is_some());
assert!(vdpa.mem().find_region(GuestAddress(0x10_0000)).is_none());
} | rust_cleaned_test_functions.jsonl/127247 | {
"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,
2273,
67,
6595,
4698,
932,
5921,
9204,
368,
341,
286,
1077,
296,
284,
26215,
10642,
44,
2186,
27638,
368,
6831,
1499,
58748,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
62,
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_stream_to_rank() {
let rank = vec![6.0,3.0,4.0].to_rank();
assert!(rank == vec![2,0,1]);
} | rust_cleaned_test_functions.jsonl/132707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
2346,
20417,
368,
341,
286,
1077,
7077,
284,
7486,
20703,
21,
13,
15,
11,
18,
13,
15,
11,
19,
13,
15,
936,
983,
20417,
543,
286,
2060,
10297,
13129,
621,
7486,
20703,
17,
11,
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 |
#[test]
fn test_select_repositories_by_name() {
assert_eq!("SELECT * FROM repositories WHERE name='rejasupotaro/cref'",
select_repositories_by_name(&"rejasupotaro/cref".to_string()));
} | rust_cleaned_test_functions.jsonl/33811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
1288,
17286,
3710,
1269,
368,
341,
286,
2060,
10714,
17223,
4858,
353,
4295,
49657,
5288,
829,
1131,
265,
29726,
454,
354,
17165,
14,
837,
69,
38330,
310,
3293,
1288,
17286,
3710,
1269,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_empty_ledger_dir() {
// copied
let origin_block_path = TempDir::new("origin").unwrap();
// This will create the ledger path
let ledger_path = TempDir::new("ledger").unwrap();
assert!(ledger_path.path().exists());
let data_path = origin_block_path.path().join("data.mdb");
File::create(data_path).unwrap();
setup_ledger_dir(
&Some(origin_block_path.path().to_path_buf()),
ledger_path.path(),
);
let new_data_path = ledger_path.path().join("data.mdb");
assert!(new_data_path.exists());
} | rust_cleaned_test_functions.jsonl/108814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
38367,
1389,
4334,
368,
341,
1789,
286,
442,
21774,
198,
286,
1077,
6238,
7113,
2638,
284,
19944,
6184,
486,
931,
445,
8611,
1827,
15454,
1428,
286,
442,
1096,
686,
1855,
279,
46933,
1815,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_command_latches() {
let mut temp_map = HashMap::default();
temp_map.insert(10.into(), 20.into());
let readonly_cmds: Vec<Command> = vec![
commands::ResolveLockReadPhase::new(temp_map.clone(), None, Context::default()).into(),
commands::MvccByKey::new(Key::from_raw(b"k"), Context::default()).into(),
commands::MvccByStartTs::new(25.into(), Context::default()).into(),
];
let write_cmds: Vec<Command> = vec![
commands::Prewrite::with_defaults(
vec![Mutation::Put((Key::from_raw(b"k"), b"v".to_vec()))],
b"k".to_vec(),
10.into(),
)
.into(),
commands::AcquirePessimisticLock::new(
vec![(Key::from_raw(b"k"), false)],
b"k".to_vec(),
10.into(),
0,
false,
TimeStamp::default(),
Some(WaitTimeout::Default),
false,
TimeStamp::default(),
OldValues::default(),
Context::default(),
)
.into(),
commands::Commit::new(
vec![Key::from_raw(b"k")],
10.into(),
20.into(),
Context::default(),
)
.into(),
commands::Cleanup::new(
Key::from_raw(b"k"),
10.into(),
20.into(),
Context::default(),
)
.into(),
commands::Rollback::new(vec![Key::from_raw(b"k")], 10.into(), Context::default())
.into(),
commands::PessimisticRollback::new(
vec![Key::from_raw(b"k")],
10.into(),
20.into(),
Context::default(),
)
.into(),
commands::ResolveLock::new(
temp_map,
None,
vec![(
Key::from_raw(b"k"),
mvcc::Lock::new(
mvcc::LockType::Put,
b"k".to_vec(),
10.into(),
20,
None,
TimeStamp::zero(),
0,
TimeStamp::zero(),
),
)],
Context::default(),
)
.into(),
commands::ResolveLockLite::new(
10.into(),
TimeStamp::zero(),
vec![Key::from_raw(b"k")],
Context::default(),
)
.into(),
commands::TxnHeartBeat::new(Key::from_raw(b"k"), 10.into(), 100, Context::default())
.into(),
];
let latches = Latches::new(1024);
let write_locks: Vec<Lock> = write_cmds
.into_iter()
.enumerate()
.map(|(id, cmd)| {
let mut lock = cmd.gen_lock();
assert_eq!(latches.acquire(&mut lock, id as u64), id == 0);
lock
})
.collect();
for (id, cmd) in readonly_cmds.iter().enumerate() {
let mut lock = cmd.gen_lock();
assert!(latches.acquire(&mut lock, id as u64));
}
// acquire/release locks one by one.
let max_id = write_locks.len() as u64 - 1;
for (id, mut lock) in write_locks.into_iter().enumerate() {
let id = id as u64;
if id != 0 {
assert!(latches.acquire(&mut lock, id));
}
let unlocked = latches.release(&lock, id);
if id as u64 == max_id {
assert!(unlocked.is_empty());
} else {
assert_eq!(unlocked, vec![id + 1]);
}
}
} | rust_cleaned_test_functions.jsonl/36480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
907,
9118,
368,
341,
286,
1077,
5206,
2730,
5376,
284,
10528,
486,
2258,
543,
286,
2730,
5376,
7030,
7,
16,
15,
39860,
1507,
220,
17,
15,
39860,
1423,
286,
1077,
5762,
89472,
25,
11312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_iter() {
let xs: Vec<(uint, char)> = vec![(1u, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')];
let map: VecMap<char> = xs.iter().map(|&x| x).collect();
for &(k, v) in xs.iter() {
assert_eq!(map.get(&k), Some(&v));
}
} | rust_cleaned_test_functions.jsonl/108802 | {
"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,
5673,
11723,
368,
341,
286,
1077,
11943,
25,
11312,
28706,
2496,
11,
1161,
16018,
284,
7486,
0,
9697,
16,
84,
11,
364,
64,
4567,
320,
17,
11,
364,
65,
4567,
320,
18,
11,
364,
66,
4567,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rsa_pkcs1_sign_parsing() {
for test in wycheproof::rsa_pkcs1_sign::TestName::all() {
let _kat = wycheproof::rsa_pkcs1_sign::TestSet::load(test).unwrap();
}
} | rust_cleaned_test_functions.jsonl/5842 | {
"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,
82522,
33321,
4837,
16,
11172,
620,
28598,
368,
341,
262,
369,
1273,
304,
289,
5641,
747,
75636,
486,
60869,
33321,
4837,
16,
11172,
486,
2271,
675,
486,
541,
368,
341,
286,
1077,
716,
33755,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_eh_frame_resolve_cie_offset_out_of_bounds() {
let buf = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
assert_eq!(
resolve_cie_offset(&buf, buf.len() + 4 + 2),
Err(Error::OffsetOutOfBounds)
);
} | rust_cleaned_test_functions.jsonl/9383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
71,
8929,
77291,
666,
645,
6917,
6068,
3575,
36878,
368,
341,
286,
1077,
6607,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
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 |
#[test]
fn test_type_08() {
let ast = check_parse("type nat = u8;");
check_name(ast.get(0),"nat");
assert_eq!(ast.get(1),&Node::IntType(false,8));
} | rust_cleaned_test_functions.jsonl/96538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
62,
15,
23,
368,
341,
262,
1077,
11763,
284,
1779,
21039,
445,
1313,
17588,
284,
575,
23,
34649,
262,
1779,
1269,
52574,
670,
7,
15,
35393,
33297,
797,
262,
2060,
10714,
10297,
559,
670,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_escape() {
assert_eq!(escape("--aaa=bbb-ccc".into()), "--aaa=bbb-ccc");
assert_eq!(
escape("linker=gcc -L/foo -Wl,bar".into()),
r#""linker=gcc -L/foo -Wl,bar""#
);
assert_eq!(
escape(r#"--features="default""#.into()),
r#""--features=\"default\"""#
);
assert_eq!(
escape(r#"\path\to\my documents\"#.into()),
r#""\path\to\my documents\\""#
);
} | rust_cleaned_test_functions.jsonl/36438 | {
"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,
21832,
368,
341,
286,
2060,
10714,
10297,
12998,
21549,
32646,
28,
53151,
12,
37054,
3263,
18122,
11858,
14482,
32646,
28,
53151,
12,
37054,
797,
286,
2060,
10714,
33673,
310,
12449,
445,
2080,
261,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace() {
let mutation = replace(
"Guild",
&["GuildId", "UserId", "UpdatedAt"],
&[&"1", &"2", &CommitTimestamp::new()],
);
match mutation.operation.unwrap() {
v1::mutation::Operation::Replace(mut w) => {
assert_eq!("Guild", w.table);
assert_eq!(3, w.values.pop().unwrap().values.len());
assert_eq!(3, w.columns.len());
}
_ => panic!("invalid operation"),
}
} | rust_cleaned_test_functions.jsonl/132332 | {
"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,
10633,
368,
341,
286,
1077,
26374,
284,
8290,
1006,
310,
330,
72574,
756,
310,
609,
1183,
72574,
764,
497,
330,
13504,
497,
330,
72279,
8097,
310,
44590,
5,
1,
16,
497,
609,
1,
17,
497,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_import_struct_typedef_from_different_decl_context() {
let ir = ir_from_cc(
"struct MyStruct {}; namespace test_namespace_bindings { typedef MyStruct MyStruct; }",
)
.unwrap();
assert_ir_matches!(ir, quote! { Record { ... cc_name: "MyStruct" ...}});
assert_ir_matches!(ir, quote! { TypeAlias { identifier: "MyStruct" ... } });
} | rust_cleaned_test_functions.jsonl/37188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
15126,
42111,
4219,
5673,
82741,
35814,
8467,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
330,
1235,
3017,
9422,
52166,
4473,
1273,
41571,
94516,
314,
13501,
3017,
9422,
301... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_translate_linestring() {
let linestring = LineString::from(vec![(0.0, 0.0), (5.0, 1.0), (10.0, 0.0)]);
let translated = linestring.translate(17.0, 18.0);
let mut correct = Vec::new();
correct.push((17.0, 18.0));
correct.push((22.0, 19.0));
correct.push((27., 18.));
let correct_ls = LineString::from(correct);
assert_eq!(translated, correct_ls);
} | rust_cleaned_test_functions.jsonl/94516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66381,
24606,
65040,
368,
341,
286,
1077,
9805,
65040,
284,
7083,
703,
486,
1499,
25592,
0,
9697,
15,
13,
15,
11,
220,
15,
13,
15,
701,
320,
20,
13,
15,
11,
220,
16,
13,
15,
701,
320,
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_authorize_override() {
let withdrawer_pubkey = Pubkey::new_rand();
let stake_lamports = 42;
let stake_account = Account::new_ref_data_with_space(
stake_lamports,
&StakeState::Initialized(Meta::auto(&withdrawer_pubkey)),
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let stake_keyed_account = KeyedAccount::new(&withdrawer_pubkey, true, &stake_account);
// Authorize a staker pubkey and move the withdrawer key into cold storage.
let stake_pubkey = Pubkey::new_rand();
let signers = vec![withdrawer_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(&stake_pubkey, StakeAuthorize::Staker, &signers),
Ok(())
);
let mallory_pubkey = Pubkey::new_rand();
let signers = vec![stake_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(&mallory_pubkey, StakeAuthorize::Staker, &signers),
Ok(())
);
// Verify the original staker no longer has access.
let new_stake_pubkey = Pubkey::new_rand();
assert_eq!(
stake_keyed_account.authorize(&new_stake_pubkey, StakeAuthorize::Staker, &signers),
Err(InstructionError::MissingRequiredSignature)
);
let signers = vec![withdrawer_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(&new_stake_pubkey, StakeAuthorize::Withdrawer, &signers),
Ok(())
);
// Attack! Verify the staker cannot be used to authorize a withdraw.
let signers = vec![new_stake_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(&mallory_pubkey, StakeAuthorize::Withdrawer, &signers),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/39450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 906
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
48576,
368,
341,
286,
1077,
14798,
261,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
1077,
18279,
13500,
284,
8615... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint_from_div_assign_no_panic() {
assert_eq!(Uint256::from(6).div(Uint256::from(2)), Uint256::from(3));
} | rust_cleaned_test_functions.jsonl/47739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
5673,
16237,
20688,
6536,
620,
31270,
368,
341,
286,
2060,
10714,
10297,
21570,
17,
20,
21,
486,
1499,
7,
21,
568,
611,
12317,
396,
17,
20,
21,
486,
1499,
7,
17,
5731,
27883,
17,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_move_d_e() {
let mut cpu: CPU = CPU::new();
cpu = cpu.set_d(Register { value: 0 });
cpu = cpu.set_e(Register { value: 10 });
cpu = execute_move(cpu, 0b011, 0b100);
assert_eq!(cpu.pc.value, 0);
assert_eq!(cpu.f.value, 0);
assert_eq!(cpu.d.value, 10);
} | rust_cleaned_test_functions.jsonl/123579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
814,
2204,
368,
341,
286,
1077,
5206,
17319,
25,
13940,
284,
13940,
486,
931,
1428,
286,
17319,
284,
17319,
980,
814,
79203,
314,
897,
25,
220,
15,
1625,
286,
17319,
284,
17319,
980,
2204... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ortho_32x32() {
let size = 32;
let angles = (0..(size - 1)).into_iter().map( |x| x as f32 / (size as f32) * 3.1415 );
let ys = ortho( angles );
let a: Vec< _ > = (0..32).into_iter().map( |n| 0.123 * n as f32 ).collect();
let b = mul_matvec( &ys, &a );
assert_f32_eq( norm( &a ), norm( &b ) );
} | rust_cleaned_test_functions.jsonl/84264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
90824,
62,
18,
17,
87,
18,
17,
368,
341,
262,
1077,
1379,
284,
220,
18,
17,
280,
262,
1077,
25941,
284,
320,
15,
496,
7,
2141,
481,
220,
16,
4579,
18122,
11723,
1005,
2186,
7,
760,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_iter_ch1() {
let needle = b"a";
let mut f = File::open("data/pride-and-prejudice.txt")
.expect("test file not found");
let mut buf = Vec::with_capacity(1000000);
f.read_to_end(&mut buf).unwrap();
f.seek(SeekFrom::Start(0)).expect("I/O operation failed");
let matches: Vec<usize> = xfind::find_iter(needle, &mut f)
.map(|x| x.expect("I/O operation failed"))
.collect();
let expected: Vec<usize> =
memchr::memmem::find_iter(&buf, needle).collect();
assert_eq!(matches, expected);
} | rust_cleaned_test_functions.jsonl/126030 | {
"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,
21814,
11723,
4138,
16,
368,
341,
262,
1077,
30309,
284,
293,
56693,
3302,
262,
1077,
5206,
282,
284,
2887,
486,
2508,
445,
691,
44672,
577,
9777,
21334,
18138,
558,
3909,
1138,
286,
659,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sequence_like_types() {
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S1(#[serde_as(as = "Box<[Same]>")] Box<[u32]>);
is_equal(
S1(vec![1, 2, 3, 99].into()),
expect![[r#"
[
1,
2,
3,
99
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S2(#[serde_as(as = "BTreeSet<Same>")] BTreeSet<u32>);
is_equal(
S2(vec![1, 2, 3, 99].into_iter().collect()),
expect![[r#"
[
1,
2,
3,
99
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S3(#[serde_as(as = "LinkedList<Same>")] LinkedList<u32>);
is_equal(
S3(vec![1, 2, 3, 99].into_iter().collect()),
expect![[r#"
[
1,
2,
3,
99
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S4(#[serde_as(as = "Vec<Same>")] Vec<u32>);
is_equal(
S4(vec![1, 2, 3, 99]),
expect![[r#"
[
1,
2,
3,
99
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S5(#[serde_as(as = "VecDeque<Same>")] VecDeque<u32>);
is_equal(
S5(vec![1, 2, 3, 99].into()),
expect![[r#"
[
1,
2,
3,
99
]"#]],
);
} | rust_cleaned_test_functions.jsonl/45730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1086
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23735,
25535,
9763,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
39900,
11,
48440,
11,
55039,
5563,
262,
2036,
328,
16,
7,
13353,
47024,
11898,
36951,
284,
330,
1611,
667... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_utc_value() {
use time::{date, time};
let timestamp = date!(2022 - 01 - 02).with_time(time!(3:04:05)).assume_utc();
let value: Value = timestamp.into();
let out: OffsetDateTime = value.unwrap();
assert_eq!(out, timestamp);
} | rust_cleaned_test_functions.jsonl/12491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
84259,
3142,
368,
341,
286,
990,
882,
22964,
1028,
11,
882,
2440,
286,
1077,
11441,
284,
2400,
10297,
17,
15,
17,
17,
481,
220,
15,
16,
481,
220,
15,
17,
568,
4197,
3009,
9730,
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_vcpu_pause_resume() {
let (vcpu_handle, vcpu_exit_evt) = vcpu_configured_for_boot();
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
queue_event_expect_response(&vcpu_handle, VcpuEvent::Pause, VcpuResponse::Paused);
// Validate vcpu handled the EINTR gracefully and didn't exit.
let err = vcpu_exit_evt.read().unwrap_err();
assert_eq!(err.raw_os_error().unwrap(), libc::EAGAIN);
queue_event_expect_response(&vcpu_handle, VcpuEvent::Pause, VcpuResponse::Paused);
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
queue_event_expect_response(&vcpu_handle, VcpuEvent::Pause, VcpuResponse::Paused);
queue_event_expect_response(&vcpu_handle, VcpuEvent::Resume, VcpuResponse::Resumed);
} | rust_cleaned_test_functions.jsonl/99251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
16475,
59989,
58132,
368,
341,
286,
1077,
320,
85,
16475,
10630,
11,
348,
16475,
16880,
60019,
8,
284,
348,
16475,
5332,
3073,
5478,
52062,
1428,
1789,
286,
7177,
6748,
68918,
9655,
2099,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_string() {
let (bytes, handles) = TestInterfaceEvent::String { arg: STRING_VALUE.to_string() }
.into_message(SENDER_ID)
.unwrap()
.take();
assert!(handles.is_empty());
assert_eq!(bytes, STRING_MESSAGE_BYTES);
} | rust_cleaned_test_functions.jsonl/55797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
3904,
368,
341,
286,
1077,
320,
9651,
11,
13469,
8,
284,
3393,
5051,
1556,
486,
703,
314,
1392,
25,
35255,
7476,
2389,
3904,
368,
456,
310,
659,
18122,
6462,
51048,
35689,
3450,
340,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_biosnoop() {
init_io_snooper().unwrap();
test_thread_idx_allocation();
test_io_context();
unsafe {
BPF_CONTEXT.take();
}
} | rust_cleaned_test_functions.jsonl/32622 | {
"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,
880,
3530,
40162,
368,
341,
286,
2930,
16939,
643,
2152,
3296,
1005,
15454,
543,
16885,
286,
1273,
10814,
7258,
81267,
543,
286,
1273,
16939,
8467,
543,
286,
19860,
341,
310,
425,
19701,
29577,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_weighted_shuffle_compare() {
let shuffle = weighted_shuffle(vec![50, 10, 2, 1, 1, 1], ChaChaRng::from_seed([0x5a; 32]));
let shuffle1 = weighted_shuffle(vec![50, 10, 2, 1, 1, 1], ChaChaRng::from_seed([0x5a; 32]));
shuffle1
.into_iter()
.zip(shuffle.into_iter())
.for_each(|(x, y)| {
assert_eq!(x, y);
});
} | rust_cleaned_test_functions.jsonl/52099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
73484,
32235,
368,
341,
286,
1077,
25947,
284,
36824,
73484,
25592,
20703,
20,
15,
11,
220,
16,
15,
11,
220,
17,
11,
220,
16,
11,
220,
16,
11,
220,
16,
1125,
27721,
95971,
49,
96... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kdtree_untrained() {
let tree = KDTree::default();
let e = tree.search_leaf(&vec![3., 4.9], 1);
assert!(e.is_err());
let e = tree.search(&vec![3., 4.9], 1);
assert!(e.is_err());
} | rust_cleaned_test_functions.jsonl/114543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
8047,
765,
4907,
35722,
368,
341,
286,
1077,
4916,
284,
62990,
6533,
486,
2258,
1428,
286,
1077,
384,
284,
4916,
9288,
38909,
2099,
4083,
20703,
18,
2572,
220,
19,
13,
24,
1125,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unterminated_extended_string() {
{
let code = r#"""""#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedExtendedString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let code = r#""""."#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedExtendedString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let code = r#"""".""#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedExtendedString
),
_ => panic!(),
},
_ => panic!(),
}
}
{
let code = r#""""."""#;
let tokenization_result = tokenize(code);
match tokenization_result {
Err(syntax_error) => match syntax_error {
SyntaxError::ParsingError(parsing_error) => assert_eq!(
parsing_error.error_code,
ErrorCode::UnterminatedExtendedString
),
_ => panic!(),
},
_ => panic!(),
}
}
} | rust_cleaned_test_functions.jsonl/116463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
68659,
61678,
3904,
368,
341,
286,
341,
310,
1077,
2038,
284,
435,
2,
3014,
12599,
2,
280,
310,
1077,
3950,
2022,
5287,
284,
77651,
15842,
626,
310,
2432,
3950,
2022,
5287,
341,
394,
15495... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_compaction_filter_allowed() {
let cluster_version = ClusterVersion::new(semver::Version::new(4, 1, 0));
let mut cfg_value = GcConfig::default();
assert!(!is_compaction_filter_allowd(&cfg_value, &cluster_version));
cfg_value.enable_compaction_filter = true;
assert!(!is_compaction_filter_allowd(&cfg_value, &cluster_version));
cfg_value.compaction_filter_skip_version_check = true;
assert!(is_compaction_filter_allowd(&cfg_value, &cluster_version));
let cluster_version = ClusterVersion::new(semver::Version::new(5, 0, 0));
cfg_value.compaction_filter_skip_version_check = false;
assert!(is_compaction_filter_allowd(&cfg_value, &cluster_version));
} | rust_cleaned_test_functions.jsonl/115664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
18177,
1311,
8727,
42155,
368,
341,
286,
1077,
10652,
9438,
284,
35380,
5637,
486,
931,
83058,
423,
486,
5637,
486,
931,
7,
19,
11,
220,
16,
11,
220,
15,
1106,
286,
1077,
5206,
13286,
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_remove_dim_error_dim_already_used() {
const VAR_NAME: &str = "var_1";
const DIM_NAME: &str = "dim_1";
const DIM_SIZE: usize = 10;
let mut data_set = DataSet::new();
assert_eq!(0, data_set.num_vars());
assert_eq!(false, data_set.has_var(VAR_NAME));
assert_eq!(0, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(false, data_set.has_dim(DIM_NAME));
assert_eq!(None, data_set.dim_size(DIM_NAME));
assert_eq!(None, data_set.dim_type(DIM_NAME));
// add a *fixed-size* dimension
data_set.add_fixed_dim(DIM_NAME, DIM_SIZE).unwrap();
assert_eq!(0, data_set.num_vars());
assert_eq!(false, data_set.has_var(VAR_NAME));
assert_eq!(1, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(true, data_set.has_dim(DIM_NAME));
assert_eq!(Some(DIM_SIZE), data_set.dim_size(DIM_NAME));
assert_eq!(Some(DimensionType::FixedSize), data_set.dim_type(DIM_NAME));
data_set.add_var_i8(VAR_NAME, &[DIM_NAME]).unwrap();
assert_eq!(1, data_set.num_vars());
assert_eq!(true, data_set.has_var(VAR_NAME));
assert_eq!(1, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(true, data_set.has_dim(DIM_NAME));
assert_eq!(Some(DIM_SIZE), data_set.dim_size(DIM_NAME));
assert_eq!(Some(DimensionType::FixedSize), data_set.dim_type(DIM_NAME));
// Try to remove the dimension while a variable it
assert_eq!(
InvalidDataSet::DimensionYetUsed{
var_names: vec![VAR_NAME.to_string()],
dim_name: DIM_NAME.to_string()
},
data_set.remove_dim(DIM_NAME).unwrap_err()
);
assert_eq!(1, data_set.num_vars());
assert_eq!(true, data_set.has_var(VAR_NAME));
assert_eq!(1, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(true, data_set.has_dim(DIM_NAME));
assert_eq!(Some(DIM_SIZE), data_set.dim_size(DIM_NAME));
assert_eq!(Some(DimensionType::FixedSize), data_set.dim_type(DIM_NAME));
// Remove the variable before
data_set.remove_var(VAR_NAME).unwrap();
assert_eq!(0, data_set.num_vars());
assert_eq!(false, data_set.has_var(VAR_NAME));
assert_eq!(1, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(true, data_set.has_dim(DIM_NAME));
assert_eq!(Some(DIM_SIZE), data_set.dim_size(DIM_NAME));
assert_eq!(Some(DimensionType::FixedSize), data_set.dim_type(DIM_NAME));
// And remove the dimension
data_set.remove_dim(DIM_NAME).unwrap();
assert_eq!(0, data_set.num_vars());
assert_eq!(false, data_set.has_var(VAR_NAME));
assert_eq!(0, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(false, data_set.has_dim(DIM_NAME));
assert_eq!(None, data_set.dim_size(DIM_NAME));
assert_eq!(None, data_set.dim_type(DIM_NAME));
} | rust_cleaned_test_functions.jsonl/40517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2032
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
10791,
4096,
10791,
80772,
27803,
368,
341,
262,
733,
43508,
4708,
25,
609,
495,
284,
330,
947,
62,
16,
876,
262,
733,
50859,
4708,
25,
609,
495,
284,
330,
12927,
62,
16,
876,
262,
733,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peek() {
init();
let input = "aname".chars().collect::<Vec<char>>();
let p = elm('a').peek() + tag("aname");
let result = p.parse_as_result(&input).unwrap();
log::debug!("result = {:?}", result);
assert_eq!(result.0, 'a');
assert_eq!(result.1, "aname");
} | rust_cleaned_test_functions.jsonl/16786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
29107,
368,
341,
262,
2930,
1428,
262,
1077,
1946,
284,
330,
93694,
3263,
19255,
1005,
17384,
27638,
10050,
21919,
37038,
262,
1077,
281,
284,
42205,
492,
64,
1823,
29107,
368,
488,
4772,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inner_hello() {
let client = Client::tracked(rocket()).unwrap();
let response = client.get("/").dispatch();
assert_eq!(response.into_string(), Some("Hello! Try /Rust%202018.".into()));
} | rust_cleaned_test_functions.jsonl/92417 | {
"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,
34345,
96724,
368,
341,
286,
1077,
2943,
284,
8423,
486,
58381,
7,
46790,
6011,
15454,
543,
286,
1077,
2033,
284,
2943,
670,
4283,
1827,
18274,
543,
286,
2060,
10714,
10297,
2322,
39860,
3904,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reference() {
let policy_name = "sgx_reference_test";
let references = r#"
{
"mrEnclave" : [
"2343545",
"5465767",
"79gfgfvf"
],
"mrSigner" : [
"323232",
"903232",
"1212"
],
"productId" : 1,
"svn" : 3
}
"#;
let result = set_reference(policy_name, references);
assert_eq!(result.unwrap(), ());
// You can view the content in the src/policy/test.rego file by yourself
} | rust_cleaned_test_functions.jsonl/84002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
25433,
368,
341,
286,
1077,
4842,
1269,
284,
330,
1991,
87,
25433,
4452,
876,
286,
1077,
15057,
284,
435,
2,
698,
286,
341,
310,
330,
20946,
1702,
40533,
1,
549,
2278,
394,
330,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str_invalid_value() {
let errval = Err(Error::Sys(Errno::EINVAL));
assert_eq!("NOSIGNAL".parse::<Signal>(), errval);
assert_eq!("kill".parse::<Signal>(), errval);
assert_eq!("9".parse::<Signal>(), errval);
} | rust_cleaned_test_functions.jsonl/10338 | {
"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,
5673,
2895,
31433,
3142,
368,
341,
286,
1077,
1848,
831,
284,
15495,
37396,
486,
32792,
7,
7747,
2152,
486,
35191,
1106,
286,
2060,
10714,
17223,
45,
3126,
17754,
3263,
6400,
27638,
26810,
39019,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_java_integers() {
let jvm = Jvm::new(&["-Xcheck:jni"]);
// Attach the current native thread to the JVM.
let jvm_attachment = JvmAttachment::new(jvm.jvm()).unwrap();
let jvm_integer_class = JvmClass::get_class(&jvm_attachment, "java/lang/Integer").unwrap();
let parse_int_method = JvmMethod::get_static_method(
&jvm_attachment,
&jvm_integer_class,
"parseInt",
"(Ljava/lang/String;)I",
)
.unwrap();
for value in -500..500 {
let jvm_string = JvmString::new(&jvm_attachment, value.to_string().as_str()).unwrap();
let jvm_int = JvmMethod::call_static_int_method(
&jvm_attachment,
&jvm_integer_class,
&parse_int_method,
vec![jvalue_from_jobject(jvm_string.jvm_ptr())].as_ptr(),
);
assert_eq!(jvm_int, value);
}
} | rust_cleaned_test_functions.jsonl/28534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77323,
4042,
67592,
368,
341,
262,
1077,
502,
7338,
284,
619,
7338,
486,
931,
2099,
1183,
12,
55,
2028,
57558,
7751,
55919,
262,
442,
48384,
279,
1482,
9867,
4516,
311,
279,
72379,
624,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_specified() {
// LinkLocalAddress::is_link_local all imply
// SpecifiedAddress::is_specified. Test that that's true for both IPv4
// and IPv6.
assert!(!Ipv6::UNSPECIFIED_ADDRESS.is_specified());
assert!(!Ipv4::UNSPECIFIED_ADDRESS.is_specified());
// Unicast
assert!(!Ipv6::UNSPECIFIED_ADDRESS.is_unicast());
let unicast = Ipv6Addr([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
assert!(unicast.is_unicast());
assert!(unicast.is_specified());
// Multicast
assert!(!Ipv4::UNSPECIFIED_ADDRESS.is_multicast());
assert!(!Ipv6::UNSPECIFIED_ADDRESS.is_multicast());
let multicast = Ipv4::MULTICAST_SUBNET.network;
assert!(multicast.is_multicast());
assert!(multicast.is_specified());
let multicast = Ipv6::MULTICAST_SUBNET.network;
assert!(multicast.is_multicast());
assert!(multicast.is_specified());
// Link-local
assert!(!Ipv4::UNSPECIFIED_ADDRESS.is_link_local());
assert!(!Ipv6::UNSPECIFIED_ADDRESS.is_link_local());
let link_local = Ipv4::LINK_LOCAL_UNICAST_SUBNET.network;
assert!(link_local.is_link_local());
assert!(link_local.is_specified());
let link_local = Ipv4::LINK_LOCAL_MULTICAST_SUBNET.network;
assert!(link_local.is_link_local());
assert!(link_local.is_specified());
let link_local = Ipv6::LINK_LOCAL_UNICAST_SUBNET.network;
assert!(link_local.is_link_local());
assert!(link_local.is_specified());
let mut link_local = Ipv6::MULTICAST_SUBNET.network;
link_local.0[1] = 0x02;
assert!(link_local.is_link_local());
assert!(link_local.is_specified());
assert!(Ipv6::LOOPBACK_ADDRESS.is_link_local());
} | rust_cleaned_test_functions.jsonl/31861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 914
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13594,
1870,
368,
341,
16885,
286,
442,
5948,
7319,
4286,
486,
285,
7233,
13564,
678,
33508,
198,
286,
442,
10956,
1870,
4286,
486,
285,
13594,
1870,
13,
3393,
429,
429,
594,
830,
369,
2176,
315... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kat() {
for kat in HKDF_KAT.iter() {
let prk = extract(&ByteSeq::from_hex(kat.salt), &ByteSeq::from_hex(kat.ikm));
assert_eq!(kat.prk, prk.to_hex());
let okm = expand(
&ByteSeq::from_seq(&prk),
&ByteSeq::from_hex(kat.info),
kat.l,
);
assert_eq!(kat.okm, okm.to_hex());
}
} | rust_cleaned_test_functions.jsonl/105090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
266,
368,
341,
262,
369,
44256,
304,
42217,
5262,
10102,
828,
19471,
368,
341,
286,
1077,
548,
74,
284,
8649,
2099,
7153,
20183,
486,
1499,
32655,
5969,
266,
514,
3145,
701,
609,
7153,
201... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_process_blockstore_with_dead_slot() {
solana_logger::setup();
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let ticks_per_slot = genesis_config.ticks_per_slot;
let (ledger_path, blockhash) = create_new_tmp_ledger_auto_delete!(&genesis_config);
debug!("ledger_path: {:?}", ledger_path);
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let slot1_blockhash =
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 1, 0, blockhash);
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 2, 1, slot1_blockhash);
blockstore.set_dead_slot(2).unwrap();
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 3, 1, slot1_blockhash);
let (bank_forks, ..) =
test_process_blockstore(&genesis_config, &blockstore, ProcessOptions::default());
assert_eq!(frozen_bank_slots(&bank_forks), vec![0, 1, 3]);
assert_eq!(bank_forks.working_bank().slot(), 3);
assert_eq!(
&bank_forks[3]
.parents()
.iter()
.map(|bank| bank.slot())
.collect::<Vec<_>>(),
&[1, 0]
);
verify_fork_infos(&bank_forks);
} | rust_cleaned_test_functions.jsonl/46796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
7113,
4314,
6615,
53427,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chacha_clone_streams() {
let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0];
let mut rng = ChaChaRng::from_seed(seed);
let mut clone = rng.clone();
for _ in 0..16 {
assert_eq!(rng.next_u64(), clone.next_u64());
}
rng.set_stream(51);
for _ in 0..7 {
assert!(rng.next_u32() != clone.next_u32());
}
clone.set_stream(51); // switch part way through block
for _ in 7..16 {
assert_eq!(rng.next_u32(), clone.next_u32());
}
} | rust_cleaned_test_functions.jsonl/113005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
51576,
54742,
74872,
368,
341,
286,
1077,
10320,
284,
508,
15,
11,
15,
11,
15,
11,
15,
11,
220,
16,
11,
15,
11,
15,
11,
15,
11,
220,
17,
11,
15,
11,
15,
11,
15,
11,
220,
18,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_document_cache_contains() {
let mut document_cache = DocumentCache::default();
let specifier = resolve_url("file:///a/b.ts").unwrap();
let missing_specifier = resolve_url("file:///a/c.ts").unwrap();
document_cache.open(
specifier.clone(),
1,
LanguageId::TypeScript,
Arc::new("console.log(\"Hello Deno\");\n".to_string()),
);
assert!(document_cache.contains_key(&specifier));
assert!(!document_cache.contains_key(&missing_specifier));
} | rust_cleaned_test_functions.jsonl/89759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26231,
11529,
63598,
368,
341,
262,
1077,
5206,
2197,
11529,
284,
11789,
8233,
486,
2258,
543,
262,
1077,
97616,
284,
8830,
2903,
445,
1192,
60896,
64,
3470,
21288,
1827,
15454,
543,
262,
1077,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_cookie_options_are_correct() {
let default_cookie = CookieOptions::default();
assert_eq!(default_cookie.cookie_name, "");
assert_eq!(default_cookie.cookie_value, None);
assert_eq!(default_cookie.max_age, None);
assert_eq!(default_cookie.domain, None);
assert_eq!(default_cookie.path, None);
assert_eq!(default_cookie.secure, false);
assert_eq!(default_cookie.http_only, false);
assert_eq!(default_cookie.same_site, None);
} | rust_cleaned_test_functions.jsonl/101592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
38663,
8743,
56855,
31550,
368,
341,
286,
1077,
1638,
38663,
284,
24356,
3798,
486,
2258,
543,
286,
2060,
10714,
10297,
2258,
38663,
39827,
1269,
11,
14498,
286,
2060,
10714,
10297,
2258,
3866... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_tuple() {
test_encode_ok(&[((5,), "[5]")]);
test_pretty_encode_ok(&[((5,), pretty_str!([5]))]);
test_encode_ok(&[((5, (6, "abc")), "[5,[6,\"abc\"]]")]);
test_pretty_encode_ok(&[((5, (6, "abc")), pretty_str!([5, [6, "abc"]]))]);
} | rust_cleaned_test_functions.jsonl/29822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
21773,
368,
341,
262,
1273,
11224,
19817,
2099,
46519,
20,
59564,
10545,
20,
87282,
10149,
262,
1273,
620,
21322,
11224,
19817,
2099,
46519,
20,
59564,
5020,
2895,
0,
2561,
20,
9365,
10149,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple() {
let technically_okay = "Da\u{0300}\u{0301}\u{0302}\u{0303}\u{0304}\u{0305}\u{0306}\u{0307}\u{0308}\u{0309}\u{030a}\u{030b}\u{030c}\u{030d}\u{030e}\u{030f}\u{0310}\u{0311}\u{0312}\u{0313}\u{0314}\u{0315}\u{0316}\u{0317}\u{0318}\u{0319}\u{031a}\u{031b}\u{031c}\u{031d}ngerzone";
assert_eq!(stream_safe(technically_okay), technically_okay);
let too_much = "Da\u{0300}\u{0301}\u{0302}\u{0303}\u{0304}\u{0305}\u{0306}\u{0307}\u{0308}\u{0309}\u{030a}\u{030b}\u{030c}\u{030d}\u{030e}\u{030f}\u{0310}\u{0311}\u{0312}\u{0313}\u{0314}\u{0315}\u{0316}\u{0317}\u{0318}\u{0319}\u{031a}\u{031b}\u{031c}\u{031d}\u{032e}ngerzone";
assert_ne!(stream_safe(too_much), too_much);
} | rust_cleaned_test_functions.jsonl/92064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
286,
1077,
31554,
19817,
352,
284,
330,
30416,
3770,
90,
15,
18,
15,
15,
11035,
84,
90,
15,
18,
15,
16,
11035,
84,
90,
15,
18,
15,
17,
11035,
84,
90,
15,
18,
15,
18,
110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_rate_limits() {
let scoping = Scoping {
organization_id: 42,
project_id: ProjectId::new(21),
project_key: ProjectKey::parse("a94ae32be2584e0bbd7a4cbb95971fee").unwrap(),
key_id: Some(17),
};
assert!(parse_rate_limits(&scoping, "").is_ok());
assert!(parse_rate_limits(&scoping, "invalid").is_ok());
assert!(parse_rate_limits(&scoping, ",,,").is_ok());
} | rust_cleaned_test_functions.jsonl/101157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
9246,
31820,
368,
341,
286,
1077,
1136,
33707,
284,
2463,
33707,
341,
310,
7321,
842,
25,
220,
19,
17,
345,
310,
2390,
842,
25,
5787,
764,
486,
931,
7,
17,
16,
1326,
310,
2390,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_save_restore_core_regs() {
let hv = hypervisor::new().unwrap();
let vm = hv.create_vm().unwrap();
let vcpu = vm.create_vcpu(0, None).unwrap();
let mut kvi: kvm_vcpu_init = kvm_vcpu_init::default();
vm.get_preferred_target(&mut kvi).unwrap();
// Must fail when vcpu is not initialized yet.
let mut state = kvm_regs::default();
let res = vcpu.core_registers(&mut state);
assert!(res.is_err());
assert_eq!(
format!("{}", res.unwrap_err()),
"Failed to get core register: Exec format error (os error 8)"
);
let res = vcpu.set_core_registers(&state);
assert!(res.is_err());
assert_eq!(
format!("{}", res.unwrap_err()),
"Failed to set core register: Exec format error (os error 8)"
);
vcpu.vcpu_init(&kvi).unwrap();
assert!(vcpu.core_registers(&mut state).is_ok());
assert_eq!(state.regs.pstate, 0x3C5);
assert!(vcpu.set_core_registers(&state).is_ok());
let off = offset__of!(user_pt_regs, pstate);
let pstate = vcpu
.get_reg(arm64_core_reg_id!(KVM_REG_SIZE_U64, off))
.expect("Failed to call kvm get one reg");
assert_eq!(state.regs.pstate, pstate);
} | rust_cleaned_test_functions.jsonl/38430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 653
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15376,
62677,
15467,
36910,
368,
341,
286,
1077,
22747,
284,
9751,
31396,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
22747,
2520,
39008,
1005,
15454,
543,
286,
1077,
348,
16475,
284,
10995,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_message() {
let mut message = RequestMessage::new_request(ApiVersionRequest {});
message
.get_mut_header()
.set_client_id("consumer-1".to_owned())
.set_correlation_id(5);
let mut out = vec![];
message.encode(&mut out, 0).expect("encode work");
let mut encode_bytes = Cursor::new(&out);
// decode back
let mut len: i32 = 0;
len.decode(&mut encode_bytes, 0).expect("cant decode len");
let res_msg_result: Result<RequestMessage<ApiVersionRequest>, IoError> =
Decoder::decode_from(&mut encode_bytes, 0);
match res_msg_result {
Ok(msg) => {
assert_eq!(msg.header.correlation_id(), 5);
}
Err(err) => {
assert!(false, "error: {}", err);
}
}
} | rust_cleaned_test_functions.jsonl/29671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
6462,
368,
341,
286,
1077,
5206,
1943,
284,
6145,
2052,
486,
931,
7893,
65830,
5637,
1900,
35311,
286,
1943,
198,
310,
659,
455,
29523,
8757,
741,
310,
659,
746,
8179,
842,
445,
46764,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_address() {
let add_str = "muta14e0lmgck835vm2dfm0w3ckv6svmez8fdgdl705";
let (_, data) = bech32::decode(add_str).unwrap();
let bytes = Bytes::from(Vec::<u8>::from_base32(&data).unwrap());
let address = Address::from_bytes(bytes).unwrap();
assert_eq!(add_str, &address.to_string());
} | rust_cleaned_test_functions.jsonl/58376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
368,
341,
286,
1077,
912,
2895,
284,
330,
6984,
64,
16,
19,
68,
15,
75,
12311,
377,
23,
18,
20,
7338,
17,
2940,
76,
15,
86,
18,
377,
85,
21,
3492,
82156,
23,
6902,
70,
8736,
22,
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_copy_within_panics_src_too_long() {
let mut bytes = *b"Hello, World!";
bytes.copy_within(10..14, 0);
} | rust_cleaned_test_functions.jsonl/9707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16096,
72385,
71099,
1211,
16274,
2346,
78,
17799,
368,
341,
262,
1077,
5206,
5820,
284,
353,
65,
1,
9707,
11,
4337,
26782,
1066,
262,
5820,
12232,
72385,
7,
16,
15,
496,
16,
19,
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 |
#[test]
fn test_encoding_simple_trie() {
for prefix in
[LEAF_PREFIX_MASK_NO_EXT, BRANCH_WITHOUT_MASK_NO_EXT, BRANCH_WITH_MASK_NO_EXT].iter()
{
for i in (0..1000).chain(NIBBLE_SIZE_BOUND_NO_EXT - 2..NIBBLE_SIZE_BOUND_NO_EXT + 2) {
let mut output = Vec::new();
encode_size_and_prefix(i, *prefix, &mut output);
let input = &mut &output[..];
let first = input.read_byte().unwrap();
assert_eq!(first & (0b11 << 6), *prefix);
let v = decode_size(first, input);
assert_eq!(Ok(std::cmp::min(i, NIBBLE_SIZE_BOUND_NO_EXT)), v);
}
}
} | rust_cleaned_test_functions.jsonl/96748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37613,
30015,
3547,
645,
368,
341,
197,
2023,
9252,
304,
198,
298,
197,
58,
867,
8276,
18519,
11720,
9100,
16066,
11,
18803,
41933,
23929,
3656,
11720,
9100,
16066,
11,
18803,
41933,
23929,
11720,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_single_base() {
let dna = b"A";
let a = encode(dna);
assert_eq!(a.len(), 2);
let dnb = b"T";
let b = encode(dnb);
assert_ne!(a, b)
} | rust_cleaned_test_functions.jsonl/89620 | {
"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,
19487,
7651,
368,
341,
286,
1077,
75334,
284,
293,
29133,
876,
286,
1077,
264,
284,
16164,
1500,
3376,
317,
286,
2060,
10714,
10297,
64,
19406,
1507,
220,
17,
317,
286,
1077,
294,
18080,
284,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_refund_tx_lock() {
set_test_mode(true);
global::set_local_chain_type(global::ChainTypes::Floonet);
swap::set_testing_cur_time(1567632152);
let kc_sell = keychain(1);
let ctx_sell = context_sell(&kc_sell);
let secondary_redeem_address = btc_address(&kc_sell);
let height = 100_000;
let mut api_sell = BtcSwapApi::new_test(
Arc::new(TestNodeClient::new(height)),
Arc::new(Mutex::new(TestBtcNodeClient::new(1))),
);
let mut swap = api_sell
.create_swap_offer(
&kc_sell,
&ctx_sell,
100 * GRIN_UNIT,
3_000_000,
Currency::Btc,
secondary_redeem_address,
true, // mwc should be publisher first
30,
3,
3600,
3600,
"file".to_string(),
"/tmp/del.me".to_string(),
None,
None,
)
.unwrap();
let mut fsm_sell = api_sell.get_fsm(&kc_sell, &swap);
let tx_state = api_sell
.request_tx_confirmations(&kc_sell, &mut swap)
.unwrap();
let message = match fsm_sell
.process(Input::Check, &mut swap, &ctx_sell, &tx_state)
.unwrap()
.action
.unwrap()
{
Action::SellerSendOfferMessage(message) => message,
_ => panic!("Unexpected action"),
};
// Simulate short refund lock time by passing height+4h
let kc_buy = keychain(2);
let ctx_buy = context_buy(&kc_buy);
let nc = TestNodeClient::new(height + 12 * 60);
let (id, offer, secondary_update) = message.unwrap_offer().unwrap();
let res = BuyApi::accept_swap_offer(&kc_buy, &ctx_buy, id, offer, secondary_update, &nc);
assert_eq!(
res.err().unwrap(),
ErrorKind::InvalidMessageData(
"Lock Slate inputs are not found at the chain".to_string()
)
); // Swap cannot be accepted
} | rust_cleaned_test_functions.jsonl/22238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
1241,
17805,
9818,
368,
341,
197,
8196,
4452,
7302,
3715,
317,
197,
18842,
486,
746,
13564,
30583,
1819,
31951,
486,
18837,
4173,
486,
37,
31335,
295,
317,
197,
71755,
486,
746,
70962,
18956... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_in_fn_name() {
assert!(in_fn_name("fn foo"));
assert!(in_fn_name(" fn foo"));
assert!(in_fn_name("fn "));
assert!(!in_fn_name("fn foo(b"));
assert!(!in_fn_name("fn"));
} | rust_cleaned_test_functions.jsonl/126178 | {
"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,
1243,
15246,
1269,
368,
341,
262,
2060,
10297,
258,
15246,
1269,
445,
8822,
15229,
4010,
262,
2060,
10297,
258,
15246,
1269,
445,
5168,
220,
15229,
4010,
262,
2060,
10297,
258,
15246,
1269,
445,
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_suggestion_different_case() {
assert_eq!(
suggestion_list("verylongstring".intern(), &["VERYLONGSTRING".intern()], 5),
vec!["VERYLONGSTRING".intern()]
);
assert_eq!(
suggestion_list("VERYLONGSTRING".intern(), &["verylongstring".intern()], 5),
vec!["verylongstring".intern()]
);
assert_eq!(
suggestion_list("VERYLONGSTRING".intern(), &["VeryLongString".intern()], 5),
vec!["VeryLongString".intern()]
);
} | rust_cleaned_test_functions.jsonl/83029 | {
"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,
643,
42116,
82741,
19096,
368,
341,
286,
2060,
10714,
33673,
310,
23776,
2019,
445,
1204,
4825,
917,
3263,
55444,
1507,
609,
1183,
30519,
51306,
16468,
3263,
55444,
79558,
220,
20,
1326,
310,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_access_point_with_iface_fails() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let test_values = test_setup();
let serve_fut = test_values.ap.serve_provider_requests(test_values.requests);
pin_mut!(serve_fut);
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
// Request a new controller.
let (controller, _) = request_controller(&test_values.provider);
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
// Set the StartAp response.
{
let iface_manager_fut = test_values.iface_manager.lock();
pin_mut!(iface_manager_fut);
let mut iface_manager = assert_variant!(
exec.run_until_stalled(&mut iface_manager_fut),
Poll::Ready(iface_manager) => { iface_manager }
);
iface_manager.start_response_succeeds = false;
}
// Issue StartAP request.
let network_id = fidl_policy::NetworkIdentifier {
ssid: b"test".to_vec(),
type_: fidl_policy::SecurityType::None,
};
let network_config = fidl_policy::NetworkConfig {
id: Some(network_id),
credential: None,
..fidl_policy::NetworkConfig::EMPTY
};
let connectivity_mode = fidl_policy::ConnectivityMode::LocalOnly;
let operating_band = fidl_policy::OperatingBand::Any;
let start_fut =
controller.start_access_point(network_config, connectivity_mode, operating_band);
pin_mut!(start_fut);
// Verify the start response is successful despite the AP's failure to start.
assert_variant!(exec.run_until_stalled(&mut serve_fut), Poll::Pending);
assert_variant!(
exec.run_until_stalled(&mut start_fut),
Poll::Ready(Ok(fidl_common::RequestStatus::Acknowledged))
);
} | rust_cleaned_test_functions.jsonl/59826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 910
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
12759,
6085,
6615,
67666,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bufs_vec_mut() {
let mut buf = BytesMut::from(&b"hello world"[..]);
let b1: &mut [u8] = &mut [];
let b2: &mut [u8] = &mut [];
let mut dst = [IoSliceMut::new(b1), IoSliceMut::new(b2)];
unsafe {
assert_eq!(1, buf.bytes_vectored_mut(&mut dst[..]));
}
} | rust_cleaned_test_functions.jsonl/51223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10363,
82,
13251,
29523,
368,
341,
262,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
2099,
65,
1,
14990,
1879,
36864,
496,
2558,
262,
1077,
293,
16,
25,
609,
6984,
508,
84,
23,
60,
284,
609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_subtraction_defined() {
fn _curve<E: Curve>() {
assert_operator_defined_for! {
assert_fn = assert_point_subtraction_defined,
lhs = {Point<E>, &Point<E>, Generator<E>},
rhs = {Point<E>, &Point<E>, Generator<E>},
}
}
} | rust_cleaned_test_functions.jsonl/101948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
5228,
26425,
52870,
368,
341,
286,
5168,
716,
50051,
23835,
25,
53677,
13555,
341,
310,
2060,
40594,
52870,
5478,
0,
341,
394,
2060,
15246,
284,
2060,
6085,
5228,
26425,
52870,
345,
394,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noto_sans() {
run_test(
&TEST_DATA,
"directwrite/good-noto-sans.or",
"noto/NotoSansOriya-Regular.ttf",
&[JOINER_GLYPH_INDEX],
206,
);
} | rust_cleaned_test_functions.jsonl/91209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
643,
596,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
19798,
4934,
4846,
1386,
29169,
78,
1331,
596,
24282,
756,
503,
330,
1921,
78,
20290,
2072,
46882,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tuple() {
test_serialize(());
test_serialize((123u64, Dummy));
test_serialize((123u64, 234u32, Dummy));
} | rust_cleaned_test_functions.jsonl/88746 | {
"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,
21773,
368,
341,
286,
1273,
88686,
7,
1423,
286,
1273,
88686,
1188,
16,
17,
18,
84,
21,
19,
11,
50567,
1106,
286,
1273,
88686,
1188,
16,
17,
18,
84,
21,
19,
11,
220,
17,
18,
19,
84,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nzint() {
let mut rng = crate::new();
// Any failures manifest as an infinite loop
for _ in 0..9000 {
let _: core::num::NonZeroU32 = Standard.sample(&mut rng);
}
} | rust_cleaned_test_functions.jsonl/85582 | {
"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,
1089,
89,
396,
368,
341,
10217,
5206,
28422,
284,
17717,
486,
931,
1428,
197,
322,
5765,
27850,
14455,
438,
458,
23809,
6337,
198,
2023,
716,
304,
220,
15,
496,
24,
15,
15,
15,
341,
197,
10217... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_lenient_release() {
let input = r#"{"release":42}"#;
let output = r#"{"release":"42"}"#;
let event = Annotated::new(Event {
release: Annotated::new("42".to_string().into()),
..Default::default()
});
assert_eq_dbg!(event, Annotated::from_json(input).unwrap());
assert_eq_dbg!(output, event.to_json().unwrap());
} | rust_cleaned_test_functions.jsonl/87707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
1167,
24577,
368,
341,
262,
1077,
1946,
284,
435,
55543,
4913,
22998,
788,
19,
17,
9863,
2,
280,
262,
1077,
2550,
284,
435,
55543,
4913,
22998,
3252,
19,
17,
9207,
57676,
280,
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_initialize_vote_account() {
let vote_account_pubkey = Pubkey::new_rand();
let mut vote_account = Account::new(100, VoteState::size_of(), &id());
let node_pubkey = Pubkey::new_rand();
//init should pass
let mut vote_account = KeyedAccount::new(&vote_account_pubkey, false, &mut vote_account);
let res = initialize_account(
&mut vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
);
assert_eq!(res, Ok(()));
// reinit should fail
let res = initialize_account(
&mut vote_account,
&VoteInit {
node_pubkey,
authorized_voter: vote_account_pubkey,
authorized_withdrawer: vote_account_pubkey,
commission: 0,
},
);
assert_eq!(res, Err(InstructionError::AccountAlreadyInitialized));
} | rust_cleaned_test_functions.jsonl/69959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
54360,
13500,
368,
341,
286,
1077,
6910,
13500,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
5206,
6910,
13500,
284,
8615,
486,
931,
7,
16,
15,
15,
11,
34034,
1397,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_formatting_indentation() {
let input = "
function() {
const veryLongIdentifierToCauseALineBreak = { veryLongKeyToCauseALineBreak: 'veryLongValueToCauseALineBreak' }
}
";
let range_start = TextSize::try_from(input.find("const").unwrap()).unwrap();
let range_end = TextSize::try_from(input.find('}').unwrap()).unwrap();
let tree = parse_script(input, 0);
let result = format_range(
FormatOptions {
indent_style: IndentStyle::Space(4),
..FormatOptions::default()
},
&tree.syntax(),
TextRange::new(range_start, range_end),
);
let result = result.expect("range formatting failed");
assert_eq!(result.range(), Some(TextRange::new(range_start, range_end)));
// the object expression is currently rounded down from an odd indentation level
assert_eq!(
result.as_code(),
"const veryLongIdentifierToCauseALineBreak = {\n veryLongKeyToCauseALineBreak: \"veryLongValueToCauseALineBreak\",\n "
);
} | rust_cleaned_test_functions.jsonl/786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
8955,
1280,
69045,
367,
368,
341,
286,
1077,
1946,
284,
6228,
1688,
368,
341,
260,
733,
1602,
6583,
8714,
1249,
60912,
969,
482,
22524,
284,
314,
1602,
6583,
1592,
1249,
60912,
969,
482,
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_is_media_filename() {
// test false cases
assert!(!is_media_filename(Path::new("/home/naftuli/Music/Directory")));
assert!(!is_media_filename(Path::new("/home/naftuli/Music/Directory/Folder.jpg")));
// test true cases
assert!(is_media_filename(Path::new("/home/naftuli/Music/01 - Track.mp3")));
assert!(is_media_filename(Path::new("/home/naftuli/Music/01 - Track.MP3")));
} | rust_cleaned_test_functions.jsonl/77635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
29173,
13323,
368,
341,
262,
442,
1273,
895,
5048,
198,
262,
2060,
0,
3471,
285,
29173,
13323,
33030,
486,
931,
4283,
5117,
14,
3376,
723,
23602,
10270,
11524,
14,
9310,
17621,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate() {
let mut buffer = [0; MTU];
let eh = ExtensionHeader::new();
let pos = eh.generate(&mut buffer);
assert_eq!(buffer[..pos], [0x01, 0xFF, 0xFF, ExtensionHeaderType::NoMore as u8]);
} | rust_cleaned_test_functions.jsonl/127867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
368,
341,
286,
1077,
5206,
4147,
284,
508,
15,
26,
19087,
52,
4821,
286,
1077,
35246,
284,
26473,
4047,
486,
931,
1428,
286,
1077,
1133,
284,
35246,
22019,
2099,
6984,
4147,
626,
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,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_i32() {
Int32Type::test(Encoding::PLAIN, TEST_SET_SIZE, -1);
Int32Type::test(Encoding::PLAIN_DICTIONARY, TEST_SET_SIZE, -1);
Int32Type::test(Encoding::DELTA_BINARY_PACKED, TEST_SET_SIZE, -1);
} | rust_cleaned_test_functions.jsonl/45121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
18,
17,
368,
341,
262,
1333,
18,
17,
929,
486,
1944,
85177,
486,
90889,
11,
13602,
8481,
4098,
11,
481,
16,
317,
262,
1333,
18,
17,
929,
486,
1944,
85177,
486,
90889,
44663,
3580,
8642,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_in_submodules_of_annotated_module() {
let mock = new_mock!(TestTrait);
given! {
<mock as TestTrait>::func |_| true then_return 12 always;
}
assert_eq!(mock.func(1), 12);
} | rust_cleaned_test_functions.jsonl/90516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
5228,
11525,
3575,
62,
3401,
657,
10750,
368,
341,
394,
1077,
7860,
284,
501,
34134,
10297,
2271,
49257,
626,
394,
2661,
0,
341,
503,
366,
16712,
438,
3393,
49257,
6831,
2830,
66091,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsafe_recovery_during_merge() {
let mut cluster = new_node_cluster(0, 3);
configure_for_merge(&mut cluster);
cluster.run();
cluster.must_put(b"k1", b"v1");
cluster.must_put(b"k3", b"v3");
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
let region = pd_client.get_region(b"k1").unwrap();
cluster.must_split(®ion, b"k2");
let left = pd_client.get_region(b"k1").unwrap();
let right = pd_client.get_region(b"k3").unwrap();
let left_on_store1 = find_peer(&left, 1).unwrap();
cluster.must_transfer_leader(left.get_id(), left_on_store1.clone());
let right_on_store1 = find_peer(&right, 1).unwrap();
cluster.must_transfer_leader(right.get_id(), right_on_store1.clone());
// in CatchUpLogs.
let append_filter = Box::new(
RegionPacketFilter::new(left.get_id(), 2)
.direction(Direction::Recv)
.msg_type(MessageType::MsgAppend),
);
// will only be replicated but not committed.
let commit_filter = Box::new(
RegionPacketFilter::new(right.get_id(), 1)
.direction(Direction::Recv)
.msg_type(MessageType::MsgAppendResponse),
);
cluster.sim.wl().add_recv_filter(1, append_filter);
cluster.sim.wl().add_recv_filter(1, commit_filter);
pd_client.merge_region(left.get_id(), right.get_id());
// Wait until the commit merge is proposed.
sleep_ms(300);
cluster.stop_node(1);
cluster.stop_node(3);
confirm_quorum_is_lost(&mut cluster, ®ion);
let report = cluster.must_enter_force_leader(right.get_id(), 2, vec![1, 3]);
assert_eq!(report.get_peer_reports().len(), 1);
let peer_report = &report.get_peer_reports()[0];
assert_eq!(peer_report.get_has_commit_merge(), false);
let region = peer_report.get_region_state().get_region();
assert_eq!(region.get_id(), right.get_id());
assert_eq!(region.get_start_key().len(), 0);
assert_eq!(region.get_end_key().len(), 0);
let to_be_removed: Vec<metapb::Peer> = right
.get_peers()
.iter()
.filter(|&peer| peer.get_store_id() != 2)
.cloned()
.collect();
let mut plan = pdpb::RecoveryPlan::default();
let mut demote = pdpb::DemoteFailedVoters::default();
demote.set_region_id(right.get_id());
demote.set_failed_voters(to_be_removed.into());
plan.mut_demotes().push(demote);
pd_client.must_set_unsafe_recovery_plan(2, plan);
cluster.must_send_store_heartbeat(2);
let mut demoted = true;
for _ in 0..10 {
let region = block_on(pd_client.get_region_by_id(right.get_id()))
.unwrap()
.unwrap();
demoted = true;
for peer in region.get_peers() {
if peer.get_id() != 2 && peer.get_role() == metapb::PeerRole::Voter {
demoted = false;
}
}
if demoted {
break;
}
sleep_ms(200);
}
assert!(demoted);
} | rust_cleaned_test_functions.jsonl/6013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18675,
91475,
814,
1677,
20888,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
20888,
2099,
6984,
10652,
626,
262,
10652,
7634,
1428,
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... | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.