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_decoder_valid_partial_non_bmp() {
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [], [0xd8], "");
assert_feed_ok!(d, [], [0x08], "");
assert_feed_ok!(d, [], [0xdf], "");
assert_feed_ok!(d, [0x45], [0xd9], "\U00012345");
assert_feed_ok!(d, [], [0x5e], "");
assert_feed_ok!(d, [], [0xdc], "");
assert_feed_ok!(d, [0x90], [], "\U00067890");
assert_finish_ok!(d, "");
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [], [0xd8], "");
assert_feed_ok!(d, [], [0x08, 0xdf], "");
assert_feed_ok!(d, [0x45], [0xd9, 0x5e], "\U00012345");
assert_feed_ok!(d, [0xdc, 0x90], [], "\U00067890");
assert_finish_ok!(d, "");
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [], [0xd8, 0x08, 0xdf], "");
assert_feed_ok!(d, [0x45], [0xd9, 0x5e, 0xdc], "\U00012345");
assert_feed_ok!(d, [0x90], [], "\U00067890");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/15678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
8337,
52068,
21637,
880,
1307,
368,
341,
286,
1077,
5206,
294,
284,
20076,
62,
16,
21,
11594,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
10071,
508,
15,
9703,
23,
1125,
14498,
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_document_from_mg_mval_mmol_with_null() {
let it = doc! {
KEY_MG: Bson::Null,
KEY_MVAL: Bson::Null,
KEY_MMOL: Bson::Null,
KEY_MVAL_PERCENT: Bson::Null
};
let r = MgMvalMmol::try_from(&it);
assert!(r.is_ok());
assert_eq!(r.unwrap(), MgMvalMmol {
mg: CellValue::Null,
mval: CellValue::Null,
mmol: CellValue::Null,
mval_percent: CellValue::Null
});
} | rust_cleaned_test_functions.jsonl/16360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26231,
5673,
717,
70,
717,
831,
35599,
337,
6615,
15162,
368,
341,
286,
1077,
432,
284,
4629,
0,
341,
310,
12013,
1245,
38,
25,
425,
930,
486,
3280,
345,
310,
12013,
1245,
5594,
25,
425,
930,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_bot_that_compares() {
let config = parse_input("value 5 goes to bot 2
bot 2 gives low to bot 1 and high to bot 0
value 3 goes to bot 1
bot 1 gives low to output 1 and high to bot 0
bot 0 gives low to output 2 and high to output 0
value 2 goes to bot 2");
assert_eq!(find_bot_that_compares(config.clone(), 5, 2), Some(2));
assert_eq!(find_bot_that_compares(config, 2, 5), Some(2));
} | rust_cleaned_test_functions.jsonl/62745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
38883,
70197,
18177,
5403,
368,
341,
10217,
2193,
284,
4715,
5898,
445,
957,
220,
20,
5780,
311,
10924,
220,
17,
198,
6331,
220,
17,
6696,
3347,
311,
10924,
220,
16,
323,
1550,
311,
10924... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_bogus_instruction() {
// Attempt to assign with no accounts
let instruction = SystemInstruction::Assign {
owner: solana_sdk::pubkey::new_rand(),
};
let data = serialize(&instruction).unwrap();
let result = process_instruction(&system_program::id(), vec![], &data);
assert_eq!(result, Err(InstructionError::NotEnoughAccountKeys));
let from = solana_sdk::pubkey::new_rand();
let from_account = AccountSharedData::new_ref(100, 0, &system_program::id());
// Attempt to transfer with no destination
let instruction = SystemInstruction::Transfer { lamports: 0 };
let data = serialize(&instruction).unwrap();
let result = process_instruction(
&system_program::id(),
vec![KeyedAccount::new(&from, true, &from_account)],
&data,
);
assert_eq!(result, Err(InstructionError::NotEnoughAccountKeys));
} | rust_cleaned_test_functions.jsonl/73050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
880,
538,
355,
54923,
368,
341,
286,
442,
43517,
311,
9793,
448,
902,
9618,
198,
286,
1077,
7600,
284,
739,
16664,
486,
28933,
341,
310,
6372,
25,
2048,
3362,
61783,
486,
9585,
792,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_winner() {
let mut game = Game::new(n!("player1").into(), n!("player2").into());
assert_eq!(game.winner, EMPTY);
game.make_move(0, 0);
assert_eq!(game.winner, EMPTY);
game.make_move(1, 0);
assert_eq!(game.winner, EMPTY);
game.make_move(0, 1);
assert_eq!(game.winner, EMPTY);
game.make_move(1, 1);
assert_eq!(game.winner, EMPTY);
game.make_move(0, 2);
assert_eq!(game.winner, HOST);
} | rust_cleaned_test_functions.jsonl/43532 | {
"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,
92588,
368,
341,
286,
1077,
5206,
1809,
284,
4050,
486,
931,
1445,
17223,
3434,
16,
1827,
18122,
1507,
308,
17223,
3434,
17,
1827,
18122,
1423,
286,
2060,
10714,
10297,
5804,
1418,
4382,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_basic_1() {
let engine = new_sample_engine();
let mut getter = new_multi_point_getter(&engine, 200.into());
// Get a deleted key
must_get_none(&mut getter, b"foo1");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 0, 0);
// Get again
must_get_none(&mut getter, b"foo1");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 0, 0);
// Get a key that exists
must_get_value(&mut getter, b"foo2", b"foo2v");
let s = getter.take_statistics();
// We have to check every version
assert_seek_next_prev(&s.write, 1, 40, 0);
// Get again
must_get_value(&mut getter, b"foo2", b"foo2v");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 40, 0);
// Get a smaller key
must_get_none(&mut getter, b"foo1");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 0, 0);
// Get a key that does not exist
must_get_none(&mut getter, b"z");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 0, 0);
// Get a key that exists
must_get_value(&mut getter, b"zz", b"zzv");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 0, 0);
// Get again
must_get_value(&mut getter, b"zz", b"zzv");
let s = getter.take_statistics();
assert_seek_next_prev(&s.write, 1, 0, 0);
} | rust_cleaned_test_functions.jsonl/32891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 752
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
34729,
62,
16,
368,
341,
286,
1077,
4712,
284,
501,
17491,
24823,
1428,
286,
1077,
5206,
33429,
284,
501,
25133,
6085,
3062,
465,
2099,
8512,
11,
220,
17,
15,
15,
39860,
5231,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cpx_imm() {
let mut r = Register::new();
r.set_X(0x40);
cpx_imm(0x50, &mut r);
assert_eq!(r.get_status_negative(), true);
assert_eq!(r.get_status_carry(), false)
} | rust_cleaned_test_functions.jsonl/14203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
1767,
71370,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
435,
980,
6859,
7,
15,
87,
19,
15,
317,
262,
272,
1767,
71370,
7,
15,
87,
20,
15,
11,
609,
6984,
435,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
create_branch(repo_path, "test").unwrap();
assert!(checkout_branch(repo_path, "refs/heads/test").is_ok());
assert!(
checkout_branch(repo_path, "refs/heads/master").is_ok()
);
assert!(checkout_branch(repo_path, "refs/heads/test").is_ok());
} | rust_cleaned_test_functions.jsonl/96506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
284,
3704,
5357,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_side_metadata_atomic_fetch_add_sub_ge8bits() {
serial_test(|| {
let data_addr = vm_layout_constants::HEAP_START;
let metadata_1_spec = SideMetadataSpec {
scope: SideMetadataScope::Global,
offset: 0,
log_num_of_bits: 4,
log_min_obj_size: constants::LOG_BYTES_IN_WORD as usize,
};
let metadata_2_spec = SideMetadataSpec {
scope: SideMetadataScope::Global,
offset: helpers::meta_bytes_per_chunk(
metadata_1_spec.log_min_obj_size,
metadata_1_spec.log_num_of_bits,
),
log_num_of_bits: 3,
log_min_obj_size: 7,
};
assert!(try_map_metadata_space(
data_addr,
constants::BYTES_IN_PAGE,
helpers::meta_bytes_per_chunk(
metadata_2_spec.log_min_obj_size,
metadata_2_spec.log_num_of_bits
) + helpers::meta_bytes_per_chunk(
metadata_1_spec.log_min_obj_size,
metadata_1_spec.log_num_of_bits
),
0
));
let zero = fetch_add_atomic(metadata_1_spec, data_addr, 5);
assert_eq!(zero, 0);
let five = load_atomic(metadata_1_spec, data_addr);
assert_eq!(five, 5);
let zero = fetch_add_atomic(metadata_2_spec, data_addr, 5);
assert_eq!(zero, 0);
let five = load_atomic(metadata_2_spec, data_addr);
assert_eq!(five, 5);
let another_five = fetch_sub_atomic(metadata_1_spec, data_addr, 2);
assert_eq!(another_five, 5);
let three = load_atomic(metadata_1_spec, data_addr);
assert_eq!(three, 3);
let another_five = fetch_sub_atomic(metadata_2_spec, data_addr, 2);
assert_eq!(another_five, 5);
let three = load_atomic(metadata_2_spec, data_addr);
assert_eq!(three, 3);
ensure_munmap_metadata_chunk(
data_addr,
helpers::meta_bytes_per_chunk(
metadata_2_spec.log_min_obj_size,
metadata_2_spec.log_num_of_bits,
) + helpers::meta_bytes_per_chunk(
metadata_1_spec.log_min_obj_size,
metadata_1_spec.log_num_of_bits,
),
0,
);
})
} | rust_cleaned_test_functions.jsonl/134485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30862,
22220,
51367,
11803,
2891,
5228,
32933,
23,
11516,
368,
341,
286,
6146,
4452,
79453,
341,
310,
1077,
821,
7387,
284,
10995,
14466,
55642,
486,
1799,
2537,
13044,
401,
310,
1077,
11160,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_make_inspect_loggable() {
let (inspector, mut node) = inspector_and_list_node();
let obj = make_inspect_loggable!(k1: "1", k2: 2i64, k3: "3");
inspect_log!(node, some_key: obj);
let point = Some((10i64, 50i64));
inspect_log!(node, point?: point.map(|(x, y)| make_inspect_loggable!({
x: x,
y: y,
})));
assert_data_tree!(inspector, root: {
list_node: {
"0": {
"@time": AnyProperty,
some_key: { k1: "1", k2: 2i64, k3: "3" },
},
"1": {
"@time": AnyProperty,
point: { x: 10i64, y: 50i64 },
},
}
});
} | rust_cleaned_test_functions.jsonl/96867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
34386,
987,
5224,
35034,
368,
341,
286,
1077,
320,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
1428,
286,
1077,
2839,
284,
1281,
34386,
987,
5224,
35034,
10297,
74,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_trim_2_args() {
let test_cases = vec![
(None, None, None),
(Some("x"), None, None),
(None, Some("x"), None),
(Some("xxx"), Some("x"), Some("")),
(Some("xxxbarxxx"), Some("x"), Some("bar")),
(Some("xxxbarxxx"), Some("xx"), Some("xbarx")),
(Some("xyxybarxyxy"), Some("xy"), Some("bar")),
(Some("xyxybarxyxyx"), Some("xy"), Some("barxyxyx")),
(Some("xyxy"), Some("xy"), Some("")),
(Some("xyxyx"), Some("xy"), Some("x")),
(Some(" bar "), Some(""), Some(" bar ")),
(Some(""), Some("x"), Some("")),
(Some("张三和张三"), Some("张三"), Some("和")),
(Some("xxxbarxxxxx"), Some("x"), Some("bar")),
];
for (arg, pat, expect) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg.map(|s| s.as_bytes().to_vec()))
.push_param(pat.map(|s| s.as_bytes().to_vec()))
.evaluate(ScalarFuncSig::Trim2Args)
.unwrap();
assert_eq!(output, expect.map(|s| s.as_bytes().to_vec()));
}
let invalid_utf8_cases = vec![
(
Some(b" \xF0 Hello \x90 World \x80 ".to_vec()),
Some(b" ".to_vec()),
Some(b"\xF0 Hello \x90 World \x80".to_vec()),
),
(
Some(b"xy\xF0 Hello \x90 World \x80 ".to_vec()),
Some(b"xy".to_vec()),
Some(b"\xF0 Hello \x90 World \x80 ".to_vec()),
),
(
Some(b"\xF0 Hello \x90 World \x80 ".to_vec()),
Some(b"\xF0".to_vec()),
Some(b" Hello \x90 World \x80 ".to_vec()),
),
];
for (arg, pat, expected) in invalid_utf8_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.push_param(pat)
.evaluate(ScalarFuncSig::Trim2Args)
.unwrap();
assert_eq!(output, expected);
}
} | rust_cleaned_test_functions.jsonl/60532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
62,
17,
8384,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
11,
2240,
1326,
310,
320,
8373,
445,
87,
3975,
2240,
11,
2240,
1326,
310,
320,
4064,
11,
4329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_with_two_integers() {
let data = vec![0x82, 0x01, 0x02];
let parsed: ParsedArray<super::ParsedArraySize2> =
ParsedArray::deserialize_data(&data).expect("Failed to parse");
assert_eq!(parsed.raw_values(), vec![vec![0x01], vec![0x02]]);
assert_eq!(parsed.get::<u8>(0).unwrap(), 1);
assert_eq!(parsed.get::<u8>(1).unwrap(), 2);
assert_eq!(parsed.tag(), None);
let serialized = parsed.serialize_data().expect("Failed to serialize");
assert_eq!(serialized, data);
} | rust_cleaned_test_functions.jsonl/10819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
6615,
23241,
4042,
67592,
368,
341,
286,
1077,
821,
284,
7486,
20703,
15,
87,
23,
17,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
935,
286,
1077,
15676,
25,
393,
18112,
1857,
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_i2c_mock_mode_err() {
let expectations = [Transaction::read(0xaa, vec![10, 12])];
let mut i2c = Mock::new(&expectations);
i2c.write(0xaa, &vec![10, 12]).unwrap();
i2c.done();
} | rust_cleaned_test_functions.jsonl/49258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
17,
66,
34134,
7302,
9266,
368,
341,
286,
1077,
16665,
284,
508,
8070,
486,
878,
7,
15,
43300,
11,
7486,
20703,
16,
15,
11,
220,
16,
17,
2467,
935,
286,
1077,
5206,
600,
17,
66,
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_squeeze_blank_before_numbering() {
for same_param in vec!["-s", "--squeeze-blank"] {
new_ucmd!()
.args(&[same_param, "-n", "-"])
.pipe_in("a\n\n\nb")
.succeeds()
.stdout_only(" 1\ta\n 2\t\n 3\tb");
}
} | rust_cleaned_test_functions.jsonl/90941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
19340,
56103,
23708,
5500,
287,
368,
341,
262,
369,
1852,
4090,
304,
7486,
0,
1183,
12,
82,
497,
14482,
51913,
16278,
1180,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
2116,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decode_bomful_invalid_utf8_as_windows_1257_to_cow() {
let (cow, encoding, had_errors) =
WINDOWS_1257.decode(b"\xEF\xBB\xBF\xE2\x82\xAC\x80\xC3\xA4");
match cow {
Cow::Borrowed(_) => unreachable!(),
Cow::Owned(s) => {
assert_eq!(s, "\u{20AC}\u{FFFD}\u{00E4}");
}
}
assert_eq!(encoding, UTF_8);
assert!(had_errors);
} | rust_cleaned_test_functions.jsonl/90248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
880,
316,
1262,
31433,
39453,
23,
11898,
58220,
62,
16,
17,
20,
22,
2346,
666,
363,
368,
341,
286,
1077,
320,
18921,
11,
11170,
11,
1030,
20196,
8,
4035,
310,
75165,
62,
16,
17,
20,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enabled() {
match parse_response(b"* ENABLED QRESYNC X-GOOD-IDEA\r\n") {
Ok((_, capabilities)) => assert_eq!(
capabilities,
Response::Capabilities(vec![
Capability::Atom("QRESYNC"),
Capability::Atom("X-GOOD-IDEA"),
])
),
rsp => panic!("Unexpected response: {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/24544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18220,
368,
341,
262,
2432,
4715,
9655,
1883,
61593,
33240,
35,
1207,
7012,
71401,
1599,
12010,
55250,
12,
12146,
32,
12016,
1699,
899,
341,
286,
7622,
1188,
6878,
16928,
593,
589,
2060,
10714,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_ok() {
let input = &["a = ", "a="];
let expected_state = ParseState::Expression;
let expected_binding = ApplyMode::After;
let ctx = &Ctx::empty();
for input in input {
let result = Assign.parse(input, &ctx, ParseState::Expression);
assert!(result.is_ok(), "input = {}", input);
let MacroParse {
result: _,
mode,
state_after,
} = result.unwrap();
assert_eq!(state_after, expected_state);
assert_eq!(mode, expected_binding);
}
} | rust_cleaned_test_functions.jsonl/14380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19817,
368,
341,
286,
1077,
1946,
284,
609,
1183,
64,
284,
3670,
330,
64,
428,
935,
286,
1077,
3601,
4387,
284,
14775,
1397,
486,
9595,
280,
286,
1077,
3601,
60815,
284,
20552,
3636,
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_json_as_uint() {
// no clip to zero
let cs: Vec<(Json, u64, Option<i32>)> = vec![
(Json::Double(-1.0), -1.0f64 as i64 as u64, None),
(Json::String(String::from("10")), 10, None),
(
Json::String(String::from("+10abc")),
10,
Some(ERR_TRUNCATE_WRONG_VALUE),
),
(
Json::String(String::from("9999999999999999999999999")),
u64::MAX,
Some(ERR_DATA_OUT_OF_RANGE),
),
(
Json::Double(2f64 * (u64::MAX as f64)),
u64::MAX,
Some(ERR_DATA_OUT_OF_RANGE),
),
];
for (input, expect, error_code) in cs {
let mut ctx = make_ctx_about_overflow_truncate_should_clip_to_zero(true, true, false);
let r = cast_json_as_uint(&mut ctx, &Some(input.clone()));
let r = r.map(|x| x.map(|x| x as u64));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_warning(&ctx, error_code, log.as_str());
}
// should clip to zero
let cs: Vec<(Json, u64, Option<i32>)> = vec![
(Json::Double(-1.0), 0, None),
(
Json::String(String::from("-10")),
0,
Some(ERR_DATA_OUT_OF_RANGE),
),
(Json::String(String::from("10")), 10, None),
(
Json::String(String::from("+10abc")),
10,
Some(ERR_TRUNCATE_WRONG_VALUE),
),
(
Json::String(String::from("9999999999999999999999999")),
u64::MAX,
Some(ERR_DATA_OUT_OF_RANGE),
),
(
Json::Double(2f64 * (u64::MAX as f64)),
u64::MAX,
Some(ERR_DATA_OUT_OF_RANGE),
),
];
for (input, expect, err_code) in cs {
let mut ctx = make_ctx_about_overflow_truncate_should_clip_to_zero(true, true, true);
let r = cast_json_as_uint(&mut ctx, &Some(input.clone()));
let r = r.map(|x| x.map(|x| x as u64));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_warning(&ctx, err_code, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
15807,
368,
341,
286,
442,
902,
12327,
311,
7168,
198,
286,
1077,
10532,
25,
11312,
28706,
5014,
11,
575,
21,
19,
11,
6959,
21897,
18,
17,
9231,
29,
284,
7486,
90515,
3374,
310,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_digest_message() {
// TODO
const EXAMPLE_CBOR_DATA: &str =
"885501fd1d0f4dfcd7e99afcb99a8326b7dc459d32c6285501b882619d46558f3d9e316d11b48dcf211327025a0144000186a0430009c4430061a80040";
let message_digest = get_digest(&decode(EXAMPLE_CBOR_DATA.as_bytes()).unwrap()).unwrap();
assert_eq!(
encode(message_digest),
"5a51287d2e5401b75014da0f050c8db96fe0bacdad75fce964520ca063b697e1"
);
} | rust_cleaned_test_functions.jsonl/48750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52994,
6462,
368,
341,
286,
442,
5343,
198,
286,
733,
66246,
48933,
868,
7896,
25,
609,
495,
4035,
310,
330,
23,
23,
20,
20,
15,
16,
6902,
16,
67,
15,
69,
19,
2940,
4385,
22,
68,
24,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_profile() {
let base_path = PathBuf::from("/tmp/data");
let last_offset_file = PathBuf::from("consumer2.offset");
let profile_path = get_base_dir().join(PROFILE_MIN);
let profile_file = Config::load(&profile_path);
if let Err(err) = &profile_file {
println!("{:?}", err);
};
assert!(profile_file.is_ok());
let expected = Profile {
data: Data {
base_path: base_path.clone(),
last_offset_file: base_path.join(last_offset_file.clone()),
},
database: Database {
ip_or_host: "localhost".to_owned(),
user: "root".to_owned(),
port: None,
password: None,
},
filters: None,
fluvio: None,
};
let profile = profile_file.as_ref().unwrap().profile();
assert_eq!(profile, &expected);
assert_eq!(
profile.last_offset_file(),
&base_path.join(last_offset_file)
);
assert_eq!(profile.ip_or_host(), Some("localhost".to_owned()));
assert_eq!(profile.port(), 3306);
assert_eq!(profile.user(), Some("root".to_owned()));
assert_eq!(profile.password(), None);
assert_eq!(profile.topic(), DEFAULT_TOPIC.to_owned());
} | rust_cleaned_test_functions.jsonl/99224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
13789,
368,
341,
286,
1077,
2331,
2638,
284,
7933,
15064,
486,
1499,
4283,
5173,
13167,
797,
286,
1077,
1537,
6917,
2458,
284,
7933,
15064,
486,
1499,
445,
46764,
17,
14760,
797,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stakes_multiple_stakers() {
let stakes_cache = StakesCache::new(Stakes {
epoch: 4,
..Stakes::default()
});
let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) =
create_staked_node_accounts(10);
let (stake_pubkey2, stake_account2) = create_stake_account(10, &vote_pubkey);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
// delegates to vote_pubkey
stakes_cache.check_and_store(&stake_pubkey, &stake_account);
stakes_cache.check_and_store(&stake_pubkey2, &stake_account2);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 20);
}
} | rust_cleaned_test_functions.jsonl/22039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
2050,
45233,
1261,
8312,
368,
341,
286,
1077,
44425,
11529,
284,
794,
2050,
8233,
486,
931,
7,
623,
2050,
341,
310,
16342,
25,
220,
19,
345,
310,
5241,
623,
2050,
486,
2258,
741,
286,
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... | 1 |
#[test]
fn test_field_name_to_tag_name() {
let cases = [
["item_id", "ItemID"],
[
"classified_ad_pay_per_lead_fee",
"ClassifiedAdPayPerLeadFee",
],
];
for pair in cases.into_iter() {
assert_eq!(field_name_to_tag_name(pair[0]), pair[1])
}
} | rust_cleaned_test_functions.jsonl/72054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
1269,
2346,
9372,
1269,
368,
341,
220,
1077,
5048,
284,
2278,
262,
4383,
1203,
842,
497,
330,
1234,
915,
8097,
262,
2278,
414,
330,
64874,
10027,
28925,
5678,
87052,
34305,
756,
414,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stop_ap_no_ifaces() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
let test_values = test_setup(&mut exec);
// Create an empty PhyManager and IfaceManager.
let phy_manager = phy_manager::PhyManager::new(
test_values.device_service_proxy.clone(),
test_values.node,
);
let mut iface_manager = IfaceManagerService::new(
Arc::new(Mutex::new(phy_manager)),
test_values.client_update_sender,
test_values.ap_update_sender,
test_values.device_service_proxy,
test_values.saved_networks,
);
let fut =
iface_manager.stop_ap(TEST_SSID.as_bytes().to_vec(), TEST_PASSWORD.as_bytes().to_vec());
pin_mut!(fut);
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(Ok(())));
} | rust_cleaned_test_functions.jsonl/62716 | {
"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,
19039,
21093,
6536,
11119,
2434,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,
284,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_fee_with_fundee_update_add_htlc() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let logger = test_utils::TestLogger::new();
// balancing
send_payment(&nodes[0], &vec!(&nodes[1])[..], 8000000);
{
let mut feerate_lock = chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
*feerate_lock += 20;
}
nodes[0].node.timer_tick_occurred();
check_added_monitors!(nodes[0], 1);
let events_0 = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events_0.len(), 1);
let (update_msg, commitment_signed) = match events_0[0] {
MessageSendEvent::UpdateHTLCs { node_id:_, updates: msgs::CommitmentUpdate { update_add_htlcs:_, update_fulfill_htlcs:_, update_fail_htlcs:_, update_fail_malformed_htlcs:_, ref update_fee, ref commitment_signed } } => {
(update_fee.as_ref(), commitment_signed)
},
_ => panic!("Unexpected event"),
};
nodes[1].node.handle_update_fee(&nodes[0].node.get_our_node_id(), update_msg.unwrap());
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), commitment_signed);
let (revoke_msg, commitment_signed) = get_revoke_commit_msgs!(nodes[1], nodes[0].node.get_our_node_id());
check_added_monitors!(nodes[1], 1);
let (our_payment_preimage, our_payment_hash, our_payment_secret) = get_payment_preimage_hash!(nodes[0]);
let net_graph_msg_handler = &nodes[1].net_graph_msg_handler;
let route = get_route(&nodes[1].node.get_our_node_id(), &net_graph_msg_handler.network_graph, &nodes[0].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &Vec::new(), 800000, TEST_FINAL_CLTV, &logger).unwrap();
// nothing happens since node[1] is in AwaitingRemoteRevoke
nodes[1].node.send_payment(&route, our_payment_hash, &Some(our_payment_secret)).unwrap();
{
let mut added_monitors = nodes[0].chain_monitor.added_monitors.lock().unwrap();
assert_eq!(added_monitors.len(), 0);
added_monitors.clear();
}
assert!(nodes[0].node.get_and_clear_pending_events().is_empty());
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
// node[1] has nothing to do
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &revoke_msg);
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
check_added_monitors!(nodes[0], 1);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &commitment_signed);
let revoke_msg = get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, nodes[1].node.get_our_node_id());
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &revoke_msg);
check_added_monitors!(nodes[1], 1);
// AwaitingRemoteRevoke ends here
let commitment_update = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
assert_eq!(commitment_update.update_add_htlcs.len(), 1);
assert_eq!(commitment_update.update_fulfill_htlcs.len(), 0);
assert_eq!(commitment_update.update_fail_htlcs.len(), 0);
assert_eq!(commitment_update.update_fail_malformed_htlcs.len(), 0);
assert_eq!(commitment_update.update_fee.is_none(), true);
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &commitment_update.update_add_htlcs[0]);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &commitment_update.commitment_signed);
check_added_monitors!(nodes[0], 1);
let (revoke, commitment_signed) = get_revoke_commit_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &revoke);
check_added_monitors!(nodes[1], 1);
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &commitment_signed);
check_added_monitors!(nodes[1], 1);
let revoke = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &revoke);
check_added_monitors!(nodes[0], 1);
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
expect_pending_htlcs_forwardable!(nodes[0]);
let events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
match events[0] {
Event::PaymentReceived { .. } => { },
_ => panic!("Unexpected event"),
};
claim_payment(&nodes[1], &vec!(&nodes[0])[..], our_payment_preimage);
send_payment(&nodes[1], &vec!(&nodes[0])[..], 800000);
send_payment(&nodes[0], &vec!(&nodes[1])[..], 800000);
close_channel(&nodes[0], &nodes[1], &chan.2, chan.3, true);
check_closed_event!(nodes[0], 1, ClosureReason::CooperativeClosure);
check_closed_event!(nodes[1], 1, ClosureReason::CooperativeClosure);
} | rust_cleaned_test_functions.jsonl/16866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2025
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
34305,
6615,
761,
1241,
2127,
8882,
2891,
49086,
17257,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_text_rs() {
test_in_db("strings", |conn| {
let result = conn
.query("SELECT text_rs('hello world!')", &[])
.expect("query failed");
assert_eq!(result.len(), 1);
let row = result.get(0);
let col: String = row.get(0);
assert_eq!(&col, "hello world!");
});
} | rust_cleaned_test_functions.jsonl/34714 | {
"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,
4326,
47115,
368,
341,
262,
1273,
1243,
8685,
445,
18594,
497,
760,
5148,
91,
341,
286,
1077,
1102,
284,
4534,
198,
310,
659,
1631,
445,
4858,
1467,
47115,
492,
14990,
1879,
0,
863,
497,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negatives() {
assert!(Decimal::try_from("-1").is_some());
assert_eq!(decimal("0") - decimal("1"), decimal("-1"));
assert_eq!(decimal("5.5") + decimal("-6.5"), decimal("-1"));
} | rust_cleaned_test_functions.jsonl/58123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
5859,
368,
341,
262,
2060,
10297,
11269,
486,
1539,
5673,
13645,
16,
1827,
285,
61855,
1423,
262,
2060,
10714,
10297,
23289,
445,
15,
899,
481,
12122,
445,
16,
3975,
12122,
13645,
16,
4010,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fvm_version_invalid() {
let header_invalid_magic = FvmHeader {
magic: FVM_MAGIC,
version: 123,
pslice_count: 1,
slice_size: FVM_BLOCK_SIZE,
fvm_partition_size: FVM_BLOCK_SIZE,
vpartition_table_size: FVM_BLOCK_SIZE,
allocation_table_size: FVM_BLOCK_SIZE,
generation: 0,
hash: vec![0u8; GPT_GUID_LEN],
};
let fvm_bytes = bincode::serialize(&header_invalid_magic).unwrap();
let mut reader = FvmReader::new(fvm_bytes);
let result = reader.parse();
assert_eq!(
result.unwrap_err().downcast::<FvmError>().unwrap(),
FvmError::UnsupportedVersion
);
} | rust_cleaned_test_functions.jsonl/67406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
7338,
9438,
31433,
368,
341,
286,
1077,
4247,
31433,
54612,
284,
434,
7338,
4047,
341,
310,
10963,
25,
434,
11187,
49194,
345,
310,
2319,
25,
220,
16,
17,
18,
345,
310,
4726,
4754,
3180,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_fixed_point_mul() {
run_test(|| {
let currency = Token(DOT);
let tests: Vec<(Amount<Test>, UnsignedFixedPoint, Amount<Test>)> = vec![
(
Amount::new(1 * 10u128.pow(8), currency), // 1 BTC
UnsignedFixedPoint::checked_from_rational(1, 2).unwrap(),
Amount::new(50000000, currency),
),
(
Amount::new(50000000, currency), // 0.5 BTC
UnsignedFixedPoint::checked_from_rational(5, 100).unwrap(),
Amount::new(2500000, currency),
),
(
Amount::new(25000000, currency), // 0.25 BTC
UnsignedFixedPoint::checked_from_rational(5, 1000).unwrap(),
Amount::new(125000, currency),
),
(
Amount::new(12500000, currency), // 0.125 BTC
UnsignedFixedPoint::checked_from_rational(5, 100000).unwrap(),
Amount::new(625, currency),
),
(
Amount::new(1 * 10u128.pow(10), currency), // 1 DOT
UnsignedFixedPoint::checked_from_rational(1, 10).unwrap(),
Amount::new(1000000000, currency),
),
];
for (amount, percent, expected) in tests {
let actual = amount.checked_fixed_point_mul(&percent).unwrap();
assert_eq!(actual, expected);
}
})
} | rust_cleaned_test_functions.jsonl/110275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 889
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
37839,
6085,
24944,
368,
341,
262,
1598,
4452,
79453,
341,
286,
1077,
11413,
284,
9660,
5432,
1793,
317,
286,
1077,
7032,
25,
11312,
28706,
10093,
71273,
8066,
97747,
13520,
2609,
11,
25783,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ref() {
let anyof: &AnyOf<MyTrait> = &AnyOf::new(MyStruct1(1i32));
assert_eq!(anyof.get(), 1i32);
assert_eq!(anyof.downcast_ref::<MyStruct1>(), Some(&MyStruct1(1i32)));
assert_eq!(anyof.downcast_ref::<MyStruct2>(), None);
let anyof: &AnyOf<MyTrait> = &AnyOf::new(MyStruct2(1i32));
assert_eq!(anyof.get(), 2i32);
assert_eq!(anyof.downcast_ref::<MyStruct1>(), None);
assert_eq!(anyof.downcast_ref::<MyStruct2>(), Some(&MyStruct2(1i32)));
} | rust_cleaned_test_functions.jsonl/66296 | {
"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,
7793,
368,
341,
286,
1077,
894,
1055,
25,
609,
8610,
2124,
79333,
49257,
29,
284,
609,
8610,
2124,
486,
931,
37485,
9422,
16,
7,
16,
72,
18,
17,
1106,
286,
2060,
10714,
10297,
3767,
1055,
670,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_rev_states_json_empty() {
init!("ledger");
// empty vector
assert_eq!(build_rev_states_json(Vec::new().as_mut()).unwrap(), "{}".to_string());
// no rev_reg_id
let cred1 = CredInfo {
requested_attr: "height_1".to_string(),
referent: LICENCE_CRED_ID.to_string(),
schema_id: SCHEMA_ID.to_string(),
cred_def_id: CRED_DEF_ID.to_string(),
rev_reg_id: None,
cred_rev_id: Some(CRED_REV_ID.to_string()),
tails_file: Some(get_temp_dir_path(Some(TEST_TAILS_FILE)).to_str().unwrap().to_string()),
revocation_interval: None,
timestamp: None,
};
assert_eq!(build_rev_states_json(vec![cred1].as_mut()).unwrap(), "{}".to_string());
} | rust_cleaned_test_functions.jsonl/106032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
38082,
22972,
9455,
15124,
368,
341,
286,
2930,
17223,
50704,
3071,
286,
442,
4287,
4621,
198,
286,
2060,
10714,
10297,
5834,
38082,
22972,
9455,
49923,
486,
931,
1005,
300,
29523,
6011,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sys_no_proxy() {
// Stop other threads from modifying process-global ENV while we are.
let _lock = ENVLOCK.lock();
// save system setting first.
let _g1 = env_guard("HTTP_PROXY");
let _g2 = env_guard("NO_PROXY");
let target = "http://example.domain/";
env::set_var("HTTP_PROXY", target);
env::set_var("NO_PROXY", ",");
// Manually construct this so we aren't use the cache
let mut p = Proxy::new(Intercept::System(Arc::new(get_sys_proxies(None))));
p.no_proxy = NoProxy::new();
assert_eq!(intercepted_uri(&p, "http://hyper.rs"), target);
// reset user setting when guards drop
drop(_g1);
drop(_g2);
// Let other threads run now
drop(_lock);
} | rust_cleaned_test_functions.jsonl/6816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
20344,
6536,
29712,
368,
341,
286,
442,
14215,
1008,
14564,
504,
46041,
1882,
73319,
32791,
1393,
582,
525,
624,
286,
1077,
716,
1023,
284,
32791,
8044,
21003,
543,
286,
442,
3581,
1849,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_muldiv() {
assert_eq!(mul_div_i64( 1_000_000_000_001, 1_000_000_000, 1_000_000),
1_000_000_000_001_000);
assert_eq!(mul_div_i64(-1_000_000_000_001, 1_000_000_000, 1_000_000),
-1_000_000_000_001_000);
assert_eq!(mul_div_i64(-1_000_000_000_001,-1_000_000_000, 1_000_000),
1_000_000_000_001_000);
assert_eq!(mul_div_i64( 1_000_000_000_001, 1_000_000_000,-1_000_000),
-1_000_000_000_001_000);
assert_eq!(mul_div_i64( 1_000_000_000_001,-1_000_000_000,-1_000_000),
1_000_000_000_001_000);
} | rust_cleaned_test_functions.jsonl/131788 | {
"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,
24944,
611,
368,
341,
286,
2060,
10714,
10297,
24160,
16237,
5318,
21,
19,
7,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
16,
11,
220,
16,
62,
15,
15,
15,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sky130_pdk_layers() -> Result<(), Box<dyn std::error::Error>> {
let pdk = super::super::pdk()?;
let _ = pdk.diff();
let _ = pdk.poly();
let _ = pdk.npc();
let _ = pdk.nwell();
let _ = pdk.licon1();
let _ = pdk.li1();
let _ = pdk.met1();
let _ = pdk.via();
let _ = pdk.met2();
let _ = pdk.via2();
let _ = pdk.met3();
Ok(())
} | rust_cleaned_test_functions.jsonl/111919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
7891,
16,
18,
15,
620,
7584,
26091,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
1077,
281,
7584,
284,
2256,
486,
9522,
486,
79,
7584,
94136,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ban_delete_message_days() {
assert!(ban_delete_message_days(0));
assert!(ban_delete_message_days(1));
assert!(ban_delete_message_days(7));
assert!(!ban_delete_message_days(8));
} | rust_cleaned_test_functions.jsonl/29937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
276,
11353,
6462,
28353,
368,
341,
286,
2060,
10297,
6850,
11353,
6462,
28353,
7,
15,
1106,
286,
2060,
10297,
6850,
11353,
6462,
28353,
7,
16,
1106,
286,
2060,
10297,
6850,
11353,
6462,
28353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_assembler_case_correctness_string_literals() {
// String literals are case sensitive
test_case(&["DAT \"Aa\""], &[0x0041, 0x0061]);
test_case(&["Dat \"Aa\""], &[0x0041, 0x0061]);
} | rust_cleaned_test_functions.jsonl/44775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
35401,
19096,
31550,
2090,
3904,
49643,
368,
341,
262,
442,
923,
75275,
525,
1142,
16216,
198,
262,
1273,
19096,
2099,
1183,
47892,
7245,
32,
64,
2105,
7914,
44590,
15,
87,
15,
15,
19,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_lonely_vertices()
{
let mut mesh = MeshBuilder::new().subdivided_triangle().build().unwrap();
let mut iter = mesh.face_iter();
let face_id1 = iter.next().unwrap();
let face_id2 = iter.next().unwrap();
mesh.remove_face_unsafe(face_id1);
mesh.remove_face_unsafe(face_id2);
mesh.remove_lonely_primitives();
assert_eq!(3, mesh.no_vertices());
assert_eq!(6, mesh.no_halfedges());
assert_eq!(1, mesh.no_faces());
mesh.is_valid().unwrap();
} | rust_cleaned_test_functions.jsonl/88710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
57688,
974,
37720,
741,
262,
341,
286,
1077,
5206,
11294,
284,
25122,
3297,
486,
931,
1005,
1966,
611,
4490,
70575,
1005,
5834,
1005,
15454,
543,
286,
1077,
5206,
5367,
284,
11294,
46031,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_vote_lockouts_no_epoch_stakes() {
let accounts = gen_stakes(&[(1, &[0])]);
let epoch_stakes = EpochStakes::new_for_tests(2);
let tower = Tower::new(epoch_stakes, 0, 0.67);
let ancestors = vec![(1, vec![0].into_iter().collect()), (0, HashSet::new())]
.into_iter()
.collect();
let staked_lockouts = tower.collect_vote_lockouts(1, accounts.into_iter(), &ancestors);
assert!(staked_lockouts.is_empty());
assert_eq!(tower.epoch_stakes.total_staked, 2);
} | rust_cleaned_test_functions.jsonl/113926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
54360,
9818,
11672,
6536,
20682,
1261,
2050,
368,
341,
286,
1077,
9618,
284,
4081,
1261,
2050,
2099,
9697,
16,
11,
44590,
15,
2467,
2558,
286,
1077,
16342,
1261,
2050,
284,
87379,
623,
2050... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_and_iterator() {
let mut cnt = 0;
let mut vec1 = BitVec::with_capacity(0);
let mut vec2 = BitVec::with_capacity(0);
let mut vec3 = BitVec::with_capacity(0);
let mut vec5 = BitVec::with_capacity(0);
let size = 2333;
for i in 0..size {
vec1.push(true);
vec2.push(i % 2 == 0);
vec3.push(i % 3 == 0);
vec5.push(i % 5 == 0);
}
for (idx, i) in BitAndIterator::new(&[&vec1, &vec2, &vec3, &vec5], size).enumerate() {
assert_eq!(i, idx % 30 == 0);
cnt += 1;
}
assert_eq!(cnt, size);
} | rust_cleaned_test_functions.jsonl/59464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
8378,
13491,
368,
341,
286,
1077,
5206,
13195,
284,
220,
15,
280,
286,
1077,
5206,
7486,
16,
284,
6495,
10050,
486,
4197,
35603,
7,
15,
317,
286,
1077,
5206,
7486,
17,
284,
6495,
10050,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_adjacently_a_ser() {
let v = EnumStructAdjacently::VariantA {
foo: 1,
bar: 2,
different: Inner::Foo,
};
let e = "(type:\"VariantA\",content:(foo:1,bar:2,different:Foo,),)";
test_ser(&v, e);
} | rust_cleaned_test_functions.jsonl/110471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42559,
580,
4402,
4306,
75861,
368,
341,
262,
1077,
348,
284,
14086,
9422,
54866,
580,
4402,
486,
20746,
32,
341,
286,
15229,
25,
220,
16,
345,
286,
3619,
25,
220,
17,
345,
286,
2155,
25,
3635... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_end_training_selected_participant_no_success_run_selection() {
let fl_settings = FederatedLearningSettings {
rounds: 1,
participants_ratio: 1.0,
min_clients: 15,
heartbeat_timeout: 15,
};
let mut protocol = Protocol::new(fl_settings);
let client_id = ClientId::new();
protocol.counters = Counters {
waiting: 6,
selected: 2,
done: 5,
done_and_inactive: 3,
ignored: 2,
};
protocol.end_training(client_id, false, ClientState::Selected);
let counters = protocol.counters();
let expected = Counters {
waiting: 6,
selected: 1,
done: 5,
done_and_inactive: 3,
ignored: 3,
};
assert_eq!(counters, expected);
assert_eq!(
protocol.next_event().unwrap(),
Event::SetState(client_id, ClientState::Ignored)
);
assert_eq!(protocol.next_event().unwrap(), Event::RunSelection(6));
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6213,
32891,
23755,
10495,
21757,
6536,
18632,
14007,
23672,
368,
341,
286,
1077,
1320,
10853,
284,
21099,
657,
47467,
6086,
341,
310,
19531,
25,
220,
16,
345,
310,
13026,
19917,
25,
220,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_proxy() {
let mut runtime = JsRuntime::new(RuntimeOptions::default());
let all_true: v8::Global<v8::Value> = runtime
.execute_script(
"is_proxy.js",
r#"
(function () {
const { isProxy } = Deno.core;
const o = { a: 1, b: 2};
const p = new Proxy(o, {});
return isProxy(p) && !isProxy(o) && !isProxy(42);
})()
"#,
)
.unwrap();
let mut scope = runtime.handle_scope();
let all_true = v8::Local::<v8::Value>::new(&mut scope, &all_true);
assert!(all_true.is_true());
} | rust_cleaned_test_functions.jsonl/27012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
29712,
368,
341,
262,
1077,
5206,
15592,
284,
39122,
15123,
486,
931,
52610,
3798,
486,
2258,
1423,
262,
1077,
678,
16082,
25,
348,
23,
486,
11646,
39297,
23,
486,
1130,
29,
284,
15592,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generator() {
let generator = JubJubAffine::prime_subgroup_generator();
assert!(generator.is_on_curve());
assert!(generator.is_in_correct_subgroup_assuming_on_curve());
} | rust_cleaned_test_functions.jsonl/76305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25813,
368,
341,
262,
1077,
13823,
284,
79280,
41,
392,
25841,
482,
486,
32338,
5228,
4074,
25813,
543,
262,
2060,
10297,
35851,
2079,
4470,
43407,
1423,
262,
2060,
10297,
35851,
2079,
1243,
31550,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iterate_no_roots() {
let mut tables = TableCollection::new(100.).unwrap();
tables.build_index().unwrap();
let treeseq = tables.tree_sequence(TreeSequenceFlags::default()).unwrap();
let mut tree_iter = treeseq.tree_iterator(TreeFlags::default()).unwrap();
while let Some(tree) = tree_iter.next() {
let mut num_roots = 0;
for _ in tree.roots() {
num_roots += 1;
}
assert_eq!(num_roots, 0);
}
} | rust_cleaned_test_functions.jsonl/23025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
6536,
26608,
2412,
368,
341,
286,
1077,
5206,
12632,
284,
6633,
6482,
486,
931,
7,
16,
15,
15,
35334,
15454,
543,
286,
12632,
13239,
3560,
1005,
15454,
543,
286,
1077,
4258,
2367,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_navigation_push() {
let mut state = BrowserState::new();
assert_eq!(*state.current_screen(), ScreenName::Home);
assert_eq!(state.count(), 1);
let new_screen = ScreenName::Artist("some_id".to_string());
state.update_with(BrowserAction::NavigationPush(new_screen.clone()));
assert_eq!(state.current_screen(), &new_screen);
assert_eq!(state.count(), 2);
assert_eq!(state.artist_state("some_id").is_some(), true);
} | rust_cleaned_test_functions.jsonl/32246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58051,
14218,
368,
341,
286,
1077,
5206,
1584,
284,
16482,
1397,
486,
931,
1428,
286,
2060,
10714,
0,
4071,
2454,
4952,
17649,
1507,
13948,
675,
486,
7623,
317,
286,
2060,
10714,
10297,
2454,
6501... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_oct_int() {
let cases = vec![
(
Datum::I64(-1),
Datum::Bytes(b"1777777777777777777777".to_vec()),
),
(Datum::I64(0), Datum::Bytes(b"0".to_vec())),
(Datum::I64(1), Datum::Bytes(b"1".to_vec())),
(Datum::I64(8), Datum::Bytes(b"10".to_vec())),
(Datum::I64(12), Datum::Bytes(b"14".to_vec())),
(Datum::I64(20), Datum::Bytes(b"24".to_vec())),
(Datum::I64(100), Datum::Bytes(b"144".to_vec())),
(Datum::I64(1024), Datum::Bytes(b"2000".to_vec())),
(Datum::I64(2048), Datum::Bytes(b"4000".to_vec())),
(
Datum::I64(i64::MAX),
Datum::Bytes(b"777777777777777777777".to_vec()),
),
(
Datum::I64(i64::MIN),
Datum::Bytes(b"1000000000000000000000".to_vec()),
),
(Datum::Null, Datum::Null),
];
let mut ctx = EvalContext::default();
for (input, exp) in cases {
let input = datum_expr(input);
let op = scalar_func_expr(ScalarFuncSig::OctInt, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/44106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 799
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70135,
4042,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
68459,
486,
40,
21,
19,
4080,
16,
1326,
394,
68459,
486,
7078,
1883,
1,
16,
22,
22,
22,
22,
22,
22,
22,
22,
22,
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_to_bytes() {
let mut bv = Bitv::from_elem(3, true);
bv.set(1, false);
assert_eq!(bv.to_bytes(), vec!(0b10100000));
let mut bv = Bitv::from_elem(9, false);
bv.set(2, true);
bv.set(8, true);
assert_eq!(bv.to_bytes(), vec!(0b00100000, 0b10000000));
} | rust_cleaned_test_functions.jsonl/119287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
12524,
368,
341,
286,
1077,
5206,
56937,
284,
6495,
85,
486,
1499,
28179,
7,
18,
11,
830,
317,
286,
56937,
980,
7,
16,
11,
895,
317,
286,
2060,
10714,
10297,
54929,
2389,
12524,
1507,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_substitute_parameters_error() {
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| -> () {
let input_type = py.get_type::<BasisRotationInputWrapper>();
let input = input_type
.call1((3, false))
.unwrap()
.cast_as::<PyCell<BasisRotationInputWrapper>>()
.unwrap();
let tmp_vec: Vec<usize> = Vec::new();
let _ = input
.call_method1("add_pauli_product", ("ro", tmp_vec))
.unwrap();
let _ = input
.call_method1("add_pauli_product", ("ro", vec![0]))
.unwrap();
let _ = input
.call_method1("add_pauli_product", ("ro", vec![0, 1]))
.unwrap();
let mut circs: Vec<CircuitWrapper> = Vec::new();
circs.push(CircuitWrapper::new());
let mut circ1 = CircuitWrapper::new();
circ1.internal += roqoqo::operations::RotateX::new(0, "theta".into());
circs.push(circ1);
let br_type = py.get_type::<BasisRotationWrapper>();
let br = br_type
.call1((Some(CircuitWrapper::new()), circs.clone(), input))
.unwrap()
.cast_as::<PyCell<BasisRotationWrapper>>()
.unwrap();
let map: HashMap<String, f64> = HashMap::<String, f64>::new();
let br_sub = br.call_method1("substitute_parameters", (map,));
assert!(br_sub.is_err());
})
} | rust_cleaned_test_functions.jsonl/5786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 736
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
7660,
18263,
4096,
368,
341,
262,
4510,
78,
18,
486,
13609,
74179,
769,
878,
291,
55869,
1428,
262,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
1464,
1719,
341,
286,
1077,
1946,
1819,
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_modified_asolute() {
let te = TestEnv::new(&[], &["15mar2018", "30dec2017"]);
change_file_modified(te.test_root().join("15mar2018"), "2018-03-15T12:00:00Z");
change_file_modified(te.test_root().join("30dec2017"), "2017-12-30T23:59:00Z");
te.assert_output(
&["", "--change-newer-than", "2018-01-01 00:00:00"],
"15mar2018",
);
te.assert_output(
&["", "--changed-before", "2018-01-01 00:00:00"],
"30dec2017",
);
} | rust_cleaned_test_functions.jsonl/10896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37749,
11898,
6268,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
2099,
12995,
609,
1183,
16,
20,
5612,
17,
15,
16,
23,
497,
330,
18,
15,
8169,
17,
15,
16,
22,
15049,
262,
2297,
245... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_directory_chain_allocation() {
let (format, mut d64) = get_fresh_d64();
let start = Location(format.directory_track, 1);
let (blocks_allocated, disk_full) = allocate_chain(&mut d64, None, Some(start));
println!(
"blocks allocated: {} disk_full={:?}",
blocks_allocated, disk_full
);
println!("BAM: {:?}", d64.bam());
assert!(disk_full);
assert_eq!(blocks_allocated, REMAINING_DIRECTORY_BLOCKS);
} | rust_cleaned_test_functions.jsonl/9181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14846,
30583,
81267,
368,
341,
286,
1077,
320,
2243,
11,
5206,
294,
21,
19,
8,
284,
633,
761,
2488,
814,
21,
19,
543,
286,
1077,
1191,
284,
9866,
20698,
59937,
28545,
11,
220,
16,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unblock_multi_16() {
new_ucmd!()
.args(&["conv=unblock", "cbs=16"])
.pipe_in_fixture("dd-unblock-cbs16.test")
.succeeds()
.stdout_is_fixture_bytes("dd-unblock-cbs16.spec");
} | rust_cleaned_test_functions.jsonl/99845 | {
"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,
4907,
4574,
25133,
62,
16,
21,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12027,
28,
359,
4574,
497,
330,
66,
1279,
28,
16,
21,
14108,
286,
659,
13768,
1243,
74409,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mars_move_forward_over_scent() {
// Given mars
let mut m = Mars::new(Coordinate::new(5, 5));
// And rover on edge
let r1 = Rover::new(Coordinate::new(5, 5), Orientation::N);
// When rover moves off map
let _ignore = m.move_rover(r1, Instructions::F);
// Then next time rover moves off map last postion returned
let r2 = Rover::new(Coordinate::new(5, 5), Orientation::N);
let actual = m.move_rover(r2, Instructions::F).unwrap();
assert_eq!(actual, Rover::new(Coordinate::new(5, 5), Orientation::N));
// And even if move repeated
let r3 = Rover::new(Coordinate::new(5, 5), Orientation::N);
let actual = m.move_rover(r3, Instructions::F).unwrap();
assert_eq!(actual, Rover::new(Coordinate::new(5, 5), Orientation::N));
} | rust_cleaned_test_functions.jsonl/107064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
1561,
17134,
32121,
15431,
643,
1168,
368,
341,
286,
442,
16246,
47349,
198,
286,
1077,
5206,
296,
284,
21048,
486,
931,
3025,
78,
8730,
486,
931,
7,
20,
11,
220,
20,
1106,
286,
442,
1597... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extern_crate() {
assert!(is_extern_crate("extern crate "));
assert!(is_extern_crate("pub extern crate abc"));
assert!(!is_extern_crate("pub extern crat"));
} | rust_cleaned_test_functions.jsonl/578 | {
"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,
6892,
62,
4301,
666,
7698,
368,
341,
262,
2060,
10297,
285,
62,
4301,
666,
7698,
445,
4301,
17717,
60240,
262,
2060,
10297,
285,
62,
4301,
666,
7698,
445,
9585,
15637,
17717,
39022,
4010,
262,
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 |
#[test]
fn test_plan_build_ignores_workspace_crates() {
let mut settings = dummy_raze_settings();
settings.genmode = GenMode::Vendored;
let planner = BuildPlannerImpl::new(
dummy_workspace_crate_metadata(templates::BASIC_METADATA),
settings,
);
let planned_build_res = planner.plan_build(Some(PlatformDetails::new(
"some_target_triple".to_owned(),
Vec::new(), /* attrs */
)));
assert!(planned_build_res.unwrap().crate_contexts.is_empty());
} | rust_cleaned_test_functions.jsonl/31789 | {
"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,
26564,
20801,
62,
622,
4589,
75560,
32331,
973,
368,
341,
262,
1077,
5206,
5003,
284,
17292,
59969,
2986,
10853,
543,
262,
5003,
22822,
8516,
284,
9316,
3636,
486,
53,
408,
3018,
401,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq() {
let a = U32(123456);
let b = U32(123456);
assert_eq!(U32::declassify(a.comp_eq(b)), u32::max_value());
let b = U32(123457);
assert_eq!(U32::declassify(a.comp_eq(b)), 0);
} | rust_cleaned_test_functions.jsonl/112389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
262,
1077,
264,
284,
547,
18,
17,
7,
16,
17,
18,
19,
20,
21,
317,
262,
1077,
293,
284,
547,
18,
17,
7,
16,
17,
18,
19,
20,
21,
317,
262,
2060,
10714,
10297,
52,
18,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tuples() {
check_round_trip(vec![('x', (), false, 0.5f32)]);
check_round_trip(vec![(9i8, 10u16, 1.5f64)]);
check_round_trip(vec![(-12i16, 11u8, 12usize)]);
check_round_trip(vec![(1234567isize, 100000000000000u64, 99999999999999i64)]);
check_round_trip(vec![(String::new(), "some string".to_string())]);
} | rust_cleaned_test_functions.jsonl/24201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
89269,
368,
341,
262,
1779,
29896,
63883,
25592,
20703,
492,
87,
516,
38104,
895,
11,
220,
15,
13,
20,
69,
18,
17,
41958,
262,
1779,
29896,
63883,
25592,
0,
9697,
24,
72,
23,
11,
220,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decompiler() {
use std::fs::{self};
let mut data_path = env::current_dir().unwrap();
data_path.push("test_data");
//let mut success = 0;
//let mut skipped = 0;
for entry in fs::read_dir(data_path).expect("Error reading test_data directory.") {
let cur_entry = entry.unwrap().path();
if cur_entry.extension().unwrap() != "ppe" {
continue;
}
let file_name = cur_entry.as_os_str();
println!("File: {}...", cur_entry.file_name().unwrap().to_str().unwrap());
let d = crate::decompiler::decompile(file_name.to_str().unwrap(), false, false);
let source_file = cur_entry.with_extension("pps");
let orig_text = fs::read_to_string(source_file).unwrap();
let are_equal = is_match(&d.to_string(), &orig_text);
if are_equal {
//success += 1;
} else {
println!("'{}' not matched…", cur_entry.file_name().unwrap().to_str().unwrap());
print!("{}", d);
println!("-----");
print!("{}", orig_text);
}
assert!(are_equal);
}
// }
} | rust_cleaned_test_functions.jsonl/114787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 661
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
33620,
368,
341,
286,
990,
1460,
486,
3848,
22964,
721,
2315,
286,
1077,
5206,
821,
2638,
284,
6105,
486,
3231,
4334,
1005,
15454,
543,
286,
821,
2638,
2552,
445,
1944,
1769,
797,
286,
442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pubsub_new() {
let pubsub_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0);
let exit = Arc::new(AtomicBool::new(false));
let max_complete_transaction_status_slot = Arc::new(AtomicU64::default());
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new_for_tests(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
max_complete_transaction_status_slot,
bank_forks,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests())),
optimistically_confirmed_bank,
));
let (_trigger, pubsub_service) =
PubSubService::new(PubSubConfig::default(), &subscriptions, pubsub_addr);
let thread = pubsub_service.thread_hdl.thread();
assert_eq!(thread.name().unwrap(), "paychains-pubsub");
} | rust_cleaned_test_functions.jsonl/94188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
1966,
5921,
368,
341,
286,
1077,
6675,
1966,
7387,
284,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
15,
11,
220,
15,
11,
220,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_node_step() {
let l = default_logger();
for msg_t in MessageType::values() {
let mut raw_node = new_raw_node(1, vec![1], 10, 1, new_storage(), &l);
let res = raw_node.step(new_message(0, 0, *msg_t, 0));
// local msg should be ignored.
if vec![
MessageType::MsgBeat,
MessageType::MsgHup,
MessageType::MsgUnreachable,
MessageType::MsgSnapStatus,
]
.contains(&msg_t)
{
assert_eq!(res, Err(Error::StepLocalMsg));
}
}
} | rust_cleaned_test_functions.jsonl/89564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
11946,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
369,
3750,
528,
304,
62336,
486,
3661,
368,
341,
286,
1077,
5206,
7112,
5084,
284,
501,
16067,
5084,
7,
16,
11,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_at_end_of_script() {
let mut ctx = EvalPtr::new("123");
assert!(!ctx.at_end_of_script());
let mut ctx = EvalPtr::new("");
assert!(ctx.at_end_of_script());
let mut ctx = EvalPtr::new("]");
assert!(!ctx.at_end_of_script());
ctx.set_bracket_term(true);
assert!(ctx.at_end_of_script());
} | rust_cleaned_test_functions.jsonl/58901 | {
"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,
3752,
6213,
3575,
14660,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
5348,
486,
931,
445,
16,
17,
18,
797,
286,
2060,
0,
3471,
3773,
6847,
6213,
3575,
14660,
5231,
286,
1077,
5206,
5635,
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_request_from_stream() {
let test_data = b"GET /testpath?foo=bar HTTP/1.1\r\nHost: localhost\r\n\r\n";
let mut stream = MockStream::with_data(VecDeque::from_iter(test_data.iter().cloned()));
let request = Request::from_stream(&mut stream, "1.2.3.4:5678".parse().unwrap());
let request = request.unwrap();
let expected_uri: String = "/testpath".into();
let expected_query: String = "foo=bar".into();
assert_eq!(request.method, Method::Get);
assert_eq!(request.uri, expected_uri);
assert_eq!(request.query, expected_query);
assert_eq!(request.version, "HTTP/1.1");
assert_eq!(request.content, None);
assert_eq!(request.address, Address::new("1.2.3.4:5678").unwrap());
let mut expected_headers: Headers = Headers::new();
expected_headers.add(HeaderType::Host, "localhost");
assert_eq!(request.headers, expected_headers);
} | rust_cleaned_test_functions.jsonl/77693 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
5673,
12673,
368,
341,
262,
1077,
1273,
1769,
284,
293,
1,
3806,
608,
1944,
2343,
30,
7975,
28,
2257,
10130,
14,
16,
13,
16,
12016,
1699,
9296,
25,
47422,
12016,
1699,
12016,
1699,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_authorize_and_withdraw() {
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let test_validator =
TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr), SocketAddrSpace::Unspecified);
let rpc_client =
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
let default_signer = Keypair::new();
let mut config = CliConfig::recent_for_tests();
config.json_rpc_url = test_validator.rpc_url();
config.signers = vec![&default_signer];
request_and_confirm_airdrop(&rpc_client, &config, &config.signers[0].pubkey(), 100_000)
.unwrap();
// Create vote account
let vote_account_keypair = Keypair::new();
let vote_account_pubkey = vote_account_keypair.pubkey();
config.signers = vec![&default_signer, &vote_account_keypair];
config.command = CliCommand::CreateVoteAccount {
vote_account: 1,
seed: None,
identity_account: 0,
authorized_voter: None,
authorized_withdrawer: config.signers[0].pubkey(),
commission: 0,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
};
process_command(&config).unwrap();
let vote_account = rpc_client
.get_account(&vote_account_keypair.pubkey())
.unwrap();
let vote_state: VoteStateVersions = vote_account.state().unwrap();
let authorized_withdrawer = vote_state.convert_to_current().authorized_withdrawer;
assert_eq!(authorized_withdrawer, config.signers[0].pubkey());
let expected_balance = rpc_client
.get_minimum_balance_for_rent_exemption(VoteState::size_of())
.unwrap()
.max(1);
check_recent_balance(expected_balance, &rpc_client, &vote_account_pubkey);
// Transfer in some more RENEC
config.signers = vec![&default_signer];
config.command = CliCommand::Transfer {
amount: SpendAmount::Some(1_000),
to: vote_account_pubkey,
from: 0,
sign_only: false,
dump_transaction_message: false,
allow_unfunded_recipient: true,
no_wait: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
derived_address_seed: None,
derived_address_program_id: None,
};
process_command(&config).unwrap();
let expected_balance = expected_balance + 1_000;
check_recent_balance(expected_balance, &rpc_client, &vote_account_pubkey);
// Authorize vote account withdrawal to another signer
let first_withdraw_authority = Keypair::new();
config.signers = vec![&default_signer];
config.command = CliCommand::VoteAuthorize {
vote_account_pubkey,
new_authorized_pubkey: first_withdraw_authority.pubkey(),
vote_authorize: VoteAuthorize::Withdrawer,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
authorized: 0,
new_authorized: None,
};
process_command(&config).unwrap();
let vote_account = rpc_client
.get_account(&vote_account_keypair.pubkey())
.unwrap();
let vote_state: VoteStateVersions = vote_account.state().unwrap();
let authorized_withdrawer = vote_state.convert_to_current().authorized_withdrawer;
assert_eq!(authorized_withdrawer, first_withdraw_authority.pubkey());
// Authorize vote account withdrawal to another signer with checked instruction
let withdraw_authority = Keypair::new();
config.signers = vec![&default_signer, &first_withdraw_authority];
config.command = CliCommand::VoteAuthorize {
vote_account_pubkey,
new_authorized_pubkey: withdraw_authority.pubkey(),
vote_authorize: VoteAuthorize::Withdrawer,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
authorized: 1,
new_authorized: Some(1),
};
process_command(&config).unwrap_err(); // unsigned by new authority should fail
config.signers = vec![
&default_signer,
&first_withdraw_authority,
&withdraw_authority,
];
config.command = CliCommand::VoteAuthorize {
vote_account_pubkey,
new_authorized_pubkey: withdraw_authority.pubkey(),
vote_authorize: VoteAuthorize::Withdrawer,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
authorized: 1,
new_authorized: Some(2),
};
process_command(&config).unwrap();
let vote_account = rpc_client
.get_account(&vote_account_keypair.pubkey())
.unwrap();
let vote_state: VoteStateVersions = vote_account.state().unwrap();
let authorized_withdrawer = vote_state.convert_to_current().authorized_withdrawer;
assert_eq!(authorized_withdrawer, withdraw_authority.pubkey());
// Withdraw from vote account
let destination_account = solana_sdk::pubkey::new_rand(); // Send withdrawal to new account to make balance check easy
config.signers = vec![&default_signer, &withdraw_authority];
config.command = CliCommand::WithdrawFromVoteAccount {
vote_account_pubkey,
withdraw_authority: 1,
withdraw_amount: SpendAmount::Some(100),
destination_account_pubkey: destination_account,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
};
process_command(&config).unwrap();
check_recent_balance(expected_balance - 100, &rpc_client, &vote_account_pubkey);
check_recent_balance(100, &rpc_client, &destination_account);
// Re-assign validator identity
let new_identity_keypair = Keypair::new();
config.signers.push(&new_identity_keypair);
config.command = CliCommand::VoteUpdateValidator {
vote_account_pubkey,
new_identity_account: 2,
withdraw_authority: 1,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
};
process_command(&config).unwrap();
} | rust_cleaned_test_functions.jsonl/103532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2908
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
22938,
551,
8378,
6615,
7633,
368,
341,
262,
1077,
28337,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
28337,
34014,
792,
284,
28337,
3097,
12670,
47773,
792,
543,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_del_slice() {
Python::with_gil(|py| {
let list = PyList::new(py, &[1, 1, 2, 3, 5, 8]);
list.del_slice(1, 4).unwrap();
assert_eq!([1, 5, 8], list.extract::<[i32; 3]>().unwrap());
list.del_slice(1, 100).unwrap();
assert_eq!([1], list.extract::<[i32; 1]>().unwrap());
});
} | rust_cleaned_test_functions.jsonl/108647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
18029,
26488,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
16,
11,
220,
16,
11,
220,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice() {
// Test fixed length vector.
let vec_fixed = [1, 2, 3, 4];
let v_a = vec_fixed[1..vec_fixed.len()].to_vec();
assert_eq!(v_a.len(), 3);
assert_eq!(v_a[0], 2);
assert_eq!(v_a[1], 3);
assert_eq!(v_a[2], 4);
// Test on stack.
let vec_stack: &[_] = &[1, 2, 3];
let v_b = vec_stack[1..3].to_vec();
assert_eq!(v_b.len(), 2);
assert_eq!(v_b[0], 2);
assert_eq!(v_b[1], 3);
// Test `Box<[T]>`
let vec_unique = vec![1, 2, 3, 4, 5, 6];
let v_d = vec_unique[1..6].to_vec();
assert_eq!(v_d.len(), 5);
assert_eq!(v_d[0], 2);
assert_eq!(v_d[1], 3);
assert_eq!(v_d[2], 4);
assert_eq!(v_d[3], 5);
assert_eq!(v_d[4], 6);
} | rust_cleaned_test_functions.jsonl/12856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
368,
341,
262,
442,
3393,
8356,
3084,
4621,
624,
262,
1077,
7486,
37839,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
348,
4306,
284,
7486,
37839,
58,
16,
496,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmd_dove_call_with_type() {
let project_name = "project_call_with_type";
let project_folder = new_demo_project(project_name).unwrap();
for call in [
vec!["call", "with_type<u8>(1)"],
vec!["call", "with_type(1)", "-t", "u8"],
vec!["call", "with_type", "-a", "1", "-t", "u8"],
] {
dove(&call, &project_folder).unwrap();
}
delete_project(&project_folder).unwrap();
} | rust_cleaned_test_functions.jsonl/70406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
814,
994,
13429,
6615,
1819,
368,
341,
262,
1077,
2390,
1269,
284,
330,
4987,
13429,
6615,
1819,
876,
262,
1077,
2390,
15268,
284,
501,
47830,
16352,
21168,
1269,
568,
15454,
1428,
262,
369... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_50limit_250offset_paging_response() {
let test_paging_response = get_response_paging_info(50, 250, TEST_LINK, 1000);
let generated_paging_response = create_test_paging_response(50, 250, 300, 200, 950);
assert_eq!(test_paging_response, generated_paging_response);
} | rust_cleaned_test_functions.jsonl/18447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
20,
15,
9506,
62,
17,
20,
15,
3176,
620,
4118,
9655,
368,
341,
1789,
286,
1077,
1273,
620,
4118,
9655,
284,
633,
9655,
620,
4118,
3109,
7,
20,
15,
11,
220,
17,
20,
15,
11,
13602,
26147... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conversion() {
let url_str = "https://user:password@iron.com:8080/path?q=wow#fragment";
let url = Url::parse(url_str).unwrap();
// Convert to a generic URL and check fidelity.
let raw_url: ::url::Url = url.clone().into();
assert_eq!(::url::Url::parse(url_str).unwrap(), raw_url);
// Convert back to an Iron URL and check fidelity.
let new_url = Url::from_generic_url(raw_url).unwrap();
assert_eq!(url, new_url);
} | rust_cleaned_test_functions.jsonl/80270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64132,
368,
341,
286,
1077,
2515,
2895,
284,
330,
2428,
1110,
872,
25,
3833,
31,
2475,
905,
25,
23,
15,
23,
15,
50976,
43782,
28,
57454,
2,
42202,
876,
286,
1077,
2515,
284,
22840,
486,
6400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solve_second() {
let input: HashMap<u32, u32> = [(0, 3), (1, 2), (4, 4), (6, 4)].iter().cloned().collect();
assert_eq!(solve_second(&input), 10);
} | rust_cleaned_test_functions.jsonl/76140 | {
"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,
86246,
29644,
368,
341,
286,
1077,
1946,
25,
10528,
34837,
18,
17,
11,
575,
18,
17,
29,
284,
17826,
15,
11,
220,
18,
701,
320,
16,
11,
220,
17,
701,
320,
19,
11,
220,
19,
701,
320,
21,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_only_semiglobal() {
let x = b"TTTT";
let y = b"AAAA";
let score = |a: u8, b: u8| if a == b { 1i32 } else { -3i32 };
let mut aligner = Aligner::new(-5, -1, &score);
let alignment = aligner.semiglobal(x, y);
assert_eq!(alignment.operations, [Ins, Ins, Ins, Ins]);
} | rust_cleaned_test_functions.jsonl/16848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
18410,
30442,
343,
2042,
368,
341,
286,
1077,
856,
284,
293,
1,
14903,
14903,
876,
286,
1077,
379,
284,
293,
1,
25699,
3302,
286,
1077,
5456,
284,
760,
64,
25,
575,
23,
11,
293,
25,
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... | 2 |
#[test]
fn test_get_log_topics() {
assert_eq!(LOG0.log_topics(), Some(0));
assert_eq!(LOG2.log_topics(), Some(2));
assert_eq!(LOG4.log_topics(), Some(4));
} | rust_cleaned_test_functions.jsonl/43366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5224,
64358,
368,
341,
197,
6948,
10714,
10297,
7243,
15,
1665,
64358,
1507,
4329,
7,
15,
1106,
197,
6948,
10714,
10297,
7243,
17,
1665,
64358,
1507,
4329,
7,
17,
1106,
197,
6948,
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 |
#[test]
fn test_filter() {
let passed_events = Rc::new(Cell::new(0));
frp::new_network! { network
source <- source::<bool>();
filtered <- source.filter(|&value| value);
eval filtered ([passed_events](&value) {
assert!(value);
passed_events.set(passed_events.get() + 1);
});
};
let input = &[false, true, true, false, false];
for val in input {
source.emit(*val);
}
let true_count = input.iter().filter(|&&val| val).count();
assert_eq!(passed_events.get(), true_count);
} | rust_cleaned_test_functions.jsonl/98537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
368,
341,
286,
1077,
5823,
19691,
284,
81463,
486,
931,
82530,
486,
931,
7,
15,
1106,
286,
1422,
79,
486,
931,
20966,
0,
314,
3922,
198,
310,
2530,
256,
9119,
2530,
27638,
2641,
3913,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_binary_search_recurse() {
let mut seg = Seg::new(10, || 0);
assert_eq!(seg.reduce(0, 10), 0);
seg.set(5, 10);
let is_ok = &|sum: &usize| *sum < 10;
assert_eq!(
seg.max_right_recurse(is_ok, 0),
5
);
assert_eq!(
seg.max_right_recurse(is_ok, 10),
10
);
assert_eq!(
seg.max_right_recurse(is_ok, 5),
5
);
assert_eq!(
seg.max_right_recurse(is_ok, 6),
10
);
assert_eq!(
seg.min_left_recurse(is_ok, 10),
6
);
assert_eq!(
seg.min_left_recurse(is_ok, 5),
0
);
assert_eq!(
seg.min_left_recurse(is_ok, 6),
6
);
} | rust_cleaned_test_functions.jsonl/38815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
10716,
1288,
2352,
325,
368,
972,
310,
1077,
5206,
4810,
284,
17209,
486,
931,
7,
16,
15,
11,
1369,
220,
15,
736,
310,
2060,
10714,
10297,
14607,
23792,
7,
15,
11,
220,
16,
15,
701,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_and_update_policy() {
new_test_ext().execute_with(|| {
let su_policy = super::types::Policy {
value: 150000,
unit: super::types::Unit::Gigabytes,
};
let nu_policy = super::types::Policy {
value: 1000,
unit: super::types::Unit::Gigabytes,
};
let cu_policy = super::types::Policy {
value: 300000,
unit: super::types::Unit::Gigabytes,
};
let ipu_policy = super::types::Policy {
value: 50000,
unit: super::types::Unit::Gigabytes,
};
let unique_name_policy = super::types::Policy {
value: 10000,
unit: super::types::Unit::Gigabytes,
};
let domain_name_policy = super::types::Policy {
value: 20000,
unit: super::types::Unit::Gigabytes,
};
let name = String::from("policy_1").as_bytes().to_vec();
TfgridModule::create_pricing_policy(
RawOrigin::Root.into(),
name.clone(),
su_policy.clone(),
cu_policy.clone(),
nu_policy.clone(),
ipu_policy.clone(),
unique_name_policy.clone(),
domain_name_policy.clone(),
bob(),
bob(),
)
.unwrap();
// get policy id
let policy_id = TfgridModule::pricing_policies_by_name_id(name.clone());
// Try updating policy with the same name
let updated_nu_policy = super::types::Policy {
value: 900,
unit: super::types::Unit::Gigabytes,
};
TfgridModule::update_pricing_policy(
RawOrigin::Root.into(),
policy_id.clone(),
name.clone(),
su_policy.clone(),
cu_policy.clone(),
updated_nu_policy.clone(),
ipu_policy.clone(),
unique_name_policy.clone(),
domain_name_policy.clone(),
bob(),
bob(),
)
.unwrap();
// Get policy and make sure it is updated
let policy = TfgridModule::pricing_policies(policy_id.clone());
assert_eq!(
policy.name.clone(),
name.clone(),
"policy name didn't match"
);
assert_eq!(policy.id.clone(), policy_id.clone());
assert_eq!(policy.nu, updated_nu_policy);
// test updating policy name
let new_name = String::from("policy_1_updated").as_bytes().to_vec();
let updated_su_policy = super::types::Policy {
value: 500,
unit: super::types::Unit::Gigabytes,
};
TfgridModule::update_pricing_policy(
RawOrigin::Root.into(),
policy_id.clone(),
new_name.clone(),
updated_su_policy.clone(),
cu_policy.clone(),
updated_nu_policy.clone(),
ipu_policy.clone(),
unique_name_policy.clone(),
domain_name_policy.clone(),
bob(),
bob(),
)
.unwrap();
let policy = TfgridModule::pricing_policies(policy_id.clone());
assert_eq!(
policy.name.clone(),
new_name.clone(),
"policy name didn't match"
);
assert_eq!(policy.id.clone(), policy_id.clone());
assert_eq!(policy.su, updated_su_policy);
// Test updating the name that conflicts with existing policy
let policy2_name = String::from("policy_2").as_bytes().to_vec();
TfgridModule::create_pricing_policy(
RawOrigin::Root.into(),
policy2_name.clone(),
su_policy.clone(),
cu_policy.clone(),
nu_policy.clone(),
ipu_policy.clone(),
unique_name_policy.clone(),
domain_name_policy.clone(),
bob(),
bob(),
)
.unwrap();
let policy2_id = TfgridModule::pricing_policies_by_name_id(policy2_name.clone());
//update name to existing name should fail
assert_noop!(
TfgridModule::update_pricing_policy(
RawOrigin::Root.into(),
policy2_id.clone(),
new_name.clone(),
updated_su_policy.clone(),
cu_policy.clone(),
updated_nu_policy.clone(),
ipu_policy.clone(),
unique_name_policy.clone(),
domain_name_policy.clone(),
bob(),
bob(),
),
Error::<TestRuntime>::PricingPolicyWithDifferentIdExists
);
});
} | rust_cleaned_test_functions.jsonl/35367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
8378,
8882,
22773,
368,
341,
262,
501,
4452,
9927,
1005,
10257,
6615,
79453,
341,
286,
1077,
913,
22773,
284,
2256,
486,
9242,
486,
13825,
341,
310,
897,
25,
220,
16,
20,
15,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_dkg_pool_filter_by_age() {
let mut pool = DkgPoolImpl::new(MetricsRegistry::new());
let now = current_time();
// 200 sec old
let msg = make_message(Height::from(1), node_test_id(1));
pool.validated.insert(
ic_crypto::crypto_hash(&msg),
ValidatedArtifact {
msg,
timestamp: now.sub(Duration::from_secs(200)),
},
);
// 100 sec old
let msg = make_message(Height::from(2), node_test_id(2));
pool.validated.insert(
ic_crypto::crypto_hash(&msg),
ValidatedArtifact {
msg,
timestamp: now.sub(Duration::from_secs(100)),
},
);
// 50 sec old
let msg = make_message(Height::from(3), node_test_id(3));
pool.validated.insert(
ic_crypto::crypto_hash(&msg),
ValidatedArtifact {
msg,
timestamp: now.sub(Duration::from_secs(50)),
},
);
// In future
let msg = make_message(Height::from(4), node_test_id(4));
pool.validated.insert(
ic_crypto::crypto_hash(&msg),
ValidatedArtifact {
msg,
timestamp: now.add(Duration::from_secs(50)),
},
);
assert_eq!(
pool.entries_older_than(now.sub(Duration::from_secs(300)))
.count(),
0
);
assert_eq!(
pool.entries_older_than(now.sub(Duration::from_secs(150)))
.count(),
1
);
assert_eq!(
pool.entries_older_than(now.sub(Duration::from_secs(75)))
.count(),
2
);
assert_eq!(
pool.entries_older_than(now.sub(Duration::from_secs(50)))
.count(),
3
);
assert_eq!(
pool.entries_older_than(now.add(Duration::from_secs(500)))
.count(),
4
);
} | rust_cleaned_test_functions.jsonl/96879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
7351,
15709,
8727,
3710,
32053,
368,
341,
286,
1077,
5206,
7314,
284,
422,
7351,
10551,
9673,
486,
931,
3189,
13468,
15603,
486,
931,
1423,
286,
1077,
1431,
284,
1482,
3009,
1428,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_secure_join_symlink() {
use std::os::unix::fs::symlink;
let tmp = create_temp_dir("root").unwrap();
let test_root_dir = tmp.path();
symlink("somepath", PathBuf::from(&test_root_dir).join("etc")).unwrap();
symlink(
"../../../../../../../../../../../../../etc",
PathBuf::from(&test_root_dir).join("longbacklink"),
)
.unwrap();
symlink(
"/../../../../../../../../../../../../../etc/passwd",
PathBuf::from(&test_root_dir).join("absolutelink"),
)
.unwrap();
assert_eq!(
secure_join(test_root_dir, PathBuf::from("etc").as_path()).unwrap(),
PathBuf::from(&test_root_dir).join("somepath")
);
assert_eq!(
secure_join(test_root_dir, PathBuf::from("longbacklink").as_path()).unwrap(),
PathBuf::from(&test_root_dir).join("somepath")
);
assert_eq!(
secure_join(test_root_dir, PathBuf::from("absolutelink").as_path()).unwrap(),
PathBuf::from(&test_root_dir).join("somepath/passwd")
);
} | rust_cleaned_test_functions.jsonl/51832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73088,
31017,
58530,
44243,
368,
341,
286,
990,
1460,
486,
436,
486,
56646,
486,
3848,
486,
22860,
44243,
401,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
2888,
1827,
15454,
543,
286,
1077,
1273... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_as_setted() {
let client: Box<dyn Setted<i64>> = Box::new(StatsdClient::from_sink("myapp", NopMetricSink));
client.set("some.set", 5).unwrap();
} | rust_cleaned_test_functions.jsonl/10630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
2602,
6565,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
2573,
6565,
21897,
21,
19,
2452,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
51567,
445,
2408,
676,
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 |
#[test]
fn test_unknown_long_tag() {
let bytes = hex!("9f 22 01 00");
let res = parse_ber(&bytes).expect("parsing failed");
assert!(res.0.is_empty());
assert_eq!(
res.1,
BerObject {
class: 2,
structured: 0,
tag: BerTag(0x22),
content: BerObjectContent::Unknown(BerTag(0x22), &bytes[3..])
}
);
} | rust_cleaned_test_functions.jsonl/73529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
17799,
9372,
368,
341,
262,
1077,
5820,
284,
12371,
17223,
24,
69,
220,
17,
17,
220,
15,
16,
220,
15,
15,
797,
262,
1077,
592,
284,
4715,
88165,
2099,
9651,
568,
17119,
445,
79,
28598,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u21_build_valid() {
test_valid::<U21>(r"\u{fa4e}","fa4e",token::EscapeStyle::U21);
} | rust_cleaned_test_functions.jsonl/35030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
17,
16,
20801,
8337,
368,
341,
286,
1273,
8337,
27638,
52,
17,
16,
2235,
81,
11934,
84,
90,
3632,
19,
68,
92,
2198,
3632,
19,
68,
497,
5839,
486,
48124,
2323,
486,
52,
17,
16,
317,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_i8() {
let mut vec = vec![];
for i in ::std::i8::MIN..::std::i8::MAX {
vec.push(i);
}
check_round_trip(vec);
} | rust_cleaned_test_functions.jsonl/24186 | {
"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,
5318,
23,
368,
341,
262,
1077,
5206,
7486,
284,
7486,
0,
15078,
262,
369,
600,
304,
3504,
1834,
486,
72,
23,
486,
16413,
496,
486,
1834,
486,
72,
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_sub() {
let rusage_a = Rusage::default();
let mut rusage_b = Rusage::default();
rusage_b.nvcsw += 1;
assert!(rusage_b.checked_sub(rusage_a).is_some());
let _ = rusage_b - rusage_a;
assert!(rusage_a.checked_sub(rusage_b).is_none());
} | rust_cleaned_test_functions.jsonl/117666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
341,
286,
1077,
435,
17698,
4306,
284,
431,
17698,
486,
2258,
543,
286,
1077,
5206,
435,
17698,
880,
284,
431,
17698,
486,
2258,
543,
286,
435,
17698,
880,
1253,
7362,
2280,
1421,
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_append() -> Result<()> {
let ignore_file_path = Path::new(".gitignore");
let file_path = Path::new("foo.txt");
let (_td, repo) = repo_init()?;
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
File::create(&root.join(file_path))?.write_all(b"test")?;
File::create(&root.join(ignore_file_path))?
.write_all(b"foo\n")?;
add_to_ignore(repo_path, file_path.to_str().unwrap())?;
let mut lines =
read_lines(&root.join(ignore_file_path)).unwrap();
assert_eq!(&lines.nth(1).unwrap().unwrap(), "foo.txt");
Ok(())
} | rust_cleaned_test_functions.jsonl/68778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
368,
1464,
5714,
71698,
341,
286,
1077,
10034,
2458,
2638,
284,
7933,
486,
931,
5680,
12882,
13130,
797,
286,
1077,
1034,
2638,
284,
7933,
486,
931,
445,
7975,
3909,
797,
286,
1077,
5453,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_override_fn_call_width_exceeds_max_width() {
let mut config = Config::default();
config.override_value("fn_call_width", "101");
assert_eq!(config.fn_call_width(), 100);
} | rust_cleaned_test_functions.jsonl/130658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48576,
15246,
13429,
7927,
2702,
4635,
82,
6345,
7927,
368,
341,
310,
1077,
5206,
2193,
284,
5532,
486,
2258,
543,
310,
2193,
96802,
3142,
445,
8822,
13429,
7927,
497,
330,
16,
15,
16,
797,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_upgrade() {
let resp = Response::build(StatusCode::OK)
.upgrade("websocket")
.finish();
assert!(resp.upgrade());
assert_eq!(
resp.headers().get(header::UPGRADE).unwrap(),
HeaderValue::from_static("websocket")
);
} | rust_cleaned_test_functions.jsonl/18835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67794,
368,
341,
286,
1077,
9039,
284,
5949,
486,
5834,
7,
15872,
486,
3925,
340,
310,
659,
44230,
445,
83208,
1138,
310,
659,
30150,
543,
286,
2060,
10297,
18243,
17652,
6937,
1423,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_zero() {
let mut de = TarsDecoder::from(&b"\x0c\x1c\x2c\x3c\x4c\x5c\xfc\xff\x9c\xac\xec"[..]);
let o0 = de.read_int8(128, false, 0).unwrap();
let o1 = de.read_int8(128, false, 13).unwrap();
let v0: u8 = de.read_uint8(0, true, 0).unwrap();
let v1: u16 = de.read_uint16(1, true, 0).unwrap();
let v2: u32 = de.read_uint32(2, true, 0).unwrap();
let v3: i8 = de.read_int8(3, true, 0).unwrap();
let v4: i16 = de.read_int16(4, true, 0).unwrap();
let v5: i32 = de.read_int32(5, true, 0).unwrap();
let v6: i64 = de.read_int64(255, true, 0).unwrap();
let v7: f32 = de.read_float(9, true, 0.0).unwrap();
let v8: f64 = de.read_double(10, true, 0.0).unwrap();
let v9: bool = de.read_boolean(14, true, false).unwrap();
assert_eq!(o0, 0);
assert_eq!(o1, 13);
assert_eq!(v0, 0);
assert_eq!(v1, 0);
assert_eq!(v2, 0);
assert_eq!(v3, 0);
assert_eq!(v4, 0);
assert_eq!(v5, 0);
assert_eq!(v6, 0);
assert_eq!(v7, 0.0);
assert_eq!(v8, 0.0);
assert_eq!(v9, false);
let err: Result<u32, DecodeErr> = de.read_uint32(129, true, 0);
assert_eq!(err, Err(DecodeErr::TarsTagNotFoundErr));
} | rust_cleaned_test_functions.jsonl/128472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 740
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
19359,
368,
341,
286,
1077,
5206,
409,
284,
350,
1561,
20732,
486,
1499,
2099,
65,
11934,
87,
15,
66,
3462,
16,
66,
3462,
17,
66,
3462,
18,
66,
3462,
19,
66,
3462,
20,
66,
3462,
8316,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_num_set_bits() {
let field = BooleanBitfield::from_bytes(INPUT);
assert_eq!(field.num_set_bits(), 2);
let field = BooleanBitfield::new();
assert_eq!(field.num_set_bits(), 0);
} | rust_cleaned_test_functions.jsonl/30473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
2602,
20034,
368,
341,
286,
1077,
2070,
284,
6992,
8344,
2566,
486,
1499,
12524,
57911,
317,
286,
2060,
10714,
10297,
2566,
10522,
2602,
20034,
1507,
220,
17,
626,
286,
1077,
2070,
284,
6992... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_map_axes_keep_dim() {
let x =
ndarray::Array::from_shape_vec((2, 3, 4, 5, 6), (0..2 * 3 * 4 * 5 * 6).collect()).unwrap();
let y = map_axes_keep_dim(&x, &[1, 3], |x| x.mean_axis(Axis(1)).unwrap());
assert_eq!(y.shape(), &[2, 1, 4, 1, 6]);
} | rust_cleaned_test_functions.jsonl/114647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
58394,
50293,
10791,
368,
341,
262,
1077,
856,
4035,
286,
66883,
486,
1857,
486,
1499,
13597,
13251,
1188,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
701,
320,
15,
496,
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_double() {
match Variant::VLong(5).multiply(Variant::VDouble(2.0)).unwrap() {
Variant::VDouble(result) => assert_eq!(result, 10.0),
_ => panic!("assertion failed"),
}
} | rust_cleaned_test_functions.jsonl/84599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
368,
341,
394,
2432,
39292,
486,
53,
6583,
7,
20,
568,
64648,
12410,
15341,
486,
53,
7378,
7,
17,
13,
15,
4579,
15454,
368,
341,
503,
39292,
486,
53,
7378,
4456,
8,
589,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_shadow_read_write_file() -> Result<()> {
let ts = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.context("Failed to get timestamp")?;
let tmpdir = std::env::temp_dir().join(format!("test_shadow_read_write_file_{:?}", ts));
std::fs::create_dir(&tmpdir).context("failed to create tmpdir")?;
let test_path = tmpdir.join("shadow");
let test_output_path = tmpdir.join("shadow_new");
test_mutate(
|content| {
std::fs::write(&test_path, &content).context("failed to write test file")?;
ShadowFile::from_file(&test_path).context("Failed to read test file")
},
|shadow_file| {
shadow_file
.write_to_file(&test_output_path)
.context("failed to write shadow file")?;
std::fs::read_to_string(&test_output_path)
.context("failed to reread the shadow file")
},
)
} | rust_cleaned_test_functions.jsonl/3935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53120,
6443,
9165,
2458,
368,
1464,
5714,
71698,
341,
286,
1077,
10591,
284,
739,
1462,
486,
3328,
741,
310,
659,
17021,
56262,
10407,
1462,
486,
99089,
2089,
69945,
340,
310,
659,
2147,
445,
9408... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check_signature_subscribe() {
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(100);
let bank = Bank::new_for_tests(&genesis_config);
let blockhash = bank.last_blockhash();
let mut bank_forks = BankForks::new(bank);
let alice = Keypair::new();
let past_bank_tx =
system_transaction::transfer(&mint_keypair, &alice.pubkey(), 1, blockhash);
let unprocessed_tx =
system_transaction::transfer(&mint_keypair, &alice.pubkey(), 2, blockhash);
let processed_tx =
system_transaction::transfer(&mint_keypair, &alice.pubkey(), 3, blockhash);
bank_forks
.get(0)
.unwrap()
.process_transaction(&past_bank_tx)
.unwrap();
let next_bank = Bank::new_from_parent(
&bank_forks.get(0).unwrap().clone(),
&solana_sdk::pubkey::new_rand(),
1,
);
bank_forks.insert(next_bank);
bank_forks
.get(1)
.unwrap()
.process_transaction(&processed_tx)
.unwrap();
let bank1 = bank_forks[1].clone();
let bank_forks = Arc::new(RwLock::new(bank_forks));
let mut cache0 = BlockCommitment::default();
cache0.increase_confirmation_stake(1, 10);
let cache1 = BlockCommitment::default();
let mut block_commitment = HashMap::new();
block_commitment.entry(0).or_insert(cache0);
block_commitment.entry(1).or_insert(cache1);
let block_commitment_cache = BlockCommitmentCache::new(
block_commitment,
10,
CommitmentSlots {
slot: bank1.slot(),
..CommitmentSlots::default()
},
);
let exit = Arc::new(AtomicBool::new(false));
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
bank_forks,
Arc::new(RwLock::new(block_commitment_cache)),
optimistically_confirmed_bank,
));
let (past_bank_rpc1, mut past_bank_receiver1) =
rpc_pubsub_service::test_connection(&subscriptions);
let (past_bank_rpc2, mut past_bank_receiver2) =
rpc_pubsub_service::test_connection(&subscriptions);
let (processed_rpc, mut processed_receiver) =
rpc_pubsub_service::test_connection(&subscriptions);
let (another_rpc, _another_receiver) = rpc_pubsub_service::test_connection(&subscriptions);
let (processed_rpc3, mut processed_receiver3) =
rpc_pubsub_service::test_connection(&subscriptions);
let past_bank_sub_id1 = past_bank_rpc1
.signature_subscribe(
past_bank_tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::processed()),
enable_received_notification: Some(false),
}),
)
.unwrap();
let past_bank_sub_id2 = past_bank_rpc2
.signature_subscribe(
past_bank_tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::finalized()),
enable_received_notification: Some(false),
}),
)
.unwrap();
let processed_sub_id = processed_rpc
.signature_subscribe(
processed_tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::processed()),
enable_received_notification: Some(false),
}),
)
.unwrap();
another_rpc
.signature_subscribe(
unprocessed_tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::processed()),
enable_received_notification: Some(false),
}),
)
.unwrap();
// Add a subscription that gets `received` notifications
let processed_sub_id3 = processed_rpc3
.signature_subscribe(
unprocessed_tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::processed()),
enable_received_notification: Some(true),
}),
)
.unwrap();
assert!(subscriptions
.control
.signature_subscribed(&unprocessed_tx.signatures[0]));
assert!(subscriptions
.control
.signature_subscribed(&processed_tx.signatures[0]));
let mut commitment_slots = CommitmentSlots::default();
let received_slot = 1;
commitment_slots.slot = received_slot;
subscriptions
.notify_signatures_received((received_slot, vec![unprocessed_tx.signatures[0]]));
subscriptions.notify_subscribers(commitment_slots);
let expected_res =
RpcSignatureResult::ProcessedSignature(ProcessedSignatureResult { err: None });
let received_expected_res =
RpcSignatureResult::ReceivedSignature(ReceivedSignatureResult::ReceivedSignature);
struct Notification {
slot: Slot,
id: u64,
}
let expected_notification =
|exp: Notification, expected_res: &RpcSignatureResult| -> String {
let json = json!({
"jsonrpc": "2.0",
"method": "signatureNotification",
"params": {
"result": {
"context": { "slot": exp.slot },
"value": expected_res,
},
"subscription": exp.id,
}
});
serde_json::to_string(&json).unwrap()
};
// Expect to receive a notification from bank 1 because this subscription is
// looking for 0 confirmations and so checks the current bank
let expected = expected_notification(
Notification {
slot: 1,
id: past_bank_sub_id1.into(),
},
&expected_res,
);
let response = past_bank_receiver1.recv();
assert_eq!(expected, response);
// Expect to receive a notification from bank 0 because this subscription is
// looking for 1 confirmation and so checks the past bank
let expected = expected_notification(
Notification {
slot: 0,
id: past_bank_sub_id2.into(),
},
&expected_res,
);
let response = past_bank_receiver2.recv();
assert_eq!(expected, response);
let expected = expected_notification(
Notification {
slot: 1,
id: processed_sub_id.into(),
},
&expected_res,
);
let response = processed_receiver.recv();
assert_eq!(expected, response);
// Expect a "received" notification
let expected = expected_notification(
Notification {
slot: received_slot,
id: processed_sub_id3.into(),
},
&received_expected_res,
);
let response = processed_receiver3.recv();
assert_eq!(expected, response);
// Subscription should be automatically removed after notification
assert!(!subscriptions
.control
.signature_subscribed(&processed_tx.signatures[0]));
assert!(!subscriptions
.control
.signature_subscribed(&past_bank_tx.signatures[0]));
// Unprocessed signature subscription should not be removed
assert!(subscriptions
.control
.signature_subscribed(&unprocessed_tx.signatures[0]));
} | rust_cleaned_test_functions.jsonl/14339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
39859,
88935,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inner_attr() {
let tokens = quote! {
#![no_std]
};
let expected = "# ! [no_std]";
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/53423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34345,
10422,
368,
341,
262,
1077,
11211,
284,
12641,
0,
341,
286,
671,
20703,
2152,
15656,
921,
262,
2605,
262,
1077,
3601,
284,
5869,
753,
508,
2152,
15656,
59757,
262,
2060,
10714,
10297,
7325,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_main_export_is_a_memory() {
let wasm: Vec<u8> = vec![
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x05, 0x03, 0x01, 0x00, 0x00, 0x07,
0x08, 0x01, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x02, 0x00,
];
let mut checker = EcicChecker::default(&wasm);
assert_eq!(
checker.checks.get_check_status("export-main"),
CheckStatus::Unknown
);
checker.fire();
assert_eq!(
checker.checks.get_check_status("export-main"),
CheckStatus::Malformed
);
} | rust_cleaned_test_functions.jsonl/10742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11027,
27114,
6892,
4306,
19195,
368,
341,
286,
1077,
98263,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
22,
18,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_cch_canonicalize_ex() {
assert_eq!(
path_cch_canonicalize_ex(r#"C:\Users\Valarauca\Documents\"#).unwrap(),
r#"C:\Users\Valarauca\Documents\"#
);
assert_eq!(
path_cch_canonicalize_ex(r#"C:\Users\Valarauca\Documents\..\..\"#).unwrap(),
r#"C:\Users\"#
);
} | rust_cleaned_test_functions.jsonl/84139 | {
"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,
2638,
666,
331,
27421,
22391,
551,
2702,
368,
341,
262,
2060,
10714,
33673,
286,
1815,
666,
331,
27421,
22391,
551,
2702,
2601,
55543,
34,
7190,
7137,
59,
2208,
277,
2863,
924,
59,
27143,
2105,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_issue_reference() {
let issue_reference: IssueReference = read_test_file("issue_reference");
let issue = if let IssueReference::Internal(issue) = issue_reference {
issue
} else {
panic!("expected to have an internal issue reference");
};
assert_eq!(issue.id, IssueId::new(69075));
assert_eq!(issue.iid, IssueInternalId::new(5));
assert_eq!(issue.project_id, ProjectId::new(855));
assert_eq!(issue.title, "Add project hook APIs");
assert_eq!(
issue.description.as_ref().unwrap(),
"The workflow currently requires that the robot be able to register itself as a webhook \
for new projects. An API needs added for this.\n\nCc: @brad.king",
);
assert_eq!(issue.state, IssueState::Closed);
assert_eq!(issue.created_at, datetime((2016, 10, 4), (18, 59, 37, 178)));
assert_eq!(issue.updated_at, datetime((2017, 7, 7), (6, 31, 5, 370)));
assert_eq!(issue.closed_at, None);
assert!(issue.closed_by.is_none());
assert!(issue.labels.is_empty());
assert!(issue.milestone.is_none());
check_user_ben_boeckel(&issue.author);
let assignee = issue.assignee.as_ref().unwrap();
check_user_ben_boeckel(assignee);
assert_eq!(issue.subscribed, None);
check_empty_time_stats(&issue.time_stats);
assert_eq!(issue.user_notes_count, 0);
assert_eq!(issue.merge_requests_count, 1);
assert_eq!(issue.upvotes, 0);
assert_eq!(issue.downvotes, 0);
assert_eq!(issue.due_date, None);
assert!(!issue.confidential);
assert_eq!(issue.discussion_locked, None);
assert_eq!(
issue.web_url,
"https://gitlab.kitware.com/utils/rust-gitlab/-/issues/5",
);
} | rust_cleaned_test_functions.jsonl/12943 | {
"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,
6443,
53340,
25433,
368,
341,
262,
1077,
4265,
25433,
25,
25226,
8856,
284,
1349,
4452,
2458,
445,
11159,
25433,
3071,
262,
1077,
4265,
284,
421,
1077,
25226,
8856,
486,
11569,
94439,
8,
284,
4265... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_concurrent_write_after_transfer_leader_invalidates_locks() {
let mut cluster = new_server_cluster(0, 1);
cluster.cfg.pessimistic_txn.pipelined = true;
cluster.cfg.pessimistic_txn.in_memory = true;
cluster.run();
cluster.must_transfer_leader(1, new_peer(1, 1));
let txn_ext = cluster
.must_get_snapshot_of_region(1)
.ext()
.get_txn_ext()
.unwrap()
.clone();
let lock = PessimisticLock {
primary: b"key".to_vec().into_boxed_slice(),
start_ts: 10.into(),
ttl: 3000,
for_update_ts: 20.into(),
min_commit_ts: 30.into(),
};
assert!(
txn_ext
.pessimistic_locks
.write()
.insert(vec![(Key::from_raw(b"key"), lock.clone())])
.is_ok()
);
let region = cluster.get_region(b"");
let leader = region.get_peers()[0].clone();
fail::cfg("invalidate_locks_before_transfer_leader", "pause").unwrap();
let env = Arc::new(Environment::new(1));
let channel =
ChannelBuilder::new(env).connect(&cluster.sim.rl().get_addr(leader.get_store_id()));
let client = TikvClient::new(channel);
let mut ctx = Context::default();
ctx.set_region_id(region.get_id());
ctx.set_region_epoch(region.get_region_epoch().clone());
ctx.set_peer(leader);
let mut mutation = pb::Mutation::default();
mutation.set_op(Op::Put);
mutation.key = b"key".to_vec();
let mut req = PrewriteRequest::default();
req.set_context(ctx);
req.set_mutations(vec![mutation].into());
req.set_start_version(20);
req.set_primary_lock(b"key".to_vec());
// Prewrite should not be blocked because we have downgrade the write lock
// the memory lock.
let resp = client.kv_prewrite(&req).unwrap();
assert_eq!(
resp.get_errors()[0].get_locked(),
&lock.into_lock().into_lock_info(b"key".to_vec())
);
} | rust_cleaned_test_functions.jsonl/8374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 879
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
3231,
9165,
19844,
35403,
79991,
31433,
973,
9818,
82,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
16,
317,
262,
10652,
30481,
556,
66733,
4532,
92299,
556,
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_cubic_glancing_intersection() {
use std::panic;
// The f64 version currently fails on a very close fat line miss after 57 recursions.
let result = panic::catch_unwind(|| {
do_test(
&CubicBezierSegment {
from: point(0.0, 0.0),
ctrl1: point(0.0, 8.0),
ctrl2: point(10.0, 8.0),
to: point(10.0, 0.0),
},
&CubicBezierSegment {
from: point(0.0, 12.0),
ctrl1: point(0.0, 4.0),
ctrl2: point(10.0, 4.0),
to: point(10.0, 12.0),
},
1,
);
});
assert!(result.is_err());
let result = panic::catch_unwind(|| {
do_test(
&CubicBezierSegment {
from: point(0.0f32, 0.0),
ctrl1: point(0.0, 8.0),
ctrl2: point(10.0, 8.0),
to: point(10.0, 0.0),
},
&CubicBezierSegment {
from: point(0.0, 12.0),
ctrl1: point(0.0, 4.0),
ctrl2: point(10.0, 4.0),
to: point(10.0, 12.0),
},
1,
);
});
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/14575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 799
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41181,
34569,
8974,
82558,
368,
341,
262,
990,
1460,
486,
19079,
280,
262,
442,
576,
282,
21,
19,
2319,
5023,
14525,
389,
264,
1602,
3265,
8664,
1555,
3116,
1283,
220,
20,
22,
24724,
908,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reflect_x() {
assert_relative_eq!(Deg(359.9999999999).reflect_x(),
Deg(0.0000000000001), epsilon=1e-5);
assert_relative_eq!(Deg(180.0).reflect_x(), Deg(180.0));
assert_relative_eq!(Deg(90.0).reflect_x(), Deg(90.0));
assert_relative_eq!(Deg(0.0).reflect_x(), Deg(0.0));
assert_relative_eq!(Deg(45.0).reflect_x(), Deg(315.0));
assert_relative_eq!(Deg(215.0).reflect_x(), Deg(145.0));
} | rust_cleaned_test_functions.jsonl/58810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
767,
3212,
368,
341,
286,
2060,
29286,
10714,
10297,
45657,
7,
18,
20,
24,
13,
24,
24,
24,
24,
24,
24,
24,
24,
24,
24,
568,
34913,
3212,
1507,
715,
310,
57237,
7,
15,
13,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_huge_buffer() -> anyhow::Result<()> {
let root = Box::new(Echo::<Msg>::new(false));
let mut console = test_console(root);
console.emit(vec![vec!["line 1"].try_into()?; MAX_GRAPHEME_BUFFER * 2]);
let msg = Msg(vec![vec!["line"].try_into()?; 1]);
let state = crate::state![&msg];
let mut buffer = Vec::new();
// Even though we have more messages than fit on the screen in the `to_emit` buffer
console.render_general(
&mut buffer,
&state,
DrawMode::Normal,
Dimensions::new(100, 20),
)?;
// We have so many that we should just drain them all.
assert!(console.to_emit.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/122136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
4733,
7776,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
3704,
284,
8261,
486,
931,
10722,
958,
27638,
6611,
6831,
931,
3576,
1106,
286,
1077,
5206,
2339,
284,
1273,
51724,
9206,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_early_exit() {
let (service, client, _server) = prepare_suite();
let (tx, rx) = std_mpsc::channel();
*service.list_feature_listener.lock().unwrap() = Some(tx);
let rect = Rectangle::default();
let l = client.list_features(&rect).unwrap();
let f = l.into_future();
match f.wait() {
Ok((Some(_), _)) => {}
Ok((None, _)) => panic!("should have result"),
Err((e, _)) => panic!("unexpected error {:?}", e),
};
rx.recv_timeout(Duration::from_secs(1)).unwrap();
} | rust_cleaned_test_functions.jsonl/4346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22140,
16880,
368,
341,
262,
1077,
320,
7936,
11,
2943,
11,
716,
4030,
8,
284,
10549,
57239,
543,
262,
1077,
320,
3998,
11,
19111,
8,
284,
1460,
717,
81984,
486,
10119,
543,
262,
353,
7936... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_connect_write_then_read() {
Runtime::new().unwrap().block_on(async {
let (mut con1, mut con2) = init_connection_pair().await;
con1.write(&[1u8, 2, 3, 4, 5]).await.unwrap();
let mut buff = [0u8; 1024];
let read = con2.read(&mut buff).await.unwrap();
assert_eq!(&buff[..read], [1u8, 2, 3, 4, 5]);
con2.write(&[6u8, 7, 8, 9, 10]).await.unwrap();
let mut buff = [0u8; 1024];
let read = con1.read(&mut buff).await.unwrap();
assert_eq!(&buff[..read], [6u8, 7, 8, 9, 10]);
});
} | rust_cleaned_test_functions.jsonl/54776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
9165,
68367,
6443,
368,
341,
286,
10954,
486,
931,
1005,
15454,
1005,
4574,
4470,
18285,
341,
310,
1077,
320,
6984,
390,
16,
11,
5206,
390,
17,
8,
284,
2930,
15866,
14445,
1005,
11421,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ovs_dpdk() {
// Create OVS-DPDK bridge and ports
assert!(exec_host_command_status(
"ovs-vsctl add-br ovsbr0 -- set bridge ovsbr0 datapath_type=netdev",
)
.success());
assert!(exec_host_command_status("ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuserclient options:vhost-server-path=/tmp/dpdkvhostclient1").success());
assert!(exec_host_command_status("ovs-vsctl add-port ovsbr0 vhost-user2 -- set Interface vhost-user2 type=dpdkvhostuserclient options:vhost-server-path=/tmp/dpdkvhostclient2").success());
assert!(exec_host_command_status("ip link set up dev ovsbr0").success());
assert!(exec_host_command_status("service openvswitch-switch restart").success());
let focal1 = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest1 = Guest::new(Box::new(focal1));
let mut child1 = GuestCommand::new(&guest1)
.args(&["--cpus", "boot=2"])
.args(&["--memory", "size=0,shared=on"])
.args(&["--memory-zone", "id=mem0,size=1G,shared=on,host_numa_node=0"])
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.default_disks()
.args(&["--net", guest1.default_net_string().as_str(), "vhost_user=true,socket=/tmp/dpdkvhostclient1,num_queues=2,queue_size=256,vhost_mode=server"])
.capture_output()
.spawn()
.unwrap();
#[cfg(target_arch = "x86_64")]
let guest_net_iface = "ens5";
#[cfg(target_arch = "aarch64")]
let guest_net_iface = "enp0s5";
let r = std::panic::catch_unwind(|| {
guest1.wait_vm_boot(None).unwrap();
guest1
.ssh_command(&format!(
"sudo ip addr add 172.100.0.1/24 dev {}",
guest_net_iface
))
.unwrap();
guest1
.ssh_command(&format!("sudo ip link set up dev {}", guest_net_iface))
.unwrap();
let guest_ip = guest1.network.guest_ip.clone();
thread::spawn(move || {
ssh_command_ip(
"nc -l 12345",
&guest_ip,
DEFAULT_SSH_RETRIES,
DEFAULT_SSH_TIMEOUT,
)
.unwrap();
});
});
if r.is_err() {
let _ = child1.kill();
let output = child1.wait_with_output().unwrap();
handle_child_output(r, &output);
panic!("Test should already be failed/panicked"); // To explicitly mark this block never return
}
let focal2 = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest2 = Guest::new(Box::new(focal2));
let mut child2 = GuestCommand::new(&guest2)
.args(&["--cpus", "boot=2"])
.args(&["--memory", "size=0,shared=on"])
.args(&["--memory-zone", "id=mem0,size=1G,shared=on,host_numa_node=0"])
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.default_disks()
.args(&["--net", guest2.default_net_string().as_str(), "vhost_user=true,socket=/tmp/dpdkvhostclient2,num_queues=2,queue_size=256,vhost_mode=server"])
.capture_output()
.spawn()
.unwrap();
let r = std::panic::catch_unwind(|| {
guest2.wait_vm_boot(None).unwrap();
guest2
.ssh_command(&format!(
"sudo ip addr add 172.100.0.2/24 dev {}",
guest_net_iface
))
.unwrap();
guest2
.ssh_command(&format!("sudo ip link set up dev {}", guest_net_iface))
.unwrap();
// Check the connection works properly between the two VMs
guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap();
// Remove one of the two ports from the OVS bridge
assert!(exec_host_command_status("ovs-vsctl del-port vhost-user1").success());
// Spawn a new netcat listener in the first VM
let guest_ip = guest1.network.guest_ip.clone();
thread::spawn(move || {
ssh_command_ip(
"nc -l 12345",
&guest_ip,
DEFAULT_SSH_RETRIES,
DEFAULT_SSH_TIMEOUT,
)
.unwrap();
});
// Check the connection fails this time
assert!(guest2.ssh_command("nc -vz 172.100.0.1 12345").is_err());
// Add the OVS port back
assert!(exec_host_command_status("ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuserclient options:vhost-server-path=/tmp/dpdkvhostclient1").success());
// And finally check the connection is functional again
guest2.ssh_command("nc -vz 172.100.0.1 12345").unwrap();
});
let _ = child1.kill();
let _ = child2.kill();
let output = child1.wait_with_output().unwrap();
child2.wait().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/29420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83981,
82,
53872,
7584,
368,
341,
310,
442,
4230,
506,
26050,
9420,
47,
18301,
14164,
323,
20325,
198,
310,
2060,
10297,
11748,
12848,
10811,
4773,
1006,
394,
330,
859,
82,
97874,
12373,
912,
3011... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_start_as_follower() {
setup_for_test();
let r = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage());
assert_eq!(r.state, StateRole::Follower);
} | rust_cleaned_test_functions.jsonl/54462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
11898,
761,
29034,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
1125,
220,
16,
15,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.