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_set_positive_period() {
// arrange
const PERIOD: u64 = 100000;
let (tmp, max) = setup("test_set_positive_period", CGROUP_CPU_MAX);
let cpu = LinuxCpuBuilder::new().with_period(PERIOD).build();
// act
Cpu::apply(&tmp, &cpu).expect("apply cpu");
// assert
let content = fs::read_to_string(max)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_MAX));
assert_eq!(content, format!("{} {}", UNRESTRICTED_QUOTA, PERIOD))
} | rust_cleaned_test_functions.jsonl/126561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
54160,
20818,
368,
341,
286,
442,
30893,
198,
286,
733,
17854,
33291,
25,
575,
21,
19,
284,
220,
16,
15,
15,
15,
15,
15,
280,
286,
1077,
320,
5173,
11,
1932,
8,
284,
6505,
445,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hundredweight() {
assert_query!("4qr to hundredweight", 1, hundredweight);
assert_query!("(1t / 20) to hundredweight", 1, hundredweight);
} | rust_cleaned_test_functions.jsonl/36188 | {
"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,
1523,
7114,
4765,
368,
341,
262,
2060,
5738,
17223,
19,
23004,
311,
7739,
4765,
497,
220,
16,
11,
7739,
4765,
317,
262,
2060,
5738,
17223,
7,
16,
83,
608,
220,
17,
15,
8,
311,
7739,
4765,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_withdraw_votes() {
let validators =
HashMap::from_iter(vec![("test1".to_string(), 10), ("test2".to_string(), 10)]);
let context = get_context_with_epoch_height("test1".to_string(), 1);
testing_env!(
context,
Default::default(),
Default::default(),
validators.clone()
);
let mut contract = VotingContract::new();
contract.vote(true);
assert_eq!(contract.votes.len(), 1);
let context = get_context_with_epoch_height("test1".to_string(), 2);
testing_env!(
context,
Default::default(),
Default::default(),
validators.clone()
);
contract.vote(false);
assert!(contract.votes.is_empty());
} | rust_cleaned_test_functions.jsonl/3919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
7633,
65116,
368,
341,
286,
1077,
38588,
4035,
310,
10528,
486,
1499,
11723,
25592,
20703,
445,
1944,
16,
3263,
983,
3904,
1507,
220,
16,
15,
701,
3489,
1944,
17,
3263,
983,
3904,
1507,
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_data_key() {
assert!(validate_data_key(&data_key(b"abc")));
assert!(!validate_data_key(b"abc"));
let mut region = Region::new();
// uninitialised region should not be passed in `enc_start_key` and `enc_end_key`.
assert!(::panic_hook::recover_safe(|| enc_start_key(®ion)).is_err());
assert!(::panic_hook::recover_safe(|| enc_end_key(®ion)).is_err());
region.mut_peers().push(Peer::new());
assert_eq!(enc_start_key(®ion), vec![DATA_PREFIX]);
assert_eq!(enc_end_key(®ion), vec![DATA_PREFIX + 1]);
region.set_start_key(vec![1]);
region.set_end_key(vec![2]);
assert_eq!(enc_start_key(®ion), vec![DATA_PREFIX, 1]);
assert_eq!(enc_end_key(®ion), vec![DATA_PREFIX, 2]);
} | rust_cleaned_test_functions.jsonl/44172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
3097,
368,
341,
286,
2060,
10297,
7067,
1769,
3097,
2099,
691,
3097,
1883,
1,
13683,
17621,
286,
2060,
0,
3471,
7067,
1769,
3097,
1883,
1,
13683,
14929,
286,
1077,
5206,
5537,
284,
17152,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_schema_based_failure() {
let schema = Schema::default();
let known = Known::for_schema(&schema);
let query = r#"
[:find ?x
:where (or [?x :foo/nope1 "John"]
[?x :foo/nope2 "Ámbar"]
[?x :foo/nope3 "Daphne"])]"#;
let cc = alg(known, query);
assert!(cc.is_known_empty());
assert_eq!(cc.empty_because, Some(EmptyBecause::Unresolvedsolitonid(Keyword::namespaced("foo", "nope3"))));
} | rust_cleaned_test_functions.jsonl/44224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
66679,
43618,
368,
341,
286,
1077,
10802,
284,
12539,
486,
2258,
543,
286,
1077,
3881,
284,
48286,
486,
1958,
25371,
2099,
17349,
317,
286,
1077,
3239,
284,
435,
2,
698,
310,
20865,
3903,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec() {
let mut a = arr2(&[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]);
a.slice_collapse(s![..;-1, ..]);
assert_eq!(a.row(3).to_vec(), vec![1, 2, 3]);
assert_eq!(a.column(2).to_vec(), vec![12, 9, 6, 3]);
a.slice_collapse(s![.., ..;-1]);
assert_eq!(a.row(3).to_vec(), vec![3, 2, 1]);
} | rust_cleaned_test_functions.jsonl/92637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
13251,
368,
341,
262,
1077,
5206,
264,
284,
2890,
17,
2099,
15505,
16,
11,
220,
17,
11,
220,
18,
1125,
508,
19,
11,
220,
20,
11,
220,
21,
1125,
508,
22,
11,
220,
23,
11,
220,
24,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_file_path_from_git_diff_header_line_containing_spaces() {
assert_eq!(
parse_diff_header_line("+++ a/my src/delta.rs", true, None),
("my src/delta.rs".to_string(), FileEvent::Change)
);
assert_eq!(
parse_diff_header_line("+++ my src/delta.rs", true, None),
("my src/delta.rs".to_string(), FileEvent::Change)
);
assert_eq!(
parse_diff_header_line("+++ a/src/my delta.rs", true, None),
("src/my delta.rs".to_string(), FileEvent::Change)
);
assert_eq!(
parse_diff_header_line("+++ a/my src/my delta.rs", true, None),
("my src/my delta.rs".to_string(), FileEvent::Change)
);
assert_eq!(
parse_diff_header_line("+++ b/my src/my enough/my delta.rs", true, None),
(
"my src/my enough/my delta.rs".to_string(),
FileEvent::Change
)
);
} | rust_cleaned_test_functions.jsonl/72332 | {
"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,
3062,
2458,
2638,
5673,
68801,
15850,
8757,
6528,
10260,
2056,
67883,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
15850,
8757,
6528,
445,
62730,
264,
34198,
2286,
3446,
5964,
25638,
497,
830,
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_format_replacement() {
let added = " 84,\
\n 248,";
let removed = " 0,\
\n 0,\
\n 128,";
let mut buf = String::new();
let _ = format_replacement(&mut buf, added, removed);
println!(
"## removed ##\
\n{}\
\n## added ##\
\n{}\
\n## diff ##\
\n{}",
removed, added, buf
);
#[cfg(not(feature = "git-style-diff"))]
assert_eq!(
buf,
"\u{1b}[31m<\u{1b}[0m\u{1b}[31m \u{1b}[0m\u{1b}[1;48;5;52;31m0\u{1b}[0m\u{1b}[31m,\u{1b}[0m\n\u{1b}[31m<\u{1b}[0m\u{1b}[31m \u{1b}[0m\u{1b}[1;48;5;52;31m0,\u{1b}[0m\n\u{1b}[1;31m<\u{1b}[0m\u{1b}[1;48;5;52;31m 1\u{1b}[0m\u{1b}[31m2\u{1b}[0m\u{1b}[31m8,\u{1b}[0m\n\u{1b}[32m>\u{1b}[0m\u{1b}[32m \u{1b}[0m\u{1b}[1;48;5;22;32m84\u{1b}[0m\u{1b}[32m,\u{1b}[0m\n\u{1b}[32m>\u{1b}[0m\u{1b}[32m \u{1b}[0m\u{1b}[32m2\u{1b}[0m\u{1b}[1;48;5;22;32m4\u{1b}[0m\u{1b}[32m8,\u{1b}[0m\n"
);
#[cfg(feature = "git-style-diff")]
assert_eq!(
buf,
"\u{1b}[31m-\u{1b}[0m\u{1b}[31m \u{1b}[0m\u{1b}[1;48;5;52;31m0\u{1b}[0m\u{1b}[31m,\u{1b}[0m\n\u{1b}[31m-\u{1b}[0m\u{1b}[31m \u{1b}[0m\u{1b}[1;48;5;52;31m0,\u{1b}[0m\n\u{1b}[1;31m-\u{1b}[0m\u{1b}[1;48;5;52;31m 1\u{1b}[0m\u{1b}[31m2\u{1b}[0m\u{1b}[31m8,\u{1b}[0m\n\u{1b}[32m+\u{1b}[0m\u{1b}[32m \u{1b}[0m\u{1b}[1;48;5;22;32m84\u{1b}[0m\u{1b}[32m,\u{1b}[0m\n\u{1b}[32m+\u{1b}[0m\u{1b}[32m \u{1b}[0m\u{1b}[32m2\u{1b}[0m\u{1b}[1;48;5;22;32m4\u{1b}[0m\u{1b}[32m8,\u{1b}[0m\n"
);
} | rust_cleaned_test_functions.jsonl/34739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
1288,
16101,
368,
341,
262,
1077,
3694,
284,
330,
262,
220,
23,
19,
42871,
338,
1124,
77,
262,
220,
17,
19,
23,
11,
876,
262,
1077,
6963,
284,
330,
262,
220,
15,
42871,
4293,
1124,
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_option_as_deref_mut() {
let mut val = 42;
let ref_option = &mut Some(&mut val);
assert_eq!(ref_option.as_deref_mut(), Some(&mut 42));
let ref_option = &mut Some(String::from("a result"));
assert_eq!(ref_option.as_deref_mut(), Some(String::from("a result").deref_mut()));
let ref_option = &mut Some(vec![1, 2, 3, 4, 5]);
assert_eq!(ref_option.as_deref_mut(), Some([1, 2, 3, 4, 5].as_mut_slice()));
let ref_option: &mut Option<&mut i32> = &mut None;
assert_eq!(ref_option.as_deref_mut(), None);
} | rust_cleaned_test_functions.jsonl/20251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
11898,
814,
43970,
29523,
368,
341,
1066,
262,
1077,
5206,
1044,
284,
220,
19,
17,
280,
262,
1077,
2053,
9672,
284,
609,
6984,
4329,
2099,
6984,
1044,
317,
262,
2060,
10714,
10297,
1097,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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: #employee_csv.id\
\n Filter: #employee_csv.state = Utf8(\"CO\")\
\n TableScan: employee_csv projection=Some([0, 3])";
assert_eq!(expected, format!("{}", plan.display_indent()));
} | rust_cleaned_test_functions.jsonl/29893 | {
"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,
14825,
69045,
368,
341,
286,
1077,
3119,
284,
3037,
26564,
1428,
286,
1077,
3601,
284,
330,
46321,
25,
671,
12946,
14020,
1764,
5661,
286,
1124,
77,
220,
12339,
25,
671,
12946,
14020,
3467,
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_compute_cached_metrics() {
let now = 100;
let mut neurons = HashMap::<u64, Neuron>::new();
// Not Dissolving neurons
neurons.insert(
1,
Neuron {
cached_neuron_stake_e8s: 100_000_000,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(1)),
..Default::default()
},
);
neurons.insert(
2,
Neuron {
cached_neuron_stake_e8s: 234_000_000,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(ONE_YEAR_SECONDS)),
joined_community_fund_timestamp_seconds: Some(1),
..Default::default()
},
);
neurons.insert(
3,
Neuron {
cached_neuron_stake_e8s: 568_000_000,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(ONE_YEAR_SECONDS * 4)),
..Default::default()
},
);
neurons.insert(
4,
Neuron {
cached_neuron_stake_e8s: 1_123_000_000,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(ONE_YEAR_SECONDS * 4)),
..Default::default()
},
);
neurons.insert(
5,
Neuron {
cached_neuron_stake_e8s: 6_087_000_000,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(ONE_YEAR_SECONDS * 8)),
..Default::default()
},
);
// Zero stake
neurons.insert(
6,
Neuron {
cached_neuron_stake_e8s: 0,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(5)),
..Default::default()
},
);
// Less than minimum stake
neurons.insert(
7,
Neuron {
cached_neuron_stake_e8s: 100,
dissolve_state: Some(DissolveState::DissolveDelaySeconds(5)),
..Default::default()
},
);
// Dissolving neurons
neurons.insert(
8,
Neuron {
cached_neuron_stake_e8s: 234_000_000,
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
now + ONE_YEAR_SECONDS,
)),
..Default::default()
},
);
neurons.insert(
9,
Neuron {
cached_neuron_stake_e8s: 568_000_000,
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
now + ONE_YEAR_SECONDS * 3,
)),
..Default::default()
},
);
neurons.insert(
10,
Neuron {
cached_neuron_stake_e8s: 1_123_000_000,
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
now + ONE_YEAR_SECONDS * 5,
)),
..Default::default()
},
);
neurons.insert(
11,
Neuron {
cached_neuron_stake_e8s: 6_087_000_000,
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
now + ONE_YEAR_SECONDS * 5,
)),
..Default::default()
},
);
neurons.insert(
12,
Neuron {
cached_neuron_stake_e8s: 18_000_000_000,
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(
now + ONE_YEAR_SECONDS * 7,
)),
..Default::default()
},
);
// Dissolved neurons
neurons.insert(
13,
Neuron {
cached_neuron_stake_e8s: 4_450_000_000,
..Default::default()
},
);
neurons.insert(
14,
Neuron {
cached_neuron_stake_e8s: 1_220_000_000,
..Default::default()
},
);
neurons.insert(
15,
Neuron {
cached_neuron_stake_e8s: 100_000_000,
dissolve_state: Some(DissolveState::WhenDissolvedTimestampSeconds(1)),
..Default::default()
},
);
let economics = NetworkEconomics {
neuron_minimum_stake_e8s: 100_000_000,
..Default::default()
};
let gov = GovernanceProto {
economics: Some(economics),
neurons,
..Default::default()
};
let actual_metrics = gov.compute_cached_metrics(now, Tokens::new(147, 0).unwrap());
let expected_metrics = GovernanceCachedMetrics {
timestamp_seconds: 100,
total_supply_icp: 147,
dissolving_neurons_count: 5,
dissolving_neurons_e8s_buckets: [
(3, 568000000.0),
(5, 7210000000.0),
(1, 234000000.0),
(7, 18000000000.0),
]
.iter()
.cloned()
.collect(),
dissolving_neurons_count_buckets: [(5, 2), (3, 1), (7, 1), (1, 1)]
.iter()
.cloned()
.collect(),
not_dissolving_neurons_count: 7,
not_dissolving_neurons_e8s_buckets: [
(8, 6087000000.0),
(4, 1691000000.0),
(1, 234000000.0),
(0, 100000100.0),
]
.iter()
.cloned()
.collect(),
not_dissolving_neurons_count_buckets: [(0, 3), (1, 1), (4, 2), (8, 1)]
.iter()
.cloned()
.collect(),
dissolved_neurons_count: 3,
dissolved_neurons_e8s: 5770000000,
garbage_collectable_neurons_count: 2,
neurons_with_invalid_stake_count: 1,
total_staked_e8s: 39_894_000_100,
neurons_with_less_than_6_months_dissolve_delay_count: 6,
neurons_with_less_than_6_months_dissolve_delay_e8s: 5870000100,
community_fund_total_staked_e8s: 234_000_000,
};
assert_eq!(expected_metrics, actual_metrics);
} | rust_cleaned_test_functions.jsonl/1185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3092
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
64369,
37686,
368,
341,
262,
1077,
1431,
284,
220,
16,
15,
15,
280,
262,
1077,
5206,
33213,
284,
10528,
27638,
84,
21,
19,
11,
4182,
36090,
6831,
931,
1428,
262,
442,
2806,
51032,
19648,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_current() {
let (version, channel) = (::Version::read(), ::Channel::read());
assert!(version.is_some());
assert!(channel.is_some());
if let Ok(known_channel) = env::var("KNOWN_CHANNEL") {
assert_eq!(channel, ::Channel::parse(&known_channel));
}
} | rust_cleaned_test_functions.jsonl/79907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11080,
368,
341,
286,
1077,
320,
4366,
11,
5496,
8,
284,
68590,
5637,
486,
878,
1507,
3504,
9629,
486,
878,
1423,
286,
2060,
10297,
4366,
2079,
61855,
1423,
286,
2060,
10297,
10119,
2079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uncle_count() {
let (shared, chain1, chain2) = prepare();
let dummy_context = dummy_context(&shared);
let block = chain1
.last()
.cloned()
.unwrap()
.as_advanced_builder()
.uncle(chain2.last().cloned().unwrap().as_uncle())
.build_unchecked();
let epoch = epoch(&shared, &chain1, chain1.len() - 2);
let uncle_verifier_context = UncleVerifierContext::new(&dummy_context, &epoch);
let verifier = UnclesVerifier::new(uncle_verifier_context, &block);
assert_eq!(
verifier.verify(),
Err(Error::Uncles(UnclesError::MissMatchCount {
expected: 0,
actual: 1
}))
);
} | rust_cleaned_test_functions.jsonl/118897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76576,
273,
3180,
368,
341,
262,
1077,
320,
6100,
11,
8781,
16,
11,
8781,
17,
8,
284,
10549,
543,
262,
1077,
17292,
8467,
284,
17292,
8467,
2099,
6100,
626,
1066,
262,
1077,
2504,
284,
8781,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_such_file_or_directory() {
new_ucmd!()
.arg("no_such_file.toml")
.fails()
.stderr_contains("cannot open 'no_such_file.toml' for reading: No such file or directory");
} | rust_cleaned_test_functions.jsonl/32772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
643,
1387,
2458,
8734,
14846,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
445,
2152,
643,
1387,
2458,
73494,
75,
1138,
286,
659,
59631,
741,
286,
659,
36422,
63598,
445,
33260,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_manhattan_dist() {
let insts = Instruction::read(SAMPLE).unwrap();
let mut ship = Ship::new();
ship.apply_insts(&insts, Ship::apply_inst).unwrap();
assert_eq!(25, ship.manhattan_dist())
} | rust_cleaned_test_functions.jsonl/17499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17062,
25337,
16031,
368,
341,
286,
1077,
1761,
82,
284,
29051,
486,
878,
3759,
18918,
568,
15454,
543,
286,
1077,
5206,
8284,
284,
26803,
486,
931,
543,
286,
8284,
13045,
17740,
82,
2099,
6308,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_packet_sender_reply() {
fn do_test(input: Result<i8, String>, expected_output: ErlResult<i8, String>) {
let mut cursor = Cursor::new(vec![]);
{
let mut sender = PacketSender::from_writer(&mut cursor, PacketSize::Four);
sender.reply(input);
}
cursor.set_position(0);
let result: Vec<ErlResult<i8, String>> =
PacketReceiver::from_reader(&mut cursor, PacketSize::Four)
.iter()
.collect();
assert_eq!(result, [expected_output]);
}
do_test(Ok(1), ErlResult::Ok(1));
do_test(
Err("Nope".to_string()),
ErlResult::Error("Nope".to_string()),
);
} | rust_cleaned_test_functions.jsonl/121757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
54356,
15323,
368,
341,
286,
5168,
653,
4452,
5384,
25,
5714,
21897,
23,
11,
923,
8066,
3601,
7645,
25,
80834,
2077,
21897,
23,
11,
923,
9231,
341,
310,
1077,
5206,
8128,
284,
28067,
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_mvcc_txn_commit_err() {
test_mvcc_txn_commit_err_imp(b"k", b"v");
let long_value = "v".repeat(SHORT_VALUE_MAX_LEN + 1).into_bytes();
test_mvcc_txn_commit_err_imp(b"k2", &long_value);
} | rust_cleaned_test_functions.jsonl/61086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
92299,
36346,
9266,
368,
341,
286,
1273,
73187,
638,
92299,
36346,
9266,
36788,
1883,
62911,
497,
293,
1,
85,
3071,
286,
1077,
1293,
3142,
284,
330,
85,
3263,
30624,
3759,
70702,
7476,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint_to_int_panic() {
Int256::from(BIGGEST_INT_AS_UINT.clone().add(Uint256::from(1 as u32)));
} | rust_cleaned_test_functions.jsonl/47759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
2346,
4042,
620,
31270,
368,
341,
286,
1333,
17,
20,
21,
486,
1499,
5349,
1914,
81757,
9161,
28028,
27241,
15997,
1005,
718,
12317,
396,
17,
20,
21,
486,
1499,
7,
16,
438,
575,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_process_op_in() {
let filter = filter();
let mut cred_def_ids = vec![unencrypted_target("Not Here".to_string())];
let mut op = Operator::In(cred_def_id_tag(), cred_def_ids.clone());
assert!(Verifier::_process_operator("zip", &op, &filter).is_err());
cred_def_ids.push(unencrypted_target(CRED_DEF_ID.to_string()));
op = Operator::In(cred_def_id_tag(), cred_def_ids.clone());
Verifier::_process_operator("zip", &op, &filter).unwrap()
} | rust_cleaned_test_functions.jsonl/71868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
10287,
1243,
368,
341,
286,
1077,
4051,
284,
4051,
543,
286,
1077,
5206,
4187,
7844,
8077,
284,
7486,
20703,
359,
36444,
11123,
445,
2623,
5692,
3263,
983,
3904,
2140,
4821,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sqrt() {
let test_cases = vec![
(None, None),
(Some(64f64), Some(Real::new(8f64).unwrap())),
(
Some(2f64),
Some(Real::new(std::f64::consts::SQRT_2).unwrap()),
),
(Some(-16f64), None),
(Some(f64::NAN), None),
];
for (input, expect) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(input)
.evaluate(ScalarFuncSig::Sqrt)
.unwrap();
assert_eq!(expect, output, "{:?}", input);
}
} | rust_cleaned_test_functions.jsonl/9486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92199,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
1326,
310,
320,
8373,
7,
21,
19,
69,
21,
19,
701,
4329,
7,
12768,
486,
931,
7,
23,
69,
21,
19,
568,
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... | 2 |
#[test]
fn test_write_single_register() {
let (_s, cfg) = start_dummy_server_with_cfg();
let mut trans = Transport::new_with_cfg("127.0.0.1", cfg).unwrap();
assert!(trans.write_single_register(0, 1).is_ok());
} | rust_cleaned_test_functions.jsonl/46837 | {
"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,
9165,
19487,
14000,
368,
341,
286,
1077,
5453,
82,
11,
13286,
8,
284,
1191,
60321,
12015,
6615,
18343,
543,
286,
1077,
5206,
1356,
284,
16742,
486,
931,
6615,
18343,
445,
16,
17,
22,
13,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_propose_and_prevote_when_we_are_leader() {
let sandbox = timestamping_sandbox();
// round happens
sandbox.add_time(Duration::from_millis(sandbox.current_round_timeout()));
sandbox.add_time(Duration::from_millis(
sandbox.current_round_timeout() + PROPOSE_TIMEOUT,
));
sandbox.assert_state(Height(1), Round(3));
let propose = ProposeBuilder::new(&sandbox).build();
sandbox.broadcast(&propose);
sandbox.broadcast(&make_prevote_from_propose(&sandbox, &propose));
sandbox.add_time(Duration::from_millis(0));
} | rust_cleaned_test_functions.jsonl/47687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
21663,
960,
8378,
25566,
1272,
47636,
45922,
56855,
79991,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
1428,
262,
442,
4778,
8573,
198,
262,
42754,
1364,
3009,
64114,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sanity() -> Result<(), ErrBox> {
let initial = AttestationConfig {
symbols: vec![
P2WSymbol {
name: Some("ETH/USD".to_owned()),
product_addr: Default::default(),
price_addr: Default::default(),
},
P2WSymbol {
name: None,
product_addr: Pubkey::new(&[42u8; 32]),
price_addr: Default::default(),
},
],
};
let serialized = serde_yaml::to_string(&initial)?;
eprintln!("Serialized:\n{}", serialized);
let deserialized: AttestationConfig = serde_yaml::from_str(&serialized)?;
assert_eq!(initial, deserialized);
Ok(())
} | rust_cleaned_test_functions.jsonl/73889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
38270,
368,
1464,
5714,
68843,
15495,
1611,
29,
341,
286,
1077,
2856,
284,
2411,
1944,
367,
2648,
341,
310,
17738,
25,
7486,
90515,
394,
393,
17,
7433,
4001,
341,
503,
829,
25,
4329,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_bitreader_lsb() {
let pattern = 0x5555_5555_5555_5555u64;
for i in 0..16 {
let segment = mask!(16u64);
let xor_mask =
(segment * ((i >> 3) & 0x1)) << 48 |
(segment * ((i >> 2) & 0x1)) << 32 |
(segment * ((i >> 1) & 0x1)) << 16 |
(segment * (i & 0x1));
let data = pattern ^ xor_mask;
let bytes = data.to_le_bytes();
for len in 0..32 {
for offset in 0..32 {
let mut reader = BitReaderLsb::new(&bytes);
let actual = reader.read(offset);
let expected = (data & mask!(offset as u64)) as u32;
assert_eq!(
actual, expected,
"offset value mismatch, left: {:b}, right: {:b}, off: {}, len: {}, data: {:b}",
actual, expected, offset, len, data
);
let actual = reader.read(len);
let expected = ((data >> offset) & mask!(len as u64)) as u32;
assert_eq!(
actual, expected,
"value mismatch, left: {:b}, right: {:b}, off: {}, len: {}, data: {:b}",
actual, expected, offset, len, data
);
}
}
}
} | rust_cleaned_test_functions.jsonl/79990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 849
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
11149,
907,
16892,
368,
341,
286,
1077,
5383,
284,
220,
15,
87,
20,
20,
20,
20,
62,
20,
20,
20,
20,
62,
20,
20,
20,
20,
62,
20,
20,
20,
20,
84,
21,
19,
280,
286,
369,
600,
304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_row_iter_complex() {
let table = Table::find_first(TABLE_COMPLEX).unwrap();
let mut table_iter = table.iter();
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(Some("John"), iter.next().map(String::as_str));
assert_eq!(Some("20"), iter.next().map(String::as_str));
assert_eq!(None, iter.next());
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(Some("May"), iter.next().map(String::as_str));
assert_eq!(Some("30"), iter.next().map(String::as_str));
assert_eq!(Some("foo"), iter.next().map(String::as_str));
assert_eq!(None, iter.next());
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(None, iter.next());
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(Some("a"), iter.next().map(String::as_str));
assert_eq!(Some("b"), iter.next().map(String::as_str));
assert_eq!(Some("c"), iter.next().map(String::as_str));
assert_eq!(Some("d"), iter.next().map(String::as_str));
assert_eq!(None, iter.next());
} | rust_cleaned_test_functions.jsonl/47599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
11723,
41522,
368,
341,
286,
1077,
1965,
284,
6633,
486,
3903,
12978,
83006,
97820,
568,
15454,
543,
286,
1077,
5206,
1965,
11723,
284,
1965,
19471,
1428,
286,
1077,
2802,
284,
1965,
11723,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_identifier() {
let mut used_names: HashMap<String, usize> = HashMap::new();
assert_eq!(
generate_identifier("someVar", &mut used_names),
"someVar".to_string()
);
assert_eq!(
generate_identifier("someVar", &mut used_names),
"someVar2".to_string()
);
assert_eq!(
generate_identifier("default", &mut used_names),
"default1".to_string()
);
assert_eq!(
generate_identifier("default", &mut used_names),
"default2".to_string()
);
} | rust_cleaned_test_functions.jsonl/103030 | {
"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,
48851,
33176,
368,
341,
262,
1077,
5206,
1483,
9187,
25,
10528,
3464,
11,
22301,
29,
284,
10528,
486,
931,
543,
262,
2060,
10714,
33673,
286,
6923,
33176,
445,
14689,
3962,
497,
609,
6984,
1483,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ldxw_all() {
test_interpreter_and_jit_asm!(
"
mov r0, r1
ldxw r9, [r0+0]
be32 r9
ldxw r8, [r0+4]
be32 r8
ldxw r7, [r0+8]
be32 r7
ldxw r6, [r0+12]
be32 r6
ldxw r5, [r0+16]
be32 r5
ldxw r4, [r0+20]
be32 r4
ldxw r3, [r0+24]
be32 r3
ldxw r2, [r0+28]
be32 r2
ldxw r1, [r0+32]
be32 r1
ldxw r0, [r0+36]
be32 r0
or r0, r1
or r0, r2
or r0, r3
or r0, r4
or r0, r5
or r0, r6
or r0, r7
or r0, r8
or r0, r9
exit",
[
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x030f0f } },
31
);
} | rust_cleaned_test_functions.jsonl/58990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 817
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
87,
86,
5705,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
435,
16,
198,
286,
326,
12719,
86,
435,
24,
11,
508,
81,
15,
10,
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_make_command_line() {
use std::str;
use std::c_str::CString;
use super::make_command_line;
fn test_wrapper(prog: &str, args: &[&str]) -> String {
make_command_line(&prog.to_c_str(),
args.iter()
.map(|a| a.to_c_str())
.collect::<Vec<CString>>()
.as_slice())
}
assert_eq!(
test_wrapper("prog", ["aaa", "bbb", "ccc"]),
"prog aaa bbb ccc".to_string()
);
assert_eq!(
test_wrapper("C:\\Program Files\\blah\\blah.exe", ["aaa"]),
"\"C:\\Program Files\\blah\\blah.exe\" aaa".to_string()
);
assert_eq!(
test_wrapper("C:\\Program Files\\test", ["aa\"bb"]),
"\"C:\\Program Files\\test\" aa\\\"bb".to_string()
);
assert_eq!(
test_wrapper("echo", ["a b c"]),
"echo \"a b c\"".to_string()
);
assert_eq!(
test_wrapper("\u03c0\u042f\u97f3\u00e6\u221e", []),
"\u03c0\u042f\u97f3\u00e6\u221e".to_string()
);
} | rust_cleaned_test_functions.jsonl/131816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
10811,
6528,
368,
341,
286,
990,
1460,
486,
495,
280,
286,
990,
1460,
486,
66,
2895,
486,
63677,
280,
286,
990,
2256,
486,
6927,
10811,
6528,
401,
286,
5168,
1273,
23561,
80078,
25,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_lifetimes_trait_impl() {
check(
r#"
trait Foo<'a> {
fn foo() -> &'a ();
}
impl<'a> Foo<'a> for &'a () {
fn foo() -> &'a<|> () {
unimplemented!()
}
}
"#,
expect![[r#"
'a LifetimeParam FileId(0) 47..49 47..49 Lifetime
FileId(0) 55..57 Lifetime
FileId(0) 64..66 Lifetime
FileId(0) 89..91 Lifetime
"#]],
);
} | rust_cleaned_test_functions.jsonl/47792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
907,
333,
6889,
78491,
21007,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
29432,
33428,
18291,
64,
29,
341,
262,
5168,
15229,
368,
1464,
30136,
64,
9563,
532,
6383,
18291,
64,
29,
33428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mcg128xsl64_true_values() {
let mut rng = Mcg128Xsl64::new(42);
let mut results = [0u64; 6];
for i in results.iter_mut() { *i = rng.next_u64(); }
let expected: [u64; 6] = [0x63b4a3a813ce700a, 0x382954200617ab24,
0xa7fd85ae3fe950ce, 0xd715286aa2887737, 0x60c92fee2e59f32c, 0x84c4e96beff30017];
assert_eq!(results, expected);
} | rust_cleaned_test_functions.jsonl/52975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
27446,
16,
17,
23,
87,
3226,
21,
19,
16082,
9146,
368,
341,
1066,
262,
1077,
5206,
28422,
284,
4483,
70,
16,
17,
23,
55,
3226,
21,
19,
486,
931,
7,
19,
17,
626,
262,
1077,
5206,
3059,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ptrace_cont() {
use nix::sys::ptrace;
use nix::sys::signal::{raise, Signal};
use nix::sys::wait::{waitpid, WaitStatus};
use nix::unistd::fork;
use nix::unistd::ForkResult::*;
let _m = ::FORK_MTX.lock().expect(
"Mutex got poisoned by another test",
);
// FIXME: qemu-user doesn't implement ptrace on all architectures
// and retunrs ENOSYS in this case.
// and skip the test then.
// is already tested by `test_ptrace`.
let err = ptrace::attach(getpid()).unwrap_err();
if err == Error::Sys(Errno::ENOSYS) {
return;
}
match fork() {
Ok(Child) => {
ptrace::traceme().unwrap();
// until the parent is ready to continue
loop {
raise(Signal::SIGTRAP).unwrap();
}
}
Ok(Parent { child }) => {
assert_eq!(
waitpid(child, None),
Ok(WaitStatus::Stopped(child, Signal::SIGTRAP))
);
ptrace::cont(child, None).unwrap();
assert_eq!(
waitpid(child, None),
Ok(WaitStatus::Stopped(child, Signal::SIGTRAP))
);
ptrace::cont(child, Signal::SIGKILL).unwrap();
match waitpid(child, None) {
Ok(WaitStatus::Signaled(pid, Signal::SIGKILL, _)) if pid == child => {}
_ => panic!("The process should have been killed"),
}
}
Err(_) => panic!("Error: Fork Failed"),
}
} | rust_cleaned_test_functions.jsonl/63569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
578,
10260,
368,
341,
262,
990,
308,
941,
486,
7791,
486,
3505,
578,
280,
262,
990,
308,
941,
486,
7791,
486,
26622,
22964,
18704,
11,
27230,
2440,
262,
990,
308,
941,
486,
7791,
486,
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... | 5 |
#[test]
fn test_current() {
let mut ss = ScopeStack::new();
assert_eq!(ss.current(), 0);
ss.push();
assert_eq!(ss.current(), 1);
ss.push();
assert_eq!(ss.current(), 2);
ss.pop();
assert_eq!(ss.current(), 1);
ss.pop();
assert_eq!(ss.current(), 0);
} | rust_cleaned_test_functions.jsonl/80368 | {
"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,
11080,
368,
341,
286,
1077,
5206,
10870,
284,
34920,
4336,
486,
931,
543,
286,
2060,
10714,
10297,
778,
4952,
1507,
220,
15,
317,
286,
10870,
2552,
543,
286,
2060,
10714,
10297,
778,
4952,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flash() {
let mut f1 = SimFlash::new(vec![4096usize; 256], 1);
test_device(&mut f1);
let mut f2 = SimFlash::new(vec![16 * 1024, 16 * 1024, 16 * 1024, 64 * 1024,
128 * 1024, 128 * 1024, 128 * 1024], 1);
test_device(&mut f2);
} | rust_cleaned_test_functions.jsonl/62820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30225,
368,
341,
1789,
286,
1077,
5206,
282,
16,
284,
4467,
23876,
486,
931,
25592,
20703,
19,
15,
24,
21,
51878,
26,
220,
17,
20,
21,
1125,
220,
16,
317,
286,
1273,
9204,
2099,
6984,
282,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_key() {
let main = hex::decode("588ba9eef353778b074413a0140205d90d7479e36e0dd4ee35bb729d26131ef1")
.unwrap();
let dk1 = derive_key(&main, b"purpose1", 32);
assert_eq!(
hex::encode(dk1),
"835b5df80ce9ca46908e8524fb308649122cfbcefbeaa7e65061c6ef08ee1b2a"
);
let dk2 = derive_key(&main, b"purpose2", 10);
assert_eq!(hex::encode(dk2), "f2238e84315b47eb6279");
} | rust_cleaned_test_functions.jsonl/89673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
3097,
368,
341,
286,
1077,
1887,
284,
12371,
486,
18196,
445,
20,
23,
23,
4645,
24,
68,
823,
18,
20,
18,
22,
22,
23,
65,
15,
22,
19,
19,
16,
18,
64,
15,
16,
19,
15,
17,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typedef_in_pod_struct() {
let hdr = indoc! {"
#include <string>
typedef uint32_t my_int;
struct A {
my_int a;
};
inline uint32_t take_a(A a) {
return a.a;
}
"};
let rs = quote! {
let a = ffi::A {
a: 32,
};
assert_eq!(ffi::take_a(a), 32);
};
run_test("", hdr, rs, &["take_a"], &["A"]);
} | rust_cleaned_test_functions.jsonl/9863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42111,
4219,
1243,
85337,
15126,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
397,
286,
13501,
2622,
18,
17,
528,
847,
4042,
280,
286,
2036,
362,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sbc() {
let mut r = Register::new();
let mut b = MockBus::new();
r.set_A(0x03);
r.set_status_carry(true);
b.memory[0x10] = 0x02;
sbc(0x10, &mut r, &mut b);
assert_eq!(r.get_A(),0x01);
assert_eq!(r.get_status_overflow(), false);
r.set_A(0x04);
r.set_status_carry(false);
b.memory[0x10] = 0x03;
sbc(0x10, &mut r, &mut b);
assert_eq!(r.get_A(),0x00);
assert_eq!(r.get_status_overflow(), false);
r.set_A(0x01);
r.set_status_carry(true);
b.memory[0x10] = 0x80;
sbc(0x10, &mut r, &mut b);
assert_eq!(r.get_status_overflow(), true);
} | rust_cleaned_test_functions.jsonl/14224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
8904,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
1077,
5206,
293,
284,
14563,
15073,
486,
931,
543,
262,
435,
980,
1566,
7,
15,
87,
15,
18,
317,
262,
435,
980,
4773,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signature_subscribe() {
let GenesisConfigInfo {
genesis_config,
mint_keypair: alice,
..
} = create_genesis_config(10_000);
let bob = Keypair::new();
let bob_pubkey = bob.pubkey();
let bank = Bank::new(&genesis_config);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let rpc = RpcSolPubSubImpl {
subscriptions: Arc::new(RpcSubscriptions::new(
&Arc::new(AtomicBool::new(false)),
bank_forks.clone(),
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests())),
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
)),
uid: Arc::new(atomic::AtomicUsize::default()),
max_active_subscriptions: MAX_ACTIVE_SUBSCRIPTIONS,
};
// Test signature subscriptions
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("signatureNotification");
rpc.signature_subscribe(
session,
subscriber,
tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::finalized()),
..RpcSignatureSubscribeConfig::default()
}),
);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions, 0).unwrap();
// Test signature confirmation notification
let (response, _) = robust_poll_or_panic(receiver);
let expected_res =
RpcSignatureResult::ProcessedSignature(ProcessedSignatureResult { err: None });
let expected = json!({
"jsonrpc": "2.0",
"method": "signatureNotification",
"params": {
"result": {
"context": { "slot": 0 },
"value": expected_res,
},
"subscription": 0,
}
});
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
// Test "received"
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("signatureNotification");
rpc.signature_subscribe(
session,
subscriber,
tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::finalized()),
enable_received_notification: Some(true),
}),
);
let received_slot = 1;
rpc.subscriptions
.notify_signatures_received((received_slot, vec![tx.signatures[0]]));
// Test signature confirmation notification
let (response, _) = robust_poll_or_panic(receiver);
let expected_res =
RpcSignatureResult::ReceivedSignature(ReceivedSignatureResult::ReceivedSignature);
let expected = json!({
"jsonrpc": "2.0",
"method": "signatureNotification",
"params": {
"result": {
"context": { "slot": received_slot },
"value": expected_res,
},
"subscription": 1,
}
});
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
// Test "received" for gossip subscription
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("signatureNotification");
rpc.signature_subscribe(
session,
subscriber,
tx.signatures[0].to_string(),
Some(RpcSignatureSubscribeConfig {
commitment: Some(CommitmentConfig::confirmed()),
enable_received_notification: Some(true),
}),
);
let received_slot = 2;
rpc.subscriptions
.notify_signatures_received((received_slot, vec![tx.signatures[0]]));
// Test signature confirmation notification
let (response, _) = robust_poll_or_panic(receiver);
let expected_res =
RpcSignatureResult::ReceivedSignature(ReceivedSignatureResult::ReceivedSignature);
let expected = json!({
"jsonrpc": "2.0",
"method": "signatureNotification",
"params": {
"result": {
"context": { "slot": received_slot },
"value": expected_res,
},
"subscription": 2,
}
});
assert_eq!(serde_json::to_string(&expected).unwrap(), response);
} | rust_cleaned_test_functions.jsonl/4698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
88935,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
25,
70433,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipe() {
let (fd0, fd1) = pipe().unwrap();
let m0 = stat::SFlag::from_bits_truncate(stat::fstat(fd0).unwrap().st_mode as mode_t);
// S_IFIFO means it's a pipe
assert_eq!(m0, SFlag::S_IFIFO);
let m1 = stat::SFlag::from_bits_truncate(stat::fstat(fd1).unwrap().st_mode as mode_t);
assert_eq!(m1, SFlag::S_IFIFO);
} | rust_cleaned_test_functions.jsonl/104819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
368,
341,
262,
1077,
320,
6902,
15,
11,
12414,
16,
8,
284,
13647,
1005,
15454,
543,
262,
1077,
296,
15,
284,
2793,
486,
50,
12135,
486,
1499,
20034,
3547,
26900,
41785,
486,
69,
9878,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_equal() {
assert!(Version::parse("1.0").unwrap() == Version::parse("1.0.0").unwrap());
assert!(!(Version::parse("1.0").unwrap() == Version::parse("1.1").unwrap()));
} | rust_cleaned_test_functions.jsonl/6349 | {
"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,
9438,
11478,
368,
341,
286,
2060,
10297,
5637,
486,
6400,
445,
16,
13,
15,
1827,
15454,
368,
621,
6079,
486,
6400,
445,
16,
13,
15,
13,
15,
1827,
15454,
1423,
286,
2060,
0,
33660,
5637,
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_counter() {
let opts = Opts::new("test", "test help")
.const_label("a", "1")
.const_label("b", "2");
let counter = Counter::with_opts(opts).unwrap();
counter.inc();
assert_eq!(counter.get() as u64, 1);
counter.inc_by(42.0);
assert_eq!(counter.get() as u64, 43);
let mut mfs = counter.collect();
assert_eq!(mfs.len(), 1);
let mf = mfs.pop().unwrap();
let m = mf.get_metric().get(0).unwrap();
assert_eq!(m.get_label().len(), 2);
assert_eq!(m.get_counter().get_value() as u64, 43);
counter.reset();
assert_eq!(counter.get() as u64, 0);
} | rust_cleaned_test_functions.jsonl/46515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15730,
368,
341,
286,
1077,
12185,
284,
506,
12754,
486,
931,
445,
1944,
497,
330,
1944,
1492,
1138,
310,
659,
1024,
6106,
445,
64,
497,
330,
16,
1138,
310,
659,
1024,
6106,
445,
65,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_strategy_for_type_6() {
let data = [0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 3];
let expected = vec!['A', 'A', 'A'];
let mut decoder = Decoder::new(&data);
if let StrategyDataTypes::VecChar(actual) = decoder.apply().unwrap() {
assert_eq!(expected, actual);
} else {
panic!();
};
} | rust_cleaned_test_functions.jsonl/30706 | {
"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,
36551,
49308,
5478,
1819,
62,
21,
368,
341,
286,
1077,
821,
284,
508,
15,
11,
220,
15,
11,
220,
15,
11,
220,
21,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,
11,
220,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_no_default_follow_for_governance() {
let driver = fake::FakeDriver::default();
let mut gov = Governance::new(
fixture_for_following(),
driver.get_fake_env(),
driver.get_fake_ledger(),
);
gov.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
title: Some("dummy title".to_string()),
summary: "test".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: "dummy text".to_string(),
})),
..Default::default()
},
)
.unwrap();
// Now vote yes for neurons 5-7.
for i in 5..=7 {
fake::register_vote_assert_success(
&mut gov,
principal(i),
NeuronId { id: i },
ProposalId { id: 1 },
Vote::Yes,
);
// The proposal should still be open
assert_eq!(
ProposalStatus::Open,
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.status()
);
}
// executed.
fake::register_vote_assert_success(
&mut gov,
principal(8),
NeuronId { id: 8 },
ProposalId { id: 1 },
Vote::Yes,
);
// The proposal should now be executed.
assert_eq!(
ProposalStatus::Executed,
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.status()
);
} | rust_cleaned_test_functions.jsonl/42895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
9993,
43490,
5478,
1889,
6706,
681,
368,
341,
262,
1077,
5579,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
5206,
47625,
284,
80589,
486,
931,
1006,
286,
12507,
5478,
43490,
287... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vcx_proof_get_requests() {
let _setup = SetupMocks::init();
let cxn = ::connection::tests::build_test_connection();
AgencyMock::set_next_response(::utils::constants::NEW_PROOF_REQUEST_RESPONSE.to_vec());
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_disclosed_proof_get_requests(cb.command_handle, cxn, Some(cb.get_callback())), error::SUCCESS.code_num as u32);
cb.receive(TimeoutUtils::some_medium()).unwrap();
} | rust_cleaned_test_functions.jsonl/104431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
86757,
3062,
37216,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
20716,
77,
284,
3504,
7742,
486,
23841,
486,
5834,
4452,
15866,
1428,
286,
16379,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_with_init_boot_request_unknown_client_returns_none() {
let mut req = new_test_request();
req.options.remove(2);
let mut server = new_test_server(|| 42);
let got = server.dispatch(req);
assert!(got.is_none());
} | rust_cleaned_test_functions.jsonl/61726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
6137,
52062,
7893,
57507,
8179,
58900,
31488,
368,
341,
286,
1077,
5206,
4232,
284,
501,
4452,
7893,
543,
286,
4232,
10912,
4850,
7,
17,
626,
286,
1077,
5206,
3538,
284,
501,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_table() {
let ddl = "\
CREATE TABLE clickhouse_test_create_table (\
click_id FixedString(64), \
click_time DateTime\
) Engine=Memory";
let pool = Pool::new(database_url());
let done = pool
.get_handle()
.and_then(move |c| c.execute("DROP TABLE IF EXISTS clickhouse_test_create_table"))
.and_then(move |c| c.execute(ddl))
.and_then(move |c| c.execute(ddl))
.map(|_| ());
let err = run(done).unwrap_err();
match err {
Error::Server(err) => assert_eq!(
err.message,
"DB::Exception: Table default.clickhouse_test_create_table already exists."
),
_ => panic!("{:?}", err),
}
} | rust_cleaned_test_functions.jsonl/30928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5237,
368,
341,
262,
1077,
55780,
284,
93317,
2290,
30776,
14363,
4205,
7675,
4452,
8657,
5237,
320,
5661,
2290,
4205,
842,
256,
20149,
703,
7,
21,
19,
701,
3044,
2290,
4205,
3009,
6520,
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_non_utf_string() {
let bytes = vec![1, 0, 0, 0, 0xC0];
assert_eq!(
String::try_from_slice(&bytes).unwrap_err().to_string(),
"invalid utf-8 sequence of 1 bytes from index 0"
);
} | rust_cleaned_test_functions.jsonl/103718 | {
"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,
21637,
39453,
3904,
368,
341,
262,
1077,
5820,
284,
7486,
20703,
16,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
12125,
15,
935,
262,
2060,
10714,
33673,
286,
923,
486,
1539,
5673,
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_btreeset_from_unit_struct() {
assert_de_tokens_error::<BTreeSet<isize>>(
&[Token::UnitStruct { name: "Anything" }],
"invalid type: unit value, expected a sequence",
);
} | rust_cleaned_test_functions.jsonl/129533 | {
"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,
48626,
7858,
295,
5673,
14832,
15126,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
33,
6533,
1649,
27,
285,
551,
97238,
286,
44590,
3323,
486,
4562,
9422,
314,
829,
25,
330,
77303,
1,
29043,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_entity_builder_bogus_entids() {
let mut builder = TermBuilder::new();
let e = builder.named_tempid("x");
let a1 = fake_known_entid(37); // :db/doc
let a2 = fake_known_entid(999);
let v = TypedValue::typed_string("Some attribute");
let ve = fake_known_entid(12345);
builder.add(e.clone(), a1, v).expect("add succeeded");
builder.add(e.clone(), a2, e.clone()).expect("add succeeded, even though it's meaningless");
builder.add(e.clone(), a2, ve).expect("add succeeded, even though it's meaningless");
let (terms, tempids) = builder.build().expect("build succeeded");
assert_eq!(tempids.len(), 1);
assert_eq!(terms.len(), 3); // TODO: check the contents?
// Now try to add them to a real store.
let mut sqlite = mentat_db::db::new_connection("").unwrap();
let mut conn = Conn::connect(&mut sqlite).unwrap();
let mut in_progress = conn.begin_transaction(&mut sqlite).expect("begun successfully");
// This should fail: unrecognized entid.
match in_progress.transact_entities(terms).expect_err("expected transact to fail") {
MentatError::DbError(e) => {
assert_eq!(e.kind(), db_traits::errors::DbErrorKind::UnrecognizedEntid(999));
},
_ => panic!("Should have rejected the entid."),
}
} | rust_cleaned_test_functions.jsonl/69161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 538
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19169,
28532,
880,
538,
355,
27425,
3365,
368,
972,
262,
1077,
5206,
7363,
284,
17519,
3297,
486,
931,
1647,
262,
1077,
384,
284,
7363,
65111,
11771,
307,
445,
87,
2815,
262,
1077,
264,
16,
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... | 2 |
#[test]
fn test_has_label() {
mock_mgp_once!(
mgp_vertex_has_label_context,
|vertex, label, result| unsafe {
assert_eq!(vertex, null_mut());
assert_eq!(CStr::from_ptr(label.name), c_str!("labela"));
(*result) = 1;
mgp_error::MGP_ERROR_NO_ERROR
}
);
with_dummy!(Vertex, |vertex: &Vertex| {
assert_eq!(vertex.has_label(c_str!("labela")).unwrap(), true);
});
} | rust_cleaned_test_functions.jsonl/28518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
6106,
368,
341,
262,
7860,
717,
21888,
7630,
33673,
286,
13742,
79,
26611,
21778,
6106,
8467,
345,
286,
760,
12085,
11,
2383,
11,
1102,
91,
19860,
341,
310,
2060,
10714,
10297,
12085,
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_parse_turnpoint() {
let tp = CRecordTurnpoint::parse(b"C5111359N00101899WTAKEOFF Lasham Clubhouse").unwrap();
assert_relative_eq!(tp.latitude, 51.18931666666667);
assert_relative_eq!(tp.longitude, -1.03165);
assert_eq!(tp.text, Some("TAKEOFF Lasham Clubhouse".into()));
let tp = CRecordTurnpoint::parse(b"C5110179N00102644WSTART Lasham Start S").unwrap();
assert_relative_eq!(tp.latitude, 51.16965);
assert_relative_eq!(tp.longitude, -1.0440666666666667);
assert_eq!(tp.text, Some("START Lasham Start S".into()));
let tp = CRecordTurnpoint::parse(b"C5209092N00255227WTURN Sarnesfield").unwrap();
assert_relative_eq!(tp.latitude, 52.15153333333333);
assert_relative_eq!(tp.longitude, -2.9204499999999998);
assert_eq!(tp.text, Some("TURN Sarnesfield".into()));
let tp = CRecordTurnpoint::parse(b"C5230147N00017612WTURN Norman Cross").unwrap();
assert_relative_eq!(tp.latitude, 52.50245);
assert_relative_eq!(tp.longitude, -0.2935333333333333);
assert_eq!(tp.text, Some("TURN Norman Cross".into()));
let tp = CRecordTurnpoint::parse(b"C5110179N00102644WFINISH Lasham Start S").unwrap();
assert_relative_eq!(tp.latitude, 51.16965);
assert_relative_eq!(tp.longitude, -1.0440666666666667);
assert_eq!(tp.text, Some("FINISH Lasham Start S".into()));
let tp = CRecordTurnpoint::parse(b"C5111359N00101899WLANDING Lasham Clubhouse").unwrap();
assert_relative_eq!(tp.latitude, 51.18931666666667);
assert_relative_eq!(tp.longitude, -1.03165);
assert_eq!(tp.text, Some("LANDING Lasham Clubhouse".into()));
let tp = CRecordTurnpoint::parse(b"C8911359S17901899E").unwrap();
assert_relative_eq!(tp.latitude, -89.18931666666667);
assert_relative_eq!(tp.longitude, 179.03165);
assert_eq!(tp.text, None);
} | rust_cleaned_test_functions.jsonl/35067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 875
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37274,
2768,
368,
341,
286,
1077,
18101,
284,
356,
6471,
19389,
2768,
486,
6400,
1883,
46316,
20,
16,
16,
16,
18,
20,
24,
45,
15,
15,
16,
15,
16,
23,
24,
24,
54,
15204,
3390,
27068,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_in_one_read_shortest_first() {
let mut d = MessageDeframer::new();
assert_eq!(d.has_pending(), false);
assert_len(FIRST_MESSAGE.len() + SECOND_MESSAGE.len(),
input_bytes_concat(&mut d, SECOND_MESSAGE, FIRST_MESSAGE));
assert_eq!(d.frames.len(), 2);
pop_second(&mut d);
pop_first(&mut d);
assert_eq!(d.has_pending(), false);
} | rust_cleaned_test_functions.jsonl/29507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
1243,
11667,
6443,
16673,
477,
12978,
368,
341,
286,
1077,
5206,
294,
284,
4856,
2620,
46369,
486,
931,
543,
286,
2060,
10714,
10297,
67,
6858,
37861,
1507,
895,
317,
286,
2060,
6043,
7832,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block() {
let mut light_chain = LightChain::default_with_length(1);
let first_block = light_chain.block(1);
assert_eq!(1, first_block.unwrap().height());
light_chain.advance_chain();
let second_block = light_chain.block(2);
assert_eq!(2, second_block.unwrap().height());
} | rust_cleaned_test_functions.jsonl/10098 | {
"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,
7113,
368,
341,
286,
1077,
5206,
3100,
30583,
284,
8658,
18837,
486,
2258,
6615,
5118,
7,
16,
317,
286,
1077,
1156,
7113,
284,
3100,
30583,
15697,
7,
16,
317,
286,
2060,
10714,
10297,
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... | 1 |
#[test]
fn test_best_peers() {
let mut pdb = get_db();
let p0 = PeerId::random();
let p1 = PeerId::random();
let p2 = PeerId::random();
pdb.connect_ingoing(&p0, "/ip4/0.0.0.0".parse().unwrap(), None);
pdb.connect_ingoing(&p1, "/ip4/0.0.0.0".parse().unwrap(), None);
pdb.connect_ingoing(&p2, "/ip4/0.0.0.0".parse().unwrap(), None);
add_score(&mut pdb, &p0, 70.0);
add_score(&mut pdb, &p1, 100.0);
add_score(&mut pdb, &p2, 50.0);
let best_peers: Vec<&PeerId> = pdb
.best_peers_by_status(PeerInfo::is_connected)
.iter()
.map(|p| p.0)
.collect();
assert_eq!(vec![&p1, &p0, &p2], best_peers);
} | rust_cleaned_test_functions.jsonl/73650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33101,
36367,
388,
368,
341,
286,
1077,
5206,
47984,
284,
633,
8685,
1428,
286,
1077,
281,
15,
284,
45147,
764,
486,
11463,
543,
286,
1077,
281,
16,
284,
45147,
764,
486,
11463,
543,
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_highlighting_with_content_children_included() {
let source = vec!["assert!(", " a.b.c() < D::e::<F>()", ");"].join("\n");
assert_eq!(
&to_token_vector(&source, get_language("rust"), &RUST_SHEET).unwrap(),
&[
vec![
("assert", vec![Highlight::Function]),
("!", vec![Highlight::Function]),
("(", vec![Highlight::PunctuationBracket]),
],
vec![
(" a", vec![]),
(".", vec![Highlight::PunctuationDelimiter]),
("b", vec![Highlight::Property]),
(".", vec![Highlight::PunctuationDelimiter]),
("c", vec![Highlight::Function]),
("(", vec![Highlight::PunctuationBracket]),
(")", vec![Highlight::PunctuationBracket]),
(" < ", vec![]),
("D", vec![Highlight::Type]),
("::", vec![Highlight::PunctuationDelimiter]),
("e", vec![Highlight::Function]),
("::", vec![Highlight::PunctuationDelimiter]),
("<", vec![Highlight::PunctuationBracket]),
("F", vec![Highlight::Type]),
(">", vec![Highlight::PunctuationBracket]),
("(", vec![Highlight::PunctuationBracket]),
(")", vec![Highlight::PunctuationBracket]),
],
vec![(")", vec![Highlight::PunctuationBracket]), (";", vec![]),]
],
);
} | rust_cleaned_test_functions.jsonl/12261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74546,
287,
6615,
7495,
31206,
1243,
10181,
368,
341,
262,
1077,
2530,
284,
7486,
0,
1183,
2207,
0,
12918,
330,
262,
264,
948,
520,
368,
366,
422,
486,
68,
27638,
37,
13555,
497,
36778,
5521,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part_two() {
let solver = Day7Solver {};
test_solver(&solver, true, &["3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5"], "139629729");
test_solver(&solver, true, &["3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,55,1005,55,26,1001,54,-5,54,1105,1,12,1,53,54,53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10"], "18216");
} | rust_cleaned_test_functions.jsonl/54987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
23241,
368,
341,
286,
1077,
28961,
284,
6059,
22,
63830,
9321,
286,
1273,
53156,
2099,
75501,
11,
830,
11,
609,
1183,
18,
11,
17,
21,
11,
16,
15,
15,
16,
11,
17,
21,
4999,
19,
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... | 1 |
#[test]
fn test_dispatch() {
let (mut isolate, dispatch_count) = setup(Mode::Async);
js_check(isolate.execute(
"filename.js",
r#"
let control = new Uint8Array([42]);
Deno.core.send(1, control);
async function main() {
Deno.core.send(1, control);
}
main();
"#,
));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
} | rust_cleaned_test_functions.jsonl/969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
368,
341,
262,
1077,
320,
6984,
42123,
11,
6845,
3180,
8,
284,
6505,
3189,
534,
486,
6525,
317,
262,
6994,
7200,
82669,
7769,
1006,
414,
330,
8404,
2857,
756,
414,
435,
2,
698,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_ip_from_client_ip_without_appropriate_platform() {
let mut event = Annotated::new(Event::default());
let mut config = StoreConfig::default();
config.client_ip = Some(IpAddr::parse("2.125.160.216").unwrap());
let geo = GeoIpLookup::open("tests/fixtures/GeoIP2-Enterprise-Test.mmdb").unwrap();
let mut processor = NormalizeProcessor::new(Arc::new(config), Some(&geo));
process_value(&mut event, &mut processor, ProcessingState::root()).unwrap();
let user = event.value().unwrap().user.value().expect("user missing");
assert!(user.ip_address.value().is_none());
assert!(user.geo.value().is_none());
} | rust_cleaned_test_functions.jsonl/14086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
10385,
5673,
8179,
10385,
39904,
8191,
24278,
34260,
368,
341,
262,
1077,
5206,
1538,
284,
1527,
87029,
486,
931,
30469,
486,
2258,
5231,
262,
1077,
5206,
2193,
284,
9129,
2648,
486,
2258,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_container() {
fn sum_len(v: &[&str]) -> uint {
v.iter().map(|x| x.len()).sum()
}
let s = String::from_str("01234");
assert_eq!(5, sum_len(&["012", "", "34"]));
assert_eq!(5, sum_len(&[String::from_str("01").as_slice(),
String::from_str("2").as_slice(),
String::from_str("34").as_slice(),
String::from_str("").as_slice()]));
assert_eq!(5, sum_len(&[s.as_slice()]));
} | rust_cleaned_test_functions.jsonl/2483 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
15847,
368,
341,
286,
5168,
2629,
6043,
3747,
25,
44590,
5,
495,
2467,
1464,
2622,
341,
310,
348,
19471,
1005,
2186,
22428,
87,
91,
856,
19406,
6011,
1242,
741,
286,
555,
286,
1077,
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_option_value() {
macro_rules! test_some_value {
( $type: ty, $val: literal ) => {
let val: Option<$type> = Some($val);
let v: Value = val.into();
let out: $type = v.unwrap();
assert_eq!(out, val.unwrap());
};
}
macro_rules! test_none {
( $type: ty, $name: ident ) => {
let val: Option<$type> = None;
let v: Value = val.into();
assert_eq!(v, Value::$name(None));
};
}
test_some_value!(u8, 255);
test_some_value!(u16, 65535);
test_some_value!(i8, 127);
test_some_value!(i16, 32767);
test_some_value!(i32, 1073741824);
test_some_value!(i64, 8589934592);
test_none!(u8, TinyUnsigned);
test_none!(u16, SmallUnsigned);
test_none!(i8, TinyInt);
test_none!(i16, SmallInt);
test_none!(i32, Int);
test_none!(i64, BigInt);
} | rust_cleaned_test_functions.jsonl/12479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
3142,
368,
341,
286,
18072,
21407,
0,
1273,
61855,
3142,
341,
310,
320,
400,
1313,
25,
13580,
11,
400,
831,
25,
23141,
873,
589,
341,
394,
1077,
1044,
25,
6959,
35887,
1313,
29,
284,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lassoc_term() {
let input = vec![Token::Integer(2), Token::Minus, Token::Integer(1), Token::Minus, Token::Integer(1)];
let stmt = parse(&input).unwrap();
assert_eq!(stmt,
Stmt::Eval(
Expr::Minus(
Expr::Minus(integer_expr(2).boxed(), integer_expr(1).boxed()).boxed(),
integer_expr(1).boxed())));
} | rust_cleaned_test_functions.jsonl/55667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62,
447,
509,
17464,
368,
341,
1789,
286,
1077,
1946,
284,
7486,
20703,
3323,
486,
3486,
7,
17,
701,
9660,
486,
74458,
11,
9660,
486,
3486,
7,
16,
701,
9660,
486,
74458,
11,
9660,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_duration() {
let tests: &[(&'static str, Option<Duration>)] = &[
("5s", Some(Duration::from_secs(5))),
("5m", Some(Duration::from_secs(60 * 5))),
("5m 8s", Some(Duration::from_secs(60 * 5 + 8))),
(
"2h3s 1ms",
Some(Duration::from_secs(60 * 60 * 2 + 3) + Duration::from_millis(1)),
),
("5sec", None),
("5d", None),
("4h4s3m", None),
];
for tc in tests {
let got = parse_duration(tc.0);
match (got, tc.1) {
(Err(..), None) => (),
(Ok(s), None) => {
panic!("parse({}): got {:?}, expected error", tc.0, s);
}
(Err(e), Some(d)) => {
panic!("parse({}): got err({:?}), expected {:?}", tc.0, e, d);
}
(Ok(g), Some(d)) => {
if g != d {
panic!("parse({}): got {:?}, expected {:?}", tc.0, g, d);
}
}
}
}
} | rust_cleaned_test_functions.jsonl/106446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25454,
368,
341,
286,
1077,
7032,
25,
44590,
2099,
6,
1978,
607,
11,
6959,
27,
12945,
29,
7252,
284,
609,
9640,
310,
3489,
20,
82,
497,
4329,
64114,
486,
1499,
68718,
7,
20,
41749,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_invalid_n_runs() {
assert!(
GaussianMixtureModel::params(1)
.with_n_runs(0)
.fit(&DatasetBase::from(array![[0.]]))
.is_err(),
"n_runs must be strictly positive"
);
} | rust_cleaned_test_functions.jsonl/10372 | {
"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,
31433,
1089,
67352,
368,
341,
286,
2060,
33673,
310,
48568,
44,
12735,
1712,
486,
3519,
7,
16,
340,
394,
659,
4197,
1089,
67352,
7,
15,
340,
394,
659,
6276,
2099,
33363,
3978,
486,
1499,
6110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_max_schedules() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank = Arc::new(Bank::new(&genesis_config));
let mut cache = LeaderScheduleCache::new_from_bank(&bank);
// Max schedules must be greater than 0
cache.set_max_schedules(0);
assert_eq!(cache.max_schedules(), MAX_SCHEDULES);
cache.set_max_schedules(std::usize::MAX);
assert_eq!(cache.max_schedules(), std::usize::MAX);
} | rust_cleaned_test_functions.jsonl/26074 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6345,
643,
49613,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
17,
317,
286,
1077,
6073,
284,
19689,
486,
931,
5349,
1180,
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_image_crops() {
// test the top left crop
let top_left = crop_and_resize("assets/lena.png",
0.25, 0.25, 0.25, 0.25, 32, 32);
println!("dims: {:?}", top_left.dimensions());
top_left.save(&Path::new("assets/test_lena_top_left.png")).unwrap();
assert!(top_left.dimensions() == (32, 32), "top left was {:?}", top_left.dimensions());
// test the top right crop
let top_right = crop_and_resize("assets/lena.png",
0.25, 0.75, 0.25, 0.25, 32, 32);
top_right.save(&Path::new("assets/test_lena_top_right.png")).unwrap();
assert!(top_right.dimensions() == (32, 32), "top right was {:?}", top_right.dimensions());
// test the bottom left crop
let bottom_left = crop_and_resize("assets/lena.png",
0.25, 0.25, 0.75, 0.25, 32, 32);
bottom_left.save(&Path::new("assets/test_lena_bottom_left.png")).unwrap();
assert!(bottom_left.dimensions() == (32, 32), "bottom left was {:?}", bottom_left.dimensions());
// test the bottom right crop
let bottom_right = crop_and_resize("assets/lena.png",
0.25, 0.75, 0.75, 0.25, 32, 32);
bottom_right.save(&Path::new("assets/test_lena_bottom_right.png")).unwrap();
assert!(bottom_right.dimensions() == (32, 32), "bottom right was {:?}", bottom_right.dimensions());
// test the center crop
let center = crop_and_resize("assets/lena.png",
0.25, 0.5, 0.5, 0.25, 32, 32);
center.save(&Path::new("assets/test_lena_center.png")).unwrap();
assert!(center.dimensions() == (32, 32), "center right was {:?}", center.dimensions());
} | rust_cleaned_test_functions.jsonl/28012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 915
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
666,
3702,
368,
341,
286,
442,
1273,
279,
1909,
2115,
19097,
198,
286,
1077,
1909,
9579,
284,
19097,
8378,
53370,
445,
5160,
14,
48021,
3508,
756,
11070,
220,
15,
13,
17,
20,
11,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_service_group() {
let _exec = fasync::Executor::new().unwrap();
let (mut service_group, _server) = build_service_group();
let mut expected_server_channels = HashSet::new();
let mut expected_psms = HashSet::new();
assert_eq!(service_group.service_defs(), &vec![]);
assert_eq!(service_group.allocated_server_channels(), &expected_server_channels);
assert_eq!(service_group.allocated_psms(), &expected_psms);
let psm = Psm::new(20);
let other_def = other_service_definition(psm);
service_group.set_service_defs(vec![other_def.clone()]);
expected_psms.insert(psm);
assert_eq!(service_group.allocated_server_channels(), &expected_server_channels);
assert_eq!(service_group.allocated_psms(), &expected_psms);
let sc = ServerChannel::try_from(10).unwrap();
let rfcomm_def = rfcomm_service_definition(Some(sc));
service_group.set_service_defs(vec![rfcomm_def, other_def]);
expected_server_channels.insert(sc);
assert_eq!(service_group.allocated_server_channels(), &expected_server_channels);
assert_eq!(service_group.allocated_psms(), &expected_psms);
} | rust_cleaned_test_functions.jsonl/98661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12267,
6288,
368,
341,
286,
1077,
716,
11748,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
1428,
286,
1077,
320,
6984,
2473,
6288,
11,
716,
4030,
8,
284,
1936,
12267,
6288,
1428,
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_region_retry() {
#[derive(Clone)]
struct MockRpcResponse;
impl HasError for MockRpcResponse {
fn error(&mut self) -> Option<Error> {
unreachable!()
}
}
impl HasRegionError for MockRpcResponse {
fn region_error(&mut self) -> Option<Error> {
Some(Error::region_not_found(1))
}
}
impl HasLocks for MockRpcResponse {}
#[derive(Clone)]
struct MockKvRequest {
test_invoking_count: Arc<Mutex<usize>>,
}
#[async_trait]
impl Request for MockKvRequest {
async fn dispatch(&self, _: &TikvClient, _: CallOption) -> Result<Box<dyn Any>> {
Ok(Box::new(MockRpcResponse {}))
}
fn label(&self) -> &'static str {
"mock"
}
fn as_any(&self) -> &dyn Any {
self
}
fn set_context(&mut self, _: kvrpcpb::Context) {
unreachable!();
}
}
#[async_trait]
impl KvRequest for MockKvRequest {
type Result = ();
type RpcResponse = MockRpcResponse;
type KeyData = Key;
fn make_rpc_request(&self, _key_data: Self::KeyData, _store: &Store) -> Result<Self> {
Ok(Self {
test_invoking_count: self.test_invoking_count.clone(),
})
}
fn map_result(_: Self::RpcResponse) -> Self::Result {}
async fn reduce(
_results: BoxStream<'static, Result<Self::Result>>,
) -> Result<Self::Result> {
unreachable!()
}
fn store_stream<PdC: PdClient>(
&mut self,
pd_client: Arc<PdC>,
) -> BoxStream<'static, Result<(Self::KeyData, Store)>> {
// Increases by 1 for each call.
let mut test_invoking_count = self.test_invoking_count.lock().unwrap();
*test_invoking_count += 1;
store_stream_for_key(Key::from("mock_key".to_owned()), pd_client)
}
}
let invoking_count = Arc::new(Mutex::new(0));
let request = MockKvRequest {
test_invoking_count: invoking_count.clone(),
};
let pd_client = Arc::new(MockPdClient::new(MockKvClient::with_dispatch_hook(
|_: &dyn Any| Ok(Box::new(MockRpcResponse) as Box<dyn Any>),
)));
let region_backoff = NoJitterBackoff::new(1, 1, 3);
let lock_backoff = NoJitterBackoff::new(1, 1, 3);
let stream = request.retry_response_stream(pd_client, region_backoff, lock_backoff);
executor::block_on(async { stream.collect::<Vec<Result<MockRpcResponse>>>().await });
// Original call plus the 3 retries
assert_eq!(*invoking_count.lock().unwrap(), 4);
} | rust_cleaned_test_functions.jsonl/3248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
62745,
368,
341,
286,
11506,
27098,
65297,
5563,
286,
2036,
14563,
60248,
2582,
401,
286,
11605,
11443,
1454,
369,
14563,
60248,
2582,
341,
310,
5168,
1465,
2099,
6984,
656,
8,
1464,
6959,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_datefastfield() {
use crate::fastfield::FastValue;
let mut schema_builder = Schema::builder();
let date_field = schema_builder.add_date_field("date", FAST);
let multi_date_field = schema_builder.add_date_field(
"multi_date",
IntOptions::default().set_fast(Cardinality::MultiValues),
);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index.writer_for_tests().unwrap();
index_writer.set_merge_policy(Box::new(NoMergePolicy));
index_writer.add_document(doc!(
date_field => crate::DateTime::from_u64(1i64.to_u64()),
multi_date_field => crate::DateTime::from_u64(2i64.to_u64()),
multi_date_field => crate::DateTime::from_u64(3i64.to_u64())
));
index_writer.add_document(doc!(
date_field => crate::DateTime::from_u64(4i64.to_u64())
));
index_writer.add_document(doc!(
multi_date_field => crate::DateTime::from_u64(5i64.to_u64()),
multi_date_field => crate::DateTime::from_u64(6i64.to_u64())
));
index_writer.commit().unwrap();
let reader = index.reader().unwrap();
let searcher = reader.searcher();
assert_eq!(searcher.segment_readers().len(), 1);
let segment_reader = searcher.segment_reader(0);
let fast_fields = segment_reader.fast_fields();
let date_fast_field = fast_fields.date(date_field).unwrap();
let dates_fast_field = fast_fields.dates(multi_date_field).unwrap();
let mut dates = vec![];
{
assert_eq!(date_fast_field.get(0u32).timestamp(), 1i64);
dates_fast_field.get_vals(0u32, &mut dates);
assert_eq!(dates.len(), 2);
assert_eq!(dates[0].timestamp(), 2i64);
assert_eq!(dates[1].timestamp(), 3i64);
}
{
assert_eq!(date_fast_field.get(1u32).timestamp(), 4i64);
dates_fast_field.get_vals(1u32, &mut dates);
assert!(dates.is_empty());
}
{
assert_eq!(date_fast_field.get(2u32).timestamp(), 0i64);
dates_fast_field.get_vals(2u32, &mut dates);
assert_eq!(dates.len(), 2);
assert_eq!(dates[0].timestamp(), 5i64);
assert_eq!(dates[1].timestamp(), 6i64);
}
} | rust_cleaned_test_functions.jsonl/5525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
9349,
2566,
368,
341,
286,
990,
17717,
486,
9349,
2566,
486,
32174,
1130,
280,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
2400,
5013,
284,
10802,
28532,
1364,
416... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stack2() {
test_interpreter_and_jit_asm!(
"
stb [r10-4], 0x01
stb [r10-3], 0x02
stb [r10-2], 0x03
stb [r10-1], 0x04
mov r1, r10
mov r2, 0x4
sub r1, r2
syscall BpfMemFrob
mov r1, 0
ldxb r2, [r10-4]
ldxb r3, [r10-3]
ldxb r4, [r10-2]
ldxb r5, [r10-1]
syscall BpfGatherBytes
xor r0, 0x2a2a2a2a
exit",
[],
(
b"BpfMemFrob" => syscalls::BpfMemFrob::call; syscalls::BpfMemFrob {},
b"BpfGatherBytes" => syscalls::BpfGatherBytes::call; syscalls::BpfGatherBytes {},
),
{ |_vm, res: Result| { res.unwrap() == 0x01020304 } },
16
);
} | rust_cleaned_test_functions.jsonl/59031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
17,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
357,
65,
508,
81,
16,
15,
12,
19,
1125,
220,
15,
87,
15,
16,
198,
286,
357,
65,
508,
81,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_compat() -> Result<()> {
// Build the big struct
let mut m = BTreeMap::new();
m.insert("m1".to_string(), 1);
m.insert("m2".to_string(), 2);
let u = Un::un1(UnOne { one: 1 });
let e = En::TWO;
let mut int_keys = BTreeMap::new();
int_keys.insert(42, 43);
int_keys.insert(44, 45);
let r = MainStructNoBinary {
foo: "foo".to_string(),
m,
bar: "test".to_string(),
l: vec![Small { num: 1, two: 2 }, Small { num: 2, two: 3 }],
u,
e,
int_keys,
opt: None,
};
let fbthrift_s = String::from_utf8(serialize(&r).to_vec()).unwrap();
// can deserialize
// what serde has written out
let serde_s = serde_json::to_string(&r).unwrap();
// but passing between them should work
assert_eq!(r, serde_json::from_str(&fbthrift_s).unwrap());
assert_eq!(r, deserialize(&serde_s).unwrap());
Ok(())
} | rust_cleaned_test_functions.jsonl/122581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
89602,
368,
1464,
5714,
71698,
341,
262,
442,
7854,
279,
2409,
2036,
198,
262,
1077,
5206,
296,
284,
425,
6533,
2227,
486,
931,
543,
262,
296,
7030,
445,
76,
16,
3263,
983,
3904,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonlinear_normal_positve() {
assert_eq!(nonlinear_normal_positve(0.0), 0.0);
assert_eq!(nonlinear_normal_positve(23.45), 23.45);
assert_eq!(nonlinear_normal_positve(-0.0), 0.0);
assert_eq!(nonlinear_normal_positve(-23.45), 0.0);
assert_eq!(nonlinear_normal_positve(f64::INFINITY), 0.0);
assert_eq!(nonlinear_normal_positve(f64::NEG_INFINITY), 0.0);
assert_eq!(nonlinear_normal_positve(f64::NAN), 0.0);
assert_eq!(nonlinear_normal_positve(f64::MIN_POSITIVE / 2.0), 0.0);
assert_eq!(nonlinear_normal_positve(f64::MAX * 2.0), 0.0);
} | rust_cleaned_test_functions.jsonl/101301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
22763,
13973,
6479,
275,
586,
368,
341,
262,
2060,
10714,
10297,
6280,
22763,
13973,
6479,
275,
586,
7,
15,
13,
15,
701,
220,
15,
13,
15,
317,
262,
2060,
10714,
10297,
6280,
22763,
13973,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lifetime() {
#[derive(PartialEq, TypedBuilder)]
struct Foo<'a, 'b> {
x: &'a i32,
y: &'b i32,
}
assert!(Foo::builder().x(&1).y(&2).build() == Foo { x: &1, y: &2 });
} | rust_cleaned_test_functions.jsonl/36678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98827,
368,
341,
262,
11506,
27098,
5304,
20894,
27312,
11,
50554,
3297,
5563,
262,
2036,
33428,
18291,
64,
11,
364,
65,
29,
341,
286,
856,
25,
30136,
64,
600,
18,
17,
345,
286,
379,
25,
30136... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retain() {
let mut set = BTreeSet::from([1, 2, 3, 4, 5, 6]);
set.retain(|&k| k % 2 == 0);
assert_eq!(set.len(), 3);
assert!(set.contains(&2));
assert!(set.contains(&4));
assert!(set.contains(&6));
} | rust_cleaned_test_functions.jsonl/13745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
368,
341,
262,
1077,
5206,
738,
284,
425,
6533,
1649,
486,
1499,
2561,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
2558,
262,
738,
1327,
22921,
22428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotate_nearest_rgb() {
fn rotate_nearest_about_center(image: &RgbImage) -> RgbImage {
rotate_about_center(
image,
std::f32::consts::PI / 4f32,
Interpolation::Nearest,
Rgb::black(),
)
}
compare_to_truth(
"elephant.png",
"elephant_rotate_nearest.png",
rotate_nearest_about_center,
);
} | rust_cleaned_test_functions.jsonl/81459 | {
"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,
60834,
13925,
15432,
37407,
368,
341,
262,
5168,
16919,
13925,
15432,
57975,
21087,
10075,
25,
609,
80951,
1906,
8,
1464,
431,
9511,
1906,
341,
286,
16919,
57975,
21087,
1006,
310,
2168,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_error_cases() {
let mut netif_configs = NetworkInterfaceConfigs::new();
let id_1 = "id_1";
let host_dev_name_1 = "dev3";
let guest_mac_1 = "01:23:45:67:89:0a";
// Adding the first valid network config.
let netif_1 = create_netif(id_1, host_dev_name_1, guest_mac_1);
assert!(netif_configs.insert(netif_1.clone()).is_ok());
// Error Cases for CREATE
// Error Case: Add new network config with the same mac as netif_1.
let id_2 = "id_2";
let host_dev_name_2 = "dev4";
let guest_mac_2 = "01:23:45:67:89:0b";
let netif_2 = create_netif(id_2, host_dev_name_2, guest_mac_1);
let expected_error = format!(
"The guest MAC address {} is already in use.",
guest_mac_1.to_string()
);
assert_eq!(
netif_configs
.insert(netif_2.clone())
.unwrap_err()
.to_string(),
expected_error
);
assert_eq!(netif_configs.if_list.len(), 1);
// Error Case: Add new network config with the same dev_host_name as netif_1.
let netif_2 = create_netif(id_2, host_dev_name_1, guest_mac_2);
let expected_error = format!(
"The host device name {} is already in use.",
netif_2.host_dev_name
);
assert_eq!(
netif_configs
.insert(netif_2.clone())
.unwrap_err()
.to_string(),
expected_error
);
assert_eq!(netif_configs.if_list.len(), 1);
// Adding the second valid network config.
let netif_2 = create_netif(id_2, host_dev_name_2, guest_mac_2);
assert!(netif_configs.insert(netif_2.clone()).is_ok());
// Error Cases for UPDATE
// Error Case: Update netif_2 mac using the same mac as netif_1.
let netif_2 = create_netif(id_2, host_dev_name_2, guest_mac_1);
let expected_error = format!(
"The guest MAC address {} is already in use.",
guest_mac_1.to_string()
);
assert_eq!(
netif_configs
.insert(netif_2.clone())
.unwrap_err()
.to_string(),
expected_error
);
// Error Case: Update netif_2 dev_host_name using the same dev_host_name as netif_1.
let netif_2 = create_netif(id_2, host_dev_name_1, guest_mac_2);
let expected_error = format!(
"The host device name {} is already in use.",
netif_2.host_dev_name
);
assert_eq!(
netif_configs
.insert(netif_2.clone())
.unwrap_err()
.to_string(),
expected_error
);
} | rust_cleaned_test_functions.jsonl/72601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
4096,
41427,
368,
341,
286,
1077,
5206,
4179,
333,
59150,
284,
8141,
5051,
84905,
486,
931,
1428,
286,
1077,
877,
62,
16,
284,
330,
307,
62,
16,
876,
286,
1077,
3468,
10433,
1269,
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... | 1 |
#[test]
fn test_datetime_add_sub_invariant() {
// issue #37
let base = NaiveDate::from_ymd(2000, 1, 1).and_hms(0, 0, 0);
let t = -946684799990000;
let time = base + Duration::microseconds(t);
assert_eq!(t, time.signed_duration_since(base).num_microseconds().unwrap());
} | rust_cleaned_test_functions.jsonl/76828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
2891,
5228,
1243,
15969,
368,
341,
286,
442,
4265,
671,
18,
22,
198,
286,
1077,
2331,
284,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
15,
15,
11,
220,
16,
11,
220,
16,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_mut_forwards() {
let mut cache = LruCache::new(4);
cache.put("a", 1);
cache.put("b", 2);
cache.put("c", 3);
cache.put("d", 4);
let mut iter = cache.iter_mut();
assert_opt_eq_mut_tuple(iter.next(), ("d", 4));
assert_opt_eq_mut_tuple(iter.next(), ("c", 3));
assert_opt_eq_mut_tuple(iter.next(), ("b", 2));
assert_opt_eq_mut_tuple(iter.next(), ("a", 1));
assert_eq!(iter.next(), None);
assert_opt_eq(cache.get(&"b"), 2);
let mut iter = cache.iter_mut();
assert_opt_eq_mut_tuple(iter.next(), ("b", 2));
assert_opt_eq_mut_tuple(iter.next(), ("d", 4));
assert_opt_eq_mut_tuple(iter.next(), ("c", 3));
assert_opt_eq_mut_tuple(iter.next(), ("a", 1));
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/77939 | {
"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,
11723,
29523,
5478,
4014,
368,
341,
286,
1077,
5206,
6500,
284,
444,
2672,
8233,
486,
931,
7,
19,
317,
286,
6500,
3597,
445,
64,
497,
220,
16,
317,
286,
6500,
3597,
445,
65,
497,
220,
17,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_chunks_zip() {
let v1: &[i32] = &[0, 1, 2, 3, 4];
let v2: &[i32] = &[6, 7, 8, 9, 10];
let res = v1
.array_chunks::<2>()
.zip(v2.array_chunks::<2>())
.map(|(a, b)| a.iter().sum::<i32>() + b.iter().sum::<i32>())
.collect::<Vec<_>>();
assert_eq!(res, vec![14, 22]);
} | rust_cleaned_test_functions.jsonl/9648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
65470,
42131,
368,
341,
262,
1077,
348,
16,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
348,
17,
25,
44590,
72,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if() {
use std::f64::consts::{E, PI};
let cases = vec![
((Some(0), E, PI), Real::new(PI).ok()),
((Some(1), E, PI), Real::new(E).ok()),
((None, E, PI), Real::new(PI).ok()),
];
for ((condition, value1, value2), expected) in cases {
assert_eq!(
expected,
RpnFnScalarEvaluator::new()
.push_param(condition)
.push_param(value1)
.push_param(value2)
.evaluate(ScalarFuncSig::IfReal)
.unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/14918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
368,
341,
286,
990,
1460,
486,
69,
21,
19,
486,
95773,
22964,
36,
11,
22578,
2315,
286,
1077,
5048,
284,
7486,
90515,
310,
1781,
8373,
7,
15,
701,
468,
11,
22578,
701,
8800,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sorted_by_ancestors_score_competitive() {
let tx1 = build_tx(vec![(&Byte32::zero(), 1)], 2);
let tx1_hash = tx1.hash();
let tx2 = build_tx(vec![(&tx1_hash, 0)], 1);
let tx2_hash = tx2.hash();
let tx3 = build_tx(vec![(&tx2_hash, 0)], 1);
let tx2_1 = build_tx(vec![(&Byte32::zero(), 2)], 2);
let tx2_1_hash = tx2_1.hash();
let tx2_2 = build_tx(vec![(&tx2_1_hash, 0)], 1);
let tx2_2_hash = tx2_2.hash();
let tx2_3 = build_tx(vec![(&tx2_2_hash, 0)], 1);
let tx2_3_hash = tx2_3.hash();
let tx2_4 = build_tx(vec![(&tx2_3_hash, 0)], 1);
let mut pool = ProposedPool::new(DEFAULT_MAX_ANCESTORS_SIZE);
// calculating the vbytes for a package.
let cycles = 5_000_839;
let size = 200;
for &tx in &[&tx1, &tx2, &tx3, &tx2_1, &tx2_2, &tx2_3, &tx2_4] {
pool.add_entry(TxEntry::dummy_resolve(
tx.clone(),
cycles,
Capacity::shannons(200),
size,
))
.unwrap();
}
let txs_sorted_by_fee_rate = pool
.score_sorted_iter()
.map(|entry| format!("{}", entry.transaction().hash()))
.collect::<Vec<_>>();
// the entry with most ancestors score will win
let expect_result = format!("{}", tx2_4.hash());
assert_eq!(txs_sorted_by_fee_rate[0], expect_result);
} | rust_cleaned_test_functions.jsonl/50524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41277,
3710,
62,
681,
267,
1087,
10405,
2965,
6862,
3404,
368,
341,
286,
1077,
9854,
16,
284,
1936,
17805,
25592,
20703,
2099,
7153,
18,
17,
486,
14154,
1507,
220,
16,
25035,
220,
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... | 2 |
#[test]
fn test_heap_str() {
let long = "I am a long string that has very many characters";
let repr = Repr::new(&long);
assert_eq!(repr.as_str(), long);
} | rust_cleaned_test_functions.jsonl/14387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33059,
2895,
368,
341,
286,
1077,
1293,
284,
330,
40,
1079,
264,
1293,
914,
429,
702,
1602,
1657,
5766,
876,
286,
1077,
30636,
284,
1032,
649,
486,
931,
2099,
4825,
317,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words = words
.iter()
.map(|x| capitalize_first(x))
.collect::<String>();
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/68053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
284,
4244,
198,
310,
659,
2015,
741,
310,
659,
2186,
224... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_value_struct() -> LuaResult<()> {
let lua = Lua::new();
let globals = lua.globals();
globals.set("null", lua.null())?;
#[derive(Serialize)]
struct Test {
name: String,
key: i64,
data: Option<bool>,
}
let test = Test {
name: "alex".to_string(),
key: -16,
data: None,
};
globals.set("value", lua.to_value(&test)?)?;
lua.load(
r#"
assert(value["name"] == "alex")
assert(value["key"] == -16)
assert(value["data"] == null)
"#,
)
.exec()
} | rust_cleaned_test_functions.jsonl/50704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3142,
15126,
368,
1464,
37662,
2077,
71698,
341,
262,
1077,
20357,
284,
37662,
486,
931,
543,
262,
1077,
37785,
284,
20357,
1302,
16616,
543,
262,
37785,
980,
445,
2921,
497,
20357,
59266,
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... | 4 |
#[test]
fn test_padding_with_large_payload() {
let mut buffer = buffer();
assert!(buffer.enqueue(12, ()).is_ok());
assert!(buffer.dequeue().is_ok());
buffer
.enqueue(12, ())
.unwrap()
.copy_from_slice(b"abcdefghijkl");
} | rust_cleaned_test_functions.jsonl/101977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40726,
6615,
45228,
32813,
368,
341,
286,
1077,
5206,
4147,
284,
4147,
543,
286,
2060,
10297,
7573,
47468,
7,
16,
17,
11,
1719,
568,
285,
19817,
1423,
286,
2060,
10297,
7573,
93789,
1005,
285,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_isometry_transform_vector() {
let distance = Vector2::new(1_f64, 2_f64);
let translation = Translation2::from_vector(&distance);
let rotation = Rotation2::from_angle(Degrees(90_f64));
let isometry = Isometry2::from_parts(&translation, &rotation);
let vector = Vector2::new(1_f64, 2_f64);
let expected = Vector2::new(-2_f64, 1_f64);
let result = isometry.transform_vector(&vector);
assert_relative_eq!(result, expected, epsilon = 1e-8);
} | rust_cleaned_test_functions.jsonl/77210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
6988,
18449,
12247,
368,
341,
286,
1077,
6010,
284,
4196,
17,
486,
931,
7,
16,
761,
21,
19,
11,
220,
17,
761,
21,
19,
317,
286,
1077,
14468,
284,
38041,
17,
486,
1499,
12247,
2099,
193... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kvm_bindings_struct() {
#[repr(C)]
#[derive(Debug, PartialEq, Versionize)]
pub struct kvm_pit_config {
pub flags: ::std::os::raw::c_uint,
pub pad: [::std::os::raw::c_uint; 15usize],
}
let state = kvm_pit_config {
flags: 123_456,
pad: [0; 15usize],
};
let vm = VersionMap::new();
let mut snapshot_mem = vec![0u8; 1024];
// Serialize as v1.
let mut snapshot = Snapshot::new(vm.clone(), 1);
snapshot
.save_without_crc(&mut snapshot_mem.as_mut_slice(), &state)
.unwrap();
let restored_state: kvm_pit_config =
Snapshot::unchecked_load(&mut snapshot_mem.as_slice(), vm).unwrap();
assert_eq!(restored_state, state);
} | rust_cleaned_test_functions.jsonl/43358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
7338,
94516,
15126,
368,
341,
286,
11506,
30837,
3025,
5563,
286,
11506,
27098,
42618,
11,
55039,
11,
6079,
551,
5563,
286,
6675,
2036,
94748,
620,
275,
5332,
341,
310,
6675,
8042,
25,
3504,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
for &p in TEST_PROB {
for &n in TEST_SIZE {
let mut rng: StdRng = SeedableRng::from_seed([0; 32]);
let mut bv = BitVector::new();
let mut ba = BitArray::new(n as usize);
for i in 0..n {
let b = rng.gen_bool(p);
ba.set_bit(i as usize, b);
bv.push(b);
}
for i in 0..n {
assert_eq!(bv.get(i), ba.get_bit(i as usize));
}
}
}
} | rust_cleaned_test_functions.jsonl/50483 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
286,
369,
609,
79,
304,
13602,
5756,
33,
341,
310,
369,
609,
77,
304,
13602,
4098,
341,
394,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_uadd8() {
assert_eq!(
decode_32(0xfa82f24c),
Instruction::UADD8 {
params: Reg3NoSetFlagsParams {
rd: Reg::R2,
rn: Reg::R2,
rm: Reg::R12,
}
}
);
} | rust_cleaned_test_functions.jsonl/64871 | {
"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,
15227,
7300,
718,
23,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
48890,
23,
17,
69,
17,
19,
66,
1326,
286,
29051,
486,
52,
15665,
23,
341,
310,
3628,
25,
3184,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finalize_some_value() {
assert_eq!(finalize(3987120094), 18446744069722431521);
} | rust_cleaned_test_functions.jsonl/54037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 58
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70616,
61855,
3142,
368,
341,
286,
2060,
10714,
10297,
94405,
7,
18,
24,
23,
22,
16,
17,
15,
15,
24,
19,
701,
220,
16,
23,
19,
19,
21,
22,
19,
19,
15,
21,
24,
22,
17,
17,
19,
18,
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 |
#[test]
fn test_multi_char_truncation_symbol() -> io::Result<()> {
test_truncate_length_with_config(
"1337_hello_world",
15,
"1337_hello_worl",
"a",
"truncation_symbol = \"apple\"",
)
} | rust_cleaned_test_functions.jsonl/106750 | {
"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,
25133,
9232,
3547,
1347,
367,
21179,
368,
1464,
6399,
486,
2077,
71698,
341,
262,
1273,
3547,
26900,
5118,
6615,
5332,
1006,
286,
330,
16,
18,
18,
22,
96724,
31792,
756,
286,
220,
16,
20,
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_square() {
let mut b : felem_as_words = [9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093];
let mut out : felem_as_words = [0, 0, 0, 0, 0, 0];
bls12_square(&mut out, &mut b);
assert_eq!(out, [12260768510540316659, 6038201419376623626, 5156596810353639551, 12813724723179037911, 10288881524157229871, 708830206584151678]);
} | rust_cleaned_test_functions.jsonl/91331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39794,
368,
341,
262,
1077,
5206,
293,
549,
1152,
3433,
11898,
18981,
284,
508,
24,
22,
24,
19,
17,
15,
18,
17,
23,
24,
21,
17,
18,
20,
19,
24,
17,
22,
21,
11,
220,
22,
18,
15,
24,
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_handle_heartbeat() {
setup_for_test();
let commit = 2u64;
let nw = |f, to, term, commit| {
let mut m = new_message(f, to, MessageType::MsgHeartbeat, 0);
m.set_term(term);
m.set_commit(commit);
m
};
let mut tests = vec![
(nw(2, 1, 2, commit + 1), commit + 1),
(nw(2, 1, 2, commit - 1), commit), // do not decrease commit
];
for (i, (m, w_commit)) in tests.drain(..).enumerate() {
let store = new_storage();
store
.wl()
.append(&[empty_entry(1, 1), empty_entry(2, 2), empty_entry(3, 3)])
.expect("");
let mut sm = new_test_raft(1, vec![1, 2], 5, 1, store);
sm.become_follower(2, 2);
sm.raft_log.commit_to(commit);
sm.handle_heartbeat(m);
if sm.raft_log.committed != w_commit {
panic!(
"#{}: committed = {}, want = {}",
i, sm.raft_log.committed, w_commit
);
}
let m = sm.read_messages();
if m.len() != 1 {
panic!("#{}: msg count = {}, want 1", i, m.len());
}
if m[0].get_msg_type() != MessageType::MsgHeartbeatResponse {
panic!(
"#{}: type = {:?}, want MsgHeartbeatResponse",
i,
m[0].get_msg_type()
);
}
}
} | rust_cleaned_test_functions.jsonl/107115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 756
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
62,
72471,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5266,
284,
220,
17,
84,
21,
19,
280,
262,
1077,
62532,
284,
760,
69,
11,
311,
11,
4647,
11,
5266,
91,
341,
286,
1077,
5206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rm_verbose() {
let (at, mut ucmd) = testing(UTIL_NAME);
let file_a = "test_rm_verbose_file_a";
let file_b = "test_rm_verbose_file_b";
at.touch(file_a);
at.touch(file_b);
let result = ucmd.arg("-v").arg(file_a).arg(file_b).run();
assert_empty_stderr!(result);
assert_eq!(result.stdout,
format!("removed '{}'\nremoved '{}'\n", file_a, file_b));
assert!(result.success);
} | rust_cleaned_test_functions.jsonl/61418 | {
"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,
58537,
67921,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
7497,
7,
36969,
4708,
317,
262,
1077,
1034,
4306,
284,
330,
1944,
58537,
67921,
2458,
4306,
876,
262,
1077,
1034,
880,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gdt_entry() {
assert_eq!(GdtEntry::new(0xa09b, 0x0, 0xfffff).0, 0xaf9b000000ffff);
assert_eq!(GdtEntry::new(0xc093, 0x0, 0xfffff).0, 0xcf93000000ffff);
} | rust_cleaned_test_functions.jsonl/12649 | {
"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,
1889,
8047,
9078,
368,
341,
286,
2060,
10714,
10297,
38,
8047,
5874,
486,
931,
7,
15,
9591,
15,
24,
65,
11,
220,
15,
87,
15,
11,
220,
15,
20518,
69,
568,
15,
11,
220,
15,
54795,
24,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_coercion() {
Python::with_gil(|py| {
let v = vec!["foo", "bar"];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert!(seq.list().is_ok());
});
} | rust_cleaned_test_functions.jsonl/70328 | {
"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,
2019,
11393,
2962,
290,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
6332,
310,
1077,
1508,
284,
348,
2389,
5314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_setter_should_panic() {
let mut a = Ts {jaf: 4, field_1: 0, field_2: String::from("hello")};
a.set_field_1(20);
assert_eq!(a.field_1, 11);
} | rust_cleaned_test_functions.jsonl/24667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
2602,
465,
43378,
620,
31270,
368,
341,
262,
1077,
5206,
264,
284,
25076,
314,
73,
2577,
25,
220,
19,
11,
2070,
62,
16,
25,
220,
15,
11,
2070,
62,
17,
25,
923,
486,
1499,
445,
14990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_entry_error() {
let tests = [
&b": 1"[..],
b"?: 1",
b"First",
b"First second",
b"First.?: 1",
b"F\xc3\xb6rst: 1",
b"F~rst: 1",
];
for data in tests.iter() {
match parse_entry(*data) {
(Ok(v), _) => panic!("Unexpected success parsing '{:?}': {:?}", data, v),
(Err(_), b"") => {}
(Err(_), remaining) => panic!(
"Unexpected remaining data parsing '{:?}': {:?}",
data, remaining
),
}
}
} | rust_cleaned_test_functions.jsonl/113430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9078,
4096,
368,
341,
286,
1077,
7032,
284,
2278,
310,
609,
65,
788,
220,
16,
36864,
496,
1259,
310,
293,
1,
4820,
220,
16,
756,
310,
293,
1,
5338,
756,
310,
293,
1,
5338,
2086,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_position_elem() {
assert!([].position_elem(&1).is_none());
let v1 = vec![1, 2, 3, 3, 2, 5];
assert_eq!(v1.position_elem(&1), Some(0));
assert_eq!(v1.position_elem(&2), Some(1));
assert_eq!(v1.position_elem(&5), Some(5));
assert!(v1.position_elem(&4).is_none());
} | rust_cleaned_test_functions.jsonl/111401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
28179,
368,
341,
286,
2060,
0,
2561,
936,
3487,
28179,
2099,
16,
568,
285,
31488,
5231,
286,
1077,
348,
16,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
18,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_max() -> Result<()> {
let observed = return_type(&AggregateFunction::Min, &[DataType::Utf8])?;
assert_eq!(DataType::Utf8, observed);
let observed = return_type(&AggregateFunction::Max, &[DataType::Int32])?;
assert_eq!(DataType::Int32, observed);
// test decimal for min
let observed = return_type(&AggregateFunction::Min, &[DataType::Decimal(10, 6)])?;
assert_eq!(DataType::Decimal(10, 6), observed);
// test decimal for max
let observed =
return_type(&AggregateFunction::Max, &[DataType::Decimal(28, 13)])?;
assert_eq!(DataType::Decimal(28, 13), observed);
Ok(())
} | rust_cleaned_test_functions.jsonl/4593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
6345,
368,
1464,
5714,
71698,
341,
286,
1077,
13166,
284,
470,
1819,
2099,
64580,
5152,
486,
6217,
11,
44590,
22653,
486,
38980,
23,
2467,
37445,
286,
2060,
10714,
10297,
22653,
486,
38980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_single_no_fraction() {
assert_eq!(
Variant::VSingle(4.0).divide(Variant::VSingle(2.0)).unwrap(),
Variant::VInteger(2)
);
} | rust_cleaned_test_functions.jsonl/84604 | {
"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,
19487,
6536,
59023,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
10888,
7,
19,
13,
15,
568,
59394,
12410,
15341,
486,
53,
10888,
7,
17,
13,
15,
4579,
15454,
3148,
503,
39292,
486,
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 |
#[test]
fn test_deserializing_lat_long_value_from_bytes() {
let lat_long_bytes = [
0, 0, 0, 2, 0, 0, 0, 20, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 8,
255, 255, 255, 255, 255, 255, 255, 255,
];
let lat_long = LatLongValue::from_sql(Some(&lat_long_bytes))
.expect("Failed to deserialize LatLongValue");
assert_eq!(lat_long, LatLongValue(0, -1));
} | rust_cleaned_test_functions.jsonl/104568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
2848,
4849,
26174,
17799,
3142,
5673,
12524,
368,
341,
286,
1077,
6844,
17799,
12524,
284,
2278,
310,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
17,
11,
220,
15,
11,
220,
15,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.