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_rent_eager_collect_rent_in_partition() {
solana_logger::setup();
let (mut genesis_config, _mint_keypair) = create_genesis_config(1_000_000);
activate_all_features(&mut genesis_config);
let zero_lamport_pubkey = solana_sdk::pubkey::new_rand();
let rent_due_pubkey = solana_sdk::pubkey::new_rand();
let rent_exempt_pubkey = solana_sdk::pubkey::new_rand();
let mut bank = Arc::new(Bank::new_for_tests(&genesis_config));
let zero_lamports = 0;
let little_lamports = 1234;
let large_lamports = 123_456_789;
let some_slot = MINIMUM_SLOTS_PER_EPOCH; // chosen to cause epoch to be +1
let rent_collected = 1; // this is a function of 'some_slot'
bank.store_account(
&zero_lamport_pubkey,
&AccountSharedData::new(zero_lamports, 0, &Pubkey::default()),
);
bank.store_account(
&rent_due_pubkey,
&AccountSharedData::new(little_lamports, 0, &Pubkey::default()),
);
bank.store_account(
&rent_exempt_pubkey,
&AccountSharedData::new(large_lamports, 0, &Pubkey::default()),
);
let genesis_slot = 0;
let ancestors = vec![(some_slot, 0), (0, 1)].into_iter().collect();
let previous_epoch = bank.epoch();
bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), some_slot));
let current_epoch = bank.epoch();
assert_eq!(previous_epoch + 1, current_epoch);
assert_eq!(bank.collected_rent.load(Relaxed), 0);
assert_eq!(
bank.get_account(&rent_due_pubkey).unwrap().lamports(),
little_lamports
);
assert_eq!(bank.get_account(&rent_due_pubkey).unwrap().rent_epoch(), 0);
assert_eq!(
bank.slots_by_pubkey(&rent_due_pubkey, &ancestors),
vec![genesis_slot]
);
assert_eq!(
bank.slots_by_pubkey(&rent_exempt_pubkey, &ancestors),
vec![genesis_slot]
);
assert_eq!(
bank.slots_by_pubkey(&zero_lamport_pubkey, &ancestors),
vec![genesis_slot]
);
assert_eq!(bank.collected_rent.load(Relaxed), 0);
assert!(bank.rewrites_skipped_this_slot.read().unwrap().is_empty());
bank.collect_rent_in_partition((0, 0, 1), true, &RentMetrics::default());
{
let rewrites_skipped = bank.rewrites_skipped_this_slot.read().unwrap();
// `activate_all_features`. These accounts will stop being written to the append vec
// when we start skipping rewrites.
// 'collect_rent_in_partition' fills 'rewrites_skipped_this_slot' with rewrites that
// were skipped during rent collection but should still be considered in the slot's
// code ignores the contents of this list. This assert is confirming that the expected #
// of accounts were included in 'rewrites_skipped' by the call to
let num_features = bank.feature_set.inactive.len() + bank.feature_set.active.len();
assert!(rewrites_skipped.len() >= num_features);
// should have skipped 'rent_exempt_pubkey'
assert!(rewrites_skipped.contains_key(&rent_exempt_pubkey));
// should NOT have skipped 'rent_exempt_pubkey'
assert!(!rewrites_skipped.contains_key(&rent_due_pubkey));
}
assert_eq!(bank.collected_rent.load(Relaxed), 0);
bank.collect_rent_in_partition((0, 0, 1), false, &RentMetrics::default()); // all range
assert_eq!(bank.collected_rent.load(Relaxed), rent_collected);
assert_eq!(
bank.get_account(&rent_due_pubkey).unwrap().lamports(),
little_lamports - rent_collected
);
assert_eq!(
bank.get_account(&rent_due_pubkey).unwrap().rent_epoch(),
current_epoch + 1
);
assert_eq!(
bank.get_account(&rent_exempt_pubkey).unwrap().lamports(),
large_lamports
);
assert_eq!(
bank.get_account(&rent_exempt_pubkey).unwrap().rent_epoch(),
current_epoch
);
assert_eq!(
bank.slots_by_pubkey(&rent_due_pubkey, &ancestors),
vec![genesis_slot, some_slot]
);
assert_eq!(
bank.slots_by_pubkey(&rent_exempt_pubkey, &ancestors),
vec![genesis_slot, some_slot]
);
assert_eq!(
bank.slots_by_pubkey(&zero_lamport_pubkey, &ancestors),
vec![genesis_slot]
);
} | rust_cleaned_test_functions.jsonl/28849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
2204,
1409,
68140,
83127,
1243,
43840,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
320,
6984,
59366,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_translate_to_bytes() {
let kb_result: u64 = gluster::translate_to_bytes("100KB").unwrap();
println!("kb_result: {}", kb_result);
assert_eq!(kb_result, 102400);
let mb_result: u64 = gluster::translate_to_bytes("100MB").unwrap();
println!("mb_result: {}", mb_result);
assert_eq!(mb_result, 104857600);
let gb_result: u64 = gluster::translate_to_bytes("100GB").unwrap();
println!("gb_result: {}", gb_result);
assert_eq!(gb_result, 107374182400);
let tb_result: u64 = gluster::translate_to_bytes("100TB").unwrap();
println!("tb_result: {}", tb_result);
assert_eq!(tb_result, 109951162777600);
let pb_result: u64 = gluster::translate_to_bytes("100PB").unwrap();
println!("pb_result: {}", pb_result);
assert_eq!(pb_result, 112589990684262400);
let pb_float_result: f64 = gluster::translate_to_bytes("100.5PB").unwrap();
println!("pb_float_result: {}", pb_float_result);
assert_eq!(pb_float_result, 113152940637683710.0);
} | rust_cleaned_test_functions.jsonl/103587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66381,
2346,
12524,
368,
341,
262,
1077,
38653,
5287,
25,
575,
21,
19,
284,
2770,
4993,
486,
14045,
2346,
12524,
445,
16,
15,
15,
29862,
1827,
15454,
543,
262,
13751,
17223,
21310,
5287,
25,
246... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shared_stack() {
let data = vec![1, 2, 3, 4, 5];
let mut stack = SharedStack::new(5);
stack.as_left_stack().push(data[0]);
stack.as_left_stack().push(data[1]);
for elem in data.iter().skip(2) {
assert_eq!(stack.as_right_stack().push(*elem), None)
}
assert_eq!(stack.slice, [Some(1), Some(2), Some(5), Some(4), Some(3)]);
assert_eq!(stack.as_right_stack().push(2), Some(2));
assert_eq!(stack.as_left_stack().pop(), Some(2));
assert_eq!(stack.as_right_stack().push(2), None);
assert_eq!(stack.as_left_stack().push(2), Some(2));
assert_eq!(stack.as_right_stack().pop(), Some(2));
assert_eq!(stack.as_left_stack().push(2), None);
assert_eq!(stack.slice, [Some(1), Some(2), Some(5), Some(4), Some(3)]);
assert_eq!(stack.as_left_stack().pop(), Some(2));
assert_eq!(stack.as_left_stack().pop(), Some(1));
assert_eq!(stack.as_left_stack().pop(), None);
assert_eq!(stack.as_right_stack().pop(), Some(5));
assert_eq!(stack.as_right_stack().pop(), Some(4));
assert_eq!(stack.as_right_stack().pop(), Some(3));
assert_eq!(stack.as_right_stack().pop(), None);
} | rust_cleaned_test_functions.jsonl/23385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
15528,
368,
341,
286,
1077,
821,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
5206,
5611,
284,
16990,
4336,
486,
931,
7,
20,
317,
286,
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_header_huge_file() {
let header = test_huge_header();
with_basic_file(&header, |disk_file: RawFile| {
QcowFile::from(disk_file).expect_err("Failed to create file.");
});
} | rust_cleaned_test_functions.jsonl/96726 | {
"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,
8757,
1523,
4733,
2458,
368,
341,
286,
1077,
4247,
284,
1273,
1523,
4733,
8757,
543,
286,
448,
34729,
2458,
2099,
2708,
11,
760,
30496,
2458,
25,
23022,
1703,
91,
341,
310,
1207,
18921,
1703,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_link_local_addr() {
assert_eq!(
LinkLocalAddr::new(Address::LinkLocalUnicast),
Some(LinkLocalAddr(Address::LinkLocalUnicast))
);
assert_eq!(LinkLocalAddr::new(Address::GlobalMulticast), None);
assert_eq!(
unsafe { LinkLocalAddr::new_unchecked(Address::LinkLocalUnicast) },
LinkLocalAddr(Address::LinkLocalUnicast)
);
} | rust_cleaned_test_functions.jsonl/33647 | {
"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,
7233,
13564,
7387,
368,
341,
286,
2060,
10714,
33673,
310,
5948,
7319,
13986,
486,
931,
68492,
486,
3939,
7319,
1806,
35446,
1326,
310,
4329,
84944,
7319,
13986,
68492,
486,
3939,
7319,
1806,
35446,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u16_segment() {
let dat = vec![1u16, 3, 10, 15, 23, 4, 45];
assert_write_check_read(dat, 8);
} | rust_cleaned_test_functions.jsonl/118841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
16,
21,
28061,
368,
341,
262,
1077,
3258,
284,
7486,
20703,
16,
84,
16,
21,
11,
220,
18,
11,
220,
16,
15,
11,
220,
16,
20,
11,
220,
17,
18,
11,
220,
19,
11,
220,
19,
20,
935,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_replace_region() {
let text = "\nabc\n123\n789\ndef\nghi";
let expected = FileChange {
changed: true,
new_lines: "\nabc\nhello world\ndef\nghi".to_string(),
};
let result = replace_region_in_text(text, r#"^\s*abc$"#, r#"^\s*def"#, false, || {
vec!["hello world".to_string()]
});
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/1255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
20627,
368,
341,
262,
1077,
1467,
284,
2917,
77,
13683,
1699,
16,
17,
18,
1699,
22,
23,
24,
59,
5037,
1699,
75076,
876,
262,
1077,
3601,
284,
2887,
4072,
341,
286,
5497,
25,
830,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_observe_schedule() {
block_on(async {
let config = config_generator();
let mut state_machine = StateMachine::new_stub(&config, make_test_app_set()).await;
let schedule = Rc::new(RefCell::new(UpdateCheckSchedule::default()));
state_machine.set_observer(TestObserver {
schedule: Some(schedule.clone()),
..TestObserver::default()
});
state_machine.start_update_check(CheckOptions::default()).await;
let schedule = schedule.borrow();
assert_eq!(*schedule, state_machine.context.schedule);
});
} | rust_cleaned_test_functions.jsonl/94222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36322,
13267,
34530,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
1584,
38695,
284,
3234,
21605,
486,
931,
62781,
2099,
1676,
11,
1281,
4452,
819... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_color_only() {
let config = make_config_from_args(&["--line-numbers", "--color-only"]);
let output = run_delta(TWO_MINUS_LINES_DIFF, &config);
let mut lines = output.lines().skip(5);
let (line_1, line_2) = (lines.next().unwrap(), lines.next().unwrap());
assert_eq!(strip_ansi_codes(line_1), " 1 ⋮ │-a = 1");
assert_eq!(strip_ansi_codes(line_2), " 2 ⋮ │-b = 2");
} | rust_cleaned_test_functions.jsonl/54584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
18410,
368,
341,
286,
1077,
2193,
284,
1281,
5332,
5673,
8384,
2099,
1183,
313,
1056,
31194,
1902,
497,
14482,
3423,
15382,
15049,
286,
1077,
2550,
284,
1598,
26710,
4140,
22681,
68263,
66744,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_short_format_combined_arg() {
assert_eq!(
parse_format_flags_str(&vec!["od", "-tu8"]).unwrap(),
vec![FORMAT_ITEM_DEC64U]
);
} | rust_cleaned_test_functions.jsonl/112182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
8955,
89945,
6057,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2895,
2099,
4083,
0,
1183,
347,
497,
6523,
24494,
23,
45014,
15454,
3148,
286,
7486,
20703,
46559,
16461,
23773,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ldf_filter() {
let data_graph = graph(DATA_GRAPH_1);
let query_graph = graph("(n0:L0), (n1:L1), (n2:L2), (n0)-->(n1), (n1)-->(n2)");
assert_eq!(data_graph.nodes_by_label(0), &[0]);
assert_eq!(data_graph.nodes_by_label(1), &[1, 3]);
assert_eq!(data_graph.nodes_by_label(2), &[2]);
assert_eq!(data_graph.nodes_by_label(4), &[4]);
let candidates = ldf_filter(&data_graph, &query_graph).unwrap();
assert_eq!(candidates.candidates(0), &[0]);
assert_eq!(candidates.candidates(1), &[1, 3]);
assert_eq!(candidates.candidates(2), &[2]);
assert_eq!(candidates.candidate_count(0), 1);
assert_eq!(candidates.candidate_count(1), 2);
assert_eq!(candidates.candidate_count(2), 1);
} | rust_cleaned_test_functions.jsonl/13050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
69,
8727,
368,
341,
286,
1077,
821,
14738,
284,
4771,
59093,
58360,
62,
16,
317,
286,
1077,
3239,
14738,
284,
4771,
31732,
77,
15,
69233,
15,
701,
320,
77,
16,
69233,
16,
701,
320,
77,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_array() {
let mut handlebars = Registry::new();
assert!(handlebars
.register_template_string("t0", "{{#each this.[0]}}{{this}}{{/each}}")
.is_ok());
let r0 = handlebars.render("t0", &(vec![vec![1, 2, 3]]));
assert_eq!(r0.ok().unwrap(), "123".to_string());
} | rust_cleaned_test_functions.jsonl/127936 | {
"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,
66279,
3858,
368,
341,
286,
1077,
5206,
3705,
24950,
284,
32112,
486,
931,
543,
286,
2060,
10297,
8192,
24950,
198,
310,
659,
6343,
8693,
3904,
445,
83,
15,
497,
47219,
2,
9547,
419,
7873,
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_min() {
let a = vec![2, 2, 3, 6, 0, 6, 7, 9, 7, 7, 4, 9];
assert_eq!(
sliding_window_minimum(&a, 4),
vec![
2,
0,
0,
0,
0,
6,
7,
4,
4
]
);
assert_eq!(sliding_window_minimum(&a, 1), a);
assert_eq!(
sliding_window_minimum(&a, a.len()),
vec![a.iter().copied().min().unwrap()],
);
} | rust_cleaned_test_functions.jsonl/10510 | {
"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,
7260,
368,
341,
286,
1077,
264,
284,
7486,
20703,
17,
11,
220,
17,
11,
220,
18,
11,
220,
21,
11,
220,
15,
11,
220,
21,
11,
220,
22,
11,
220,
24,
11,
220,
22,
11,
220,
22,
11,
220,
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_import_refs() {
let settings = testutils::user_settings();
let test_repo = testutils::init_repo(&settings, true);
let repo = &test_repo.repo;
let git_repo = repo.store().git_repo().unwrap();
let commit1 = empty_git_commit(&git_repo, "refs/heads/main", &[]);
git_ref(&git_repo, "refs/remotes/origin/main", commit1.id());
let commit2 = empty_git_commit(&git_repo, "refs/heads/main", &[&commit1]);
let commit3 = empty_git_commit(&git_repo, "refs/heads/feature1", &[&commit2]);
let commit4 = empty_git_commit(&git_repo, "refs/heads/feature2", &[&commit2]);
let commit5 = empty_git_commit(&git_repo, "refs/tags/v1.0", &[&commit1]);
// Should not be imported
empty_git_commit(&git_repo, "refs/notes/x", &[&commit2]);
empty_git_commit(&git_repo, "refs/remotes/origin/HEAD", &[&commit2]);
git_repo.set_head("refs/heads/main").unwrap();
let git_repo = repo.store().git_repo().unwrap();
let mut tx = repo.start_transaction("test");
git::import_refs(tx.mut_repo(), &git_repo).unwrap();
tx.mut_repo().rebase_descendants(&settings).unwrap();
let repo = tx.commit();
let view = repo.view();
let expected_heads = hashset! {
commit_id(&commit3),
commit_id(&commit4),
commit_id(&commit5)
};
assert_eq!(*view.heads(), expected_heads);
let expected_main_branch = BranchTarget {
local_target: Some(RefTarget::Normal(commit_id(&commit2))),
remote_targets: btreemap! {
"origin".to_string() => RefTarget::Normal(commit_id(&commit1)),
},
};
assert_eq!(
view.branches().get("main"),
Some(expected_main_branch).as_ref()
);
let expected_feature1_branch = BranchTarget {
local_target: Some(RefTarget::Normal(commit_id(&commit3))),
remote_targets: btreemap! {},
};
assert_eq!(
view.branches().get("feature1"),
Some(expected_feature1_branch).as_ref()
);
let expected_feature2_branch = BranchTarget {
local_target: Some(RefTarget::Normal(commit_id(&commit4))),
remote_targets: btreemap! {},
};
assert_eq!(
view.branches().get("feature2"),
Some(expected_feature2_branch).as_ref()
);
assert_eq!(
view.tags().get("v1.0"),
Some(RefTarget::Normal(commit_id(&commit5))).as_ref()
);
assert_eq!(view.git_refs().len(), 5);
assert_eq!(
view.git_refs().get("refs/heads/main"),
Some(RefTarget::Normal(commit_id(&commit2))).as_ref()
);
assert_eq!(
view.git_refs().get("refs/heads/feature1"),
Some(RefTarget::Normal(commit_id(&commit3))).as_ref()
);
assert_eq!(
view.git_refs().get("refs/heads/feature2"),
Some(RefTarget::Normal(commit_id(&commit4))).as_ref()
);
assert_eq!(
view.git_refs().get("refs/remotes/origin/main"),
Some(RefTarget::Normal(commit_id(&commit1))).as_ref()
);
assert_eq!(
view.git_refs().get("refs/tags/v1.0"),
Some(RefTarget::Normal(commit_id(&commit5))).as_ref()
);
assert_eq!(view.git_head(), Some(commit_id(&commit2)));
} | rust_cleaned_test_functions.jsonl/96053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
60638,
368,
341,
262,
1077,
5003,
284,
1273,
6031,
486,
872,
10853,
543,
262,
1077,
1273,
37784,
284,
1273,
6031,
486,
2327,
37784,
2099,
6511,
11,
830,
317,
262,
1077,
15867,
284,
609,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_long_format_cz() {
assert_eq!(
parse_format_flags(&["od".to_string(), "--format=cz".to_string()]).unwrap(),
vec![ParsedFormatterItemInfo::new(FORMAT_ITEM_C, true)]
);
} | rust_cleaned_test_functions.jsonl/78697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
8955,
666,
89,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2099,
1183,
347,
3263,
983,
3904,
1507,
14482,
2243,
28,
13769,
3263,
983,
3904,
368,
10697,
15454,
3148,
286,
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 |
#[test]
fn test_try_parse_fps_vfilter() {
let fps = try_parse_fps_vfilter("scale=1280:-1, fps=24, transpose=1").unwrap();
assert!((fps - 24.0).abs() < f64::EPSILON, "{:?}", fps);
let fps = try_parse_fps_vfilter("scale=1280:-1, fps=ntsc, transpose=1").unwrap();
assert!((fps - 30000.0 / 1001.0).abs() < f64::EPSILON, "{:?}", fps);
} | rust_cleaned_test_functions.jsonl/8029 | {
"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,
53283,
21039,
65163,
2273,
5315,
368,
341,
262,
1077,
33881,
284,
1430,
21039,
65163,
2273,
5315,
445,
12445,
28,
16,
17,
23,
15,
10944,
16,
11,
33881,
28,
17,
19,
11,
50923,
28,
16,
1827,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_elgamal() {
for p in [997, 2677, 454711, 952252135981] {
let mut rng = rand::thread_rng();
let base = choose_base(p);
let (private_key, public_key) = generate_key_pair(&base);
let message_length: usize = rng.gen_range(1..100);
let mut message: Vec<u128> = vec![];
for _ in 0..message_length {
message.push(rng.gen_range(1..base.modulus));
}
let ciphertext = encrypt(&base, &message, &public_key);
let decrypted_message = decrypt(&ciphertext, private_key);
assert_eq!(message, decrypted_message);
}
} | rust_cleaned_test_functions.jsonl/122289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21602,
39329,
278,
368,
341,
286,
369,
281,
304,
508,
24,
24,
22,
11,
220,
17,
21,
22,
22,
11,
220,
19,
20,
19,
22,
16,
16,
11,
220,
24,
20,
17,
17,
20,
17,
16,
18,
20,
24,
23,
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... | 3 |
#[test]
fn test_create_date_time() {
let tz = Tz::Zulu;
let column =
Vec::column_from::<ArcColumnWrapper>(vec![tz.ymd(2016, 10, 22).and_hms(12, 0, 0)]);
assert_eq!("2016-10-22 12:00:00 UTC", format!("{}", column.at(0)));
assert_eq!(SqlType::DateTime, column.sql_type());
} | rust_cleaned_test_functions.jsonl/40720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
4164,
3009,
368,
341,
286,
1077,
42528,
284,
350,
89,
486,
57,
24411,
280,
286,
1077,
3250,
4035,
310,
11312,
486,
6229,
5673,
27638,
36809,
2933,
11542,
2235,
4083,
20703,
37592,
13,
1600,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fails_to_accept_other_fork_node() {
let magic1 = Network::Mainnet.magic(&ConsensusFork::NoFork);
let magic2 = Network::Mainnet.magic(&ConsensusFork::BitcoinCash(Default::default()));
let version = 70012;
let local_version = local_version();
let remote_version = remote_version();
let mut remote_stream = Stream::new();
remote_stream.append_slice(Message::new(magic2, version, &remote_version).unwrap().as_ref());
let test_io = TestIo {
read: io::Cursor::new(remote_stream.out()),
write: Bytes::default(),
};
let expected = Error::InvalidMagic;
let hs = accept_handshake(test_io, magic1, local_version, 0).wait().unwrap();
assert_eq!(hs.1.unwrap_err(), expected);
} | rust_cleaned_test_functions.jsonl/79009 | {
"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,
761,
6209,
2346,
35728,
30456,
761,
669,
5084,
368,
341,
197,
10217,
10963,
16,
284,
8141,
486,
6202,
4711,
88870,
2099,
15220,
13626,
37,
669,
486,
2753,
37,
669,
317,
197,
10217,
10963,
17,
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_set_operator() {
let storage_helper = StorageHelper::new();
let local_owner_ns = "local";
let remote_owner_ns = "owner";
storage_helper.initialize(local_owner_ns.into());
// Upload an operator key to the remote storage
let operator_name = "operator";
let operator_key = Ed25519PrivateKey::generate_for_testing().public_key();
let mut remote_storage = storage_helper.storage(operator_name.into());
remote_storage
.set(OPERATOR_KEY, Value::Ed25519PublicKey(operator_key))
.map_err(|e| Error::RemoteStorageWriteError(OPERATOR_KEY, e.to_string()))
.unwrap();
// Owner calls the set-operator command
let local_operator_name = storage_helper
.set_operator(operator_name, local_owner_ns, remote_owner_ns)
.unwrap();
// Verify that a file setting the operator was uploaded to the remote storage
let remote_storage = storage_helper.storage(remote_owner_ns.into());
let uploaded_operator_name = remote_storage
.get(constants::VALIDATOR_OPERATOR)
.unwrap()
.value
.string()
.unwrap();
assert_eq!(local_operator_name, uploaded_operator_name);
} | rust_cleaned_test_functions.jsonl/126023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
40594,
368,
341,
286,
1077,
5819,
10418,
284,
14693,
5511,
486,
931,
543,
286,
1077,
2205,
29027,
34728,
284,
330,
2438,
876,
286,
1077,
8699,
29027,
34728,
284,
330,
8118,
876,
286,
5819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_buffer() -> Result<()> {
let module = WasmModule::from_file("testdata/simple_add/test.wasm")?;
let _: Vec<u8> = module.to_bytes()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/48636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
7776,
368,
1464,
5714,
71698,
341,
286,
1077,
4688,
284,
467,
10530,
3332,
486,
1499,
2458,
445,
92425,
67195,
2891,
12697,
1418,
10530,
899,
37445,
286,
1077,
58536,
11312,
34837,
23,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 3 |
#[test]
fn test_int_local_counter() {
let counter = IntCounter::new("foo", "bar").unwrap();
let local_counter = counter.local();
local_counter.inc();
assert_eq!(local_counter.get(), 1);
assert_eq!(counter.get(), 0);
local_counter.inc_by(5);
local_counter.flush();
assert_eq!(local_counter.get(), 0);
assert_eq!(counter.get(), 6);
local_counter.reset();
counter.reset();
assert_eq!(counter.get() as u64, 0);
local_counter.flush();
assert_eq!(counter.get() as u64, 0);
} | rust_cleaned_test_functions.jsonl/46518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
13564,
15730,
368,
341,
286,
1077,
5546,
284,
1333,
14099,
486,
931,
445,
7975,
497,
330,
2257,
1827,
15454,
543,
286,
1077,
2205,
15730,
284,
5546,
11033,
1428,
286,
2205,
15730,
26797,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile() {
let _m = RecursiveMutator::new(|self_| {
SMutator::new(<bool as DefaultMutator>::default_mutator(), {
OptionMutator::new(BoxMutator::new(self_.into()))
})
});
let _m: RecursiveMutator<SMutator<BoolMutator>> = S::default_mutator();
let m = S::default_mutator();
let (x, _) = m.random_arbitrary(10.0);
println!("{:?}", x);
} | rust_cleaned_test_functions.jsonl/68826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
368,
341,
262,
1077,
716,
76,
284,
85896,
51440,
850,
486,
931,
22428,
721,
35395,
341,
286,
13716,
332,
850,
486,
931,
22726,
2641,
438,
7899,
51440,
850,
6831,
2258,
29523,
850,
1507,
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... | 1 |
#[test]
fn test_count_bits_slice() {
assert_eq!(
0,
Buffer::from(&[0b11111111, 0b00000000])
.slice(1)
.count_set_bits()
);
assert_eq!(
8,
Buffer::from(&[0b11111111, 0b11111111])
.slice(1)
.count_set_bits()
);
assert_eq!(
3,
Buffer::from(&[0b11111111, 0b11111111, 0b00001101])
.slice(2)
.count_set_bits()
);
assert_eq!(
6,
Buffer::from(&[0b11111111, 0b01001001, 0b01010010])
.slice(1)
.count_set_bits()
);
assert_eq!(
16,
Buffer::from(&[0b11111111, 0b11111111, 0b11111111, 0b11111111])
.slice(2)
.count_set_bits()
);
} | rust_cleaned_test_functions.jsonl/25078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
20034,
26488,
368,
341,
286,
2060,
10714,
33673,
310,
220,
15,
345,
310,
10312,
486,
1499,
2099,
58,
15,
65,
16,
16,
16,
16,
16,
16,
16,
16,
11,
220,
15,
65,
15,
15,
15,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_integer_str() {
let val: ScalarCow<'_> = "foobar".into();
assert_eq!(val.to_integer(), None);
let val: ScalarCow<'_> = "42.34".into();
assert_eq!(val.to_integer(), None);
let val: ScalarCow<'_> = "42".into();
assert_eq!(val.to_integer(), Some(42));
} | rust_cleaned_test_functions.jsonl/108130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
31725,
2895,
368,
341,
286,
1077,
1044,
25,
35176,
89915,
18291,
98377,
284,
330,
50267,
3263,
18122,
543,
286,
2060,
10714,
10297,
831,
2389,
31725,
1507,
2240,
626,
286,
1077,
1044,
25,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cond_else() {
let input = &[0x01][..];
let empty = &b""[..];
let a = 1;
fn parse_u8(i: &[u8]) -> IResult<&[u8], u8> {
be_u8(i)
}
assert_eq!(
cond_else(|| a == 1, parse_u8, pure(0x02))(input),
Ok((empty, 0x01))
);
assert_eq!(
cond_else(|| a == 1, parse_u8, pure(0x02))(input),
Ok((empty, 0x01))
);
assert_eq!(
cond_else(|| a == 2, parse_u8, pure(0x02))(input),
Ok((input, 0x02))
);
assert_eq!(
cond_else(|| a == 1, pure(0x02), parse_u8)(input),
Ok((input, 0x02))
);
let res: IResult<&[u8], u8> = cond_else(|| a == 1, parse_u8, parse_u8)(input);
assert_eq!(res, Ok((empty, 0x01)));
} | rust_cleaned_test_functions.jsonl/51158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24433,
62628,
368,
341,
286,
1077,
1946,
284,
44590,
15,
87,
15,
16,
1457,
496,
935,
286,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
286,
1077,
264,
284,
220,
16,
280,
286,
5168,
4715,
7300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_empty() {
let mut v = VecDeque::<i32>::new();
assert!(v.is_empty());
assert!(v.iter().is_empty());
assert!(v.iter_mut().is_empty());
v.extend(&[2, 3, 4]);
assert!(!v.is_empty());
assert!(!v.iter().is_empty());
assert!(!v.iter_mut().is_empty());
while let Some(_) = v.pop_front() {
assert_eq!(v.is_empty(), v.len() == 0);
assert_eq!(v.iter().is_empty(), v.iter().len() == 0);
assert_eq!(v.iter_mut().is_empty(), v.iter_mut().len() == 0);
}
assert!(v.is_empty());
assert!(v.iter().is_empty());
assert!(v.iter_mut().is_empty());
assert!(v.into_iter().is_empty());
} | rust_cleaned_test_functions.jsonl/73734 | {
"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,
6892,
15124,
368,
341,
262,
1077,
5206,
348,
284,
11312,
73891,
27638,
72,
18,
17,
6831,
931,
543,
262,
2060,
10297,
85,
2079,
15124,
1423,
262,
2060,
10297,
85,
19471,
1005,
285,
15124,
1423,
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_update_new_leader_schedule_epoch() {
let (_, bank, _, _) = setup();
// Check outdated slots are purged with new root
let leader_schedule_epoch = bank.get_leader_schedule_epoch(bank.slot());
let next_leader_schedule_epoch = leader_schedule_epoch + 1;
let mut next_leader_schedule_computed = bank.slot();
loop {
next_leader_schedule_computed += 1;
if bank.get_leader_schedule_epoch(next_leader_schedule_computed)
== next_leader_schedule_epoch
{
break;
}
}
assert_eq!(
bank.get_leader_schedule_epoch(next_leader_schedule_computed),
next_leader_schedule_epoch
);
} | rust_cleaned_test_functions.jsonl/118399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5921,
79991,
34530,
20682,
368,
341,
286,
1077,
39464,
6073,
11,
8358,
27439,
284,
6505,
1428,
286,
442,
4248,
40526,
15711,
525,
3999,
3556,
448,
501,
3704,
198,
286,
1077,
7653,
34530,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_current_era_num() {
new_test_ext().execute_with(|| {
advance_session();
assert_eq!(<frame_system::Pallet<Test>>::block_number(), 5 );
assert_eq!(Session::current_index(), 1 );
assert_eq!(OracleFinance::current_era_num(), 0);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 0);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 1);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 1);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 2);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 2);
advance_session();
assert_eq!(OracleFinance::current_era_num(), 3);
});
} | rust_cleaned_test_functions.jsonl/35132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
62,
2416,
4273,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
197,
59320,
12316,
543,
197,
6948,
10714,
10297,
27,
6763,
17687,
486,
47,
7464,
71273,
77595,
4574,
5500,
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_fastq_truncated() {
let mut reader = Reader::new(&b"@id\nATGC\n+"[..]);
let rec = reader.next().unwrap();
let p = ErrorPosition { line: 3, id: Some("id".to_string()) };
assert_matches!(rec, Err(Error::UnexpectedEnd { pos: p }));
} | rust_cleaned_test_functions.jsonl/40332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
80,
3547,
38007,
368,
341,
262,
1077,
5206,
6604,
284,
25166,
486,
931,
2099,
65,
96270,
307,
1699,
828,
22863,
1699,
5172,
95874,
2558,
262,
1077,
1395,
284,
6604,
4529,
1005,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_named_pattern() {
let mut grok = Grok::empty();
grok.insert_definition("USERNAME", r"[a-zA-Z0-9._-]+");
let pattern = grok.compile("%{USERNAME:usr}", false)
.expect("Error while compiling!");
let matches = pattern.match_against("root").expect("No matches found!");
assert_eq!("root", matches.get("usr").unwrap());
assert_eq!(1, matches.len());
let matches = pattern
.match_against("john doe")
.expect("No matches found!");
assert_eq!("john", matches.get("usr").unwrap());
assert_eq!(1, matches.len());
} | rust_cleaned_test_functions.jsonl/117565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
71834,
21260,
368,
341,
286,
1077,
5206,
10487,
74,
284,
17888,
74,
486,
3194,
543,
286,
10487,
74,
7030,
31698,
445,
63516,
497,
435,
36864,
64,
21088,
11171,
15,
12,
24,
1436,
12,
7574,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bracket_generator_window_negative() {
let fin = |x: f64| x.sin();
let f = RealFn::new(&fin);
let b = Bounds::new(-10.0, 10.0);
let _brackets: Vec<Bounds> = BracketGenerator::new(&f, b, -0.1).collect();
} | rust_cleaned_test_functions.jsonl/7160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17682,
5709,
25813,
12571,
53865,
368,
341,
286,
1077,
1875,
284,
760,
87,
25,
282,
21,
19,
91,
856,
16318,
543,
286,
1077,
282,
284,
8800,
24911,
486,
931,
2099,
5472,
317,
286,
1077,
293,
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_parse_ansi_term_style() {
assert_eq!(
parse_ansi_term_style("", None, false),
(ansi_term::Style::new(), false, false, false)
);
assert_eq!(
parse_ansi_term_style("red", None, false),
(
ansi_term::Style {
foreground: Some(ansi_term::Color::Red),
..ansi_term::Style::new()
},
false,
false,
false
)
);
assert_eq!(
parse_ansi_term_style("red green", None, false),
(
ansi_term::Style {
foreground: Some(ansi_term::Color::Red),
background: Some(ansi_term::Color::Green),
..ansi_term::Style::new()
},
false,
false,
false
)
);
assert_eq!(
parse_ansi_term_style("bold red underline green blink", None, false),
(
ansi_term::Style {
foreground: Some(ansi_term::Color::Red),
background: Some(ansi_term::Color::Green),
is_blink: true,
is_bold: true,
is_underline: true,
..ansi_term::Style::new()
},
false,
false,
false
)
);
} | rust_cleaned_test_functions.jsonl/129638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 950
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62,
52067,
17464,
15117,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
62,
52067,
17464,
15117,
19814,
2240,
11,
895,
1326,
310,
320,
52067,
17464,
486,
2323,
486,
931,
1507,
895,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_construct_point_get_command_from_raw_get_request() {
let mut context = Context::default();
context.set_region_id(1);
let raw_key = b"raw_key".to_vec();
let mut req = RawGetRequest::default();
req.set_context(context.clone());
req.set_key(raw_key.clone());
let cmd = PointGetCommand::from_raw_get(&mut req);
assert_eq!(cmd.ctx, context);
assert_eq!(cmd.key.into_encoded(), raw_key);
assert_eq!(cmd.ts, None);
} | rust_cleaned_test_functions.jsonl/68217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
6085,
3062,
10811,
5673,
16067,
3062,
7893,
368,
341,
286,
1077,
5206,
2266,
284,
9608,
486,
2258,
543,
286,
2266,
980,
20627,
842,
7,
16,
317,
286,
1077,
7112,
3097,
284,
293,
1,
1041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example1() {
assert_eq!(
vec![
vec![5, 0],
vec![7, 0],
vec![5, 2],
vec![6, 1],
vec![4, 4],
vec![7, 1],
],
Solution::reconstruct_queue(
vec![
vec![7, 0],
vec![4, 4],
vec![7, 1],
vec![5, 0],
vec![6, 1],
vec![5, 2],
],
),
);
} | rust_cleaned_test_functions.jsonl/106047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
16,
368,
341,
286,
2060,
10714,
33673,
310,
7486,
90515,
394,
7486,
20703,
20,
11,
220,
15,
1259,
394,
7486,
20703,
22,
11,
220,
15,
1259,
394,
7486,
20703,
20,
11,
220,
17,
1259,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dynamic() {
let rng = &mut ChaChaRng::from_seed([0u8; 32]);
for _ in 0..20 {
let int_size_bits = 256;
let mut acc = Accumulator::setup::<RSAGroup, _>(rng, int_size_bits);
let xs = (0..5)
.map(|_| rng.gen_prime(int_size_bits))
.collect::<Vec<_>>();
for x in &xs {
acc.add(x);
}
let ws = xs
.iter()
.map(|x| {
let w = acc.mem_wit_create(x);
assert!(acc.ver_mem(&w, x));
w
})
.collect::<Vec<_>>();
for (x, w) in xs.iter().zip(ws.iter()) {
// remove x
acc.del(x).unwrap();
// make sure test now fails
assert!(!acc.ver_mem(w, x));
}
}
} | rust_cleaned_test_functions.jsonl/96046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
368,
341,
286,
1077,
28422,
284,
609,
6984,
27721,
95971,
49,
968,
486,
1499,
33809,
2561,
15,
84,
23,
26,
220,
18,
17,
10149,
286,
369,
716,
304,
220,
15,
496,
17,
15,
341,
310,
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... | 4 |
#[test]
fn test_base32_extra_operand() {
// Expect a failure when multiple files are specified.
new_ucmd!()
.arg("a.txt")
.arg("a.txt")
.fails()
.stderr_only("base32: extra operand 'a.txt'");
} | rust_cleaned_test_functions.jsonl/93248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7651,
18,
17,
31858,
69259,
368,
341,
262,
442,
32085,
264,
7901,
979,
5248,
3542,
525,
5189,
624,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
445,
64,
3909,
1138,
286,
659,
858,
445,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_discard_vote_for_absent_propose() {
let mut testkit: TestKit = TestKit::configuration_default();
let cfg_change_height = Height(5);
let new_cfg = {
let mut cfg = testkit.configuration_change_proposal();
cfg.set_service_config("dummy", "First cfg");
cfg.set_actual_from(cfg_change_height);
cfg.stored_configuration().clone()
};
let absent_cfg = {
let mut cfg = testkit.configuration_change_proposal();
cfg.set_service_config("dummy", "Absent propose");
cfg.set_actual_from(cfg_change_height);
cfg.stored_configuration().clone()
};
let propose_tx = new_tx_config_propose(&testkit.network().validators()[1], new_cfg.clone());
testkit.create_block_with_transactions(txvec![propose_tx]);
let legal_vote = new_tx_config_vote(&testkit.network().validators()[3], new_cfg.hash());
let illegal_vote = new_tx_config_vote(&testkit.network().validators()[3], absent_cfg.hash());
testkit.create_block_with_transactions(txvec![legal_vote.clone(), illegal_vote.clone()]);
let votes = testkit.votes_for_propose(new_cfg.hash());
assert!(votes.contains(&Some(VotingDecision::Yea(legal_vote.hash()))));
assert!(!votes.contains(&Some(VotingDecision::Yea(illegal_vote.hash()))));
} | rust_cleaned_test_functions.jsonl/106413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
567,
54360,
5478,
31170,
306,
21663,
960,
368,
341,
262,
1077,
5206,
1273,
8226,
25,
3393,
7695,
284,
3393,
7695,
486,
21138,
9993,
1428,
262,
1077,
13286,
15947,
9561,
284,
21432,
7,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_transaction_metrics() {
let json = r#"
{
"type": "transaction",
"timestamp": "2021-04-26T08:00:00+0100",
"start_timestamp": "2021-04-26T07:59:01+0100",
"release": "1.2.3",
"dist": "foo ",
"environment": "fake_environment",
"transaction": "mytransaction",
"user": {
"id": "user123"
},
"tags": {
"fOO": "bar",
"bogus": "absolutely"
},
"measurements": {
"foo": {"value": 420.69},
"lcp": {"value": 3000.0}
},
"spans": [
{
"description": "<OrganizationContext>",
"op": "react.mount",
"parent_span_id": "8f5a2b8768cafb4e",
"span_id": "bd429c44b67a3eb4",
"start_timestamp": 1597976393.4619668,
"timestamp": 1597976393.4718769,
"trace_id": "ff62a8b040f340bda5d830223def1d81"
}
]
}
"#;
let breakdowns_config: BreakdownsConfig = serde_json::from_str(
r#"
{
"span_ops": {
"type": "spanOperations",
"matches": ["react.mount"]
}
}
"#,
)
.unwrap();
let event = Annotated::from_json(json).unwrap();
let mut metrics = vec![];
extract_transaction_metrics(
&TransactionMetricsConfig::default(),
Some(&breakdowns_config),
event.value().unwrap(),
&mut metrics,
);
assert_eq!(metrics, &[]);
let config: TransactionMetricsConfig = serde_json::from_str(
r#"
{
"extractMetrics": [
"sentry.transactions.measurements.foo",
"sentry.transactions.measurements.lcp",
"sentry.transactions.breakdowns.span_ops.ops.react.mount",
"sentry.transactions.transaction.duration",
"sentry.transactions.user"
],
"extractCustomTags": ["fOO"]
}
"#,
)
.unwrap();
let mut metrics = vec![];
extract_transaction_metrics(
&config,
Some(&breakdowns_config),
event.value().unwrap(),
&mut metrics,
);
assert_eq!(metrics.len(), 5, "{:?}", metrics);
assert_eq!(metrics[0].name, "sentry.transactions.measurements.foo");
assert_eq!(metrics[1].name, "sentry.transactions.measurements.lcp");
assert_eq!(
metrics[2].name,
"sentry.transactions.breakdowns.span_ops.ops.react.mount"
);
let duration_metric = &metrics[3];
assert_eq!(
duration_metric.name,
"sentry.transactions.transaction.duration"
);
if let MetricValue::Distribution(value) = duration_metric.value {
assert_eq!(value, 59000.0);
} else {
panic!(); // Duration must be set
}
let user_metric = &metrics[4];
assert_eq!(user_metric.name, "sentry.transactions.user");
assert!(matches!(user_metric.value, MetricValue::Set(_)));
assert_eq!(metrics[1].tags["measurement_rating"], "meh");
for metric in &metrics[0..4] {
assert!(matches!(metric.value, MetricValue::Distribution(_)));
}
for metric in metrics {
assert_eq!(metric.tags["release"], "1.2.3");
assert_eq!(metric.tags["dist"], "foo");
assert_eq!(metric.tags["environment"], "fake_environment");
assert_eq!(metric.tags["transaction"], "mytransaction");
assert_eq!(metric.tags["fOO"], "bar");
assert!(!metric.tags.contains_key("bogus"));
}
} | rust_cleaned_test_functions.jsonl/21929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
28884,
37686,
368,
341,
286,
1077,
2951,
284,
435,
2,
698,
286,
341,
310,
330,
1313,
788,
330,
13528,
756,
310,
330,
13035,
788,
330,
17,
15,
17,
16,
12,
15,
19,
12,
17,
21,
51,
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... | 4 |
#[test]
fn test_function_caps() {
let formatter = Formatter::new();
// tests with functions
{
let test_metadata = test::MetadataProvider::new(HashMap::new());
{
let expression = formatter.parser().parse("$caps(hello world)").unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("Hello World", s.to_string().as_str());
}
{
let expression = formatter.parser().parse("$caps(ça t''étonne?)").unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("Ça T'étonne?", s.to_string().as_str());
}
{
let expression = formatter.parser().parse("$caps(ÇA T''ÉTONNE ね?)").unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("Ça T'étonne ね?", s.to_string().as_str());
}
}
} | rust_cleaned_test_functions.jsonl/5971 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
52955,
368,
341,
262,
1077,
24814,
284,
81387,
486,
931,
543,
262,
442,
7032,
448,
5746,
198,
262,
341,
286,
1077,
1273,
22220,
284,
1273,
486,
14610,
5179,
486,
931,
7,
18497,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_base_split_region_left_derive() {
let count = 5;
let mut cluster = new_server_cluster(0, count);
test_base_split_region(&mut cluster, Cluster::must_split, false);
} | rust_cleaned_test_functions.jsonl/25763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
7651,
17052,
20627,
9579,
35345,
533,
368,
341,
262,
1077,
1760,
284,
220,
20,
280,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
1760,
317,
262,
1273,
7651,
17052,
20627,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_load_json() {
let result = load_json(Language::English, 1);
assert!(result.is_ok());
assert_eq!(result.unwrap(), minify(EXPECTED_UNIGRAM_MODEL));
} | rust_cleaned_test_functions.jsonl/43393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
9455,
368,
341,
286,
1077,
1102,
284,
2795,
9455,
83670,
486,
22574,
11,
220,
16,
317,
286,
2060,
10297,
1382,
2079,
19817,
1423,
286,
2060,
10714,
10297,
1382,
55395,
1507,
1308,
1437,
254... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_shuffle() {
let r = flags_from_vec(svec!["deno", "test", "--shuffle=1"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Test {
no_run: false,
doc: false,
fail_fast: None,
filter: None,
allow_none: false,
quiet: false,
shuffle: Some(1),
include: None,
concurrent_jobs: 1,
},
watch: false,
..Flags::default()
}
);
} | rust_cleaned_test_functions.jsonl/27019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73484,
368,
341,
262,
1077,
435,
284,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
330,
1944,
497,
14482,
65355,
28,
16,
15049,
262,
2060,
10714,
33673,
414,
435,
55395,
3148,
414,
332... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_affine_point_equality() {
let a = G2Affine::generator();
let b = G2Affine::identity();
assert!(a == a);
assert!(b == b);
assert!(a != b);
assert!(b != a);
} | rust_cleaned_test_functions.jsonl/47797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
6085,
2204,
10473,
368,
341,
262,
1077,
264,
284,
479,
17,
25841,
482,
486,
35851,
543,
262,
1077,
293,
284,
479,
17,
25841,
482,
486,
16912,
1428,
262,
2060,
10297,
64,
621,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash() {
let a = BigInt::new(NoSign, vec![]);
let b = BigInt::new(NoSign, vec![0]);
let c = BigInt::new(Plus, vec![1]);
let d = BigInt::new(Plus, vec![1, 0, 0, 0, 0, 0]);
let e = BigInt::new(Plus, vec![0, 0, 0, 0, 0, 1]);
let f = BigInt::new(Minus, vec![1]);
assert!(hash(&a) == hash(&b));
assert!(hash(&b) != hash(&c));
assert!(hash(&c) == hash(&d));
assert!(hash(&d) != hash(&e));
assert!(hash(&c) != hash(&f));
} | rust_cleaned_test_functions.jsonl/56617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
262,
1077,
264,
284,
62608,
486,
931,
7,
2753,
7264,
11,
7486,
0,
56703,
262,
1077,
293,
284,
62608,
486,
931,
7,
2753,
7264,
11,
7486,
20703,
15,
2558,
262,
1077,
272,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrono_local_value() {
let timestamp_utc =
DateTime::<Utc>::from_utc(NaiveDate::from_ymd(2022, 1, 2).and_hms(3, 4, 5), Utc);
let timestamp_local: DateTime<Local> = timestamp_utc.into();
let value: Value = timestamp_local.into();
let out: DateTime<Local> = value.unwrap();
assert_eq!(out, timestamp_local);
} | rust_cleaned_test_functions.jsonl/12487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2248,
78,
13564,
3142,
368,
341,
286,
1077,
11441,
84259,
4035,
310,
6520,
27638,
97768,
6831,
1499,
84259,
8204,
64,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
17,
17,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_median_filter() {
let mut gt = Mask::from_elem((3, 3, 3), false);
let mut mask = gt.clone();
mask[(0, 0, 0)] = true;
assert_eq!(median_filter(&mask), gt);
mask[(1, 0, 0)] = true;
assert_eq!(median_filter(&mask), gt);
mask[(0, 1, 0)] = true;
assert_eq!(median_filter(&mask), gt);
gt[(0, 0, 0)] = true;
mask[(0, 0, 1)] = true;
assert_eq!(median_filter(&mask), gt);
mask[(1, 1, 0)] = true;
assert_eq!(median_filter(&mask), gt);
gt[(1, 0, 0)] = true;
gt[(0, 1, 0)] = true;
gt[(0, 0, 1)] = true;
mask[(1, 0, 1)] = true;
assert_eq!(median_filter(&mask), gt);
gt[(2, 0, 0)] = true;
mask[(1, 1, 1)] = true;
assert_eq!(median_filter(&mask.view()), gt);
} | rust_cleaned_test_functions.jsonl/57228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83003,
8727,
368,
341,
262,
1077,
5206,
25161,
284,
19924,
486,
1499,
28179,
1188,
18,
11,
220,
18,
11,
220,
18,
701,
895,
317,
262,
1077,
5206,
6911,
284,
25161,
15997,
543,
262,
6911,
9697,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_service_none_payload() {
#[derive(Serialize, Deserialize, Debug, Default)]
struct TestServiceResponse {
pub message: String,
}
struct Tests<SDK: ServiceSDK> {
_sdk: SDK,
genesis_data: String,
hook_before: bool,
hook_after: bool,
}
#[service]
impl<SDK: ServiceSDK> Tests<SDK> {
#[genesis]
fn init_genesis(&mut self) {
self.genesis_data = "genesis".to_owned();
}
#[hook_before]
fn custom_hook_before(&mut self, _params: &ExecutorParams) {
self.hook_before = true;
}
#[hook_after]
fn custom_hook_after(&mut self, _params: &ExecutorParams) {
self.hook_after = true;
}
#[read]
fn test_read(&self, _ctx: ServiceContext) -> ServiceResponse<TestServiceResponse> {
let res = TestServiceResponse {
message: "read ok".to_owned(),
};
ServiceResponse::<TestServiceResponse>::from_succeed(res)
}
#[write]
fn test_write(&mut self, _ctx: ServiceContext) -> ServiceResponse<TestServiceResponse> {
let res = TestServiceResponse {
message: "write ok".to_owned(),
};
ServiceResponse::<TestServiceResponse>::from_succeed(res)
}
}
let sdk = MockServiceSDK {};
let mut test_service = Tests {
_sdk: sdk,
genesis_data: "".to_owned(),
hook_after: false,
hook_before: false,
};
test_service.genesis_("".to_owned());
assert_eq!(test_service.genesis_data, "genesis");
let context = get_context(1024 * 1024, "", "test_write", "");
let write_res = test_service.write_(context).succeed_data;
assert_eq!(write_res, r#"{"message":"write ok"}"#);
let context = get_context(1024 * 1024, "", "test_read", "");
let read_res = test_service.read_(context).succeed_data;
assert_eq!(read_res, r#"{"message":"read ok"}"#);
let context = get_context(1024 * 1024, "", "test_notfound", "");
let read_res = panic::catch_unwind(AssertUnwindSafe(|| test_service.read_(context.clone())));
assert_eq!(read_res.unwrap().is_error(), true);
let write_res = panic::catch_unwind(AssertUnwindSafe(|| test_service.write_(context)));
assert_eq!(write_res.unwrap().is_error(), true);
test_service.hook_before_(&mock_executor_params());
assert_eq!(test_service.hook_before, true);
test_service.hook_after_(&mock_executor_params());
assert_eq!(test_service.hook_after, true);
} | rust_cleaned_test_functions.jsonl/11476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12267,
31488,
32813,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
11091,
11,
7899,
5563,
262,
2036,
3393,
1860,
2582,
341,
286,
6675,
1943,
25,
923,
345,
262,
555,
262,
2036,
20150,
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_get_range_change() {
let a = "abcdefg";
let b = "abedcfg";
let actual = get_range_change(a, b);
assert_eq!(
actual,
json!({
"span": {
"start": 2,
"length": 3,
},
"newLength": 3
})
);
let a = "abfg";
let b = "abcdefg";
let actual = get_range_change(a, b);
assert_eq!(
actual,
json!({
"span": {
"start": 2,
"length": 0,
},
"newLength": 3
})
);
let a = "abcdefg";
let b = "abfg";
let actual = get_range_change(a, b);
assert_eq!(
actual,
json!({
"span": {
"start": 2,
"length": 3,
},
"newLength": 0
})
);
let a = "abcdefg";
let b = "abfghij";
let actual = get_range_change(a, b);
assert_eq!(
actual,
json!({
"span": {
"start": 2,
"length": 5,
},
"newLength": 5
})
);
let a = "abcdefghijk";
let b = "axcxexfxixk";
let actual = get_range_change(a, b);
assert_eq!(
actual,
json!({
"span": {
"start": 1,
"length": 9,
},
"newLength": 9
})
);
let a = "abcde";
let b = "ab(c)de";
let actual = get_range_change(a, b);
assert_eq!(
actual,
json!({
"span" : {
"start": 2,
"length": 1,
},
"newLength": 3
})
);
} | rust_cleaned_test_functions.jsonl/39679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 888
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9698,
15947,
368,
341,
262,
1077,
264,
284,
330,
41202,
70,
876,
262,
1077,
293,
284,
330,
370,
291,
14072,
876,
262,
1077,
5042,
284,
633,
9698,
15947,
2877,
11,
293,
317,
262,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heading() {
for opt in vec!["-H", "--heading"] {
// allow whitespace variation
// * minor whitespace differences occur between platform built-in outputs;
// specifically number of TABs between "TIME" and "COMMENT" may be variant
let actual = new_ucmd!().arg(opt).succeeds().stdout_move_str();
let expect = expected_result(&[opt]);
println!("actual: {:?}", actual);
println!("expect: {:?}", expect);
let v_actual: Vec<&str> = actual.split_whitespace().collect();
let v_expect: Vec<&str> = expect.split_whitespace().collect();
assert_eq!(v_actual, v_expect);
}
} | rust_cleaned_test_functions.jsonl/79390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47242,
368,
341,
262,
369,
3387,
304,
7486,
0,
1183,
12,
39,
497,
14482,
11412,
1341,
341,
286,
442,
2138,
36372,
22990,
198,
286,
442,
353,
8922,
36372,
11799,
12170,
1948,
5339,
5798,
3419,
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_truncated_helloretry_extension_is_detected() {
let hrr = get_sample_helloretryrequest();
for ext in &hrr.extensions {
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
// the input
for l in 0..enc.len() {
assert!(HelloRetryExtension::read_bytes(&enc[..l]).is_none());
}
// these extension types don't have any internal encoding that rustls validates:
match ext.get_type() {
ExtensionType::Unknown(_) => {
continue;
}
_ => {}
};
for l in 0..(enc.len() - 4) {
put_u16(l as u16, &mut enc[2..]);
println!(" encoding {:?} len {:?}", enc, l);
assert!(HelloRetryExtension::read_bytes(&enc).is_none());
}
}
} | rust_cleaned_test_functions.jsonl/100973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
38007,
96724,
44848,
31035,
6892,
98876,
368,
341,
262,
1077,
305,
634,
284,
633,
17491,
96724,
44848,
2035,
1428,
262,
369,
1303,
304,
609,
71,
634,
48439,
341,
286,
1077,
5206,
3209,
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... | 5 |
#[test]
fn test_merge() {
// merging 1 1 1 1 1 1 1 1 1 16
// with 2 2 4 4 8 8
let mut sb = SpansBuilder::new(10);
sb.add_span(Interval::new(0, 9), 1u32);
sb.add_span(Interval::new(9, 10), 16);
let red = sb.build();
let mut sb = SpansBuilder::new(10);
sb.add_span(Interval::new(0, 2), 2);
sb.add_span(Interval::new(2, 4), 4);
sb.add_span(Interval::new(6, 8), 8);
let blue = sb.build();
let merged = red.merge(&blue, |r, b| b.map(|b| b + r).unwrap_or(*r));
let mut merged_iter = merged.iter();
let (iv, val) = merged_iter.next().unwrap();
assert_eq!(iv, Interval::new(0, 2));
assert_eq!(*val, 3);
let (iv, val) = merged_iter.next().unwrap();
assert_eq!(iv, Interval::new(2, 4));
assert_eq!(*val, 5);
let (iv, val) = merged_iter.next().unwrap();
assert_eq!(iv, Interval::new(4, 6));
assert_eq!(*val, 1);
let (iv, val) = merged_iter.next().unwrap();
assert_eq!(iv, Interval::new(6, 8));
assert_eq!(*val, 9);
let (iv, val) = merged_iter.next().unwrap();
assert_eq!(iv, Interval::new(8, 9));
assert_eq!(*val, 1);
let (iv, val) = merged_iter.next().unwrap();
assert_eq!(iv, Interval::new(9, 10));
assert_eq!(*val, 16);
assert!(merged_iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/106169 | {
"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,
20888,
368,
341,
286,
442,
53377,
220,
16,
220,
16,
220,
16,
220,
16,
220,
16,
220,
16,
220,
16,
220,
16,
220,
16,
220,
16,
21,
198,
286,
442,
448,
262,
220,
17,
220,
17,
220,
19,
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_rent_state_incinerator() {
let GenesisConfigInfo {
mut genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(sol_to_lamports(100.), &Pubkey::new_unique(), 42);
genesis_config.rent = Rent::default();
let rent_exempt_minimum = genesis_config.rent.minimum_balance(0);
activate_all_features(&mut genesis_config);
let bank = Bank::new_for_tests(&genesis_config);
for amount in [rent_exempt_minimum - 1, rent_exempt_minimum] {
bank.transfer(amount, &mint_keypair, &solana_sdk::incinerator::id())
.unwrap();
}
} | rust_cleaned_test_functions.jsonl/29017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
4387,
31285,
10453,
850,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fifo_path() {
let test_data = PathBuf::from(TEST_BUNDLE_PATH)
.join(TEST_CONTAINER_ID)
.join(EXEC_FIFO_FILENAME);
let status = create_dummy_status();
assert_eq!(get_fifo_path(&status), test_data);
} | rust_cleaned_test_functions.jsonl/51227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
56590,
2638,
368,
341,
286,
1077,
1273,
1769,
284,
7933,
15064,
486,
1499,
50320,
1668,
71489,
7944,
340,
310,
659,
5987,
50320,
50689,
3450,
340,
310,
659,
5987,
25409,
7498,
49429,
45005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_encoded_pointer_sdata2() {
let encoding =
constants::DwEhPe(constants::DW_EH_PE_absptr.0 | constants::DW_EH_PE_sdata2.0);
let expected_rest = [1, 2, 3, 4];
let expected = 0x111 as i16;
let input = Section::with_endian(Endian::Little)
.L16(expected as u16)
.append_bytes(&expected_rest);
let input = input.get_contents().unwrap();
let input = EndianSlice::new(&input, LittleEndian);
let mut rest = input;
let parameters = PointerEncodingParameters {
bases: &SectionBaseAddresses::default(),
func_base: None,
address_size: 4,
section: &input,
};
assert_eq!(
parse_encoded_pointer(encoding, ¶meters, &mut rest),
Ok(Pointer::Direct(expected as u64))
);
assert_eq!(rest, EndianSlice::new(&expected_rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/9416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
73069,
21425,
643,
691,
17,
368,
341,
286,
1077,
11170,
4035,
310,
18021,
486,
35,
86,
36,
71,
10197,
80368,
486,
54219,
2089,
39,
45784,
22885,
2154,
376,
13,
15,
760,
18021,
486,
54219,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_count_nullifies() {
let mut vm: VimMachine<KeyEvent> = VimMachine::default();
let mut ctx = VimContext::default();
let op = EditAction::Delete;
let mov = MoveType::Column(MoveDir1D::Next, false);
let mov = EditTarget::Motion(mov, Count::Contextual);
let mov = Action::Edit(op.into(), mov);
vm.input_key(key!(KeyCode::Delete));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
ctx.action.count = Some(1);
ctx.action.operation = EditAction::Motion;
vm.input_key(key!('1'));
vm.input_key(key!(KeyCode::Delete));
assert_pop2!(vm, Action::NoOp, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
} | rust_cleaned_test_functions.jsonl/74588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
15162,
9606,
368,
341,
286,
1077,
5206,
10995,
25,
94484,
21605,
42003,
1556,
29,
284,
94484,
21605,
486,
2258,
543,
286,
1077,
5206,
5635,
284,
94484,
1972,
486,
2258,
1428,
1789,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_node() -> Result<()> {
let l = default_logger();
let mut r = new_test_raft(1, vec![1], 10, 1, new_storage(), &l);
r.apply_conf_change(&add_node(2))?;
assert_iter_eq!(o r.prs().conf().voters().ids(),
vec![1, 2]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/19148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5084,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
1125,
220,
16,
15,
11,
220,
16,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_option_too_much_dance() {
struct A;
let mut y = Some(A);
let _y2 = y.take().unwrap();
let _y3 = y.take().unwrap();
} | rust_cleaned_test_functions.jsonl/20233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
2346,
78,
717,
1387,
814,
681,
368,
341,
262,
2036,
362,
280,
262,
1077,
5206,
379,
284,
4329,
4346,
317,
262,
1077,
716,
88,
17,
284,
379,
40161,
1005,
15454,
543,
262,
1077,
716,
88,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_eval_neg2() {
let mut s = Stack::new();
s.push(Elt::Bool(false)).unwrap();
assert!(s.eval(Op::Neg).is_ok());
assert_eq!(s.pop().unwrap(), Elt::Bool(true));
} | rust_cleaned_test_functions.jsonl/34523 | {
"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,
21296,
28209,
17,
368,
341,
286,
1077,
5206,
274,
284,
14284,
486,
931,
543,
286,
274,
2552,
10722,
4832,
486,
11233,
3576,
4579,
15454,
543,
286,
2060,
10297,
82,
31710,
54494,
486,
47800,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_a2s_info_request_serialize() {
let packet = GoldSrcPacket::A2sInfoRequest;
let mut buf = [0u8; 25];
let bytes_written = packet
.serialize(&mut buf)
.expect("Failed to serialize A2sInfoRequest");
assert_eq!(&buf[0..bytes_written], A2S_INFO_REQUEST);
assert_eq!(bytes_written, A2S_INFO_REQUEST.len());
} | rust_cleaned_test_functions.jsonl/2111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
17,
82,
3109,
7893,
88686,
368,
341,
286,
1077,
10151,
284,
7421,
20360,
16679,
486,
32,
17,
82,
1731,
1900,
280,
286,
1077,
5206,
6607,
284,
508,
15,
84,
23,
26,
220,
17,
20,
4821,
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_mapping_document() {
let data = "{\"a\": 1, \"b\": 2}";
let parser = parser::YamlByteParser::init(data.as_bytes(), YamlUtf8Encoding);
let docs_res:Result<Vec<Box<YamlDocument>>, YamlError> = parser.load().collect();
match docs_res {
Err(e) => panic!("unexpected result: {:?}", e),
Ok(docs) => match docs[..].first().and_then(|doc| doc.root()) {
Some(YamlNode::YamlMappingNode(seq)) => {
let values:Vec<(String, String)> = seq.pairs().map(|(key, value)| {
(
match key {
YamlNode::YamlScalarNode(scalar) => scalar.get_value(),
_ => panic!("unexpected scalar")
},
match value {
YamlNode::YamlScalarNode(scalar) => scalar.get_value(),
_ => panic!("unexpected scalar")
}
)
}).collect();
assert_eq!(vec![("a".to_string(), "1".to_string()), ("b".to_string(), "2".to_string())], values)
},
_ => panic!("unexpected result")
}
}
} | rust_cleaned_test_functions.jsonl/58261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 788
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26930,
26231,
368,
341,
286,
1077,
821,
284,
54734,
64,
11693,
220,
16,
11,
7245,
65,
11693,
220,
17,
26259,
286,
1077,
6729,
284,
6729,
486,
56,
9467,
7153,
6570,
486,
2327,
2592,
5357,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_weighted_best() {
let weights_and_indexes: Vec<_> = vec![100u64, 1000, 10_000, 10]
.into_iter()
.enumerate()
.map(|(i, weight)| (weight, i))
.collect();
let best_index = weighted_best(&weights_and_indexes, [0x5b; 32]);
assert_eq!(best_index, 2);
} | rust_cleaned_test_functions.jsonl/68776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
33101,
368,
341,
286,
1077,
14324,
8378,
50161,
25,
11312,
32399,
29,
284,
7486,
20703,
16,
15,
15,
84,
21,
19,
11,
220,
16,
15,
15,
15,
11,
220,
16,
15,
62,
15,
15,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_from_t() {
let cm = CubicMap::new((10, 10), (100, 100));
let _p = cm.compute_from_t(0.5);
} | rust_cleaned_test_functions.jsonl/38120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
5673,
528,
368,
341,
262,
1077,
9961,
284,
18030,
292,
2227,
486,
931,
1188,
16,
15,
11,
220,
16,
15,
701,
320,
16,
15,
15,
11,
220,
16,
15,
15,
1106,
262,
1077,
716,
79,
284,
9961,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_prime() {
let loader = Loader::<i32, (usize, i32), (), _>::new(Batcher::new(1)).cached();
loader.prime(1, (0, 101));
let v1 = loader.load(1);
let v2 = loader.load(2);
assert_eq!((0, 101), executor::block_on(v1).unwrap());
assert_eq!((1, 20), executor::block_on(v2).unwrap());
loader.prime(2, (0, 201)); // should have no effect as key 2 are loaded already
let v3 = loader.load(2);
assert_eq!((1, 20), executor::block_on(v3).unwrap());
} | rust_cleaned_test_functions.jsonl/18912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38217,
368,
341,
1066,
262,
1077,
16047,
284,
27811,
27638,
72,
18,
17,
11,
320,
51878,
11,
600,
18,
17,
701,
38104,
716,
6831,
931,
5349,
28058,
486,
931,
7,
16,
4579,
32918,
543,
262,
16047,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cpu_add_set_flags8() {
let mut cpu = Cpu8080::new();
let a = 0xffu8;
let b = 0x01u8;
let res = cpu.add_set_flags8(a, b, flag_mask::ALL_FLAGS);
println!(
"{:#04x} + {:#04x} = {:#04x}; flags: {:?}",
a, b, res, cpu.state.flags
);
assert_eq!(res, 0x00u8);
assert_eq!(
cpu.state.flags,
FlagReg {
zf: true,
sf: false,
pf: true,
cf: true,
af: true
}
);
let a = 0x8fu8;
let b = 0x01u8;
let res = cpu.add_set_flags8(a, b, flag_mask::ALL_FLAGS);
println!(
"{:#04x} + {:#04x} = {:#04x}; flags: {:?}",
a, b, res, cpu.state.flags
);
assert_eq!(res, 0x90u8);
assert_eq!(
cpu.state.flags,
FlagReg {
zf: false,
sf: true,
pf: true,
cf: false,
af: true
}
);
let a = 0x05u8;
let b = 0x03u8;
let res = cpu.add_set_flags8(a, b, flag_mask::ALL_FLAGS);
println!(
"{:#04x} + {:#04x} = {:#04x}; flags: {:?}",
a, b, res, cpu.state.flags
);
assert_eq!(res, 0x08u8);
assert_eq!(
cpu.state.flags,
FlagReg {
zf: false,
sf: false,
pf: false,
cf: false,
af: false
}
);
} | rust_cleaned_test_functions.jsonl/35545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1082
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21795,
2891,
2602,
14130,
23,
368,
341,
286,
1077,
5206,
17319,
284,
356,
5584,
23,
15,
23,
15,
486,
931,
1428,
1789,
286,
1077,
264,
284,
220,
15,
9020,
84,
23,
280,
286,
1077,
293,
284,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_type_constructor() {
let hdr = indoc! {"
#include <string>
class A {
public:
class B {
public:
B(const std::string&) {}
int b;
};
int a;
};
"};
let rs = quote! {
ffi::A_B::make_unique(&ffi::make_string("Hello"));
};
run_test("", hdr, rs, &["A_B"], &[]);
} | rust_cleaned_test_functions.jsonl/9854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
1819,
66210,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
397,
286,
536,
362,
341,
286,
584,
510,
310,
536,
425,
341,
310,
584,
510,
394,
425,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ld_r_mem() {
let mut emu = MockEmulator::new().unwrap();
emu.cpu.pc = 0xC000;
emu.wram[0] = 0xFA;
emu.wram[1] = 0x00;
emu.wram[2] = 0xD0;
emu.wram[3] = 0x7E;
emu.wram[0x1000] = 20;
emu.wram[0x1010] = 42;
emu.cpu.h = 0xD0;
emu.cpu.l = 0x10;
execute_n(&mut emu, 1);
assert_eq!(emu.cpu.a, 20);
execute_n(&mut emu, 1);
assert_eq!(emu.cpu.a, 42);
} | rust_cleaned_test_functions.jsonl/51427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
1710,
12976,
368,
341,
286,
1077,
5206,
976,
84,
284,
14563,
2269,
10511,
486,
931,
1005,
15454,
1428,
286,
976,
84,
42387,
53335,
284,
220,
15,
12125,
15,
15,
15,
280,
286,
976,
84,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mixer() {
use packed_struct::prelude::*;
let m = MspMixerConfig {
mixer_mode: MixerMode::QuadX,
};
assert_eq!(3, m.mixer_mode.to_primitive());
let p = m.pack().unwrap();
assert_eq!(&[3], &p);
} | rust_cleaned_test_functions.jsonl/22867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
39014,
368,
341,
262,
990,
19375,
15126,
486,
1726,
52538,
79304,
262,
1077,
296,
284,
386,
2154,
44,
39014,
2648,
341,
286,
37778,
7302,
25,
71292,
3636,
486,
43474,
55,
345,
262,
2605,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_bytearray_to_vec() {
let gil = Python::acquire_gil();
let py = gil.python();
let v: Vec<u8> = py
.eval("bytearray(b'abc')", None, None)
.unwrap()
.extract()
.unwrap();
assert!(v == b"abc");
} | rust_cleaned_test_functions.jsonl/47430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
19737,
1653,
2346,
13251,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
25,
11312,
34837,
23,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_predicate_pushdown_binary_expr() {
let df = load_df();
df.lazy()
.filter(col("a").eq(col("b")))
.select([col("c")])
.collect()
.unwrap();
} | rust_cleaned_test_functions.jsonl/130 | {
"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,
49646,
97474,
14218,
2923,
31761,
21915,
368,
341,
262,
1077,
6764,
284,
2795,
10894,
543,
262,
6764,
84121,
741,
286,
659,
5315,
19611,
445,
64,
1827,
11006,
19611,
445,
65,
29836,
286,
659,
1742... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_union() {
let a = BooleanBitfield::from_bytes(&[0b1100, 0b0001]);
let b = BooleanBitfield::from_bytes(&[0b1011, 0b1001]);
let c = BooleanBitfield::from_bytes(&[0b1111, 0b1001]);
assert_eq!(a.union(&b), c);
assert_eq!(b.union(&a), c);
assert_eq!(a.union(&a), a);
assert_eq!(b.union(&b), b);
assert_eq!(c.union(&c), c);
} | rust_cleaned_test_functions.jsonl/30485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
368,
341,
286,
1077,
264,
284,
6992,
8344,
2566,
486,
1499,
12524,
2099,
58,
15,
65,
16,
16,
15,
15,
11,
220,
15,
65,
15,
15,
15,
16,
2558,
286,
1077,
293,
284,
6992,
8344,
2566,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dollar_crate_lhs_is_not_meta() {
parse_macro(
r#"
macro_rules! foo {
($crate) => {};
() => {0};
}
"#,
)
.assert_expand_items(r#"foo!{}"#, r#"0"#);
} | rust_cleaned_test_functions.jsonl/28753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
21295,
666,
7698,
84284,
6892,
7913,
13381,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
32606,
21407,
0,
15229,
341,
262,
1711,
61711,
8,
589,
9321,
262,
1719,
589,
314,
15,
2440,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_inflation_features_enabled_devnet_and_testnet() {
let mut feature_set = FeatureSet::default();
assert!(feature_set.full_inflation_features_enabled().is_empty());
feature_set
.active
.insert(full_inflation::devnet_and_testnet::id(), 42);
assert_eq!(
feature_set.full_inflation_features_enabled(),
[full_inflation::devnet_and_testnet::id()]
.iter()
.cloned()
.collect()
);
} | rust_cleaned_test_functions.jsonl/30670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
1243,
64149,
14965,
18220,
10433,
4711,
8378,
4452,
4711,
368,
341,
286,
1077,
5206,
4565,
2602,
284,
19998,
1649,
486,
2258,
543,
286,
2060,
10297,
12753,
2602,
21534,
1243,
64149,
14965,
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_parse_preserve_header_case_in_request() {
let mut raw =
BytesMut::from("GET / HTTP/1.1\r\nHost: hyper.rs\r\nX-BREAD: baguette\r\n\r\n");
let ctx = ParseContext {
cached_headers: &mut None,
req_method: &mut None,
h1_parser_config: Default::default(),
h1_header_read_timeout: None,
h1_header_read_timeout_fut: &mut None,
h1_header_read_timeout_running: &mut false,
preserve_header_case: true,
h09_responses: false,
#[cfg(feature = "ffi")]
on_informational: &mut None,
#[cfg(feature = "ffi")]
raw_headers: false,
};
let parsed_message = Server::parse(&mut raw, ctx).unwrap().unwrap();
let orig_headers = parsed_message
.head
.extensions
.get::<HeaderCaseMap>()
.unwrap();
assert_eq!(
orig_headers
.get_all_internal(&HeaderName::from_static("host"))
.into_iter()
.collect::<Vec<_>>(),
vec![&Bytes::from("Host")]
);
assert_eq!(
orig_headers
.get_all_internal(&HeaderName::from_static("x-bread"))
.into_iter()
.collect::<Vec<_>>(),
vec![&Bytes::from("X-BREAD")]
);
} | rust_cleaned_test_functions.jsonl/7664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
32116,
5852,
8757,
19096,
1243,
7893,
368,
341,
286,
1077,
5206,
7112,
4035,
310,
30024,
51440,
486,
1499,
445,
3806,
608,
10130,
14,
16,
13,
16,
12016,
1699,
9296,
25,
17071,
25638,
12016,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
let upt = upt::init();
check_parse!(upt, ["install", "vim"], (Install, "vim", false));
check_parse!(upt, ["install", "-y", "vim"], (Install, "vim", true));
check_parse!(upt, ["install", "--yes", "vim"], (Install, "vim", true));
check_parse!(
upt,
["remove", "--yes", "vim", "jq"],
(Remove, "vim jq", true)
);
check_parse!(upt, ["upgrade", "vim"], (Upgrade, "vim", false));
check_parse!(upt, ["search", "vim"], (Search, pkg = "vim"));
check_parse!(upt, ["search", "vim", "jq"], (Search, pkg = "vim jq"));
check_parse!(upt, ["show", "vim"], (Show, pkg = "vim"));
check_parse!(upt, ["update"], UpdateIndex);
check_parse!(upt, ["upgrade"], (UpgradeAll, yes = false));
check_parse!(upt, ["list", "--upgradable"], ListUpgradable);
check_parse!(upt, ["list", "-i"], ListInstalled);
check_parse!(upt, ["install"]);
check_parse!(upt, ["install", "--ye"]);
check_parse!(upt, ["update", "--yes"]);
check_parse!(upt, ["list"]);
} | rust_cleaned_test_functions.jsonl/37066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
34335,
284,
34335,
486,
2327,
543,
286,
1779,
21039,
10297,
7564,
11,
4383,
12248,
497,
330,
41194,
7914,
320,
24690,
11,
330,
41194,
497,
895,
1106,
286,
1779,
21039,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reg(){
let reference = Package::Reg(RegistrationPackage{ is_router: false });
let result: Vec<u8> = reference.clone().into();
match Package::try_from(result){
Ok(result) => {
assert_eq!(reference, result)
}
Err(_) => {assert!(false, "Unexpected error")}
}
} | rust_cleaned_test_functions.jsonl/124206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4920,
3032,
286,
1077,
5785,
284,
16906,
486,
3477,
7,
23365,
13100,
90,
374,
55587,
25,
895,
1625,
286,
1077,
1102,
25,
11312,
34837,
23,
29,
284,
5785,
15997,
1005,
18122,
543,
286,
2432,
1690... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_measure_qubit() {
let mut circuit = Circuit::new();
circuit += DefinitionBit::new("ro".to_string(), 1, true);
circuit += PauliX::new(0);
circuit += MeasureQubit::new(0, "ro".to_string(), 1);
let (bit_registers, _f, _c, _bo, _co) = call_circuit(&circuit, empty_regs(), 2).unwrap();
assert!(bit_registers.contains_key("ro"));
let out_reg = bit_registers.get("ro").unwrap();
assert_eq!(out_reg.len(), 1);
for reg in out_reg.iter() {
assert!(*reg || !*reg);
}
} | rust_cleaned_test_functions.jsonl/40993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48938,
8976,
59220,
368,
341,
262,
1077,
5206,
16224,
284,
27218,
486,
931,
543,
262,
16224,
1421,
19709,
8344,
486,
931,
445,
299,
3263,
983,
3904,
1507,
220,
16,
11,
830,
317,
262,
16224,
1421... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_test_case_4() {
let key = Vec::from_hex("0102030405060708090a0b0c0d0e0f10111213141516171819").unwrap();
let data = Vec::from_hex("cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd").unwrap();
let expected = "697eaf0aca3a3aea3a75164746ffaa79";
run_test_case(&key[..], &data[..], expected);
} | rust_cleaned_test_functions.jsonl/17341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
19096,
62,
19,
368,
341,
286,
1077,
1376,
284,
11312,
486,
1499,
32655,
445,
15,
16,
15,
17,
15,
18,
15,
19,
15,
20,
15,
21,
15,
22,
15,
23,
15,
24,
15,
64,
15,
65,
15,
66,
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_pull_assignment_up_retains_stmts() {
check_assist(
pull_assignment_up,
r#"
fn foo() {
let mut a = 1;
if true {
let b = 2;
$0a = 2;
} else {
let b = 3;
a = 3;
}
}"#,
r#"
fn foo() {
let mut a = 1;
a = if true {
let b = 2;
2
} else {
let b = 3;
3
};
}"#,
)
} | rust_cleaned_test_functions.jsonl/117257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65693,
51891,
8237,
21695,
1735,
21824,
82,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6815,
51891,
8237,
345,
310,
435,
2,
698,
8822,
15229,
368,
341,
262,
1077,
5206,
264,
284,
220,
16,
401,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_write_state_table() -> Result<()> {
let fs1 = IntegerFilterState::new(1);
let fs2 = IntegerFilterState::new(2);
let tuple_1 = ComposeStateTuple {
fs: fs1,
s1: 1 as StateId,
s2: 2 as StateId,
};
let tuple_2 = ComposeStateTuple {
fs: fs2,
s1: 1 as StateId,
s2: 2 as StateId,
};
let state_table = StateTable::new();
state_table.find_id(tuple_1);
state_table.find_id(tuple_2);
let mut buffer = Vec::new();
state_table.write_binary(&mut buffer)?;
let (_, parsed_state_table) =
StateTable::<ComposeStateTuple<IntegerFilterState>>::parse_binary(&buffer)
.map_err(|err| anyhow!("{}", err))?;
assert_eq!(state_table, parsed_state_table);
Ok(())
} | rust_cleaned_test_functions.jsonl/80507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
4387,
5237,
368,
1464,
5714,
71698,
341,
286,
1077,
8619,
16,
284,
4440,
5632,
1397,
486,
931,
7,
16,
317,
286,
1077,
8619,
17,
284,
4440,
5632,
1397,
486,
931,
7,
17,
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... | 3 |
#[test]
fn test_nested_types() {
if let Ok(r) = NestedTypes::from_file("src/fixed_struct.bin") {
assert_eq!(r.one.typed_at_root.value_b, 80);
assert_eq!(r.one.typed_here.value_c, 65);
assert_eq!(r.two.value_b, 67);
}
} | rust_cleaned_test_functions.jsonl/8583 | {
"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,
66279,
9763,
368,
341,
262,
421,
1077,
7622,
2601,
8,
284,
71742,
4173,
486,
1499,
2458,
445,
3548,
6663,
3286,
15126,
29394,
899,
341,
286,
2060,
10714,
10297,
81,
30973,
734,
32501,
3752,
12993,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_url_parsing() {
assert_eq!(
VcsUrl::parse("http://github.com/mitsuhiko/flask"),
VcsUrl {
provider: "github.com".into(),
id: "mitsuhiko/flask".into(),
}
);
assert_eq!(
VcsUrl::parse("git@github.com:mitsuhiko/flask.git"),
VcsUrl {
provider: "github.com".into(),
id: "mitsuhiko/flask".into(),
}
);
assert_eq!(
VcsUrl::parse("http://bitbucket.org/mitsuhiko/flask"),
VcsUrl {
provider: "bitbucket.org".into(),
id: "mitsuhiko/flask".into(),
}
);
assert_eq!(
VcsUrl::parse("git@bitbucket.org:mitsuhiko/flask.git"),
VcsUrl {
provider: "bitbucket.org".into(),
id: "mitsuhiko/flask".into(),
}
);
assert_eq!(
VcsUrl::parse("https://neilmanvar.visualstudio.com/_git/sentry-demo"),
VcsUrl {
provider: "neilmanvar.visualstudio.com".into(),
id: "neilmanvar/sentry-demo".into(),
}
);
assert_eq!(
VcsUrl::parse("https://github.myenterprise.com/mitsuhiko/flask.git"),
VcsUrl {
provider: "github.myenterprise.com".into(),
id: "mitsuhiko/flask".into(),
}
);
assert_eq!(
VcsUrl::parse("https://gitlab.example.com/gitlab-org/gitlab-ce"),
VcsUrl {
provider: "gitlab.example.com".into(),
id: "gitlab-org/gitlab-ce".into(),
}
);
assert_eq!(
VcsUrl::parse("git@gitlab.example.com:gitlab-org/gitlab-ce.git"),
VcsUrl {
provider: "gitlab.example.com".into(),
id: "gitlab-org/gitlab-ce".into(),
}
);
assert_eq!(
VcsUrl::parse("https://gitlab.com/gitlab-org/gitlab-ce"),
VcsUrl {
provider: "gitlab.com".into(),
id: "gitlab-org/gitlab-ce".into(),
}
);
assert_eq!(
VcsUrl::parse("git@gitlab.com:gitlab-org/gitlab-ce.git"),
VcsUrl {
provider: "gitlab.com".into(),
id: "gitlab-org/gitlab-ce".into(),
}
)
} | rust_cleaned_test_functions.jsonl/3562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
620,
28598,
368,
341,
262,
2060,
10714,
33673,
286,
647,
4837,
2864,
486,
6400,
445,
1254,
1110,
5204,
905,
3183,
1199,
12540,
23630,
58303,
1073,
4461,
286,
647,
4837,
2864,
341,
310,
9109,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
use query::{Q, QH};
let db = Database::open("/tmp/test_database").unwrap();
let coll = db.collection("example_collection").unwrap();
let items = (0..10).map(|i| {
bson! {
"name" => (format!("Me #{}", i)),
"age" => (23.8 + i as f64)
}
});
coll.save_all(items).unwrap();
let q = Q.field("age").gte(25);
for item in coll.query(&q, QH.empty()).find().unwrap() {
println!("{}", item.unwrap());
}
let count = coll.query(&q, QH.empty()).count().unwrap();
println!("Count: {}", count);
let one = coll.query(&q, QH.empty()).find_one().unwrap();
println!("One: {}", one.unwrap());
} | rust_cleaned_test_functions.jsonl/115196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
262,
990,
3239,
22964,
48,
11,
1207,
39,
2315,
262,
1077,
2927,
284,
9994,
486,
2508,
4283,
5173,
12697,
27341,
1827,
15454,
543,
262,
1077,
4530,
284,
2927,
17578,
445,
8687,
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_distance_and_ordering() {
let node_id1 = NodeId::try_from(
[
144, 28, 106, 112, 220, 197, 216, 119, 9, 217, 42, 77, 159, 211, 53, 207, 0, 157, 5, 55, 235, 247, 160,
195, 240, 48, 146, 168, 119, 15, 241, 54,
]
.as_bytes(),
)
.unwrap();
let node_id2 = NodeId::try_from(
[
186, 43, 62, 14, 60, 214, 9, 180, 145, 122, 55, 160, 83, 83, 45, 185, 219, 206, 226, 128, 5, 26, 20, 0,
192, 121, 216, 178, 134, 212, 51, 131,
]
.as_bytes(),
)
.unwrap();
let node_id3 = NodeId::try_from(
[
60, 32, 246, 39, 108, 201, 214, 91, 30, 230, 3, 126, 31, 46, 66, 203, 27, 51, 240, 177, 230, 22, 118,
102, 201, 55, 211, 147, 229, 26, 116, 103,
]
.as_bytes(),
)
.unwrap();
assert!(node_id1.0 < node_id2.0);
assert!(node_id1.0 > node_id3.0);
// XOR metric
let desired_n1_to_n2_dist = NodeDistance::try_from(
[
42, 55, 84, 126, 224, 19, 209, 195, 152, 163, 29, 237, 204, 128, 24, 118, 219, 83, 231, 183, 238, 237,
180, 195, 48, 73, 74, 26, 241, 219, 194, 181,
]
.as_bytes(),
)
.unwrap();
let desired_n1_to_n3_dist = NodeDistance::try_from(
[
172, 60, 156, 87, 176, 12, 14, 44, 23, 63, 41, 51, 128, 253, 119, 4, 27, 174, 245, 134, 13, 225, 214,
165, 57, 7, 65, 59, 146, 21, 133, 81,
]
.as_bytes(),
)
.unwrap();
// Hamming distance
// let desired_n1_to_n3_dist = NodeDistance::try_from(
let n1_to_n2_dist = node_id1.distance(&node_id2);
let n1_to_n3_dist = node_id1.distance(&node_id3);
assert!(n1_to_n2_dist < n1_to_n3_dist); // XOR metric
assert_eq!(n1_to_n2_dist, desired_n1_to_n2_dist);
assert_eq!(n1_to_n3_dist, desired_n1_to_n3_dist);
// Commutative
let n1_to_n2_dist = node_id1.distance(&node_id2);
let n2_to_n1_dist = node_id2.distance(&node_id1);
assert_eq!(n1_to_n2_dist, n2_to_n1_dist);
} | rust_cleaned_test_functions.jsonl/76526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19464,
8378,
7869,
287,
368,
341,
286,
1077,
2436,
842,
16,
284,
6018,
764,
486,
1539,
5673,
1006,
310,
2278,
394,
220,
16,
19,
19,
11,
220,
17,
23,
11,
220,
16,
15,
21,
11,
220,
16,
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_outbound_multiple_protocols() {
let mut rt = Runtime::new().unwrap();
let (mut ds_requests_tx, _ds_notifs_rx, _peer_mgr_notifs_tx, mut peer_mgr_reqs_rx) =
start_direct_send_actor(rt.handle().clone());
let peer_id = PeerId::random();
let (dialer_substream_1, listener_substream_1) = MemorySocket::new_pair();
let (dialer_substream_2, listener_substream_2) = MemorySocket::new_pair();
// Fake the dialer NetworkProvider
let f_network_provider = async move {
// Send 2 messages with different protocols to the same peer
ds_requests_tx
.send(DirectSendRequest::SendMessage(
peer_id,
Message {
protocol: Bytes::from_static(&PROTOCOL_1[..]),
mdata: Bytes::from_static(MESSAGE_1),
},
))
.await
.unwrap();
ds_requests_tx
.send(DirectSendRequest::SendMessage(
peer_id,
Message {
protocol: Bytes::from_static(&PROTOCOL_2[..]),
mdata: Bytes::from_static(MESSAGE_2),
},
))
.await
.unwrap();
// DirectSend actor should request to open 2 different substreams.
expect_open_substream_request(
&mut peer_mgr_reqs_rx,
peer_id,
PROTOCOL_1,
Ok(dialer_substream_1),
)
.await;
expect_open_substream_request(
&mut peer_mgr_reqs_rx,
peer_id,
PROTOCOL_2,
Ok(dialer_substream_2),
)
.await;
};
// The listener should receive 1 message on each substream.
let f_substream = async move {
let mut listener_substream_1 = Framed::new(
IoCompat::new(listener_substream_1),
LengthDelimitedCodec::new(),
);
let msg = listener_substream_1.next().await.unwrap().unwrap();
assert_eq!(msg.as_ref(), MESSAGE_1);
let mut listener_substream_2 = Framed::new(
IoCompat::new(listener_substream_2),
LengthDelimitedCodec::new(),
);
let msg = listener_substream_2.next().await.unwrap().unwrap();
assert_eq!(msg.as_ref(), MESSAGE_2);
};
rt.spawn(f_network_provider);
rt.block_on(f_substream);
} | rust_cleaned_test_functions.jsonl/13364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
10891,
45233,
22357,
22018,
368,
341,
262,
1077,
5206,
16677,
284,
10954,
486,
931,
1005,
15454,
1428,
262,
1077,
320,
6984,
11472,
37216,
17805,
11,
716,
5356,
7913,
21835,
24330,
11,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_u512_r_squared() {
assert_eq!(r_squared(), Scalar::from_u512([0, 0, 0, 0, 1, 0, 0, 0]));
} | rust_cleaned_test_functions.jsonl/108342 | {
"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,
5673,
7300,
20,
16,
17,
1710,
54641,
368,
341,
262,
2060,
10714,
10297,
81,
54641,
1507,
35176,
486,
1499,
7300,
20,
16,
17,
2561,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_poly_to_from_bytes() {
let degree = 3;
let mut rng = rand::thread_rng();
let poly = Poly::random(degree, &mut rng);
let poly_bytes = poly.to_bytes();
assert_eq!(poly_bytes.len(), (degree + 1) * 32);
// the first bytes of the poly match the first Fr
let fr = poly.evaluate(0);
let fr_bytes = fr.to_bytes_be();
let fr_bytes_size = fr_bytes.len();
for i in 0..fr_bytes_size {
assert_eq!(fr_bytes[i], poly_bytes[i]);
}
// from bytes gives original poly
let restored_poly = Poly::from_bytes(poly_bytes).expect("invalid poly bytes");
assert_eq!(poly, restored_poly);
// for vectors see SecretKeySet
} | rust_cleaned_test_functions.jsonl/49478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36133,
2346,
5673,
12524,
368,
341,
286,
1077,
8381,
284,
220,
18,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
9861,
284,
18767,
486,
11463,
12797,
22490,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_resolving_one_dep() {
let reg = registry(vec![pkg!("foo"), pkg!("bar")]);
let res = resolve(&pkg_id("root"), vec![dep("foo")], ®).unwrap();
assert_same(&res, &names(&["root", "foo"]));
} | rust_cleaned_test_functions.jsonl/48303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
19648,
11667,
49258,
368,
341,
262,
1077,
1217,
284,
19424,
25592,
20703,
30069,
17223,
7975,
3975,
24793,
17223,
2257,
899,
2558,
262,
1077,
592,
284,
8830,
2099,
30069,
842,
445,
2888,
3975,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_A_to_Y() {
//TAY
let code = vec![0xA8];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.A = 0xF1;
nes.next(&mut memory).unwrap();
assert_eq!(0xF1, nes.Y);
} | rust_cleaned_test_functions.jsonl/38719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
1566,
2346,
10626,
368,
341,
286,
442,
51,
3022,
198,
286,
1077,
2038,
284,
7486,
20703,
15,
14673,
23,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_cursor() {
let mut test = SdlTest::new();
test.console().write(b"Move cursor over parts of this text").unwrap();
for _ in 0..15 {
test.console().move_within_line(-1).unwrap();
}
for _ in 0..5 {
test.console().move_within_line(1).unwrap();
}
test.verify("sdl-move-cursor");
} | rust_cleaned_test_functions.jsonl/15264 | {
"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,
17134,
28601,
368,
341,
286,
1077,
5206,
1273,
284,
328,
8736,
2271,
486,
931,
1428,
286,
1273,
47802,
1005,
4934,
1883,
1,
9860,
8128,
916,
5479,
315,
419,
1467,
1827,
15454,
543,
286,
369,
716... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eq_dyn_neq_dyn_dictionary_interval_array() {
let values = IntervalDayTimeArray::from(vec![1, 6, 10, 2, 3, 5]);
let keys1 = UInt64Array::from_iter_values([1_u64, 0, 3]);
let keys2 = UInt64Array::from_iter_values([2_u64, 0, 3]);
let dict_array1 =
DictionaryArray::<UInt64Type>::try_new(&keys1, &values).unwrap();
let dict_array2 =
DictionaryArray::<UInt64Type>::try_new(&keys2, &values).unwrap();
let result = eq_dyn(&dict_array1, &dict_array2);
assert_eq!(result.unwrap(), BooleanArray::from(vec![false, true, true]));
let result = neq_dyn(&dict_array1, &dict_array2);
assert_eq!(
result.unwrap(),
BooleanArray::from(vec![true, false, false])
);
} | rust_cleaned_test_functions.jsonl/98254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
69213,
13925,
80,
69213,
42605,
20541,
3858,
368,
341,
286,
1077,
2750,
284,
40584,
10159,
1462,
1857,
486,
1499,
25592,
20703,
16,
11,
220,
21,
11,
220,
16,
15,
11,
220,
17,
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... | 1 |
#[test]
fn test_opt_cell_set() {
let one:OptCell<u32> = OptCell::new(None);
one.set(1);
assert_eq!(*one,Some(1));
} | rust_cleaned_test_functions.jsonl/88909 | {
"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,
15032,
16648,
2602,
368,
341,
286,
1077,
825,
25,
21367,
3599,
34837,
18,
17,
29,
284,
16554,
3599,
486,
931,
26717,
317,
286,
825,
980,
7,
16,
317,
286,
2060,
10714,
0,
4071,
603,
11,
8373,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_len() {
let mut block = Block::new();
block.push(row!{foo: "bar"}).unwrap();
for row in block.rows() {
assert_eq!(row.len(), 1);
}
} | rust_cleaned_test_functions.jsonl/126603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
368,
341,
286,
1077,
5206,
2504,
284,
8362,
486,
931,
543,
286,
2504,
2552,
7835,
0,
90,
7975,
25,
330,
2257,
9207,
568,
15454,
1428,
286,
369,
2802,
304,
2504,
19336,
368,
341,
310,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_max_u64() {
assert_eq!(
say::encode(18_446_744_073_709_551_615),
String::from(
"eighteen quintillion four hundred forty-six \
quadrillion seven hundred forty-four trillion \
seventy-three billion seven hundred nine million \
five hundred fifty-one thousand six hundred fifteen"
)
);
} | rust_cleaned_test_functions.jsonl/15988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
7300,
21,
19,
368,
341,
262,
2060,
10714,
33673,
286,
1977,
486,
6180,
7,
16,
23,
62,
19,
19,
21,
62,
22,
19,
19,
62,
15,
22,
18,
62,
22,
15,
24,
62,
20,
20,
16,
62,
21,
16,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assert_greater_than() -> Result<()> {
super::setup_test_env();
assert_greater_than!(2, 1).map(|a| a.panic());
assert!(assert_greater_than!(1, 1).is_some());
assert!(assert_greater_than!(0, 1).is_some());
assert!(assert_greater_than!("234", "cde").is_some());
assert!(assert_greater_than!(std::f64::NAN, 1.0f64).is_some());
let failure_message = assert_greater_than!(1, 2)
.expect("must fail")
.get_failure_message();
assert_matches_snapshot!(failure_message).map(|a| a.panic());
assert!(assert_greater_than!(9.8, 3.15, "Expected left to be greater than right").is_none());
Ok(())
} | rust_cleaned_test_functions.jsonl/51016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
97994,
51613,
368,
1464,
5714,
71698,
341,
262,
2256,
486,
15188,
4452,
15879,
1428,
262,
2060,
97994,
51613,
10297,
17,
11,
220,
16,
568,
2186,
22428,
64,
91,
264,
556,
31270,
1423,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_upload() {
// Delete the upload file before we begin.
let _ = fs::remove_file("/tmp/upload.txt");
let client = Client::new(super::rocket()).unwrap();
let mut res = client.post("/upload")
.header(ContentType::Plain)
.body(UPLOAD_CONTENTS)
.dispatch();
assert_eq!(res.status(), Status::Ok);
assert_eq!(res.body_string(), Some(UPLOAD_CONTENTS.len().to_string()));
let mut file_contents = String::new();
let mut file = File::open("/tmp/upload.txt").expect("open upload.txt file");
file.read_to_string(&mut file_contents).expect("read upload.txt");
assert_eq!(&file_contents, UPLOAD_CONTENTS);
} | rust_cleaned_test_functions.jsonl/30682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
21691,
368,
341,
262,
442,
10428,
279,
8135,
1034,
1573,
582,
3161,
624,
262,
1077,
716,
284,
8619,
486,
5399,
2458,
4283,
5173,
37173,
3909,
3071,
1066,
262,
1077,
2943,
284,
8423,
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_final_value_after_operations() {
{
let operations = vec!["--X".to_string(), "X++".to_string(), "X++".to_string()];
assert_eq!(final_value_after_operations(operations), 1);
}
{
let operations = vec!["++X".to_string(), "++X".to_string(), "X++".to_string()];
assert_eq!(final_value_after_operations(operations), 3);
}
{
let operations = vec![
"X++".to_string(),
"++X".to_string(),
"--X".to_string(),
"X--".to_string(),
];
assert_eq!(final_value_after_operations(operations), 0);
}
} | rust_cleaned_test_functions.jsonl/72379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20676,
3142,
19844,
57345,
368,
341,
262,
341,
286,
1077,
7525,
284,
7486,
0,
1183,
313,
55,
3263,
983,
3904,
1507,
330,
55,
1027,
3263,
983,
3904,
1507,
330,
55,
1027,
3263,
983,
3904,
33800,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_indent() {
let plan = display_plan();
let expected = "Projection: #id\
\n Filter: #state Eq Utf8(\"CO\")\
\n TableScan: employee.csv projection=Some([0, 3])";
assert_eq!(expected, format!("{}", plan.display_indent()));
} | rust_cleaned_test_functions.jsonl/10286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
69045,
368,
341,
286,
1077,
3119,
284,
3037,
26564,
1428,
286,
1077,
3601,
284,
330,
46321,
25,
671,
307,
5661,
286,
1124,
77,
220,
12339,
25,
671,
2454,
33122,
43432,
23,
36014,
8281,
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_constant() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("const x = 123; x")?, 123);
assert!(matches!(
*engine.eval::<INT>("const x = 123; x = 42;").expect_err("expects error"),
EvalAltResult::ErrorParsing(err) if err.error_type() == &ParseErrorType::AssignmentToConstant("x".to_string())
));
#[cfg(not(feature = "no_index"))]
assert!(matches!(
*engine.eval::<INT>("const x = [1, 2, 3, 4, 5]; x[2] = 42;").expect_err("expects error"),
EvalAltResult::ErrorParsing(err) if err.error_type() == &ParseErrorType::AssignmentToConstant("x".to_string())
));
Ok(())
} | rust_cleaned_test_functions.jsonl/55333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
10297,
8512,
31710,
27638,
3221,
13211,
1024,
856,
284,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_double() {
assert_eq!(
Variant::VDouble(5.9).divide(Variant::VDouble(2.4)).unwrap(),
Variant::VDouble(2.45833333333333)
);
} | rust_cleaned_test_functions.jsonl/84611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
7378,
7,
20,
13,
24,
568,
59394,
12410,
15341,
486,
53,
7378,
7,
17,
13,
19,
4579,
15454,
3148,
503,
39292,
486,
53,
7378,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.