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_reindent_multiline_lines_deeper() {
assert_eq!("\
if x {
y
} else {
z
}", reindent_multiline("\
if x {
y
} else {
z
}".into(), true, Some(8)));
} | rust_cleaned_test_functions.jsonl/6182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
32840,
26290,
26560,
18323,
2259,
10436,
368,
341,
286,
2060,
10714,
0,
4921,
198,
286,
421,
856,
341,
310,
379,
198,
286,
335,
770,
341,
310,
1147,
198,
286,
335,
497,
312,
32840,
26290,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_store_write_conflict() {
let store = AssertionStorage::default();
let key = b"key";
let primary = b"key";
let conflict_start_ts = 5;
let conflict_commit_ts = 10;
store.put_ok(key, primary, conflict_start_ts, conflict_commit_ts);
let start_ts2 = 6;
store.prewrite_conflict(
vec![Mutation::make_put(Key::from_raw(key), primary.to_vec())],
primary,
start_ts2,
key,
conflict_start_ts,
);
} | rust_cleaned_test_functions.jsonl/37891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
9165,
16059,
21242,
368,
341,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
1077,
1376,
284,
293,
1,
792,
876,
262,
1077,
6028,
284,
293,
1,
792,
876,
262,
1077,
12055,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_setup() {
let _ = thread::spawn(move || {
panic_hook::mute();
let _g = setup();
panic!("Poison!");
}).join();
let _g = setup();
} | rust_cleaned_test_functions.jsonl/4361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
368,
341,
262,
1077,
716,
284,
4516,
486,
46087,
34081,
1369,
341,
286,
21975,
32005,
486,
52214,
543,
286,
1077,
716,
70,
284,
6505,
543,
286,
21975,
17223,
32904,
3335,
11142,
262,
8533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_ldrsb_imm_w() {
assert_eq!(
decode_32(0xf9956000),
Instruction::LDRSB_imm {
params: Reg2FullParams {
rt: Reg::R6,
rn: Reg::R5,
imm32: 0,
index: true,
add: true,
wback: false,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
5428,
65,
71370,
1670,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
24,
24,
20,
21,
15,
15,
15,
1326,
286,
29051,
486,
43,
7687,
16680,
71370,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_qc_ancestry() {
let mut inserter = TreeInserter::default();
let block_store = inserter.block_store();
let genesis = block_store.root();
let block_a_1 = inserter.insert_block_with_qc(certificate_for_genesis(), &genesis, 1);
let block_a_2 = inserter.insert_block(&block_a_1, 2, None);
assert_eq!(
block_store.get_block(genesis.quorum_cert().certified_block().id()),
None
);
assert_eq!(
block_store.get_block(block_a_1.quorum_cert().certified_block().id()),
Some(genesis)
);
assert_eq!(
block_store.get_block(block_a_2.quorum_cert().certified_block().id()),
Some(block_a_1)
);
} | rust_cleaned_test_functions.jsonl/50983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
66,
62,
681,
4617,
368,
341,
262,
1077,
5206,
47325,
465,
284,
8942,
641,
90727,
486,
2258,
543,
262,
1077,
2504,
14809,
284,
47325,
465,
15697,
14809,
543,
262,
1077,
59366,
284,
2504,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kaku_top_wall_inside_gote() {
const KOMAKINDS:[KomaKind; 2] = [GFu,SFu];
let blank_banmen = Banmen([[Blank; 9]; 9]);
for k1 in &KOMAKINDS {
for k2 in &KOMAKINDS {
let mut wall_banmen = blank_banmen.clone();
for x in 1..8 {
wall_banmen.0[0][x] = *k1;
wall_banmen.0[1][x] = *k2;
}
for x in 3..6 {
let mut banmen = wall_banmen.clone();
banmen.0[2][x] = GKaku;
assert_eq!(legal_moves_from_banmen(&Teban::Gote,&banmen),
Rule::legal_moves_from_banmen(Teban::Gote,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
}
}
}
} | rust_cleaned_test_functions.jsonl/81117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
23557,
10426,
50731,
72860,
1889,
1272,
368,
972,
4777,
730,
1898,
11907,
5245,
50,
7259,
42,
7786,
10629,
26,
220,
17,
60,
284,
508,
36332,
84,
21172,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_chunks_nth() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let mut c = v.array_chunks::<2>();
assert_eq!(c.nth(1).unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[4, 5]);
let v2: &[i32] = &[0, 1, 2, 3, 4, 5, 6];
let mut c2 = v2.array_chunks::<3>();
assert_eq!(c2.nth(1).unwrap(), &[3, 4, 5]);
assert_eq!(c2.next(), None);
} | rust_cleaned_test_functions.jsonl/9644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
65470,
78342,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
272,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplies_clothes_left() {
let mut supplies = Supplies::new();
supplies.buy_clothes(200).unwrap();
assert_eq!(200, supplies.clothes_left());
} | rust_cleaned_test_functions.jsonl/28653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
666,
385,
6375,
9579,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
16720,
63871,
666,
385,
6375,
7,
17,
15,
15,
568,
15454,
543,
286,
2060,
10714,
10297,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_kary_and() -> Result<(), SynthesisError> {
// test different numbers of operands
for i in 1..15 {
// with every possible assignment for them
for mut b in 0..(1 << i) {
let cs = ConstraintSystem::<Fr>::new_ref();
let mut expected = true;
let mut bits = vec![];
for _ in 0..i {
expected &= b & 1 == 1;
bits.push(Boolean::new_witness(cs.clone(), || Ok(b & 1 == 1))?);
b >>= 1;
}
let r = Boolean::kary_and(&bits)?;
assert!(cs.is_satisfied().unwrap());
if let Boolean::Is(ref r) = r {
assert_eq!(r.value()?, expected);
}
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/3481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
658,
8378,
368,
1464,
5714,
68843,
23153,
13189,
1454,
29,
341,
286,
442,
1273,
2155,
5109,
315,
54510,
198,
286,
369,
600,
304,
220,
16,
496,
16,
20,
341,
310,
442,
448,
1449,
3204,
163... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_trip_turn() {
let mut trip = Trip::new();
trip.turn(300);
assert!(trip.miles_traveled() > 200);
assert!(trip.miles_traveled() < 300);
} | rust_cleaned_test_functions.jsonl/44525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63883,
37274,
368,
341,
286,
1077,
5206,
8411,
284,
26754,
486,
931,
543,
286,
8411,
45634,
7,
18,
15,
15,
317,
286,
2060,
10297,
32981,
744,
3658,
3547,
28185,
368,
861,
220,
17,
15,
15,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pool_fida_ray() {
pool_actions::run_test(
"RDM.FIDA-RAY-V4",
vec![
utils::Swap {
protocol: "RDM",
from_token: "SOL",
to_token: "RAY",
amount: 0.21111111,
},
utils::Swap {
protocol: "RDM",
from_token: "RAY",
to_token: "FIDA",
amount: -0.5,
},
],
vec![utils::Swap {
protocol: "RDM",
from_token: "FIDA",
to_token: "RAY",
amount: 0.0,
}],
false,
);
} | rust_cleaned_test_functions.jsonl/120677 | {
"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,
15709,
761,
4744,
72690,
368,
341,
262,
7314,
25368,
486,
6108,
4452,
1006,
286,
330,
49,
8395,
991,
51171,
10911,
3022,
19625,
19,
756,
286,
7486,
90515,
310,
12439,
486,
46179,
341,
394,
11507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_positioner() {
let input = ["a".to_string(), "b".to_string(), "c".to_string()];
let mut parser = crate::parser::range::take(2);
let result = parser.parse(Stream::new(&input[..]));
assert_eq!(
result,
Ok((
&["a".to_string(), "b".to_string()][..],
Stream::with_positioner(
&["c".to_string()][..],
IndexPositioner::new_with_position(2)
)
))
);
} | rust_cleaned_test_functions.jsonl/122618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
9661,
261,
368,
341,
286,
1077,
1946,
284,
4383,
64,
3263,
983,
3904,
1507,
330,
65,
3263,
983,
3904,
1507,
330,
66,
3263,
983,
3904,
33800,
286,
1077,
5206,
6729,
284,
17717,
486,
9657,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compose_path() {
assert_eq!(compose_path("/home", ""), Some("/home".to_string()));
assert_eq!(
compose_path("/path/to", "foo=bar"),
Some("/path/to?foo=bar".to_string())
);
assert_eq!(
compose_path("/events", "from=2019&to=2021"),
Some("/events?from=2019&to=2021".to_string())
);
} | rust_cleaned_test_functions.jsonl/92315 | {
"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,
2965,
2900,
2638,
368,
341,
286,
2060,
10714,
10297,
52706,
2638,
4283,
5117,
497,
77130,
4329,
4283,
5117,
3263,
983,
3904,
7392,
286,
2060,
10714,
33673,
310,
30335,
2638,
4283,
2343,
32429,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solve() {
let mut sudoku = create_sudoku(TEST_VALUES);
assert_eq!(sudoku.solve(), SolveResult::Solved);
let mut impossible = create_sudoku(IMPOSSIBLE_VALUES);
assert_eq!(impossible.solve(), SolveResult::Unsolvable);
} | rust_cleaned_test_functions.jsonl/58574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86246,
368,
341,
286,
1077,
5206,
90809,
284,
1855,
643,
68302,
50320,
58662,
317,
286,
2060,
10714,
10297,
82,
68302,
69102,
1507,
63284,
2077,
486,
50,
8731,
626,
286,
1077,
5206,
11997,
284,
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_header() {
let header = super::header_from_level(3);
assert_eq!(
((usize::from(header[0]) * 256) + usize::from(header[1])) % 31,
0
);
} | rust_cleaned_test_functions.jsonl/60124 | {
"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,
8757,
368,
341,
310,
1077,
4247,
284,
2256,
486,
2708,
5673,
8274,
7,
18,
317,
310,
2060,
10714,
33673,
394,
1781,
51878,
486,
1499,
25534,
58,
15,
2467,
353,
220,
17,
20,
21,
8,
488,
22301,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ziplist() {
struct TestRdbHandler {
list: Vec<String>,
}
impl EventHandler for TestRdbHandler {
fn handle(&mut self, data: Event) {
match data {
Event::RDB(rdb) => match rdb {
Object::List(list) => {
assert_eq!("ziplist_compresses_easily", String::from_utf8_lossy(list.key));
for val in list.values {
let value = String::from_utf8_lossy(val).to_string();
self.list.push(value);
}
}
Object::EOR => {
assert_eq!(6, self.list.len());
assert_eq!("aaaaaa", self.list.get(0).unwrap());
assert_eq!("aaaaaaaaaaaa", self.list.get(1).unwrap());
assert_eq!("aaaaaaaaaaaaaaaaaa", self.list.get(2).unwrap());
assert_eq!("aaaaaaaaaaaaaaaaaaaaaaaa", self.list.get(3).unwrap());
assert_eq!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", self.list.get(4).unwrap());
assert_eq!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", self.list.get(5).unwrap());
}
_ => {}
},
Event::AOF(_) => {}
}
}
}
start_redis_test(
"ziplist_that_compresses_easily.rdb",
10015,
Rc::new(RefCell::new(TestRdbHandler { list: vec![] })),
);
} | rust_cleaned_test_functions.jsonl/93099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 902
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
10352,
380,
368,
341,
262,
2036,
3393,
49,
1999,
3050,
341,
286,
1140,
25,
11312,
3464,
12520,
262,
555,
262,
11605,
31957,
369,
3393,
49,
1999,
3050,
341,
286,
5168,
3705,
2099,
6984,
656... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialization_cycle() -> TestResult {
let mut hasher = XxHash32::with_seed(0);
hasher.write(b"Hello, world!\0");
hasher.finish();
let serialized = serde_json::to_string(&hasher)?;
let unserialized: XxHash32 = serde_json::from_str(&serialized)?;
assert_eq!(hasher, unserialized);
Ok(())
} | rust_cleaned_test_functions.jsonl/126798 | {
"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,
25602,
2022,
39079,
368,
1464,
3393,
2077,
341,
286,
1077,
5206,
90819,
284,
1599,
87,
6370,
18,
17,
486,
4197,
33809,
7,
15,
317,
286,
90819,
3836,
1883,
1,
9707,
11,
1879,
14771,
15,
797,
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... | 3 |
#[test]
fn test_underscore_in_search() {
let parsed = parse_resolv_conf("search Speedport_000").expect("failed");
let mut cfg = empty_config();
cfg.add_search(Name::from_str_relaxed("Speedport_000.").unwrap());
assert_eq!(cfg.search(), parsed.0.search());
assert_eq!(ResolverOpts::default(), parsed.1);
} | rust_cleaned_test_functions.jsonl/39726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
53933,
1243,
10716,
368,
341,
286,
1077,
15676,
284,
4715,
4918,
35315,
16059,
445,
1836,
15181,
403,
62,
15,
15,
15,
1827,
17119,
445,
16091,
797,
286,
1077,
5206,
13286,
284,
4287,
5332,
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_match_char_with_surrounding_properties_with_2_vertically_aligned_underscore() {
let u = CellGrid::u();
let y = CellGrid::y();
let mut fragments = vec![line(u, y)];
fragments.sort();
let top_left = &Property::empty();
let top = &Property::from_char('_').unwrap();
let top_right = &Property::empty();
let left = &Property::empty();
let right = &Property::empty();
let bottom_left = &Property::empty();
let bottom = &Property::empty();
let bottom_right = &Property::empty();
let ch = PropertyBuffer::match_char_with_surrounding_properties(
&Settings::default(),
&fragments,
top_left,
top,
top_right,
left,
right,
bottom_left,
bottom,
bottom_right,
);
println!("ch: {:?}", ch);
assert_eq!(ch, Some('_'));
} | rust_cleaned_test_functions.jsonl/33918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
9232,
6615,
49946,
1049,
287,
25158,
6615,
62,
17,
54000,
2673,
66385,
62,
53933,
368,
341,
286,
1077,
575,
284,
13972,
3543,
486,
84,
543,
286,
1077,
379,
284,
13972,
3543,
486,
88,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_mask() {
let config = MaskConfig {
group_type: GroupType::Prime,
data_type: DataType::F32,
bound_type: BoundType::B0,
model_type: ModelType::M3,
};
let seed = MaskSeed::generate();
let mask = seed.derive_mask(10, config.into());
assert_eq!(mask.vect.data.len(), 10);
assert!(mask
.vect
.data
.iter()
.all(|integer| integer < &config.order()));
} | rust_cleaned_test_functions.jsonl/39314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
9999,
368,
341,
286,
1077,
2193,
284,
19924,
2648,
341,
310,
1874,
1819,
25,
5737,
929,
486,
32306,
345,
310,
821,
1819,
25,
33172,
486,
37,
18,
17,
345,
310,
6822,
1819,
25,
37176... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_increasing() {
assert!(is_increasing_and_has_eq_didgits(112345));
assert!(is_increasing_and_has_eq_didgits(11344));
assert_eq!(false, is_increasing_and_has_eq_didgits(10345));
assert_eq!(false, is_increasing_and_has_eq_didgits(12345));
} | rust_cleaned_test_functions.jsonl/82201 | {
"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,
6892,
1243,
75462,
368,
341,
286,
2060,
10297,
285,
1243,
75462,
8378,
21778,
10714,
814,
307,
70,
1199,
7,
16,
16,
17,
18,
19,
20,
1106,
286,
2060,
10297,
285,
1243,
75462,
8378,
21778,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_offline_subscribe() {
let id = "id1".to_string();
let client_id = ClientId::from(id);
let mut session = Session::new_offline(SessionState::new(client_id));
let subscribe = proto::Subscribe {
packet_identifier: proto::PacketIdentifier::new(1).unwrap(),
subscribe_to: vec![proto::SubscribeTo {
topic_filter: "topic/new".to_string(),
qos: proto::QoS::AtMostOnce,
}],
};
let err = session.subscribe(subscribe).unwrap_err();
assert_eq!(ErrorKind::SessionOffline, *err.kind());
} | rust_cleaned_test_functions.jsonl/51752 | {
"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,
13651,
1056,
88935,
368,
341,
286,
1077,
877,
284,
330,
307,
16,
3263,
983,
3904,
543,
286,
1077,
2943,
842,
284,
8423,
764,
486,
1499,
3724,
317,
286,
1077,
5206,
3797,
284,
9164,
486,
931,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_antijoin_happy_path() {
use super::CaptureSink;
use crate::ground::Variable;
use crate::matching::plan::Source;
use crate::unification::Element;
use differential_dataflow::input::InputSession;
use std::collections::HashSet;
let x = MetaVar::new("x");
let y = MetaVar::new("y");
let p1 = Plan::filter(
Source::new("foo", 2),
&[Element::Reference(x.clone()), Element::Reference(y.clone())],
)
.expect("ok");
let p2 = Plan::filter(Source::new("bar", 1), &[Element::Reference(x.clone())]).expect("ok");
let antijoin = Plan::antijoin(p1, &[x.clone()], vec![p2]).expect("ok");
let sink = CaptureSink::new(antijoin.result().into());
let writer = sink.writer();
timely::execute::example(move |scope| {
let mut foo = InputSession::new();
let mut bar = InputSession::new();
let sources = vec![
(
"foo".into(),
FactCollection::new(2, foo.to_collection(scope)),
),
(
"bar".into(),
FactCollection::new(1, bar.to_collection(scope)),
),
]
.into_iter()
.collect::<std::collections::HashMap<String, _>>();
let captures =
lower_matching_plan(scope, &mut default_injector, &antijoin, &sources).expect("ok");
writer.attach(&captures).expect("ok");
foo.advance_to(0);
for (x, y) in &[(1, 2), (3, 4), (5, 2), (6, 7)] {
foo.insert([Variable::new(*x), Variable::new(*y)].into());
}
foo.flush();
foo.advance_to(1);
for x in &[1, 5] {
bar.insert([Variable::new(*x)].into());
}
bar.flush();
bar.advance_to(1);
});
assert_eq!(
sink.values::<HashSet<_>>(),
[(3, 4), (6, 7)]
.iter()
.cloned()
.map(|(x, y)| [Variable::new(x), Variable::new(y)].into())
.collect()
);
} | rust_cleaned_test_functions.jsonl/31143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 986
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62460,
3172,
1961,
1523,
11144,
2638,
368,
341,
262,
990,
2256,
486,
27429,
45094,
280,
262,
990,
17717,
486,
1951,
486,
7827,
280,
262,
990,
17717,
486,
89043,
486,
10393,
486,
3608,
280,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_rigid_multiply() {
let translation = Vector3D::new(12.1, 17.8, -5.5);
let rotation = Rotation3D::unit_quaternion(0.5, -7.8, 2.2, 4.3);
let translation2 = Vector3D::new(9.3, -3.9, 1.1);
let rotation2 = Rotation3D::unit_quaternion(0.1, 0.2, 0.3, -0.4);
let rigid = RigidTransform3D::new(rotation, translation);
let rigid2 = RigidTransform3D::new(rotation2, translation2);
assert!(rigid
.then(&rigid2)
.to_transform()
.approx_eq(&rigid.to_transform().then(&rigid2.to_transform())));
assert!(rigid2
.then(&rigid)
.to_transform()
.approx_eq(&rigid2.to_transform().then(&rigid.to_transform())));
} | rust_cleaned_test_functions.jsonl/43231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
20926,
93054,
368,
341,
286,
1077,
14468,
284,
4196,
18,
35,
486,
931,
7,
16,
17,
13,
16,
11,
220,
16,
22,
13,
23,
11,
481,
20,
13,
20,
317,
286,
1077,
12695,
284,
47528,
18,
35,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full() {
for option in ["--version", "--help"] {
let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();
new_ucmd!()
.arg(option)
.set_stdout(dev_full)
.fails()
.stderr_contains("No space left on device");
}
} | rust_cleaned_test_functions.jsonl/110188 | {
"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,
16372,
368,
341,
262,
369,
2999,
304,
4383,
313,
4366,
497,
14482,
8653,
1341,
341,
286,
1077,
3483,
16372,
284,
5264,
3798,
486,
931,
1005,
4934,
3715,
568,
2508,
4283,
3583,
62975,
1827,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_heartbeat_unknown_participant() {
let mut protocol = Protocol::new(get_default_fl_settings());
let client_id = ClientId::new();
let resp = protocol.heartbeat(client_id, ClientState::Unknown);
assert_eq!(HeartBeatResponse::Reject, resp);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
72471,
57507,
10495,
21757,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
1423,
286,
1077,
2943,
842,
284,
8423,
764,
486,
931,
1428,
286,
1077,
9039,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_response_first_word() {
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![
"me".to_string(),
"8BITMIME".to_string(),
"SIZE 42".to_string(),
],
)
.first_word(),
Some("me")
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![
"me mo".to_string(),
"8BITMIME".to_string(),
"SIZE 42".to_string(),
],
)
.first_word(),
Some("me")
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![],
)
.first_word(),
None
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![" ".to_string()],
)
.first_word(),
None
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec![" ".to_string()],
)
.first_word(),
None
);
assert_eq!(
Response::new(
Code {
severity: Severity::TransientNegativeCompletion,
category: Category::MailSystem,
detail: Detail::One,
},
vec!["".to_string()],
)
.first_word(),
None
);
} | rust_cleaned_test_functions.jsonl/10044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
12978,
13533,
368,
341,
286,
2060,
10714,
33673,
310,
5949,
486,
931,
1006,
394,
6119,
341,
503,
29920,
25,
51139,
486,
48183,
38489,
33190,
345,
503,
5582,
25,
10054,
486,
16702,
2320,
345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_overlapping_intersects() {
let mut e1: EnumSet<Foo> = EnumSet::new();
e1.insert(A);
let mut e2: EnumSet<Foo> = EnumSet::new();
e2.insert(A);
e2.insert(B);
assert!(!e1.is_disjoint(&e2));
} | rust_cleaned_test_functions.jsonl/2754 | {
"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,
15431,
90619,
15318,
54429,
368,
341,
286,
1077,
5206,
384,
16,
25,
14086,
1649,
30499,
2624,
29,
284,
14086,
1649,
486,
931,
543,
286,
384,
16,
7030,
4346,
626,
286,
1077,
5206,
384,
17,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get() {
assert_eq!(
get_irregular().len(),
IRREGULAR_INFLECTIONS.read().unwrap().len()
);
assert_eq!(get_plural().len(), PLURAL_INFLECTIONS.read().unwrap().len());
assert_eq!(
get_uncountable().len(),
UNCOUNTABLE_INFLECTIONS.read().unwrap().len()
);
assert_eq!(
get_singular().len(),
SINGULAR_INFLECTIONS.read().unwrap().len()
);
} | rust_cleaned_test_functions.jsonl/42795 | {
"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,
3062,
368,
341,
286,
2060,
10714,
33673,
310,
633,
51433,
22308,
1005,
2892,
3148,
310,
16248,
12173,
7081,
65487,
28017,
50,
4125,
1005,
15454,
1005,
2892,
741,
286,
1439,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metadata_column_orders_parse() {
let mut fields = vec![
Arc::new(
SchemaType::primitive_type_builder("col1", Type::INT32)
.build()
.unwrap(),
),
Arc::new(
SchemaType::primitive_type_builder("col2", Type::FLOAT)
.build()
.unwrap(),
),
];
let schema = SchemaType::group_type_builder("schema")
.with_fields(&mut fields)
.build()
.unwrap();
let schema_descr = SchemaDescriptor::new(Arc::new(schema));
let t_column_orders = Some(vec![
TColumnOrder::TYPEORDER(TypeDefinedOrder::new()),
TColumnOrder::TYPEORDER(TypeDefinedOrder::new()),
]);
assert_eq!(
parse_column_orders(t_column_orders, &schema_descr),
Some(vec![
ColumnOrder::TYPE_DEFINED_ORDER(SortOrder::SIGNED),
ColumnOrder::TYPE_DEFINED_ORDER(SortOrder::SIGNED)
])
);
// Test when no column orders are defined.
assert_eq!(parse_column_orders(None, &schema_descr), None);
} | rust_cleaned_test_functions.jsonl/38495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 672
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
8744,
37129,
21039,
368,
341,
1789,
286,
1077,
5206,
5043,
284,
7486,
90515,
310,
19689,
486,
931,
1006,
394,
12539,
929,
486,
73448,
1819,
28532,
445,
2074,
16,
497,
3990,
486,
3221,
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_compares_float_equality() {
assert_eq!(
Variable::Number(Number::from_f64(1.0).unwrap()),
Variable::Number(Number::from_f64(1.0).unwrap())
);
assert_eq!(
Variable::Number(Number::from_f64(0.0).unwrap()),
Variable::Number(Number::from_f64(0.0).unwrap())
);
assert_ne!(
Variable::Number(Number::from_f64(0.00001).unwrap()),
Variable::Number(Number::from_f64(0.0).unwrap())
);
assert_eq!(
Variable::Number(Number::from_f64(999.999).unwrap()),
Variable::Number(Number::from_f64(999.999).unwrap())
);
assert_eq!(
Variable::Number(Number::from_f64(1.000000000001).unwrap()),
Variable::Number(Number::from_f64(1.000000000001).unwrap())
);
assert_eq!(
Variable::Number(Number::from_f64(0.7100000000000002).unwrap()),
Variable::Number(Number::from_f64(0.71).unwrap())
);
assert_eq!(
Variable::Number(Number::from_f64(0.0000000000000002).unwrap()),
Variable::Number(Number::from_f64(0.0000000000000002).unwrap())
);
assert_ne!(
Variable::Number(Number::from_f64(0.0000000000000002).unwrap()),
Variable::Number(Number::from_f64(0.0000000000000003).unwrap())
);
} | rust_cleaned_test_functions.jsonl/108395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
5403,
17586,
2204,
10473,
368,
341,
286,
2060,
10714,
33673,
310,
12407,
486,
2833,
42999,
486,
1499,
761,
21,
19,
7,
16,
13,
15,
568,
15454,
14702,
310,
12407,
486,
2833,
42999,
486,
149... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_ns_query_response() {
let cache = DnsLru::new(1, dns_lru::TtlConfig::default());
let mut message = ns_message().unwrap();
message.add_answer(Record::from_rdata(
Name::from_str("www.example.com.").unwrap(),
86400,
RData::CNAME(Name::from_str("actual.example.com.").unwrap()),
));
message.insert_additionals(vec![
Record::from_rdata(
Name::from_str("actual.example.com.").unwrap(),
86400,
RData::A(Ipv4Addr::new(127, 0, 0, 1)),
),
Record::from_rdata(
Name::from_str("actual.example.com.").unwrap(),
86400,
RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)),
),
]);
let client = mock(vec![error(), Ok(message)]);
let client = CachingClient::with_cache(cache, client, false);
let ips = block_on(CachingClient::inner_lookup(
Query::query(Name::from_str("www.example.com.").unwrap(), RecordType::NS),
DnsRequestOptions::default(),
client,
vec![],
))
.expect("lookup failed");
assert_eq!(
ips.iter().cloned().collect::<Vec<_>>(),
vec![
RData::NS(Name::from_str("www.example.com.").unwrap()),
RData::A(Ipv4Addr::new(127, 0, 0, 1)),
RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)),
]
);
} | rust_cleaned_test_functions.jsonl/39913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 854
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
34728,
5738,
9655,
368,
341,
286,
1077,
6500,
284,
422,
4412,
43,
2672,
486,
931,
7,
16,
11,
44077,
907,
2672,
486,
51,
11544,
2648,
486,
2258,
5231,
286,
1077,
5206,
1943,
284,
12268,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_genotype_field_values_with_int16_array_values() -> io::Result<()> {
let data = [
0x22,
0x05, 0x00, 0x08, 0x00,
0x0d, 0x00, 0x00, 0x80,
0x15, 0x00, 0x01, 0x80,
0x00, 0x80, 0x01, 0x80, // None
];
let mut reader = &data[..];
let actual = read_genotype_field_values(&mut reader, 4)?;
let expected = vec![
Some(Value::IntegerArray(vec![Some(5), Some(8)])),
Some(Value::IntegerArray(vec![Some(13), None])),
Some(Value::IntegerArray(vec![Some(21)])),
None,
];
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/52813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
16322,
4156,
5013,
9146,
6615,
4042,
16,
21,
3858,
9146,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
17,
17,
11,
715,
310,
220,
15,
87,
15,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_u8() {
let mut vec = vec![];
for i in ::std::u8::MIN..::std::u8::MAX {
vec.push(i);
}
check_round_trip(vec);
} | rust_cleaned_test_functions.jsonl/24181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
23,
368,
341,
262,
1077,
5206,
7486,
284,
7486,
0,
15078,
262,
369,
600,
304,
3504,
1834,
486,
84,
23,
486,
16413,
496,
486,
1834,
486,
84,
23,
486,
10586,
341,
286,
7486,
2552,
1956,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_metadata_convenience_builder() {
use super::Metadata;
let target = "myApp";
let metadata_test = Metadata::builder()
.level(Level::Debug)
.target(target)
.build();
assert_eq!(metadata_test.level(), Level::Debug);
assert_eq!(metadata_test.target(), "myApp");
} | rust_cleaned_test_functions.jsonl/71738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
3382,
39547,
28532,
368,
341,
286,
990,
2256,
486,
14610,
280,
286,
1077,
2169,
284,
330,
2408,
2164,
876,
286,
1077,
11160,
4452,
284,
33589,
486,
17850,
741,
310,
659,
3294,
30263,
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_symbol_relocation() {
let prog = &mut [
0xbf, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r1 = r10
0xb7, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // r2 = 1
0x85, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, // call -1
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r0 = 0
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exit
];
LittleEndian::write_u32(&mut prog[20..24], ebpf::hash_symbol_name(b"log"));
let mut mem = [72, 101, 108, 108, 111, 0];
let mut vm = EbpfVm::new(None).unwrap();
vm.register_helper_ex("log", bpf_helper_string, None).unwrap();
vm.set_program(prog).unwrap();
vm.execute_program(&mut mem, &[], &[]).unwrap();
} | rust_cleaned_test_functions.jsonl/15531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21179,
1288,
2527,
368,
341,
286,
1077,
29271,
284,
609,
6984,
2278,
286,
220,
15,
47659,
11,
220,
15,
14673,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotation_inverse_vector() {
let angle = Degrees(135.0);
let rotation = Rotation2::from_angle(angle);
let vector = Vector2::new(-1_f64, 1_f64);
let expected = Vector2::new(f64::sqrt(2_f64), 0_f64);
let rotation_inv = rotation.inverse();
let result = rotation_inv.rotate_vector(&vector);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44813,
63333,
12247,
368,
341,
286,
1077,
9210,
284,
92901,
7,
16,
18,
20,
13,
15,
317,
286,
1077,
12695,
284,
47528,
17,
486,
1499,
21727,
29633,
317,
286,
1077,
4621,
284,
4196,
17,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_self() {
check(
r#"
struct Thing { x: u32 }
impl Thing {
fn new() -> Self { Self$0 { x: 0 } }
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
struct Thing
```
"#]],
);
check(
r#"
struct Thing { x: u32 }
impl Thing {
fn new() -> Self$0 { Self { x: 0 } }
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
struct Thing
```
"#]],
);
check(
r#"
enum Thing { A }
impl Thing {
pub fn new() -> Self$0 { Thing::A }
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
enum Thing
```
"#]],
);
check(
r#"
enum Thing { A }
impl Thing {
pub fn thing(a: Self$0) {}
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
enum Thing
```
"#]],
);
} | rust_cleaned_test_functions.jsonl/66638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 979
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
25637,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
37200,
314,
856,
25,
575,
18,
17,
456,
6383,
37200,
341,
262,
5168,
501,
368,
1464,
10115,
314,
10115,
3,
15,
314,
856,
25,
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_content_new_with_trans() {
let mut trans = Vec::<SignedTransaction>::new();
for _ in 0..3 {
trans.push(generate_random_signed_transaction());
}
let _content = Content::new_with_trans(&trans);
} | rust_cleaned_test_functions.jsonl/18471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
5921,
6615,
7965,
368,
341,
286,
1077,
5206,
1356,
284,
11312,
27638,
49312,
8070,
6831,
931,
543,
286,
369,
716,
304,
220,
15,
496,
18,
341,
310,
1356,
2552,
3268,
13220,
22644,
55617,
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
] | 2 |
#[test]
fn test_ex() {
let input = r#"forward 5
down 5
forward 8
up 3
down 8
forward 2"#;
let (res1, res2) = Solver::run_on(input);
assert_eq!(res1, 150);
assert_eq!(res2, 900);
} | rust_cleaned_test_functions.jsonl/77553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
368,
341,
286,
1077,
1946,
284,
435,
55543,
13435,
220,
20,
198,
5180,
1495,
220,
20,
198,
5180,
4637,
220,
23,
198,
5180,
705,
220,
18,
198,
5180,
1495,
220,
23,
198,
5180,
4637,
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_encoding_constructor_as_array() {
use validators::constructor;
let code = Vec::new();
let first = [0x11u8; 20];
let second = [0x22u8; 20];
let encoded_from_vec = constructor(code.clone(), vec![first.clone(), second.clone()]);
let encoded_from_vec_iter = constructor(code.clone(), vec![first.clone(), second.clone()].into_iter());
let encoded_from_vec_wrapped = constructor(code.clone(), vec![Wrapper(first), Wrapper(second)]);
let expected = "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000011111111111111111111111111111111111111110000000000000000000000002222222222222222222222222222222222222222".to_owned();
assert_eq!(expected, encoded_from_vec.to_hex::<String>());
assert_eq!(expected, encoded_from_vec_iter.to_hex::<String>());
assert_eq!(expected, encoded_from_vec_wrapped.to_hex::<String>());
} | rust_cleaned_test_functions.jsonl/20149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37613,
66210,
11898,
3858,
368,
341,
197,
41819,
38588,
486,
21846,
401,
197,
10217,
2038,
284,
11312,
486,
931,
543,
197,
10217,
1156,
284,
508,
15,
87,
16,
16,
84,
23,
26,
220,
17,
15,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_message_type_no_name() {
let mut iter = Tokenizer::from_str("message");
let result = Parser {
tokenizer: &mut iter,
}
.parse_message_type();
assert!(result.is_err());
assert_eq!(
result.unwrap_err().to_string(),
"Parquet error: Expected name, found None"
);
} | rust_cleaned_test_functions.jsonl/79627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6462,
1819,
6536,
1269,
368,
341,
286,
1077,
5206,
5367,
284,
9660,
3135,
486,
1499,
2895,
445,
1994,
797,
286,
1077,
1102,
284,
21102,
341,
310,
45958,
25,
609,
6984,
5367,
345,
286,
456... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_igmp_integration_last_send_leave() {
let mut ctx = setup_simple_test_environment();
igmp_join_group(&mut ctx, DummyDeviceId, MulticastAddr::new(GROUP_ADDR).unwrap());
assert_eq!(ctx.timers().len(), 1);
// The initial unsolicited report
assert_eq!(ctx.frames().len(), 1);
assert!(ctx.trigger_next_timer::<IgmpTimerHandler>());
// The report after the delay
assert_eq!(ctx.frames().len(), 2);
assert!(igmp_leave_group(&mut ctx, DummyDeviceId, MulticastAddr::new(GROUP_ADDR).unwrap())
.is_ok());
// our leave message
assert_eq!(ctx.frames().len(), 3);
let leave_frame = &ctx.frames().last().unwrap().1;
// make sure it is a leave message
assert_eq!(leave_frame[24], 0x17);
assert_eq!(leave_frame[16], 224);
assert_eq!(leave_frame[17], 0);
assert_eq!(leave_frame[18], 0);
assert_eq!(leave_frame[19], 2);
ensure_ttl_ihl_rtr(&ctx);
} | rust_cleaned_test_functions.jsonl/30905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
343,
1307,
90250,
12195,
13565,
62666,
368,
341,
286,
1077,
5206,
5635,
284,
6505,
30015,
4452,
51774,
543,
286,
19373,
1307,
31017,
6288,
2099,
6984,
5635,
11,
50567,
6985,
764,
11,
22162,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alpn() {
let roots = rustls::RootCertStore::empty();
let tls_config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(roots)
.with_no_client_auth();
let connector = HttpsConnectorBuilder::new()
.with_tls_config(tls_config.clone())
.https_only()
.enable_http1()
.build();
assert!(connector
.tls_config
.alpn_protocols
.is_empty());
let connector = HttpsConnectorBuilder::new()
.with_tls_config(tls_config.clone())
.https_only()
.enable_http2()
.build();
assert_eq!(&connector.tls_config.alpn_protocols, &[b"h2".to_vec()]);
let connector = HttpsConnectorBuilder::new()
.with_tls_config(tls_config.clone())
.https_only()
.enable_http1()
.enable_http2()
.build();
assert_eq!(
&connector.tls_config.alpn_protocols,
&[b"h2".to_vec(), b"http/1.1".to_vec()]
);
} | rust_cleaned_test_functions.jsonl/16226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8418,
19958,
368,
341,
286,
1077,
19703,
284,
23071,
4730,
486,
8439,
36934,
6093,
486,
3194,
543,
286,
1077,
55026,
5332,
284,
23071,
4730,
486,
2959,
2648,
486,
17850,
741,
310,
659,
4197,
34067... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_v32_4() {
let mut data : &[u8] = &[0xff, 0xff, 0xff, 0xff, 0x80];
assert_eq!(Err(Error::Overflow), data.read_v32());
} | rust_cleaned_test_functions.jsonl/72923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2273,
18,
17,
62,
19,
368,
341,
286,
1077,
5206,
821,
549,
44590,
84,
23,
60,
284,
44590,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
87,
23,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_datetime() {
let buf = [0u8; 8];
let date: PrimitiveDateTime = Decode::<Postgres>::decode(PgValue::from_bytes(&buf)).unwrap();
assert_eq!(
date,
PrimitiveDateTime::new(date!(2000 - 01 - 01), time!(00:00:00))
);
let buf = 3_600_000_000i64.to_be_bytes();
let date: PrimitiveDateTime = Decode::<Postgres>::decode(PgValue::from_bytes(&buf)).unwrap();
assert_eq!(
date,
PrimitiveDateTime::new(date!(2000 - 01 - 01), time!(01:00:00))
);
let buf = 629_377_265_000_000i64.to_be_bytes();
let date: PrimitiveDateTime = Decode::<Postgres>::decode(PgValue::from_bytes(&buf)).unwrap();
assert_eq!(
date,
PrimitiveDateTime::new(date!(2019 - 12 - 11), time!(11:01:05))
);
} | rust_cleaned_test_functions.jsonl/21437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
28943,
368,
341,
262,
1077,
6607,
284,
508,
15,
84,
23,
26,
220,
23,
935,
262,
1077,
2400,
25,
51460,
7689,
284,
50194,
27638,
4133,
17818,
6831,
18196,
5304,
70,
1130,
486,
1499,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cfg_expr_minimal_features_needed() {
check(r#"#![cfg(feature = "baz")]"#, &["baz"]);
check(r#"#![cfg(all(feature = "baz", feature = "foo"))]"#, &["baz", "foo"]);
check(r#"#![cfg(any(feature = "baz", feature = "foo", unix))]"#, &["baz"]);
check(r#"#![cfg(foo)]"#, &[]);
} | rust_cleaned_test_functions.jsonl/17195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18343,
21915,
7260,
2861,
14965,
57426,
368,
341,
286,
1779,
2601,
55543,
85366,
14072,
27062,
284,
330,
42573,
899,
19177,
60778,
609,
1183,
42573,
15049,
286,
1779,
2601,
55543,
85366,
14072,
20388,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_header() {
use super::*;
let dt = chrono::DateTime::parse_from_rfc2822("Fri, 28 Nov 2014 21:00:09 +0900").unwrap();
let time = format!("{}", dt.format("%a, %d %h %Y %T GMT%Z"));
println!("time == {}", time);
let mut h = hyper::header::Headers::new();
h.set(XMSDate(time));
h.set(XMSVersion("2015-04-05".to_owned()));
assert_eq!(super::canonicalize_header(&h),
"x-ms-date:Fri, 28 Nov 2014 21:00:09 GMT+09:00\nx-ms-version:2015-04-05\n");
} | rust_cleaned_test_functions.jsonl/100671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
8757,
368,
341,
286,
990,
2256,
79304,
286,
1077,
7594,
284,
80372,
486,
7689,
486,
6400,
5673,
1710,
8316,
17,
23,
17,
17,
445,
53884,
11,
220,
17,
23,
4620,
220,
17,
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_async_ready_become_leader() {
let l = default_logger();
let s = new_storage();
s.wl()
.apply_snapshot(new_snapshot(5, 5, vec![1, 2, 3]))
.unwrap();
let mut raw_node = new_raw_node(1, vec![1, 2, 3], 10, 1, s.clone(), &l);
for _ in 1..raw_node.raft.election_timeout() * 2 {
raw_node.raft.tick_election();
}
let rd = raw_node.ready();
assert_eq!(rd.number(), 1);
must_cmp_ready(
&rd,
&Some(soft_state(0, StateRole::Candidate)),
&Some(hard_state(6, 5, 1)),
&[],
&[],
&None,
true,
true,
);
s.wl().set_hardstate(rd.hs().unwrap().clone());
let mut light_rd = raw_node.advance_append(rd);
for vec_msg in light_rd.take_messages() {
for msg in vec_msg {
assert_eq!(msg.get_msg_type(), MessageType::MsgRequestVote);
}
}
// Peer 1 should reject to vote to peer 2
let mut vote_request_2 = new_message(2, 1, MessageType::MsgRequestVote, 0);
vote_request_2.set_term(6);
vote_request_2.set_log_term(4);
vote_request_2.set_index(4);
raw_node.step(vote_request_2).unwrap();
let rd = raw_node.ready();
assert_eq!(rd.number(), 2);
must_cmp_ready(&rd, &None, &None, &[], &[], &None, true, false);
raw_node.advance_append_async(rd);
// Peer 1 should reject to vote to peer 2
let mut vote_request_3 = new_message(3, 1, MessageType::MsgRequestVote, 0);
vote_request_3.set_term(6);
vote_request_3.set_log_term(4);
vote_request_3.set_index(4);
raw_node.step(vote_request_3).unwrap();
let rd = raw_node.ready();
assert_eq!(rd.number(), 3);
must_cmp_ready(&rd, &None, &None, &[], &[], &None, true, false);
raw_node.advance_append_async(rd);
// Peer 1 receives the vote from peer 2
let mut vote_response_2 = new_message(2, 1, MessageType::MsgRequestVoteResponse, 0);
vote_response_2.set_term(6);
vote_response_2.set_reject(false);
raw_node.step(vote_response_2).unwrap();
let mut rd = raw_node.ready();
assert_eq!(rd.number(), 4);
assert_eq!(rd.entries().len(), 1);
must_cmp_ready(
&rd,
&Some(soft_state(1, StateRole::Leader)),
&None,
rd.entries(),
&[],
&None,
false,
true,
);
// 2 vote reject + 2 append entries
let mut count = 0;
for vec_msg in rd.take_messages() {
for msg in vec_msg {
let msg_type = match count {
0 | 1 => MessageType::MsgRequestVoteResponse,
_ => MessageType::MsgAppend,
};
assert_eq!(msg.get_msg_type(), msg_type);
count += 1;
}
}
assert_eq!(count, 4);
s.wl().append(rd.entries()).unwrap();
let light_rd = raw_node.advance_append(rd);
assert_eq!(light_rd.commit_index(), None);
assert!(light_rd.committed_entries().is_empty());
assert!(light_rd.messages().is_empty());
} | rust_cleaned_test_functions.jsonl/53377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
35456,
880,
51421,
79991,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
274,
284,
501,
23310,
543,
262,
274,
1418,
75,
741,
286,
659,
10280,
53265,
1755,
53265,
7,
20,
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... | 7 |
#[test]
fn test_oauth_data_parse() {
// This example is from a login response that did not contain any transfer URLs.
let oauth: OAuthData = serde_json::from_str("{\"steamid\":\"78562647129469312\",\"account_name\":\"feuarus\",\"oauth_token\":\"fd2fdb3d0717bcd2220d98c7ec61c7bd\",\"wgtoken\":\"72E7013D598A4F68C7E268F6FA3767D89D763732\",\"wgtoken_secure\":\"21061EA13C36D7C29812CAED900A215171AD13A2\",\"webcookie\":\"6298070A226E5DAD49938D78BCF36F7A7118FDD5\"}").unwrap();
assert_eq!(oauth.steamid, "78562647129469312");
assert_eq!(oauth.oauth_token, "fd2fdb3d0717bcd2220d98c7ec61c7bd");
assert_eq!(oauth.wgtoken, "72E7013D598A4F68C7E268F6FA3767D89D763732");
assert_eq!(
oauth.wgtoken_secure,
"21061EA13C36D7C29812CAED900A215171AD13A2"
);
assert_eq!(oauth.webcookie, "6298070A226E5DAD49938D78BCF36F7A7118FDD5");
} | rust_cleaned_test_functions.jsonl/52547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91193,
1769,
21039,
368,
341,
197,
322,
1096,
3110,
374,
504,
264,
5858,
2033,
429,
1521,
537,
6644,
894,
8317,
35006,
624,
10217,
46415,
25,
38316,
1043,
284,
61570,
9455,
486,
1499,
2895,
99141,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_then_verify_groestl_256_private_key() {
const DATA: &'static [u8] = b"hello, world!";
let _ = env_logger::try_init();
let mut rng = OsRng::new().unwrap();
let mut private_key = PrivateKey::<Groestl256>::new(&mut rng);
let public_key = private_key.public_key();
let signature = private_key.sign(DATA);
debug!("signature: {:?}", signature);
assert!(signature.is_ok());
let signature = signature.unwrap();
assert!(public_key.verify(&signature, DATA));
} | rust_cleaned_test_functions.jsonl/89979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
68367,
35638,
1889,
299,
477,
75,
62,
17,
20,
21,
26249,
3097,
368,
341,
262,
733,
14112,
25,
30136,
1978,
508,
84,
23,
60,
284,
293,
1,
14990,
11,
1879,
0,
3302,
262,
1077,
716,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fs_sqrt() {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
assert_eq!(Fs::zero().sqrt().unwrap(), Fs::zero());
for _ in 0..1000 {
let a = Fs::rand(&mut rng);
let mut nega = a;
nega.negate();
let mut b = a;
b.square();
let b = b.sqrt().unwrap();
assert!(a == b || nega == b);
}
for _ in 0..1000 {
let a = Fs::rand(&mut rng);
if let Some(mut tmp) = a.sqrt() {
tmp.square();
assert_eq!(a, tmp);
}
}
} | rust_cleaned_test_functions.jsonl/95519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34470,
92199,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
20,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
18,
16,
18,
67,
22,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_table_block_cache_use() {
let (src, size) = build_table(build_data());
let mut opt = options::for_test();
opt.block_size = 32;
let table = Table::new_raw(opt.clone(), wrap_buffer(src), size).unwrap();
let mut iter = table.iter();
assert_eq!(opt.block_cache.borrow().count(), 0);
iter.next();
assert_eq!(opt.block_cache.borrow().count(), 1);
iter.next();
iter.next();
iter.next();
iter.next();
assert_eq!(opt.block_cache.borrow().count(), 2);
} | rust_cleaned_test_functions.jsonl/43238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
7113,
11529,
15951,
368,
341,
286,
1077,
320,
3548,
11,
1379,
8,
284,
1936,
5237,
43333,
1769,
1423,
286,
1077,
5206,
3387,
284,
2606,
486,
1958,
4452,
543,
286,
3387,
15697,
2368,
284,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_initramfs() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
#[cfg(target_arch = "x86_64")]
let mut kernels = vec![direct_kernel_boot_path()];
#[cfg(target_arch = "aarch64")]
let kernels = vec![direct_kernel_boot_path()];
#[cfg(target_arch = "x86_64")]
{
let mut pvh_kernel_path = workload_path.clone();
pvh_kernel_path.push("vmlinux");
kernels.push(pvh_kernel_path);
}
let mut initramfs_path = workload_path;
initramfs_path.push("alpine_initramfs.img");
let test_string = String::from("axz34i9rylotd8n50wbv6kcj7f2qushme1pg");
let cmdline = format!("console=hvc0 quiet TEST_STRING={}", test_string);
kernels.iter().for_each(|k_path| {
let mut child = GuestCommand::new(&guest)
.args(&["--kernel", k_path.to_str().unwrap()])
.args(&["--initramfs", initramfs_path.to_str().unwrap()])
.args(&["--cmdline", &cmdline])
.capture_output()
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
let _ = child.kill();
let output = child.wait_with_output().unwrap();
let r = std::panic::catch_unwind(|| {
let s = String::from_utf8_lossy(&output.stdout);
assert_ne!(s.lines().position(|line| line == test_string), None);
});
handle_child_output(r, &output);
});
} | rust_cleaned_test_functions.jsonl/26172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
2396,
3848,
368,
341,
286,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
955,
3683,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_install_creating_leading_dir_fails_on_long_name() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let source = "create_leading_test_file";
let target = format!("{}/test_file", "d".repeat(libc::PATH_MAX as usize + 1));
at.touch(source);
scene
.ucmd()
.arg("-D")
.arg(source)
.arg(at.plus(target.as_str()))
.fails()
.stderr_contains("failed to create");
} | rust_cleaned_test_functions.jsonl/47040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
666,
72810,
11751,
2228,
4334,
761,
6209,
4470,
17799,
1269,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indexedfield_not_in_documents() {
let mut schema_builder = Schema::builder();
let text_field = schema_builder.add_text_field("text", TEXT);
let absent_field = schema_builder.add_text_field("text", TEXT);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index.writer_with_num_threads(2, 6_000_000).unwrap();
index_writer.add_document(doc!(text_field=>"a"));
assert!(index_writer.commit().is_ok());
let reader = index.reader().unwrap();
let searcher = reader.searcher();
let segment_reader = searcher.segment_reader(0);
segment_reader.inverted_index(absent_field); //< should not panic
} | rust_cleaned_test_functions.jsonl/41949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
291,
2566,
7913,
1243,
75927,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
15762,
317,
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... | 1 |
#[test]
fn test_transitions_with_src_not_a_number() {
let model =
"0\n\
3\n\
c b 3";
match DFAReader::new_from_string(model) {
Err(DFAReaderError::Parse(_,line)) => assert!(line == 3),
_ => assert!(false, "Parse expected."),
}
} | rust_cleaned_test_functions.jsonl/47833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
5930,
6615,
16274,
7913,
4306,
5500,
368,
341,
286,
1077,
1614,
4035,
310,
330,
15,
1699,
5661,
1797,
220,
18,
1699,
5661,
1797,
272,
293,
220,
18,
876,
286,
2432,
93631,
5062,
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_serialization_roundtrip() {
let bar = Bar {
a: 50,
b: vec![10u8; 100],
c: Addr::new([3u8; 32]),
d: 12,
};
let mut map = BTreeMap::new();
map.insert(vec![0, 56, 21], vec![22, 10, 5]);
map.insert(vec![1], vec![22, 21, 67]);
map.insert(vec![20, 21, 89, 105], vec![201, 23, 90]);
let foo = Foo {
a: 1,
b: vec![32, 41, 190, 200, 2, 5, 90, 100, 123, 234, 159, 159, 101],
c: bar,
d: false,
e: map,
};
let mut serializer = SimpleSerializer::<Vec<u8>>::new();
foo.serialize(&mut serializer).unwrap();
let serialized_bytes = serializer.get_output();
let mut deserializer = SimpleDeserializer::new(&serialized_bytes);
let deserialized_foo = Foo::deserialize(&mut deserializer).unwrap();
assert_eq!(foo, deserialized_foo);
assert_eq!(
deserializer.raw_bytes.position(),
deserializer.raw_bytes.get_ref().len() as u64
);
} | rust_cleaned_test_functions.jsonl/1864 | {
"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,
25602,
2022,
29896,
32981,
368,
341,
262,
1077,
3619,
284,
4716,
341,
286,
264,
25,
220,
20,
15,
345,
286,
293,
25,
7486,
20703,
16,
15,
84,
23,
26,
220,
16,
15,
15,
1259,
286,
272,
25,
72... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_purge_old_full_snapshot_archives() {
let snap1_name = format!("snapshot-1-{}.tar.zst", Hash::default());
let snap2_name = format!("snapshot-3-{}.tar.zst", Hash::default());
let snap3_name = format!("snapshot-50-{}.tar.zst", Hash::default());
let snapshot_names = vec![&snap1_name, &snap2_name, &snap3_name];
// expecting only the newest to be retained
let expected_snapshots = vec![&snap3_name];
common_test_purge_old_snapshot_archives(
&snapshot_names,
1,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
&expected_snapshots,
);
common_test_purge_old_snapshot_archives(
&snapshot_names,
0,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
&expected_snapshots,
);
let expected_snapshots = vec![&snap2_name, &snap3_name];
common_test_purge_old_snapshot_archives(
&snapshot_names,
2,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
&expected_snapshots,
);
let expected_snapshots = vec![&snap1_name, &snap2_name, &snap3_name];
common_test_purge_old_snapshot_archives(
&snapshot_names,
3,
DEFAULT_MAX_INCREMENTAL_SNAPSHOT_ARCHIVES_TO_RETAIN,
&expected_snapshots,
);
} | rust_cleaned_test_functions.jsonl/75087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
21108,
16372,
53265,
34330,
1886,
368,
341,
286,
1077,
10658,
16,
1269,
284,
3561,
17223,
35501,
12,
16,
12,
46391,
26737,
3938,
267,
497,
6531,
486,
2258,
1423,
286,
1077,
10658,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reopen_blockchain_db() {
let genesis = BlockBuilder::genesis();
let first = genesis.add_block();
let genesis_hash = genesis.last().hash();
let first_hash = first.last().hash();
let db = new_db();
{
let bc = new_chain(genesis.last().encoded(), db.clone());
assert_eq!(bc.best_block_hash(), genesis_hash);
let mut batch = db.key_value().transaction();
insert_block_batch(&mut batch, &bc, first.last().encoded(), vec![]);
db.key_value().write(batch).unwrap();
bc.commit();
assert_eq!(bc.best_block_hash(), first_hash);
}
{
let bc = new_chain(genesis.last().encoded(), db.clone());
assert_eq!(bc.best_block_hash(), first_hash);
}
} | rust_cleaned_test_functions.jsonl/39256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
2508,
7113,
8819,
8685,
368,
341,
197,
10217,
59366,
284,
8362,
3297,
486,
77894,
543,
197,
10217,
1156,
284,
59366,
1364,
7113,
543,
197,
10217,
59366,
8950,
284,
59366,
9110,
1005,
8296,
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_cf_lock_without_range_prop() {
let path = Builder::new().prefix("test-raftstore").tempdir().unwrap();
let path_str = path.path().to_str().unwrap();
let db_opts = DBOptions::new();
let mut cf_opt = ColumnFamilyOptions::new();
let f = Box::new(RangePropertiesCollectorFactory::default());
cf_opt.add_table_properties_collector_factory("tikv.range-collector", f);
let cfs_opts = ALL_CFS
.iter()
.map(|cf| {
if cf != &CF_LOCK {
CFOptions::new(cf, cf_opt.clone())
} else {
CFOptions::new(cf, ColumnFamilyOptions::new())
}
})
.collect();
let engine = Arc::new(new_engine_opt(path_str, db_opts, cfs_opts).unwrap());
let mut region = Region::default();
region.set_id(1);
region.set_start_key(vec![]);
region.set_end_key(vec![]);
region.mut_peers().push(Peer::default());
region.mut_region_epoch().set_version(2);
region.mut_region_epoch().set_conf_ver(5);
let (tx, rx) = mpsc::sync_channel(100);
let mut cfg = Config::default();
cfg.region_max_size = ReadableSize(100);
cfg.region_split_size = ReadableSize(60);
cfg.batch_split_limit = 5;
let mut runnable = SplitCheckRunner::new(
engine.c().clone(),
tx.clone(),
CoprocessorHost::new(tx.clone()),
cfg.clone(),
);
for cf in LARGE_CFS {
let cf_handle = engine.cf_handle(cf).unwrap();
for i in 0..7 {
let s = keys::data_key(format!("{:04}", i).as_bytes());
engine.put_cf(&cf_handle, &s, &s).unwrap();
}
engine.flush_cf(&cf_handle, true).unwrap();
}
for policy in &[CheckPolicy::Scan, CheckPolicy::Approximate] {
runnable.run(SplitCheckTask::split_check(region.clone(), true, *policy));
must_split_at_impl(&rx, ®ion, vec![], true);
}
drop(engine);
drop(runnable);
// Reopen the engine and all cfs have range properties.
let cfs_opts = ALL_CFS
.iter()
.map(|cf| CFOptions::new(cf, ColumnFamilyOptions::new()))
.collect();
let engine = Arc::new(new_engine_opt(path_str, DBOptions::new(), cfs_opts).unwrap());
let mut runnable = SplitCheckRunner::new(
engine.c().clone(),
tx.clone(),
CoprocessorHost::new(tx),
cfg,
);
// Flush a sst of CF_LOCK with range properties.
let cf_handle = engine.cf_handle(CF_LOCK).unwrap();
for i in 7..15 {
let s = keys::data_key(format!("{:04}", i).as_bytes());
engine.put_cf(&cf_handle, &s, &s).unwrap();
}
engine.flush_cf(&cf_handle, true).unwrap();
for policy in &[CheckPolicy::Scan, CheckPolicy::Approximate] {
runnable.run(SplitCheckTask::split_check(region.clone(), true, *policy));
must_split_at_impl(&rx, ®ion, vec![], true);
}
} | rust_cleaned_test_functions.jsonl/29230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71143,
9818,
39904,
9698,
21663,
368,
341,
286,
1077,
1815,
284,
20626,
486,
931,
1005,
11849,
445,
1944,
12,
2944,
4314,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
1815,
2895,
284,
1815,
3875... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_update_query() {
let query = query_builder::update("users")
.set("karma", "0")
.set("last_login", "1970-01-01")
.build();
let possibility1 = "UPDATE users SET karma = 0 AND last_login = 1970-01-01;" == query;
let possibility2 = "UPDATE users SET last_login = 1970-01-01 AND karma = 0;" == query;
assert!(possibility1 || possibility2);
} | rust_cleaned_test_functions.jsonl/93983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5738,
368,
341,
286,
1077,
3239,
284,
3239,
28532,
486,
2386,
445,
4218,
1138,
310,
659,
746,
445,
74,
19726,
497,
330,
15,
1138,
310,
659,
746,
445,
4259,
13681,
497,
330,
16,
24,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_draw() {
let mut test = SdlTest::new();
let console = test.console();
fn xy(x: i16, y: i16) -> PixelsXY {
PixelsXY { x, y }
}
// Draw some stuff that is completely visible.
console.color(Some(15), None).unwrap();
console.draw_line(xy(10, 50), xy(110, 60)).unwrap();
console.color(Some(12), Some(1)).unwrap();
console.draw_line(xy(120, 70), xy(20, 60)).unwrap();
console.color(Some(15), None).unwrap();
console.draw_rect_filled(xy(380, 180), xy(220, 120)).unwrap();
console.color(Some(10), None).unwrap();
console.draw_rect(xy(200, 100), xy(400, 200)).unwrap();
console.color(Some(14), None).unwrap();
for i in 0..8 {
console.draw_pixel(xy(i * 100, 300)).unwrap();
}
// Draw some stuff that is completely off screen.
console.color(Some(15), None).unwrap();
console.draw_pixel(xy(-1, 1)).unwrap();
console.draw_pixel(xy(801, 601)).unwrap();
console.draw_pixel(xy(-1, 0)).unwrap();
console.draw_pixel(xy(0, 601)).unwrap();
console.draw_line(xy(-1000, -2000), xy(-50, -30)).unwrap();
console.draw_rect(xy(-10, -10), xy(-5, -5)).unwrap();
console.draw_rect(xy(-10, -10), xy(810, 610)).unwrap();
console.draw_rect(xy(810, 610), xy(815, 615)).unwrap();
// Draw some stuff that is partially visible.
console.color(Some(15), None).unwrap();
console.draw_line(xy(-1000, 500), xy(100, 520)).unwrap();
console.draw_rect(xy(-10, 400), xy(10, 450)).unwrap();
console.draw_rect(xy(790, 410), xy(810, 440)).unwrap();
console.draw_rect_filled(xy(500, -10), xy(510, 610)).unwrap();
console.color(None, None).unwrap();
console.locate(CharsXY { x: 4, y: 22 }).unwrap();
console.write(b"Done!").unwrap();
test.verify("sdl-draw");
} | rust_cleaned_test_functions.jsonl/15270 | {
"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,
23021,
368,
341,
286,
1077,
5206,
1273,
284,
328,
8736,
2271,
486,
931,
543,
286,
1077,
2339,
284,
1273,
47802,
1428,
286,
5168,
30784,
2075,
25,
600,
16,
21,
11,
379,
25,
600,
16,
21,
8,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_deref_mut() {
let mut lazy = Lazy::new(|| 100i32);
assert_eq!(100, *DerefMut::deref_mut(&mut lazy));
assert_eq!(100, *DerefMut::deref_mut(&mut lazy));
*lazy = 200i32;
assert_eq!(200, *Deref::deref(&lazy));
assert_eq!(200, *DerefMut::deref_mut(&mut lazy));
} | rust_cleaned_test_functions.jsonl/209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
814,
43970,
29523,
368,
341,
286,
1077,
5206,
15678,
284,
44263,
486,
931,
79453,
220,
16,
15,
15,
72,
18,
17,
626,
286,
2060,
10714,
10297,
16,
15,
15,
11,
353,
35,
43970,
51440,
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... | 2 |
#[test]
fn test_validate_non_genesis_write_set() {
let (config, key) = config_builder::test_config();
let (vm_validator, mut rt) = TestValidator::new(&config);
let address = account_config::association_address();
let transaction =
transaction_test_helpers::get_write_set_txn(address, 1, &key, key.public_key(), None)
.into_inner();
let ret = rt
.block_on(vm_validator.validate_transaction(transaction))
.unwrap();
assert_eq!(ret.unwrap().major_status, StatusCode::REJECTED_WRITE_SET);
} | rust_cleaned_test_functions.jsonl/2307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
21637,
16322,
13774,
9165,
2602,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
320,
7338,
64959,
11,
5206,
16677,
8,
284,
3393,
14256,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prefixes_sorted() {
let mut sorted_prefixes = PREFIXES;
sorted_prefixes.sort_unstable();
assert_eq!(PREFIXES, sorted_prefixes);
let mut sorted_suffixes = SUFFIXES;
sorted_suffixes.sort_by(|a, b| a.bytes().rev().cmp(b.bytes().rev()));
assert_eq!(SUFFIXES, sorted_suffixes);
} | rust_cleaned_test_functions.jsonl/10377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13974,
288,
41277,
368,
341,
262,
1077,
5206,
10615,
13974,
288,
284,
69978,
1570,
280,
262,
10615,
13974,
288,
10614,
4907,
27992,
543,
262,
2060,
10714,
10297,
56588,
1570,
11,
10615,
13974,
288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_health() {
let mut vmm = create_vmm_object(InstanceState::Uninitialized);
assert!(vmm.check_health().is_err());
vmm.set_kernel_config(KernelConfig {
cmdline: kernel_cmdline::Cmdline::new(10),
kernel_file: tempfile::tempfile().unwrap(),
});
assert!(vmm.check_health().is_ok());
} | rust_cleaned_test_functions.jsonl/28144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
45727,
368,
341,
286,
1077,
5206,
348,
3821,
284,
1855,
2273,
3821,
5314,
7,
8846,
486,
1806,
36161,
317,
286,
2060,
10297,
85,
3821,
9093,
45727,
1005,
285,
9266,
5231,
286,
348,
3821,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negative_fuel() {
assert_eq!(naive_calculate_fuel(0), 0);
assert_eq!(naive_calculate_fuel(1), 0);
assert_eq!(naive_calculate_fuel(2), 0);
assert_eq!(naive_calculate_fuel(3), 0);
} | rust_cleaned_test_functions.jsonl/99669 | {
"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,
53865,
761,
4000,
368,
341,
286,
2060,
10714,
10297,
3376,
533,
24005,
11207,
761,
4000,
7,
15,
701,
220,
15,
317,
286,
2060,
10714,
10297,
3376,
533,
24005,
11207,
761,
4000,
7,
16,
701,
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_timer_tick_called() {
// Test that ChannelManager's and PeerManager's `timer_tick_occurred` is called every
// `FRESHNESS_TIMER`.
let nodes = create_nodes(1, "test_timer_tick_called".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let persister = move |node: &ChannelManager<InMemorySigner, Arc<ChainMonitor>, Arc<test_utils::TestBroadcaster>, Arc<KeysManager>, Arc<test_utils::TestFeeEstimator>, Arc<test_utils::TestLogger>>| FilesystemPersister::persist_manager(data_dir.clone(), node);
let event_handler = |_: &_| {};
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].net_graph_msg_handler.clone(), nodes[0].peer_manager.clone(), nodes[0].logger.clone());
loop {
let log_entries = nodes[0].logger.lines.lock().unwrap();
let desired_log = "Calling ChannelManager's timer_tick_occurred".to_string();
let second_desired_log = "Calling PeerManager's timer_tick_occurred".to_string();
if log_entries.get(&("lightning_background_processor".to_string(), desired_log)).is_some() &&
log_entries.get(&("lightning_background_processor".to_string(), second_desired_log)).is_some() {
break
}
}
assert!(bg_processor.stop().is_ok());
} | rust_cleaned_test_functions.jsonl/26264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16255,
43612,
27859,
368,
341,
197,
197,
322,
3393,
429,
13434,
2043,
594,
323,
45147,
2043,
594,
1565,
19278,
43612,
57291,
8130,
63,
374,
2598,
1449,
198,
197,
197,
322,
1565,
37,
21221,
7267,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_frexp() {
// We have to use from_str until base-2 exponents
// are supported in floating-point literals
let f1: f32 = from_str_hex("1p-123").unwrap();
let f2: f32 = from_str_hex("1p-111").unwrap();
let (x1, exp1) = f1.frexp();
let (x2, exp2) = f2.frexp();
assert_eq!((x1, exp1), (0.5f32, -122));
assert_eq!((x2, exp2), (0.5f32, -110));
assert_eq!(Float::ldexp(x1, exp1), f1);
assert_eq!(Float::ldexp(x2, exp2), f2);
assert_eq!(0f32.frexp(), (0f32, 0));
assert_eq!((-0f32).frexp(), (-0f32, 0));
let inf: f32 = Float::infinity();
let neg_inf: f32 = Float::neg_infinity();
let nan: f32 = Float::NaN();
assert_eq!(match inf.frexp() { (x, _) => x }, inf)
assert_eq!(match neg_inf.frexp() { (x, _) => x }, neg_inf)
assert!(match nan.frexp() { (x, _) => x.is_NaN() })
} | rust_cleaned_test_functions.jsonl/33121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74179,
35725,
368,
341,
286,
442,
1205,
614,
311,
990,
504,
2895,
3080,
2331,
12,
17,
505,
2700,
198,
286,
442,
525,
7248,
304,
19057,
16574,
75275,
198,
286,
1077,
282,
16,
25,
282,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_tick() {
let tick_sequence = Arc::new(AtomicUsize::new(0));
let tick_sequence2 = tick_sequence.clone();
let (tx, rx) = mpsc::sync_channel(1000);
let pool = Builder::new()
.pool_size(1)
.on_tick(move || {
let seq = tick_sequence2.fetch_add(1, Ordering::SeqCst);
tx.send(seq).unwrap();
})
.build();
assert!(rx.try_recv().is_err());
// Tick is not emitted since there is no task
thread::sleep(TICK_INTERVAL * 2);
assert!(rx.try_recv().is_err());
// Tick is emitted because long enough time has elapsed since pool is created
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
assert!(rx.try_recv().is_err());
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
assert!(rx.try_recv().is_err());
thread::sleep(TICK_INTERVAL * 2);
assert!(rx.try_recv().is_err());
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
assert_eq!(rx.try_recv().unwrap(), 0);
assert!(rx.try_recv().is_err());
// Tick is not emitted if there is no task
thread::sleep(TICK_INTERVAL * 2);
assert!(rx.try_recv().is_err());
// Tick is emitted since long enough time has passed
spawn_future_and_wait(&pool, TICK_INTERVAL / 20);
assert_eq!(rx.try_recv().unwrap(), 1);
assert!(rx.try_recv().is_err());
// Tick is emitted immediately after a long task
spawn_future_and_wait(&pool, TICK_INTERVAL * 2);
assert_eq!(rx.try_recv().unwrap(), 2);
assert!(rx.try_recv().is_err());
} | rust_cleaned_test_functions.jsonl/55770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 891
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43612,
368,
341,
286,
1077,
9341,
23735,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
3237,
286,
1077,
9341,
23735,
17,
284,
9341,
23735,
15997,
543,
286,
1077,
320,
3998,
11,
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... | 2 |
#[test]
fn test_ner_predict() {
let ner = ChineseNER::new();
let sentence = "今天纽约的天气真好啊,京华大酒店的李白经理吃了一只北京烤鸭。";
let result = ner.predict(sentence).unwrap();
assert_eq!(
result.word,
vec![
"今天",
"纽约",
"的",
"天气",
"真好",
"啊",
",",
"京华",
"大酒店",
"的",
"李白",
"经理",
"吃",
"了",
"一只",
"北京烤鸭",
"。"
]
);
assert_eq!(
result.tag,
vec![
"t", "ns", "uj", "n", "d", "zg", "x", "nz", "n", "uj", "nr", "n", "v", "ul", "m",
"n", "x"
]
);
assert_eq!(
result.entity,
vec![
(2, 4, "location"),
(11, 16, "org_name"),
(17, 19, "person_name"),
(25, 27, "location")
]
);
} | rust_cleaned_test_functions.jsonl/101363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 886
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
261,
26815,
368,
341,
286,
1077,
40183,
284,
8453,
13896,
486,
931,
543,
286,
1077,
11652,
284,
330,
100644,
106357,
9370,
104307,
88051,
52801,
103924,
3837,
46553,
85361,
113300,
9370,
115187,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter() {
let size = 10000usize;
// Forwards
let mut map: SkipList<usize, usize> = (0..size).map(|i| (i, i)).collect();
{
let mut iter = map.iter();
for i in 0..size {
assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
assert_eq!(iter.next().unwrap(), (&i, &i));
}
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
}
{
let mut iter = map.iter_mut();
for i in 0..size {
assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
assert_eq!(iter.next().unwrap(), (&i, &mut (i + 0)));
}
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
}
{
let mut iter = map.into_iter();
for i in 0..size {
assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
assert_eq!(iter.next().unwrap(), (i, i));
}
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
}
} | rust_cleaned_test_functions.jsonl/79633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 570
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
1077,
1379,
284,
220,
16,
15,
15,
15,
15,
51878,
401,
262,
442,
1752,
4014,
198,
262,
1077,
5206,
2415,
25,
25784,
852,
90244,
11,
22301,
29,
284,
320,
15,
496,
2141,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_directory() {
assert!(Directory::lets_encrypt().is_ok());
let dir = Directory::from_url(LETSENCRYPT_STAGING_DIRECTORY_URL).unwrap();
assert!(dir.url_for("new-reg").is_some());
assert!(dir.url_for("new-authz").is_some());
assert!(dir.url_for("new-cert").is_some());
assert!(!dir.get_nonce().unwrap().is_empty());
let pkey = gen_key().unwrap();
assert!(dir.jwk(&pkey).is_ok());
assert!(dir.jws(&pkey, true).is_ok());
} | rust_cleaned_test_functions.jsonl/116985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14846,
368,
341,
286,
2060,
10297,
9310,
486,
9942,
66593,
1005,
285,
19817,
5231,
286,
1077,
5419,
284,
18033,
486,
1499,
2903,
7,
20756,
44756,
42917,
2402,
79606,
43814,
8000,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flatten_enum_newtype() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct S {
#[serde(flatten)]
flat: E,
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
enum E {
Q(HashMap<String, String>),
}
let e = E::Q({
let mut map = HashMap::new();
map.insert("k".to_owned(), "v".to_owned());
map
});
let s = S { flat: e };
assert_tokens(
&s,
&[
Token::Map { len: None },
Token::Str("Q"),
Token::Map { len: Some(1) },
Token::Str("k"),
Token::Str("v"),
Token::MapEnd,
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/59167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
14456,
31054,
5921,
1313,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
262,
2036,
328,
341,
286,
11506,
47024,
49747,
14456,
5563,
286,
10063,
25,
468,
345... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcx_connection_deserialize_succeeds() {
init!("true");
let string = ::utils::constants::DEFAULT_CONNECTION;
let cb = return_types_u32::Return_U32_U32::new().unwrap();
let err = vcx_connection_deserialize(cb.command_handle,
CString::new(string).unwrap().into_raw(),
Some(cb.get_callback()));
assert_eq!(err, SUCCESS.code_num);
let handle = cb.receive(Some(Duration::from_secs(2))).unwrap();
assert!(handle > 0);
} | rust_cleaned_test_functions.jsonl/25727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
15866,
15768,
9050,
643,
29264,
82,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
914,
284,
3504,
6031,
486,
15763,
486,
17285,
40708,
280,
286,
1077,
9858,
284,
470,
9763,
7300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sample_bitsize() {
let bit_size = 54;
let bound = 1u64 << bit_size;
for _ in 0..10 {
let a = Scalar::_sample(bit_size);
assert!(a < bound);
}
} | rust_cleaned_test_functions.jsonl/1924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
20034,
551,
368,
341,
286,
1077,
2699,
2368,
284,
220,
20,
19,
280,
286,
1077,
6822,
284,
220,
16,
84,
21,
19,
1115,
2699,
2368,
280,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_t4() {
let oup = exec_target_with_in(
TARGET_EXE_PATH,
&["-h", "9", "-t", "14", "-i"],
super::IN_DAT_1.as_bytes(),
);
assert_eq!(oup.stderr, "");
assert_eq!(
oup.stdout,
concat!(
"Try the settee, said Holmes,\n",
"relapsing into his armchair and putting his finger-tips together,\n",
"as was his custom when in judicial moods.\n",
)
);
assert_eq!(oup.status.success(), true);
} | rust_cleaned_test_functions.jsonl/67526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
19,
368,
341,
286,
1077,
5908,
79,
284,
3883,
11123,
6615,
1243,
1006,
310,
41033,
4966,
36,
7944,
345,
310,
609,
1183,
12,
71,
497,
330,
24,
497,
6523,
83,
497,
330,
16,
19,
497,
6523,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_status_response_decode() {
let mut cursor =
Cursor::new(include_bytes!("../test/packet/status/status_response.dat").to_vec());
let status_response = StatusResponse::decode(&mut cursor).unwrap();
let server_status = status_response.server_status;
let player = OnlinePlayer {
id: Uuid::parse_str("2a1e1912-7103-4add-80fc-91ebc346cbce").unwrap(),
name: String::from("Username"),
};
assert_eq!(server_status.version.name, String::from("1.15.1"));
assert_eq!(server_status.version.protocol, 575);
assert_eq!(server_status.players.max, 100);
assert_eq!(server_status.players.online, 10);
assert_eq!(server_status.players.sample, vec![player]);
assert_eq!(
server_status.description,
Message::new(Payload::text("Description"))
);
} | rust_cleaned_test_functions.jsonl/84713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
9655,
15227,
368,
341,
286,
1077,
5206,
8128,
4035,
310,
28067,
486,
931,
77863,
12524,
17223,
1244,
1944,
4322,
5709,
32518,
32518,
9655,
9915,
1827,
983,
13251,
1423,
286,
1077,
2639,
9655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_samples_for_dio() {
let fs = 44100;
let x_length = 256;
let frame_period = 5.0;
unsafe {
let samples = GetSamplesForDIO(fs, x_length, frame_period);
assert_eq!(samples, 2);
}
} | rust_cleaned_test_functions.jsonl/20844 | {
"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,
3062,
18297,
5478,
814,
815,
368,
341,
286,
1077,
8619,
1843,
284,
220,
19,
19,
16,
15,
15,
280,
286,
1077,
856,
5118,
257,
284,
220,
17,
20,
21,
280,
286,
1077,
4034,
20818,
284,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eos() {
check("\r\n[SECTION]", &[Item::Blank, Item::Section("SECTION")]);
check("\r\n[SECTION]\n", &[Item::Blank, Item::Section("SECTION")]);
check("\r\n;comment", &[Item::Blank, Item::Comment("comment")]);
check("\r\n;comment\n", &[Item::Blank, Item::Comment("comment")]);
check("\r\nKey=Value", &[Item::Blank, Item::Property("Key", "Value")]);
check("\r\nKey=Value\n", &[Item::Blank, Item::Property("Key", "Value")]);
check("\r\nKey=Value\r", &[Item::Blank, Item::Property("Key", "Value")]);
check("\r\nKey=Value\r\n", &[Item::Blank, Item::Property("Key", "Value")]);
check("\r\nAction", &[Item::Blank, Item::Action("Action")]);
check("\r\nAction\n", &[Item::Blank, Item::Action("Action")]);
check("\r\nAction\r", &[Item::Blank, Item::Action("Action")]);
check("\r\nAction\r\n", &[Item::Blank, Item::Action("Action")]);
} | rust_cleaned_test_functions.jsonl/129465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
436,
368,
341,
25157,
4921,
81,
1699,
58,
58778,
19076,
44590,
1234,
486,
22770,
11,
5739,
486,
9620,
445,
58778,
899,
2558,
25157,
4921,
81,
1699,
58,
58778,
17960,
77,
497,
44590,
1234,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcx_credential_serialize_and_deserialize() {
let _setup = SetupMocks::init();
let handle = _vcx_credential_create_with_offer_c_closure(ARIES_CREDENTIAL_OFFER).unwrap();
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_credential_serialize(cb.command_handle,
handle,
Some(cb.get_callback())), error::SUCCESS.code_num);
let credential_json = cb.receive(TimeoutUtils::some_short()).unwrap().unwrap();
debug!("Serialized credential: {:?}", credential_json);
let object: Value = serde_json::from_str(&credential_json).unwrap();
assert_eq!(object["version"], V3_OBJECT_SERIALIZE_VERSION);
let cb = return_types_u32::Return_U32_U32::new().unwrap();
assert_eq!(vcx_credential_deserialize(cb.command_handle,
CString::new(credential_json).unwrap().into_raw(),
Some(cb.get_callback())), error::SUCCESS.code_num);
let handle = cb.receive(TimeoutUtils::some_short()).unwrap();
assert!(handle > 0);
} | rust_cleaned_test_functions.jsonl/115033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
666,
30320,
88686,
8378,
15768,
9050,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
716,
7362,
87,
666,
30320,
8657,
6615,
67814,
666,
728... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_crossing_out_graph() {
let left_image = vec![vec![0u32; 2]; 1];
let right_image = vec![vec![0u32; 2]; 1];
let max_disparity = 1;
let diffusion_graph = DiffusionGraph::initialize(left_image, right_image, max_disparity, 1.);
let mut vertices = vec![vec![vec![true; max_disparity]; 2]; 1];
vertices[0][0][0] = false;
let mut edges = vec![vec![vec![vec![vec![false; max_disparity]; 4]; max_disparity]; 2]; 1];
edges[0][0][0][2][0] = true;
let mut crossing_out_graph = CrossingOutGraph::initialize(diffusion_graph, vertices, edges);
crossing_out_graph.crossing_out();
println!("{:?}", crossing_out_graph.vertices);
println!("{:?}", crossing_out_graph.edges);
assert!(!crossing_out_graph.vertices_exist());
assert!(!crossing_out_graph.edges_exist());
assert!(!crossing_out_graph.is_not_empty());
} | rust_cleaned_test_functions.jsonl/133550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
35284,
287,
6068,
14738,
368,
341,
286,
1077,
2115,
4954,
284,
7486,
20703,
4083,
20703,
15,
84,
18,
17,
26,
220,
17,
5265,
220,
16,
935,
286,
1077,
1290,
4954,
284,
7486,
20703,
4083,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ser() {
println!(
"{}",
quick_xml::se::to_string(&MavenMetadata {
group_id: "marais".into(),
artifact_id: "graphql".into(),
versioning: Versioning {
latest: "0.1.0".into(),
release: "0.1.0".into(),
versions: Versions {
versions: vec!["0.1.0".into()]
},
},
})
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/90007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
368,
341,
286,
13751,
33673,
310,
35503,
756,
310,
3974,
23855,
486,
325,
486,
983,
3904,
2099,
44,
5276,
14610,
341,
394,
1874,
842,
25,
330,
5612,
2782,
3263,
18122,
3148,
394,
36639,
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_deserialize_data() {
let source = "\
foo=bar\r\n\
baz=123\r\n\
extra=lines\r\n\
and stuff\r\n\
";
let data = deserializer()
.separator("=")
.newline("\r\n")
.keys(&["foo", "baz"])
.deserialize(source);
let pairs = data.pairs;
let extra_lines = data.extra_lines;
assert_eq!(pairs, vec![("foo", "bar"), ("baz", "123")]);
assert_eq!(extra_lines, vec!["extra=lines", "and stuff"]);
} | rust_cleaned_test_functions.jsonl/101324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
1769,
368,
341,
286,
1077,
2530,
284,
93317,
310,
15229,
28,
2257,
12016,
1699,
5661,
310,
50247,
28,
16,
17,
18,
12016,
1699,
5661,
310,
4960,
28,
7969,
12016,
1699,
5661,
310,
323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date() {
let cases = vec![
("2011-11-11", Some("2011-11-11")),
("2011-11-11 10:10:10", Some("2011-11-11")),
("0000-00-00 00:00:00", None),
];
let mut ctx = EvalContext::default();
for (date, expect) in cases {
let date = Some(DateTime::parse_datetime(&mut ctx, date, MAX_FSP, true).unwrap());
let expect =
expect.map(|expect| Time::parse_datetime(&mut ctx, expect, MAX_FSP, true).unwrap());
let output = RpnFnScalarEvaluator::new()
.push_param(date)
.evaluate(ScalarFuncSig::Date)
.unwrap();
assert_eq!(output, expect, "{:?}", date);
}
} | rust_cleaned_test_functions.jsonl/36230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
16,
12,
16,
16,
12,
16,
16,
497,
4329,
445,
17,
15,
16,
16,
12,
16,
16,
12,
16,
16,
30154,
310,
3489,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ecdsa_next_quadruples_in_creation() {
let subnet_id = subnet_test_id(1);
let subnet_nodes = (0..10).map(node_test_id).collect::<Vec<_>>();
let summary_registry_version = RegistryVersion::new(10);
let env = CanisterThresholdSigTestEnvironment::new(4);
let algorithm = AlgorithmId::ThresholdEcdsaSecp256k1;
let key_transcript = generate_key_transcript(&env, algorithm);
let key_transcript_ref =
ecdsa::UnmaskedTranscript::try_from((Height::new(1), &key_transcript)).unwrap();
let summary = empty_ecdsa_summary_payload(subnet_id, key_transcript_ref);
let quadruples_to_create_in_advance = 5;
let ecdsa_config = EcdsaConfig {
quadruples_to_create_in_advance,
};
let mut next_unused_transcript_id = IDkgTranscriptId::new(subnet_id, 10);
// Success case
let result = next_quadruples_in_creation(
&subnet_nodes,
summary_registry_version,
&summary,
Some(&ecdsa_config),
&mut next_unused_transcript_id,
);
assert!(result.is_ok());
let quadruples = result.unwrap();
assert_eq!(quadruples.len(), quadruples_to_create_in_advance as usize);
// Check transcript ids are unique
let mut transcript_ids = BTreeSet::new();
for quadruple in quadruples.iter() {
transcript_ids.insert(quadruple.1.kappa_config.as_ref().transcript_id);
transcript_ids.insert(quadruple.1.lambda_config.as_ref().transcript_id);
}
assert_eq!(
transcript_ids.len(),
2 * quadruples_to_create_in_advance as usize
);
assert_eq!(
transcript_ids.iter().max().unwrap().increment(),
next_unused_transcript_id
);
// Failure case
let result = next_quadruples_in_creation(
&[],
summary_registry_version,
&summary,
Some(&ecdsa_config),
&mut next_unused_transcript_id,
);
assert_matches!(
result,
Err(EcdsaPayloadError::IDkgParamsValidationError(
IDkgParamsValidationError::DealersEmpty
))
);
} | rust_cleaned_test_functions.jsonl/113081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
11257,
11280,
14666,
28323,
1243,
46163,
368,
341,
286,
1077,
51457,
842,
284,
51457,
4452,
842,
7,
16,
317,
286,
1077,
51457,
14896,
284,
320,
15,
496,
16,
15,
568,
2186,
6958,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_image_from_url_self_hosted() {
let mut uprq = super::ImageUploadRequest {
content_type: None,
data: None,
filename: None,
url: None,
};
match super::image_from_url(&mut uprq) {
Err(e) => assert_eq!(e, "image URL not specified"),
_ => panic!("url == None isn't an image!"),
}
uprq.url = Some(String::from(
"http://qerqcqwer3454fdsgdfgsdfg/not-exist-server",
));
if let Ok(_) = super::image_from_url(&mut uprq) {
panic!("url pointing to not existent server isn't an image!")
}
let (join_handle, srv_tx) = mock::test_http_server(8888);
std::thread::sleep(std::time::Duration::from_secs(2)); // Await for server warm-up or else may false test failures araise.
uprq.url = Some(String::from("http://localhost:8888/not-exist-url"));
match super::image_from_url(&mut uprq) {
Err(e) => assert_eq!(e, "not an image"),
_ => panic!("url pointing to invalid resource isn't an image!"),
}
uprq.url = Some(String::from("http://localhost:8888/unknown-content-type"));
match super::image_from_url(&mut uprq) {
Err(e) => assert_eq!(e, "not an image"),
_ => panic!("url pointing to a resource with unknown Content-Type isn't an image!"),
}
uprq.content_type = Some(String::from("image/jpeg"));
let (filename, content_type, data) = super::image_from_url(&mut uprq).unwrap();
assert_eq!(filename, "unknown-content-type.jpg");
assert_eq!(content_type, "image/jpeg");
assert_eq!(data, b"Hello!");
uprq.url = Some(String::from("http://localhost:8888/"));
match super::image_from_url(&mut uprq) {
Err(e) => assert_eq!(e, "not an image"),
_ => panic!("url pointing to html or text resource isn't an image!"),
}
uprq.content_type = None;
uprq.url = Some(String::from("http://localhost:8888/image"));
let (filename, content_type, data) = super::image_from_url(&mut uprq).unwrap();
assert_eq!(filename, "image.jpg");
assert_eq!(content_type, "image/jpeg");
assert_eq!(data, b"TEST JPEG DATA");
uprq.filename = Some(String::from("testfile"));
let (filename, _, _) = super::image_from_url(&mut uprq).unwrap();
assert_eq!(filename, "testfile.jpg");
uprq.filename = Some(String::from("testfile.jpeg"));
let (filename, _, _) = super::image_from_url(&mut uprq).unwrap();
assert_eq!(filename, "testfile.jpeg");
srv_tx.send("stop").unwrap();
join_handle.join().unwrap();
} | rust_cleaned_test_functions.jsonl/132613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
5673,
2903,
25637,
12848,
291,
368,
341,
286,
1077,
5206,
705,
52189,
284,
2256,
486,
1906,
13844,
1900,
341,
310,
2213,
1819,
25,
2240,
345,
310,
821,
25,
2240,
345,
310,
3899,
25,
2240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_decode_push() {
match decode_16(0xb510) {
Instruction::PUSH { registers, thumb32 } => {
let elems: Vec<_> = registers.iter().collect();
assert_eq!(vec![Reg::R4, Reg::LR], elems);
assert_eq!(thumb32, false);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
14218,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
7929,
20,
16,
15,
8,
341,
286,
29051,
486,
47,
19518,
314,
24740,
11,
24050,
18,
17,
335,
589,
341,
310,
1077,
55968,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_path_escape() {
let cases = vec![
// turn empty string path into escaped /
(r#""#, r#"-"#),
// turn redundant ////s into single escaped /
(r#"/////////"#, r#"-"#),
// remove all redundant ////s
(r#"///foo////bar/////tail//////"#, r#"foo-bar-tail"#),
// escape leading dot
(r#"."#, r#"\x2e"#),
(r#"/."#, r#"\x2e"#),
(r#"/////////.///////////////"#, r#"\x2e"#),
(r#"....."#, r#"\x2e...."#),
(r#"/.foo/.bar"#, r#"\x2efoo-.bar"#),
(r#".foo/.bar"#, r#"\x2efoo-.bar"#),
// escape disallowed
(r#"///..\-!#??///"#, r#"\x2e.\x5c\x2d\x21\x23\x3f\x3f"#),
];
for t in cases {
let res = escape_path(t.0);
assert_eq!(res, t.1.to_string());
}
} | rust_cleaned_test_functions.jsonl/125367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
21832,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
442,
2484,
4287,
914,
1815,
1119,
27783,
38981,
310,
320,
81,
2,
3014,
60778,
435,
55543,
27651,
2,
1326,
310,
442,
2484,
47732,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_index_doc_missing_field() -> crate::Result<()> {
let mut schema_builder = schema::Schema::builder();
let idfield = schema_builder.add_text_field("id", STRING);
schema_builder.add_text_field("optfield", STRING);
let index = Index::create_in_ram(schema_builder.build());
let mut index_writer = index.writer_for_tests()?;
index_writer.add_document(doc!(idfield=>"myid"))?;
index_writer.commit()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/21513 | {
"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,
3560,
18869,
40447,
5013,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
877,
2566,
284,
10802,
28532,
1364,
4326,
5013,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_modify_master_index() {
let candidate_block = get_block(0);
let conman = TestConnectionManager::new();
let mut rpc = MockRpc::new();
rpc.should_call_testproposedblock(Ok(true));
rpc.should_call_testproposedblock(Ok(true));
let prev_state = Member::for_test().master_index(0).build();
let params = NodeParametersBuilder::new()
.public_key(TEST_KEYS.pubkeys()[1])
.rpc(rpc)
.build();
// Step 1.
let sender_id = SignerID::new(TEST_KEYS.pubkeys()[0]);
let state =
process_candidateblock(&sender_id, &candidate_block, &prev_state, &conman, ¶ms);
assert_eq!(master_index(&state, ¶ms).unwrap(), 0);
// Step 2.
let sender_id = SignerID::new(TEST_KEYS.pubkeys()[4]);
let state =
process_candidateblock(&sender_id, &candidate_block, &prev_state, &conman, ¶ms);
assert_eq!(master_index(&state, ¶ms).unwrap(), 4);
params.rpc.assert();
} | rust_cleaned_test_functions.jsonl/99677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57725,
24582,
3560,
368,
341,
286,
1077,
9144,
7113,
284,
633,
7113,
7,
15,
317,
286,
1077,
390,
1515,
284,
3393,
4526,
2043,
486,
931,
543,
286,
1077,
5206,
35596,
284,
14563,
60248,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_agg_summary_split() {
let mut splitter: MetricSplitter<AggregatedSummarySplitter> = MetricSplitter::default();
let counter = Metric::new(
"counter",
MetricKind::Incremental,
MetricValue::Counter { value: 42.0 },
);
let gauge = Metric::new(
"gauge",
MetricKind::Absolute,
MetricValue::Gauge { value: 3.15 },
);
let set = Metric::new(
"set",
MetricKind::Absolute,
MetricValue::Set {
values: BTreeSet::from([String::from("foobar")]),
},
);
let distribution = Metric::new(
"distribution",
MetricKind::Incremental,
MetricValue::Distribution {
statistic: StatisticKind::Histogram,
samples: vec![Sample {
value: 13.37,
rate: 10,
}],
},
);
let agg_histo = Metric::new(
"agg_histo",
MetricKind::Absolute,
MetricValue::AggregatedHistogram {
buckets: vec![
Bucket {
upper_limit: 10.0,
count: 5,
},
Bucket {
upper_limit: 25.0,
count: 2,
},
],
count: 7,
sum: 100.0,
},
);
let agg_summary = Metric::new(
"agg_summary",
MetricKind::Absolute,
MetricValue::AggregatedSummary {
quantiles: vec![
Quantile {
quantile: 0.05,
value: 10.0,
},
Quantile {
quantile: 0.95,
value: 25.0,
},
],
count: 7,
sum: 100.0,
},
);
let quantile_tag = |q: f64| -> Option<MetricTags> {
let quantile = Quantile {
quantile: q,
value: 0.0,
};
Some(
vec![("quantile".to_owned(), quantile.to_quantile_string())]
.into_iter()
.collect(),
)
};
let agg_summary_splits = vec![
Metric::new(
"agg_summary_count",
MetricKind::Absolute,
MetricValue::Counter { value: 7.0 },
),
Metric::new(
"agg_summary",
MetricKind::Absolute,
MetricValue::Gauge { value: 10.0 },
)
.with_tags(quantile_tag(0.05)),
Metric::new(
"agg_summary",
MetricKind::Absolute,
MetricValue::Gauge { value: 25.0 },
)
.with_tags(quantile_tag(0.95)),
Metric::new(
"agg_summary_sum",
MetricKind::Absolute,
MetricValue::Counter { value: 100.0 },
),
];
let cases = &[
(counter.clone(), vec![counter]),
(gauge.clone(), vec![gauge]),
(set.clone(), vec![set]),
(distribution.clone(), vec![distribution]),
(agg_histo.clone(), vec![agg_histo]),
(agg_summary, agg_summary_splits),
];
for (input, expected) in cases {
let actual = splitter.split(input.clone()).collect::<Vec<_>>();
assert_eq!(expected.clone(), actual);
}
} | rust_cleaned_test_functions.jsonl/99798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83534,
27251,
17052,
368,
341,
286,
1077,
5206,
72986,
25,
52458,
20193,
465,
27,
9042,
93040,
19237,
20193,
465,
29,
284,
52458,
20193,
465,
486,
2258,
1428,
286,
1077,
5546,
284,
52458,
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_rent_eager_pubkey_range_dividable() {
let test_map = map_to_test_bad_range();
let range = Bank::pubkey_range_from_partition((0, 0, 2));
assert_eq!(
range,
Pubkey::new_from_array([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
])
..=Pubkey::new_from_array([
0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
])
);
test_map.range(range);
let range = Bank::pubkey_range_from_partition((0, 1, 2));
assert_eq!(
range,
Pubkey::new_from_array([
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
])
..=Pubkey::new_from_array([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
])
);
test_map.range(range);
} | rust_cleaned_test_functions.jsonl/2547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
2204,
1409,
34014,
792,
9698,
16237,
36754,
368,
341,
286,
1077,
1273,
5376,
284,
2415,
2346,
4452,
34199,
9698,
543,
286,
1077,
2088,
284,
8547,
486,
9585,
792,
9698,
5673,
43840,
1188,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_invalid_header() {
assert_eq!(Header::parse(&[0, 0, 0, 3, 0, 0, 0]).unwrap_err().to_string(), "length of message frame cannot be < 4");
} | rust_cleaned_test_functions.jsonl/23377 | {
"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,
21039,
31433,
8757,
368,
341,
286,
2060,
10714,
10297,
4047,
486,
6400,
2099,
58,
15,
11,
220,
15,
11,
220,
15,
11,
220,
18,
11,
220,
15,
11,
220,
15,
11,
220,
15,
10697,
15454,
9266,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_skiplist() {
let mut output: Vec<u8> = Vec::new();
let mut skip_list_builder: SkipListBuilder<u32> = SkipListBuilder::new(8);
skip_list_builder.insert(2, &3).unwrap();
skip_list_builder.write::<Vec<u8>>(&mut output).unwrap();
let mut skip_list: SkipList<'_, u32> = SkipList::from(output.as_slice());
assert_eq!(skip_list.next(), Some((2, 3)));
} | rust_cleaned_test_functions.jsonl/65074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6642,
39934,
368,
341,
286,
1077,
5206,
2550,
25,
11312,
34837,
23,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
10706,
2019,
28532,
25,
25784,
852,
3297,
34837,
18,
17,
29,
284,
25784,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_final_stats_unspec() {
let output = vec![
"0+0 records in",
"0+0 records out",
"0 bytes (0 B, 0 B) copied, 0.0 s, 0 B/s",
];
let output = output.into_iter().fold(String::new(), |mut acc, s| {
acc.push_str(s);
acc.push('\n');
acc
});
new_ucmd!().run().stderr_only(&output).success();
} | rust_cleaned_test_functions.jsonl/59384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20676,
15381,
4907,
9535,
368,
341,
262,
1077,
2550,
284,
7486,
90515,
286,
330,
15,
10,
15,
7424,
304,
756,
286,
330,
15,
10,
15,
7424,
700,
756,
286,
330,
15,
5820,
320,
15,
425,
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_program_bpf_invoke_upgradeable_via_cpi() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, id, entrypoint);
let (name, id, entrypoint) = solana_bpf_loader_upgradeable_program!();
bank.add_builtin(&name, id, entrypoint);
let bank_client = BankClient::new(bank);
let invoke_and_return = load_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
"solana_bpf_rust_invoke_and_return",
);
// Deploy upgradeable program
let buffer_keypair = Keypair::new();
let program_keypair = Keypair::new();
let program_id = program_keypair.pubkey();
let authority_keypair = Keypair::new();
load_upgradeable_bpf_program(
&bank_client,
&mint_keypair,
&buffer_keypair,
&program_keypair,
&authority_keypair,
"solana_bpf_rust_upgradeable",
);
let mut instruction = Instruction::new_with_bytes(
invoke_and_return,
&[0],
vec![
AccountMeta::new(program_id, false),
AccountMeta::new(program_id, false),
AccountMeta::new(clock::id(), false),
AccountMeta::new(fees::id(), false),
],
);
// Call invoker program to invoke the upgradeable program
instruction.data[0] += 1;
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction.clone());
assert_eq!(
result.unwrap_err().unwrap(),
TransactionError::InstructionError(0, InstructionError::Custom(42))
);
// Upgrade program
let buffer_keypair = Keypair::new();
upgrade_bpf_program(
&bank_client,
&mint_keypair,
&buffer_keypair,
&program_id,
&authority_keypair,
"solana_bpf_rust_upgraded",
);
// Call the upgraded program
instruction.data[0] += 1;
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction.clone());
assert_eq!(
result.unwrap_err().unwrap(),
TransactionError::InstructionError(0, InstructionError::Custom(43))
);
// Set a new authority
let new_authority_keypair = Keypair::new();
set_upgrade_authority(
&bank_client,
&mint_keypair,
&program_id,
&authority_keypair,
Some(&new_authority_keypair.pubkey()),
);
// Upgrade back to the original program
let buffer_keypair = Keypair::new();
upgrade_bpf_program(
&bank_client,
&mint_keypair,
&buffer_keypair,
&program_id,
&new_authority_keypair,
"solana_bpf_rust_upgradeable",
);
// Call original program
instruction.data[0] += 1;
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction.clone());
assert_eq!(
result.unwrap_err().unwrap(),
TransactionError::InstructionError(0, InstructionError::Custom(42))
);
} | rust_cleaned_test_functions.jsonl/11458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
79779,
67794,
480,
80710,
666,
2493,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
1731,
341,
286,
59366,
5332,
345,
286,
28337,
3097,
12670,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_gt() {
let a = Int32Array::from(vec![8, 8, 8, 8, 8]);
let b = Int32Array::from(vec![6, 7, 8, 9, 10]);
let c = gt(&a, &b).unwrap();
assert_eq!(true, c.value(0));
assert_eq!(true, c.value(1));
assert_eq!(false, c.value(2));
assert_eq!(false, c.value(3));
assert_eq!(false, c.value(4));
} | rust_cleaned_test_functions.jsonl/3133 | {
"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,
84087,
3858,
37479,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
2558,
286,
1077,
293,
284,
1333,
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_matches_any_correctly() {
check(
&WildcardPattern::Any,
vec!["alf-loves-cats", "alfcats", "alf+cats", "", "something"],
vec![]);
} | rust_cleaned_test_functions.jsonl/80618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38344,
37248,
31550,
398,
368,
341,
286,
1779,
1006,
310,
609,
92988,
15760,
486,
8610,
345,
310,
7486,
0,
1183,
3104,
26480,
2342,
1786,
1862,
497,
330,
3104,
37452,
497,
330,
3104,
10,
37452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.