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_2019_d11() {
let grid = vec![
"ββββββ ββββ ββββββ ββββββ ββββ ββββββ ββββββ ββ ββ",
"ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ",
"ββ ββ ββ ββ ββ ββ ββ ββ ββ ββββββ ββ ββ ββββββββ",
"ββββββ ββββββββ ββββββ ββββββ ββ ββ ββ ββββββ ββ ββ",
"ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ ββ",
"ββ ββ ββ ββ ββ ββ ββ ββββ ββββββ ββ ββ ββ",
]
.join("\n");
let recognizer = Recognizer::new(ALPHABET_2019_D11);
assert_eq!(
recognizer.parse(&grid).expect("Should parse"),
"RAPRCBPH".to_string()
);
} | rust_cleaned_test_functions.jsonl/129949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
15,
16,
24,
814,
16,
16,
368,
341,
286,
1077,
5827,
284,
7486,
90515,
310,
330,
51678,
21460,
414,
32588,
21460,
15199,
262,
92329,
15199,
262,
92329,
15199,
414,
32588,
21460,
15199,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_let() {
let input = String::from("let x = 0;");
let result = lexer::lex(&input);
parse_let_stmt(&mut result.into_iter().peekable()).unwrap();
parse_program(lexer::lex(&input)).unwrap();
} | rust_cleaned_test_functions.jsonl/83961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62,
1149,
368,
341,
286,
1077,
1946,
284,
923,
486,
1499,
445,
1149,
856,
284,
220,
15,
34649,
286,
1077,
1102,
284,
53259,
486,
2571,
2099,
1355,
317,
286,
4715,
62,
1149,
21824,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stonemask() {
let x: Vec<f64> = vec![0.0; 256];
let x_length = x.len() as i32;
let fs = 44100;
let option = DioOption::new();
let f0_length: usize;
unsafe {
f0_length = GetSamplesForDIO(fs, x_length, option.frame_period) as usize;
}
let mut temporal_positions: Vec<f64> = vec![0.0; f0_length];
let mut f0: Vec<f64> = vec![0.0; f0_length];
unsafe {
Dio(x.as_ptr(), x_length, fs, &option as *const _, temporal_positions.as_mut_ptr(), f0.as_mut_ptr());
}
let mut refined_f0 = vec![0.0; f0_length];
unsafe {
StoneMask(x.as_ptr(), x_length, fs, temporal_positions.as_ptr(), f0.as_ptr(), f0_length as i32, refined_f0.as_mut_ptr());
}
assert_eq!(refined_f0, vec![0.0, 0.0]);
} | rust_cleaned_test_functions.jsonl/20849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
263,
336,
1073,
368,
341,
286,
1077,
856,
25,
11312,
63895,
21,
19,
29,
284,
7486,
20703,
15,
13,
15,
26,
220,
17,
20,
21,
935,
286,
1077,
856,
5118,
262,
284,
856,
19406,
368,
438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_list_table_no_header_no_data() {
let data: Vec<Patient> = vec![];
assert_eq!(
format_table(create_list_table(
data,
PATIENTS_LIST_HEADER,
PATIENTS_LIST_DICOM_TAGS,
true,
)),
""
);
} | rust_cleaned_test_functions.jsonl/76485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
2019,
5237,
6536,
8757,
6536,
1769,
368,
341,
286,
1077,
821,
25,
11312,
21604,
16389,
29,
284,
7486,
0,
15078,
286,
2060,
10714,
33673,
310,
3561,
5237,
32602,
2019,
5237,
1006,
394,
821,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rename() {
catch(|| {
let db = TestDb::new_with_seed()?;
let jbl = db.collection("c1").rename("c2")?.get(1)?;
Ok(())
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/99614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
368,
341,
286,
2287,
79453,
341,
310,
1077,
2927,
284,
3393,
7994,
486,
931,
6615,
33809,
94136,
310,
1077,
502,
2024,
284,
2927,
17578,
445,
66,
16,
1827,
51058,
445,
66,
17,
899,
4607,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 6 |
#[test]
fn test_bpf_to_bpf_depth() {
let config = Config::default();
for i in 0..config.max_call_depth {
test_interpreter_and_jit_elf!(
"tests/elfs/multiple_file.so",
[i as u8],
(
b"log" => syscalls::BpfSyscallString::call; syscalls::BpfSyscallString {},
),
{ |_vm, res: Result| { res.unwrap() == 0 } },
if i == 0 { 4 } else { 3 + 10 * i as u64 }
);
}
} | rust_cleaned_test_functions.jsonl/59043 | {
"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,
880,
15897,
2346,
880,
15897,
19061,
368,
341,
262,
1077,
2193,
284,
5532,
486,
2258,
543,
262,
369,
600,
304,
220,
15,
496,
1676,
6678,
13429,
19061,
341,
286,
1273,
15318,
28637,
8378,
5374,
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... | 3 |
#[test]
fn test_install_git_cannot_be_a_base_url() {
assert_that(cargo_process("install").arg("--git").arg("github.com:rust-lang-nursery/rustfmt.git"),
execs().with_status(101).with_stderr("\
error: invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported
"));
} | rust_cleaned_test_functions.jsonl/74851 | {
"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,
34245,
68801,
666,
3401,
21263,
4306,
7651,
2903,
368,
341,
262,
2060,
70197,
1337,
12088,
11305,
445,
12248,
1827,
858,
21549,
12882,
1827,
858,
445,
5204,
905,
25,
35788,
75460,
5279,
1723,
722,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ptr() {
let mut l = Lexer::<DefaultContext>::new(b"int (*foo[2]) [3]");
let p = TypeDeclaratorParser::new(&mut l);
let mut context = Context::default();
let (_, decl) = p.parse(None, None, true, &mut context).unwrap();
let decl = decl.unwrap();
assert_eq!(
decl,
Rc::new(TypeDeclarator {
typ: Type {
base: BaseType::Array(Box::new(Array {
base: Some(Type {
base: BaseType::Array(Box::new(Array {
base: Some(Type {
base: BaseType::Primitive(Primitive::Int),
cv: CVQualifier::empty(),
pointers: None,
}),
dimensions: vec![Dimension {
size: Some(ExprNode::Integer(Box::new(literals::Integer {
value: IntLiteral::Int(3)
}))),
attributes: None,
}],
})),
cv: CVQualifier::empty(),
pointers: Some(vec![Pointer {
kind: PtrKind::Pointer,
attributes: None,
cv: CVQualifier::empty(),
ms: MSModifier::empty(),
}]),
}),
dimensions: vec![Dimension {
size: Some(ExprNode::Integer(Box::new(literals::Integer {
value: IntLiteral::Int(2)
}))),
attributes: None,
}],
})),
cv: CVQualifier::empty(),
pointers: None,
},
specifier: Specifier::empty(),
identifier: Identifier {
identifier: Some(mk_id!("foo")),
attributes: None
},
init: None,
bitfield_size: None,
})
);
} | rust_cleaned_test_functions.jsonl/117528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
4348,
368,
341,
286,
1077,
5206,
326,
284,
85082,
27638,
3675,
1972,
6831,
931,
1883,
1,
396,
4609,
7975,
58,
17,
2467,
508,
18,
37389,
286,
1077,
281,
284,
3990,
1912,
12821,
850,
6570,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partition_template_empty() {
use management::partition_template::part::{ColumnFormat, Part};
let protobuf = management::PartitionTemplate {
parts: vec![management::partition_template::Part {
part: Some(Part::Regex(ColumnFormat {
..Default::default()
})),
}],
};
let res: Result<PartitionTemplate, _> = protobuf.try_into();
let err = res.expect_err("expected failure");
assert_eq!(&err.field, "parts.0.part.regex.column");
assert_eq!(&err.description, "Field is required");
} | rust_cleaned_test_functions.jsonl/65181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43840,
8693,
15124,
368,
341,
286,
990,
6240,
486,
40998,
8693,
486,
4480,
22964,
2933,
4061,
11,
3660,
2315,
286,
1077,
69634,
284,
6240,
486,
49978,
7275,
341,
310,
5479,
25,
7486,
20703,
42473,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_rand_should_apply_rule_once() {
let mut lsys: LSystem = LSystem::new("AA".to_string());
let mut rule: HashMap<char, String> = HashMap::new();
rule.insert('A', "B".to_string());
lsys.push(rule);
let next: LSystem = lsys.next_rand();
assert!(next.start == "AB" || next.start == "BA");
} | rust_cleaned_test_functions.jsonl/101655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
33864,
43378,
36551,
21124,
7630,
368,
341,
286,
1077,
5206,
326,
7791,
25,
444,
2320,
284,
444,
2320,
486,
931,
445,
6029,
3263,
983,
3904,
1423,
286,
1077,
5206,
5912,
25,
10528,
21919,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_display_server_error() {
assert_eq!(
format!(
"{}",
ServerError::ConnectionError(ConnectionError::ConnectionClosed)
),
"Connection error: Connection closed."
);
assert_eq!(format!("{}", ServerError::ServerFull), "Server is full.");
assert_eq!(
format!(
"{}",
ServerError::IOError(std::io::Error::from_raw_os_error(11))
),
"IO error: Resource temporarily unavailable (os error 11)"
);
} | rust_cleaned_test_functions.jsonl/81001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
12015,
4096,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
33673,
394,
35503,
756,
394,
8422,
1454,
486,
4526,
1454,
47218,
1454,
486,
4526,
26884,
340,
310,
2837,
310,
330,
4526,
1465,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enrich_tf1x_audio() {
let v = SummaryValue(Box::new(Value::Audio(pb::summary::Audio {
sample_rate: 44100.0,
encoded_audio_string: Bytes::from_static(b"RIFFabcd"),
..Default::default()
})));
let md = v.initial_metadata(None);
let expected = BlobSequenceValue(vec![Bytes::from_static(b"RIFFabcd")]);
assert_eq!(
EventValue::Summary(v).into_blob_sequence(md.as_ref()),
Ok(expected)
);
} | rust_cleaned_test_functions.jsonl/6224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
47719,
16,
87,
29688,
368,
341,
310,
1077,
348,
284,
21517,
1130,
67758,
486,
931,
25346,
486,
14755,
76878,
486,
1708,
486,
14755,
341,
394,
6077,
9246,
25,
220,
19,
19,
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_parse_time_range() {
assert_eq!(
parse_time_range(b"-101010.123456789").ok(),
Some(TimeRange {
start: None,
end: Some(NaiveTime::from_hms_micro(10, 10, 10, 123_456))
})
);
assert_eq!(
parse_time_range(b"-101010.123 ").ok(),
Some(TimeRange {
start: None,
end: Some(NaiveTime::from_hms_micro(10, 10, 10, 123_999))
})
);
assert_eq!(
parse_time_range(b"-01 ").ok(),
Some(TimeRange {
start: None,
end: Some(NaiveTime::from_hms_micro(01, 59, 59, 999_999))
})
);
assert_eq!(
parse_time_range(b"101010.123456-").ok(),
Some(TimeRange {
start: Some(NaiveTime::from_hms_micro(10, 10, 10, 123_456)),
end: None
})
);
assert_eq!(
parse_time_range(b"101010.123-").ok(),
Some(TimeRange {
start: Some(NaiveTime::from_hms_micro(10, 10, 10, 123_000)),
end: None
})
);
assert_eq!(
parse_time_range(b"1010-").ok(),
Some(TimeRange {
start: Some(NaiveTime::from_hms(10, 10, 0)),
end: None
})
);
assert_eq!(
parse_time_range(b"00-").ok(),
Some(TimeRange {
start: Some(NaiveTime::from_hms(0, 0, 0)),
end: None
})
);
} | rust_cleaned_test_functions.jsonl/22051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 992
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3009,
9698,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
3009,
9698,
1883,
34294,
16,
15,
16,
15,
16,
15,
13,
16,
17,
18,
19,
20,
21,
22,
23,
24,
1827,
562,
3148,
310,
4329,
36968,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_authorize_override() {
let withdrawer_pubkey = analog_sdk::pubkey::new_rand();
let stake_lamports = 42;
let stake_account = AccountSharedData::new_ref_data_with_space(
stake_lamports,
&StakeState::Initialized(Meta::auto(&withdrawer_pubkey)),
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let stake_keyed_account = KeyedAccount::new(&withdrawer_pubkey, true, &stake_account);
// Authorize a staker pubkey and move the withdrawer key into cold storage.
let new_authority = analog_sdk::pubkey::new_rand();
let signers = vec![withdrawer_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&new_authority,
StakeAuthorize::Staker,
false,
&Clock::default(),
None
),
Ok(())
);
let mallory_pubkey = analog_sdk::pubkey::new_rand();
let signers = vec![new_authority].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&mallory_pubkey,
StakeAuthorize::Staker,
false,
&Clock::default(),
None
),
Ok(())
);
// Verify the original staker no longer has access.
let new_stake_pubkey = analog_sdk::pubkey::new_rand();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&new_stake_pubkey,
StakeAuthorize::Staker,
false,
&Clock::default(),
None
),
Err(InstructionError::MissingRequiredSignature)
);
let signers = vec![withdrawer_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&new_stake_pubkey,
StakeAuthorize::Withdrawer,
false,
&Clock::default(),
None
),
Ok(())
);
// Attack! Verify the staker cannot be used to authorize a withdraw.
let signers = vec![new_stake_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&mallory_pubkey,
StakeAuthorize::Withdrawer,
false,
&Clock::default(),
None
),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/15309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
48576,
368,
341,
286,
1077,
14798,
261,
34014,
792,
284,
23400,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
1077,
18279... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extern_crate_string() {
let lib = ExternalLibrary {
namespace: "Gdk".to_owned(),
crate_name: "gdk".to_owned(),
};
assert_eq!(
get_extern_crate_string(&lib),
"extern crate gdk_sys as gdk;\n".to_owned()
);
let lib = ExternalLibrary {
namespace: "GdkPixbuf".to_owned(),
crate_name: "gdk_pixbuf".to_owned(),
};
assert_eq!(
get_extern_crate_string(&lib),
"extern crate gdk_pixbuf_sys as gdk_pixbuf;\n".to_owned()
);
let lib = ExternalLibrary {
namespace: "GdkPixbuf".to_owned(),
crate_name: "some-crate".to_owned(),
};
assert_eq!(
get_extern_crate_string(&lib),
"extern crate some_crate_sys as gdk_pixbuf;\n".to_owned()
);
} | rust_cleaned_test_functions.jsonl/101826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
62,
4301,
666,
7698,
3904,
368,
341,
286,
1077,
3051,
284,
30936,
16915,
341,
310,
4473,
25,
330,
38,
7584,
3263,
983,
51973,
3148,
310,
17717,
1269,
25,
330,
70,
7584,
3263,
983,
51973,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_a_megabyte_of_data_from_another_thread() {
let data = vec![0xff; 1_000_000];
let data_copy = data.clone();
let (mut reader, mut writer) = crate::pipe().unwrap();
let joiner = thread::spawn(move || {
writer.write_all(&data_copy).unwrap();
// accidentally forgetting to drop if we switch to scoped threads or
// something like that and change this to a non-moving closure. The
// explicit drop forces `writer` to move.
drop(writer);
});
let mut out = Vec::new();
reader.read_to_end(&mut out).unwrap();
joiner.join().unwrap();
assert_eq!(out, data);
} | rust_cleaned_test_functions.jsonl/1284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
4306,
717,
791,
66711,
3575,
1769,
5673,
12008,
1575,
10814,
368,
341,
286,
1077,
821,
284,
7486,
20703,
15,
9020,
26,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
935,
286,
1077,
821,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_split_isolation() {
let mut cluster = new_node_cluster(0, 2);
// Use long election timeout and short lease.
configure_for_hibernate(&mut cluster);
configure_for_lease_read(&mut cluster, Some(200), Some(10));
cluster.cfg.raft_store.raft_log_gc_count_limit = 11;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
let rid = cluster.run_conf_change();
pd_client.must_add_peer(rid, new_learner_peer(2, 2));
cluster.must_put(b"k1", b"v1");
cluster.must_put(b"k2", b"v2");
must_get_equal(&cluster.get_engine(2), b"k1", b"v1");
must_get_equal(&cluster.get_engine(2), b"k2", b"v2");
cluster.must_transfer_leader(1, new_peer(1, 1));
cluster.stop_node(2);
let r1 = cluster.get_region(b"k2");
cluster.must_split(&r1, b"k2");
let idx = cluster.truncated_state(1, 1).get_index();
for i in 2..cluster.cfg.raft_store.raft_log_gc_count_limit * 2 {
cluster.must_put(format!("k{}", i).as_bytes(), format!("v{}", i).as_bytes());
}
let timer = Instant::now();
loop {
if cluster.truncated_state(1, 1).get_index() > idx {
break;
}
thread::sleep(Duration::from_millis(10));
if timer.elapsed() > Duration::from_secs(3) {
panic!("log is not compact after 3 seconds");
}
}
// Wait till leader peer goes to sleep again.
thread::sleep(
cluster.cfg.raft_store.raft_base_tick_interval.0
* 2
* cluster.cfg.raft_store.raft_election_timeout_ticks as u32,
);
let mut peer = None;
let r2 = cluster.get_region(b"k1");
for p in r2.get_peers() {
if p.store_id == 2 {
peer = Some(p.clone());
break;
}
}
let peer = peer.unwrap();
cluster.run_node(2).unwrap();
for _ in 0..10 {
let resp = async_read_on_peer(&mut cluster, peer.clone(), r2.clone(), b"k1", true, true);
let resp = resp.recv_timeout(Duration::from_secs(1)).unwrap();
if !resp.get_header().has_error() {
return;
}
thread::sleep(Duration::from_millis(200));
}
panic!("test failed");
} | rust_cleaned_test_functions.jsonl/100490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1029
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
6892,
34962,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
17,
317,
262,
442,
5443,
1293,
6223,
9632,
323,
2805,
25064,
624,
262,
14411,
5478,
1523,
18818,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_response_struct_creation_200() {
let response_actual = HttpResponse::new(
"200",
None,
Some("xxxx".into()),
);
let response_expected = HttpResponse {
version: "HTTP/1.1",
status_code: "200",
status_text: "OK",
headers: {
let mut h = HashMap::new();
h.insert("Content-Type", "text/html");
Some(h)
},
body: Some("xxxx".into()),
};
assert_eq!(response_actual, response_expected);
} | rust_cleaned_test_functions.jsonl/109135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
15126,
46163,
62,
17,
15,
15,
368,
341,
262,
1077,
2033,
40149,
284,
17580,
486,
931,
1006,
414,
330,
17,
15,
15,
756,
414,
2240,
345,
414,
4329,
445,
18516,
3263,
18122,
14702,
262,
347... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_memo() -> Result<(), Error> {
let memo = Memo::new(&random_string());
let test = MemoTest { memo };
run_binary_channel_test(&test)
} | rust_cleaned_test_functions.jsonl/28239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
6726,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
21438,
284,
56201,
486,
931,
2099,
11463,
3904,
1423,
262,
1077,
1273,
284,
56201,
2271,
314,
21438,
2605,
262,
1598,
31761,
14571,
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 |
#[test]
fn test_basic_email_html() {
let email = Email::new("test-from@email.org", "test-to@email.org", "Body text")
.with_html("<html><h1>Header</h1></html>");
assert_eq!(email.to_string(), "{\"from\":\"test-from@email.org\",\"to\":\"test-to@email.org\",\"htmlbody\":\"<html><h1>Header</h1></html>\"}");
} | rust_cleaned_test_functions.jsonl/67591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
9172,
9564,
368,
341,
262,
1077,
2551,
284,
8299,
486,
931,
445,
1944,
38051,
71776,
2659,
497,
330,
1944,
4686,
71776,
2659,
497,
330,
5444,
1467,
1138,
286,
659,
4197,
9564,
9639,
1551,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_raw_condition_tree() {
let expected_sql =
"SELECT `naukio`.* FROM `naukio` WHERE (NOT ((`word` = ? OR `age` < ?) AND `paw` = ?))";
let expected_params = vec![
ParameterizedValue::Text(Cow::from("meow")),
ParameterizedValue::Integer(10),
ParameterizedValue::Text(Cow::from("warm")),
];
let conditions = ConditionTree::not(ConditionTree::and(
ConditionTree::or("word".equals("meow"), "age".less_than(10)),
"paw".equals("warm"),
));
let query = Select::from_table("naukio").so_that(conditions);
let (sql, params) = Sqlite::build(query);
assert_eq!(expected_sql, sql);
assert_eq!(default_params(expected_params), params);
} | rust_cleaned_test_functions.jsonl/80612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
16067,
27656,
11663,
368,
341,
286,
1077,
3601,
18063,
4035,
310,
330,
4858,
1565,
77,
2863,
74,
815,
63,
4908,
4295,
1565,
77,
2863,
74,
815,
63,
5288,
320,
14065,
1781,
63,
1158,
63,
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_mut_message() {
let mut m = TestTypesSingular::new();
{
let message_field_field = m.descriptor().get_field_by_name("message_field").unwrap();
let sub_m = message_field_field.mut_message(&mut m);
let n_field = sub_m.descriptor().get_field_by_name("n").unwrap();
n_field.set_singular_field(sub_m, ReflectValueBox::I32(10));
// TODO: test `mut_message` works for oneof fields
}
assert_eq!(10, m.get_message_field().get_n());
} | rust_cleaned_test_functions.jsonl/74908 | {
"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,
29523,
6462,
368,
341,
262,
1077,
5206,
296,
284,
3393,
4173,
50,
41880,
486,
931,
543,
262,
341,
286,
1077,
1943,
5013,
5013,
284,
296,
94802,
1005,
455,
5013,
3710,
1269,
445,
1994,
5013,
1827... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_set() {
loom::model(|| {
let rt = Builder::new_multi_thread()
.worker_threads(1)
.build()
.unwrap();
let mut set = JoinSet::new();
rt.block_on(async {
assert_eq!(set.len(), 0);
set.spawn(async { () });
assert_eq!(set.len(), 1);
set.spawn(async { () });
assert_eq!(set.len(), 2);
let () = set.join_one().await.unwrap().unwrap();
assert_eq!(set.len(), 1);
set.spawn(async { () });
assert_eq!(set.len(), 2);
let () = set.join_one().await.unwrap().unwrap();
assert_eq!(set.len(), 1);
let () = set.join_one().await.unwrap().unwrap();
assert_eq!(set.len(), 0);
set.spawn(async { () });
assert_eq!(set.len(), 1);
});
drop(set);
drop(rt);
});
} | rust_cleaned_test_functions.jsonl/39905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
2602,
368,
341,
262,
775,
316,
486,
2528,
79453,
341,
286,
1077,
16677,
284,
20626,
486,
931,
25133,
10814,
741,
310,
659,
21462,
29725,
7,
16,
340,
310,
659,
5834,
741,
310,
659,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_termfreq() -> crate::Result<()> {
let mut schema_builder = Schema::builder();
let text_field = schema_builder.add_text_field("text", TEXT);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
{
// writing the segment
let mut index_writer = index.writer_for_tests()?;
index_writer.add_document(doc!(text_field=>"af af af bc bc"));
index_writer.commit()?;
}
{
let index_reader = index.reader()?;
let searcher = index_reader.searcher();
let reader = searcher.segment_reader(0);
let inverted_index = reader.inverted_index(text_field)?;
let term_abcd = Term::from_field_text(text_field, "abcd");
assert!(inverted_index
.read_postings(&term_abcd, IndexRecordOption::WithFreqsAndPositions)?
.is_none());
let term_af = Term::from_field_text(text_field, "af");
let mut postings = inverted_index
.read_postings(&term_af, IndexRecordOption::WithFreqsAndPositions)?
.unwrap();
assert_eq!(postings.doc(), 0);
assert_eq!(postings.term_freq(), 3);
assert_eq!(postings.advance(), TERMINATED);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/12723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 661
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
33540,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
15762,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_random_aggregate_public_keys() {
let control_kp = Keypair::random(&mut rand::thread_rng());
let signing_kps = vec![
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
];
let non_signing_kps = vec![
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
Keypair::random(&mut rand::thread_rng()),
];
helper_test_aggregate_public_keys(control_kp, signing_kps, non_signing_kps);
} | rust_cleaned_test_functions.jsonl/112216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
20587,
14240,
27074,
12631,
368,
341,
286,
1077,
2524,
4698,
79,
284,
6569,
1082,
1310,
486,
11463,
2099,
6984,
10382,
486,
4528,
66849,
1423,
286,
1077,
15971,
4698,
1690,
284,
7486,
90515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_limbs() {
let (is_positive, limbs) = str_to_limbs("-5");
assert!(!is_positive);
assert_eq!(&limbs, &["5u64".to_string()]);
let (is_positive, limbs) = str_to_limbs("100");
assert!(is_positive);
assert_eq!(&limbs, &["100u64".to_string()]);
let large_num = -((1i128 << 64) + 101234001234i128);
let (is_positive, limbs) = str_to_limbs(&large_num.to_string());
assert!(!is_positive);
assert_eq!(&limbs, &["101234001234u64".to_string(), "1u64".to_string()]);
let num = "80949648264912719408558363140637477264845294720710499478137287262712535938301461879813459410946";
let (is_positive, limbs) = str_to_limbs(&num.to_string());
assert!(is_positive);
let expected_limbs = [
format!("{}u64", 0x8508c00000000002u64),
format!("{}u64", 0x452217cc90000000u64),
format!("{}u64", 0xc5ed1347970dec00u64),
format!("{}u64", 0x619aaf7d34594aabu64),
format!("{}u64", 0x9b3af05dd14f6ecu64),
];
assert_eq!(&limbs, &expected_limbs);
} | rust_cleaned_test_functions.jsonl/38552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
2346,
58191,
1279,
368,
341,
262,
1077,
320,
285,
54160,
11,
48595,
8,
284,
607,
2346,
58191,
1279,
13645,
20,
797,
262,
2060,
0,
3471,
285,
54160,
317,
262,
2060,
10714,
0,
2099,
4659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_adaptive() {
const TEST_LEN: usize = 5000;
// by cloning we get maps with the same hasher seed
let mut first = HashMap::new();
let mut second = first.clone();
first.extend((0..TEST_LEN).map(|i| (i, i)));
second.extend((TEST_LEN..TEST_LEN * 2).map(|i| (i, i)));
for (&k, &v) in &second {
let prev_cap = first.capacity();
let expect_grow = first.len() == prev_cap;
first.insert(k, v);
if !expect_grow && first.capacity() != prev_cap {
return;
}
}
panic!("Adaptive early resize failed");
} | rust_cleaned_test_functions.jsonl/59552 | {
"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,
10027,
27781,
368,
341,
286,
733,
13602,
15536,
25,
22301,
284,
220,
20,
15,
15,
15,
280,
286,
442,
553,
77866,
582,
633,
14043,
448,
279,
1852,
90819,
10320,
198,
286,
1077,
5206,
1156,
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... | 4 |
#[test]
fn test_runnables_module() {
let (analysis, pos) = analysis_and_position(
r#"
//- /lib.rs
<|> //empty
mod test_mod {
#[test]
fn test_foo1() {}
}
"#,
);
let runnables = analysis.runnables(pos.file_id).unwrap();
assert_debug_snapshot!(&runnables,
@r#"[
Runnable {
range: [1; 59),
kind: TestMod {
path: "test_mod",
},
},
Runnable {
range: [28; 57),
kind: Test {
name: "test_foo1",
},
},
]"#
);
} | rust_cleaned_test_functions.jsonl/56180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
77,
4788,
10750,
368,
341,
286,
1077,
320,
34484,
11,
1133,
8,
284,
6358,
8378,
9661,
1006,
310,
435,
2,
698,
286,
78406,
608,
2740,
25638,
198,
286,
82639,
29,
442,
3194,
198,
286,
146... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ipv4_remote_no_rfc1191() {
// Test receiving an IPv4 Dest Unreachable Fragmentation
// Required from a node that does not implement RFC 1191.
let dummy_config = get_dummy_config::<Ipv4Addr>();
let mut ctx = DummyEventDispatcherBuilder::from_config(dummy_config.clone())
.build::<DummyEventDispatcher>();
let device = DeviceId::new_ethernet(0);
let frame_dst = FrameDestination::Unicast;
// Update from None
// Create ICMP IP buf w/ orig packet body len = 500; orig packet len = 520
let packet_buf = create_packet_too_big_buf(
dummy_config.remote_ip,
dummy_config.local_ip,
0, // A 0 value indicates that the source of the
// ICMP message does not implement RFC 1191.
create_orig_packet_buf(dummy_config.local_ip, dummy_config.remote_ip, 500).into(),
);
// Receive the IP packet.
receive_ip_packet::<_, _, Ipv4>(&mut ctx, device, frame_dst, packet_buf);
// Should have dispatched the packet.
assert_eq!(get_counter_val(&mut ctx, "dispatch_receive_ip_packet"), 1);
// Should have decreased PMTU value to the next lower PMTU
// plateau from `crate::ip::path_mtu::PMTU_PLATEAUS`.
assert_eq!(get_pmtu(&mut ctx, dummy_config.local_ip, dummy_config.remote_ip).unwrap(), 508);
// Don't Update when packet size is too small
// Create ICMP IP buf w/ orig packet body len = 1; orig packet len = 21
let packet_buf = create_packet_too_big_buf(
dummy_config.remote_ip,
dummy_config.local_ip,
0,
create_orig_packet_buf(dummy_config.local_ip, dummy_config.remote_ip, 1).into(),
);
// Receive the IP packet.
receive_ip_packet::<_, _, Ipv4>(&mut ctx, device, frame_dst, packet_buf);
// Should have dispatched the packet.
assert_eq!(get_counter_val(&mut ctx, "dispatch_receive_ip_packet"), 2);
// Should not have updated PMTU as there is no other valid
// lower PMTU value.
assert_eq!(get_pmtu(&mut ctx, dummy_config.local_ip, dummy_config.remote_ip).unwrap(), 508);
// Update to lower PMTU estimate based on original packet size.
// Create ICMP IP buf w/ orig packet body len = 60; orig packet len = 80
let packet_buf = create_packet_too_big_buf(
dummy_config.remote_ip,
dummy_config.local_ip,
0,
create_orig_packet_buf(dummy_config.local_ip, dummy_config.remote_ip, 60).into(),
);
// Receive the IP packet.
receive_ip_packet::<_, _, Ipv4>(&mut ctx, device, frame_dst, packet_buf);
// Should have dispatched the packet.
assert_eq!(get_counter_val(&mut ctx, "dispatch_receive_ip_packet"), 3);
// Should have decreased PMTU value to the next lower PMTU
// plateau from `crate::ip::path_mtu::PMTU_PLATEAUS`.
assert_eq!(get_pmtu(&mut ctx, dummy_config.local_ip, dummy_config.remote_ip).unwrap(), 68);
// Should not update PMTU because the next low PMTU from this original
// packet size is higher than current PMTU.
// Create ICMP IP buf w/ orig packet body len = 290; orig packet len = 310
let packet_buf = create_packet_too_big_buf(
dummy_config.remote_ip,
dummy_config.local_ip,
0, // A 0 value indicates that the source of the
// ICMP message does not implement RFC 1191.
create_orig_packet_buf(dummy_config.local_ip, dummy_config.remote_ip, 290).into(),
);
// Receive the IP packet.
receive_ip_packet::<_, _, Ipv4>(&mut ctx, device, frame_dst, packet_buf);
// Should have dispatched the packet.
assert_eq!(get_counter_val(&mut ctx, "dispatch_receive_ip_packet"), 4);
// Should not have updated the PMTU as the current PMTU is lower.
assert_eq!(get_pmtu(&mut ctx, dummy_config.local_ip, dummy_config.remote_ip).unwrap(), 68);
} | rust_cleaned_test_functions.jsonl/94417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1860
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
19,
36425,
6536,
1710,
8316,
16,
16,
24,
16,
368,
341,
1789,
286,
442,
3393,
12308,
458,
31560,
19,
28531,
1230,
46550,
19034,
367,
198,
286,
442,
12659,
504,
264,
2436,
429,
1558,
537,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arrow_schema_roundtrip_lists() -> Result<()> {
let metadata: HashMap<String, String> =
[("Key".to_string(), "Value".to_string())]
.iter()
.cloned()
.collect();
let schema = Schema::new_with_metadata(
vec![
Field::new(
"c21",
DataType::List(Box::new(Field::new(
"array",
DataType::Boolean,
true,
))),
false,
),
Field::new(
"c22",
DataType::FixedSizeList(
Box::new(Field::new("items", DataType::Boolean, false)),
5,
),
false,
),
Field::new(
"c23",
DataType::List(Box::new(Field::new(
"items",
DataType::LargeList(Box::new(Field::new(
"items",
DataType::Struct(vec![
Field::new("a", DataType::Int16, true),
Field::new("b", DataType::Float64, false),
]),
true,
))),
true,
))),
true,
),
],
metadata,
);
// write to an empty parquet file so that schema is serialized
let file = get_temp_file("test_arrow_schema_roundtrip_lists.parquet", &[]);
let mut writer = ArrowWriter::try_new(
file.try_clone().unwrap(),
Arc::new(schema.clone()),
None,
)?;
writer.close()?;
// read file back
let parquet_reader = SerializedFileReader::try_from(file)?;
let mut arrow_reader = ParquetFileArrowReader::new(Arc::new(parquet_reader));
let read_schema = arrow_reader.get_schema()?;
assert_eq!(schema, read_schema);
// read all fields by columns
let partial_read_schema =
arrow_reader.get_schema_by_columns(0..(schema.fields().len()), false)?;
assert_eq!(schema, partial_read_schema);
Ok(())
} | rust_cleaned_test_functions.jsonl/130374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46566,
25371,
29896,
32981,
37288,
368,
1464,
5714,
71698,
341,
286,
1077,
11160,
25,
10528,
3464,
11,
923,
29,
4035,
310,
84019,
1592,
3263,
983,
3904,
1507,
330,
1130,
3263,
983,
3904,
2140,
921... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_check_vote_threshold_without_votes() {
let tower = Tower::new_for_tests(1, 0.67);
let stakes = vec![(0, 1)].into_iter().collect();
assert!(tower.check_vote_stake_threshold(0, &stakes, 2));
} | rust_cleaned_test_functions.jsonl/61125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
54360,
21858,
39904,
65116,
368,
341,
286,
1077,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
11,
220,
15,
13,
21,
22,
317,
286,
1077,
44425,
284,
7486,
0,
9697,
15,
11,
220,
16,
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_hmac_md5() {
// [Page 8] Test Vectors
let b16 = [0x0b; 16]; // 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
let aa16 = [0xaa; 16]; // 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
let dd50 = [0xdd; 50];
let suites: &[(&[u8], &[u8], &str)] = &[
(b"key", b"The quick brown fox jumps over the lazy dog", "80070713463e7749b90c2dc24911e275"),
(&b16, b"Hi There", "9294727a3638bb1c13f48ef8158bfc9d"),
(b"Jefe", b"what do ya want for nothing?", "750c783e6ab0b503eaa86e310a5db738"),
(&aa16, &dd50, "56be34521d144c88dbb8c733f0e8b3f6"),
];
for (key, data, result) in suites.iter() {
assert_eq!(&hex::encode(&HmacMd5::oneshot(key, data)), result);
}
} | rust_cleaned_test_functions.jsonl/12662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
11948,
32994,
20,
368,
341,
262,
442,
508,
2665,
220,
23,
60,
3393,
647,
10605,
7213,
262,
1077,
293,
16,
21,
220,
284,
508,
15,
87,
15,
65,
26,
220,
16,
21,
5265,
442,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_mint_transfer_block_metadata() {
let (env, client) = setup_swarm_and_client_proxy(1, 0);
// This script does 4 transactions
check_create_mint_transfer(client);
// assert committed version > # of user transactions
let mut vclient = env.get_validator_client(0, None);
vclient.test_trusted_connection().expect("success");
let version = vclient.get_latest_version();
assert!(
version > 4,
"BlockMetadata txn not produced, current version: {}",
version
);
} | rust_cleaned_test_functions.jsonl/81626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
717,
396,
35403,
7113,
22220,
368,
341,
262,
1077,
320,
3160,
11,
2943,
8,
284,
6505,
32581,
2178,
8378,
8179,
29712,
7,
16,
11,
220,
15,
626,
262,
442,
1096,
5316,
1558,
220,
19,
14131,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_invalid_ip() {
let documents = load_document("../tests/Soft_Job_M.1519661420.A.098.html");
assert_eq!(
parse_ip(&documents),
Err(Error::FieldNotFound("ip".to_owned()))
);
} | rust_cleaned_test_functions.jsonl/87161 | {
"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,
21039,
31433,
10385,
368,
341,
286,
1077,
9293,
284,
2795,
26231,
17409,
23841,
14,
30531,
10598,
674,
1245,
13,
16,
20,
16,
24,
21,
21,
16,
19,
17,
15,
875,
13,
15,
24,
23,
2564,
797,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_historgram_duration() {
let client = StatsdClient::from_sink("prefix", NopMetricSink);
let res = client.histogram_duration("key", Duration::from_nanos(210));
assert_eq!("prefix.key:210|h", res.unwrap().as_metric_str());
} | rust_cleaned_test_functions.jsonl/48381 | {
"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,
15381,
67,
8179,
1523,
5323,
1520,
25454,
368,
341,
286,
1077,
2943,
284,
29927,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
453,
54310,
45094,
317,
286,
1077,
592,
284,
2943,
94184,
25454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_illegal_node_actions() -> Result<(), Error> {
let mut info = Data::new();
// Parent must exist
assert!(info.apply(&create_node!(parent: 42, id: 1, name: "child")).is_err());
// Can't reuse node IDs
info = Data::new();
info.apply(&create_node!(parent: ROOT_ID, id: 1, name: "child"))?;
assert!(info.apply(&create_node!(parent: ROOT_ID, id: 1, name: "another_child")).is_err());
// Can't delete root
info = Data::new();
assert!(info.apply(&delete_node!(id: ROOT_ID)).is_err());
// Can't delete nonexistent node
info = Data::new();
assert!(info.apply(&delete_node!(id: 333)).is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/10363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26743,
6428,
5084,
25368,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3546,
284,
2885,
486,
931,
543,
286,
442,
17022,
1969,
3000,
198,
286,
2060,
10297,
2733,
13045,
2099,
3182,
5084,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decode_ack_frame() {
let res = Frame::decode_ack_frame(7, 2, vec![AckRange { gap: 0, range: 3 }]);
assert!(res.is_ok());
assert_eq!(res.unwrap(), vec![(7, 5), (3, 0)]);
} | rust_cleaned_test_functions.jsonl/30435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
48447,
8929,
368,
341,
286,
1077,
592,
284,
16321,
486,
18196,
48447,
8929,
7,
22,
11,
220,
17,
11,
7486,
20703,
55559,
6046,
314,
12929,
25,
220,
15,
11,
2088,
25,
220,
18,
88853,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_html5_not_valid_xml() {
let input = load_fixture("TEST_HTML5.html");
let links: HashSet<Uri> =
extract_links(&InputContent::from_string(&input, FileType::Html), None)
.into_iter()
.map(|r| r.uri)
.collect();
let expected_links = [
website("https://example.org/head/home"),
website("https://example.org/css/style_full_url.css"),
// the body links wouldn't be present if the file was parsed strictly as XML
website("https://example.org/body/a"),
website("https://example.org/body/div_empty_a"),
]
.iter()
.cloned()
.collect();
assert_eq!(links, expected_links);
} | rust_cleaned_test_functions.jsonl/93893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
9564,
20,
7913,
8337,
23855,
368,
341,
286,
1077,
1946,
284,
2795,
74409,
445,
10033,
56726,
20,
2564,
797,
286,
1077,
7746,
25,
18931,
27,
13899,
29,
4035,
310,
8649,
25258,
2099,
2505,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addition() {
let a = Fp([
0x5360_bb59_7867_8032,
0x7dd2_75ae_799e_128e,
0x5c5b_5071_ce4f_4dcf,
0xcdb2_1f93_078d_bb3e,
0xc323_65c5_e73f_474a,
0x115a_2a54_89ba_be5b,
]);
let b = Fp([
0x9fd2_8773_3d23_dda0,
0xb16b_f2af_738b_3554,
0x3e57_a75b_d3cc_6d1d,
0x900b_c0bd_627f_d6d6,
0xd319_a080_efb2_45fe,
0x15fd_caa4_e4bb_2091,
]);
let c = Fp([
0x3934_42cc_b58b_b327,
0x1092_685f_3bd5_47e3,
0x3382_252c_ab6a_c4c9,
0xf946_94cb_7688_7f55,
0x4b21_5e90_93a5_e071,
0x0d56_e30f_34f5_f853,
]);
assert_eq!(a + b, c);
} | rust_cleaned_test_functions.jsonl/23230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
680,
368,
341,
262,
1077,
264,
284,
434,
79,
8956,
286,
220,
15,
87,
20,
18,
21,
15,
50255,
20,
24,
62,
22,
23,
21,
22,
62,
23,
15,
18,
17,
345,
286,
220,
15,
87,
22,
631,
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_underscored_namespace_for_inner_type() {
let hdr = indoc! {"
namespace __foo {
struct daft {
struct bob {
int a;
};
int a;
};
}
inline void bar(__foo::daft::bob) {}
"};
let rs = quote! {};
run_test("", hdr, rs, &["bar"], &[]);
} | rust_cleaned_test_functions.jsonl/9909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
53933,
67,
41571,
5478,
34345,
1819,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
4473,
1304,
7975,
341,
310,
2036,
2994,
723,
341,
394,
2036,
35192,
341,
503,
526,
264,
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_can_cast_types() {
// this function attempts to ensure that can_cast_types stays
// in sync with cast. It simply tries all combinations of
// types and makes sure that if `can_cast_types` returns
let all_types = get_all_types();
for array in get_arrays_of_all_types() {
for to_type in &all_types {
println!("Test casting {:?} --> {:?}", array.data_type(), to_type);
let cast_result = cast(&array, &to_type);
let reported_cast_ability = can_cast_types(array.data_type(), to_type);
// check for mismatch
match (cast_result, reported_cast_ability) {
(Ok(_), false) => {
panic!("Was able to cast array from {:?} to {:?} but can_cast_types reported false",
array.data_type(), to_type)
}
(Err(e), true) => {
panic!("Was not able to cast array from {:?} to {:?} but can_cast_types reported true. \
Error was {:?}",
array.data_type(), to_type, e)
}
// otherwise it was a match
_ => {}
};
}
}
} | rust_cleaned_test_functions.jsonl/45442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
5303,
9763,
368,
341,
286,
442,
419,
729,
13553,
311,
5978,
429,
646,
5303,
9763,
26558,
198,
286,
442,
304,
12811,
448,
6311,
13,
220,
1084,
4936,
16297,
678,
27459,
315,
198,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_ecdsa_p256_pkcs8() {
generic_test(
confg_toml(),
"tests/named_test_configs/dnssec/ecdsa_p256.pk8",
KeyFormat::Pkcs8,
Algorithm::ECDSAP256SHA256,
);
} | rust_cleaned_test_functions.jsonl/110029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
620,
17,
20,
21,
33321,
4837,
23,
368,
341,
262,
13954,
4452,
1006,
286,
2335,
70,
528,
316,
75,
3148,
286,
330,
23841,
9612,
3606,
4452,
59150,
3446,
4412,
5024,
73058,
96780,
620... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_selector_pseudo_last_child() -> Result {
let html = r#"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>:last-child</title>
</head>
<body>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
<li>item4</li>
<li>item5</li>
<li>item6</li>
<li>item7</li>
<li>item8</li>
<li>item9</li>
</ul>
</body>
</html>
"#;
let root = Vis::load(html)?;
// :last-child
let last_child = root.find("li:last-child");
assert_eq!(last_child.length(), 1);
assert_eq!(last_child.text(), "item9");
// prev :first-child
let prev_last_child = last_child.prev_all(":last-child");
assert_eq!(prev_last_child.length(), 0);
// next :first-child
let next_last_child = last_child.next_all(":last-child");
assert_eq!(next_last_child.length(), 0);
Ok(())
} | rust_cleaned_test_functions.jsonl/58023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28890,
620,
21952,
12195,
17268,
368,
1464,
5714,
341,
10217,
5272,
284,
435,
2,
698,
262,
71341,
50139,
5272,
397,
262,
366,
1551,
8688,
428,
268,
881,
414,
366,
1983,
397,
286,
366,
5490,
1161... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_verify() {
let pvk = PreparedVerifyingKey::<DummyEngine> {
alpha_g1_beta_g2: Fr(Wrapping(18634)),
neg_gamma_g2: Fr(Wrapping(11181)),
neg_delta_g2: Fr(Wrapping(59032)),
ic: vec![Fr(Wrapping(14034)), Fr(Wrapping(58774))],
};
let proof = Proof {
a: Fr(Wrapping(3269)),
b: Fr(Wrapping(471)),
c: Fr(Wrapping(8383)),
};
let pub_inp = [Fr(Wrapping(1)); 1];
assert!(verify_proof(&pvk, &proof, &pub_inp).unwrap());
} | rust_cleaned_test_functions.jsonl/14322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
368,
341,
286,
1077,
33491,
74,
284,
87167,
10141,
7766,
1592,
27638,
43344,
4571,
29,
341,
310,
8287,
1889,
16,
49292,
1889,
17,
25,
2869,
14031,
81,
3629,
7,
16,
23,
21,
18,
19,
6965,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clear() {
let mut ll = LinkedList::<u8>::with_capacity(10);
ll.push_head(0);
ll.push_head(1);
ll.push_head(2);
assert_eq!(ll.len(), 3);
assert_eq!(ll.capacity(), 10);
ll.clear();
assert_eq!(ll.len(), 0);
assert_eq!(ll.capacity(), 10);
} | rust_cleaned_test_functions.jsonl/59893 | {
"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,
21811,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
4197,
35603,
7,
16,
15,
317,
286,
9323,
2552,
13138,
7,
15,
317,
286,
9323,
2552,
13138,
7,
16,
317,
286,
9323,
2552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_promotion() {
// Each value represents the expected decoded value when promoting a value previously encoded with a promotable schema
let promotable_schemas = vec![r#""int""#, r#""long""#, r#""float""#, r#""double""#];
let promotable_values = vec![
Value::Int(219),
Value::Long(219),
Value::Float(219.0),
Value::Double(219.0),
];
for (i, writer_raw_schema) in promotable_schemas.iter().enumerate() {
let writer_schema = Schema::parse_str(writer_raw_schema).unwrap();
let original_value = &promotable_values[i];
for (j, reader_raw_schema) in promotable_schemas.iter().enumerate().skip(i + 1) {
let reader_schema = Schema::parse_str(reader_raw_schema).unwrap();
let encoded = to_avro_datum(&writer_schema, original_value.clone()).unwrap();
let decoded = from_avro_datum(
&writer_schema,
&mut Cursor::new(encoded),
Some(&reader_schema),
)
.unwrap_or_else(|_| {
panic!(
"failed to decode {:?} with schema: {:?}",
original_value, reader_raw_schema,
)
});
assert_eq!(decoded, promotable_values[j]);
}
}
} | rust_cleaned_test_functions.jsonl/129453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 656
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
47877,
5956,
368,
341,
1066,
262,
442,
8886,
897,
10868,
279,
3601,
29213,
897,
979,
22136,
264,
897,
8597,
20498,
448,
264,
18408,
480,
10802,
198,
262,
1077,
18408,
480,
643,
31126,
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... | 3 |
#[test]
fn test_unreachable_not_reached_1() {
let working_config = r#"
e.Bar.filename = "blah"
"#;
let mut c = Config::default();
c.merge(File::from_str(working_config, FileFormat::Toml)).unwrap();
let c: CFG = c.try_into().unwrap();
} | rust_cleaned_test_functions.jsonl/125319 | {
"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,
4907,
46550,
7913,
1288,
3854,
62,
16,
368,
341,
286,
1077,
3238,
5332,
284,
435,
2,
698,
310,
384,
40520,
30882,
284,
330,
70614,
698,
286,
5869,
401,
286,
1077,
5206,
272,
284,
5532,
486,
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_parsefail() {
test_parsefail_1("PT.S");
test_parsefail_1("PT.0S");
test_parsefail_1("PT0.S");
test_parsefail_1("PTS");
test_parsefail_1("PT-S");
test_parsefail_1("PT-.S");
test_parsefail_1("PT-0.S");
test_parsefail_1("PT-.0S");
test_parsefail_1("AT0S");
test_parsefail_1("PU0S");
test_parsefail_1("P0S");
test_parsefail_1("T0S");
test_parsefail_1("PT0");
// Overflow causes parse failure
test_parsefail_1("PT922337203685.4775808S");
test_parsefail_1("PT-922337203685.4775809S");
test_parsefail_1("PT922337203685.47758075S");
test_parsefail_1("PT-922337203685.47758086S");
test_parsefail_1("PT922337203686S");
test_parsefail_1("PT-922337203686S");
test_parsefail_1("PT100000000000000000000000000S");
test_parsefail_1("PT-100000000000000000000000000S");
} | rust_cleaned_test_functions.jsonl/60409 | {
"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,
21039,
18403,
368,
341,
262,
1273,
21039,
18403,
62,
16,
445,
2828,
808,
797,
262,
1273,
21039,
18403,
62,
16,
445,
2828,
13,
15,
50,
797,
262,
1273,
21039,
18403,
62,
16,
445,
2828,
15,
808,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_astar_admissible_inconsistent() {
let mut g = Graph::new();
let a = g.add_node("A");
let b = g.add_node("B");
let c = g.add_node("C");
let d = g.add_node("D");
g.add_edge(a, b, 3);
g.add_edge(b, c, 3);
g.add_edge(c, d, 3);
g.add_edge(a, c, 8);
g.add_edge(a, d, 10);
let admissible_inconsistent = |n: NodeIndex| match g[n] {
"A" => 9,
"B" => 6,
"C" => 0,
&_ => 0,
};
let optimal = astar(&g, a, |n| n == d, |e| *e.weight(), admissible_inconsistent);
assert_eq!(optimal, Some((9, vec![a, b, c, d])));
} | rust_cleaned_test_functions.jsonl/46744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48019,
277,
10027,
44064,
1243,
78399,
368,
341,
262,
1077,
5206,
342,
284,
12165,
486,
931,
543,
262,
1077,
264,
284,
342,
1364,
5084,
445,
32,
797,
262,
1077,
293,
284,
342,
1364,
5084,
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... | 2 |
#[test]
fn test_dup_order_hashes() {
let hashes = vec![
Hasher::digest(Bytes::from("test1")),
Hasher::digest(Bytes::from("test2")),
Hasher::digest(Bytes::from("test3")),
Hasher::digest(Bytes::from("test4")),
Hasher::digest(Bytes::from("test2")),
];
assert!(check_dup_order_hashes(&hashes).is_err());
let hashes = vec![
Hasher::digest(Bytes::from("test1")),
Hasher::digest(Bytes::from("test2")),
Hasher::digest(Bytes::from("test3")),
Hasher::digest(Bytes::from("test4")),
];
assert!(!check_dup_order_hashes(&hashes).is_err());
} | rust_cleaned_test_functions.jsonl/18544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51932,
7869,
91616,
368,
341,
262,
1077,
50257,
284,
7486,
90515,
286,
6531,
261,
486,
36339,
76423,
486,
1499,
445,
1944,
16,
30154,
286,
6531,
261,
486,
36339,
76423,
486,
1499,
445,
1944,
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_matmul_arcarray() {
let mut A = ArcArray::<usize, _>::zeros((2, 3));
for (i, elt) in A.iter_mut().enumerate() {
*elt = i;
}
let mut B = ArcArray::<usize, _>::zeros((3, 4));
for (i, elt) in B.iter_mut().enumerate() {
*elt = i;
}
let c = A.dot(&B);
println!("A = \n{:?}", A);
println!("B = \n{:?}", B);
println!("A x B = \n{:?}", c);
unsafe {
let result =
ArcArray::from_shape_vec_unchecked((2, 4), vec![20, 23, 26, 29, 56, 68, 80, 92]);
assert_eq!(c.shape(), result.shape());
assert!(c.iter().zip(result.iter()).all(|(a, b)| a == b));
assert!(c == result);
}
} | rust_cleaned_test_functions.jsonl/92587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
24160,
62914,
1653,
368,
341,
262,
1077,
5206,
362,
284,
19689,
1857,
27638,
51878,
11,
716,
6831,
35716,
1188,
17,
11,
220,
18,
1106,
262,
369,
320,
72,
11,
54139,
8,
304,
362,
19471,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_appl_ver_id() {
define_fixt_message!(TestMessage: b"9999" => {
REQUIRED, text: Text [FIX50..],
});
define_dictionary!(Logon, Reject, TestMessage,);
//appropriate Reject message and notification.
{
//Connect and logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon(build_dictionary());
//Send TestMessage with ApplVerID field as the seventh tag.
let appl_ver_id_seventh_tag_message = b"8=FIXT.1.1\x019=44\x0135=9999\x0149=SERVER\x0156=CLIENT\x0134=2\x011128=9\x0110=000\x01";
let bytes_written = test_server
.stream
.write(appl_ver_id_seventh_tag_message)
.unwrap();
assert_eq!(bytes_written, appl_ver_id_seventh_tag_message.len());
//Make sure Engine responds with an appropriate reject.
let message = test_server.recv_message::<Reject>();
assert_eq!(
message.session_reject_reason.unwrap(),
SessionRejectReason::TagSpecifiedOutOfRequiredOrder
);
assert_eq!(
message.text,
b"ApplVerID must be the 6th tag if specified".to_vec()
);
//Make sure Engine indicates that it rejected the message.
engine_poll_event!(client,EngineEvent::MessageReceivedGarbled(msg_connection,parse_error) => {
assert_eq!(msg_connection,connection);
assert!(if let ParseError::ApplVerIDNotSixthTag = parse_error { true } else { false });
});
}
//Make sure ApplVerID overrides the default message version set in the initial Logon message.
{
//Connect and logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon(build_dictionary());
//Send TestMessage with ApplVerID < FIX50 and without text field.
let mut message = new_fixt_message!(TestMessage);
message.msg_seq_num = 2;
message.appl_ver_id = Some(MessageVersion::FIX40);
test_server.send_message_with_ver(
FIXVersion::FIXT_1_1,
message.appl_ver_id.unwrap(),
message,
);
//Confirm Engine accepted message correctly.
let message = engine_poll_message!(client, connection, TestMessage);
assert_eq!(message.appl_ver_id, Some(MessageVersion::FIX40));
assert_eq!(message.text.len(), 0);
//Send TestMessage with ApplVerID < FIX50 and with text field.
let mut message = new_fixt_message!(TestMessage);
message.msg_seq_num = 3;
message.appl_ver_id = Some(MessageVersion::FIX40);
message.text = b"text".to_vec();
test_server.send_message_with_ver(FIXVersion::FIXT_1_1, MessageVersion::FIX50SP2, message); //Force text field to be included.
//Confirm Engine rejected message because text field is unsupported for this version.
let message = test_server.recv_message::<Reject>();
assert_eq!(
message.session_reject_reason.unwrap(),
SessionRejectReason::TagNotDefinedForThisMessageType
);
assert_eq!(
message.text,
b"Tag not defined for this message type".to_vec()
);
engine_poll_event!(client,EngineEvent::MessageReceivedGarbled(msg_connection,parse_error) => {
assert_eq!(msg_connection,connection);
assert!(if let ParseError::UnexpectedTag(ref tag) = parse_error { *tag == Text::tag() } else { false });
});
}
} | rust_cleaned_test_functions.jsonl/29 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21093,
500,
26042,
842,
368,
341,
262,
6979,
36060,
83,
6462,
10297,
2271,
2052,
25,
293,
1,
24,
24,
24,
24,
1,
589,
341,
286,
66577,
11,
1467,
25,
2918,
508,
39690,
20,
15,
496,
1259,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_authorized_authorize() {
let staker = Pubkey::new_rand();
let mut authorized = Authorized::auto(&staker);
let mut signers = HashSet::new();
assert_eq!(
authorized.authorize(&signers, &staker, StakeAuthorize::Staker),
Err(InstructionError::MissingRequiredSignature)
);
signers.insert(staker);
assert_eq!(
authorized.authorize(&signers, &staker, StakeAuthorize::Staker),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/39429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19084,
22938,
551,
368,
341,
286,
1077,
357,
4407,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
5206,
18630,
284,
90569,
486,
3902,
2099,
267,
4407,
317,
286,
1077,
5206,
1841,
388,
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_write_channel_config_data_too_large() {
let config = OtaUpdateChannelConfig {
channel_name: "channel".repeat(1000),
tuf_config_name: "tuf".to_string(),
};
assert_matches!(write_channel_config(&config), Err(ChannelConfigError::DataLength(_)));
} | rust_cleaned_test_functions.jsonl/43612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
14571,
5332,
1769,
2346,
78,
45228,
368,
341,
286,
1077,
2193,
284,
506,
2565,
4289,
9629,
2648,
341,
310,
5496,
1269,
25,
330,
10119,
3263,
30624,
7,
16,
15,
15,
15,
1326,
310,
259,
170... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_v_with_property_many_v2() {
let client = graph_serializer(GraphSON::V2);
drop_vertices(&client, "test_add_v_with_property_many").unwrap();
let g = traversal().with_remote(client.clone());
let results = g
.add_v("test_add_v_with_property_many")
.property_many(vec![
(String::from("name"), "marko"),
(String::from("age"), "29"),
])
.to_list()
.unwrap();
assert!(results.len() > 0);
assert_eq!("test_add_v_with_property_many", results[0].label());
let results = client
.execute("g.V(_id).propertyMap()", &[("_id", results[0].id())])
.expect("it should execute addV")
.filter_map(Result::ok)
.map(|f| f.take::<Map>())
.collect::<Result<Vec<Map>, _>>()
.expect("It should be ok");
let properties = &results[0];
assert_eq!(
&"29".to_string(),
properties["age"].get::<List>().unwrap()[0]
.get::<VertexProperty>()
.unwrap()
.get::<String>()
.unwrap()
);
assert_eq!(
&"marko",
properties["name"].get::<List>().unwrap()[0]
.get::<VertexProperty>()
.unwrap()
.get::<String>()
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/26279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
2273,
6615,
16638,
22101,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
5943,
37720,
2099,
2972,
11,
330,
1944,
2891,
2273,
6615,
16638,
22101,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_null_offset() -> Result<()> {
let int_builder = Int64Builder::new(24);
let mut builder = ListBuilder::<Int64Builder>::new(int_builder);
builder.values().append_slice(&[1, 2, 3])?;
builder.append(true)?;
builder.values().append_slice(&[4, 5])?;
builder.append(true)?;
builder.values().append_slice(&[6, 7, 8])?;
builder.append(true)?;
let array = builder.finish().data();
let arrays = vec![array.as_ref()];
let mut mutable = MutableArrayData::new(arrays, false, 0);
mutable.extend(0, 0, 1);
let result = mutable.freeze();
let array = ListArray::from(Arc::new(result));
let int_builder = Int64Builder::new(24);
let mut builder = ListBuilder::<Int64Builder>::new(int_builder);
builder.values().append_slice(&[1, 2, 3])?;
builder.append(true)?;
let expected = builder.finish();
assert_eq!(array, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/102338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
15162,
6917,
368,
1464,
5714,
71698,
341,
286,
1077,
526,
28532,
284,
1333,
21,
19,
3297,
486,
931,
7,
17,
19,
317,
286,
1077,
5206,
7363,
284,
1759,
3297,
27638,
1072,
21,
19,
3297,
683... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_primitive_array_modulus_scalar() {
let a = Int32Array::from(vec![15, 14, 9, 8, 1]);
let b = 3;
let c = modulus_scalar(&a, b).unwrap();
let expected = Int32Array::from(vec![0, 2, 0, 2, 1]);
assert_eq!(c, expected);
} | rust_cleaned_test_functions.jsonl/120271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
7480,
19425,
41652,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
16,
20,
11,
220,
16,
19,
11,
220,
24,
11,
220,
23,
11,
220,
16,
2558,
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_stat_and_fstat() {
let filename = b"target/foo.txt".as_ref();
let fd = open(filename, O_CREAT, S_IWUSR).unwrap(); // create empty file
let stat_result = stat(filename);
assert_stat_results(stat_result);
let fstat_result = fstat(fd);
assert_stat_results(fstat_result);
close(fd).unwrap();
unlink(filename).unwrap();
} | rust_cleaned_test_functions.jsonl/111022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16271,
8378,
761,
9878,
368,
341,
262,
1077,
3899,
284,
293,
1,
5657,
60555,
3909,
3263,
300,
7793,
543,
262,
1077,
12414,
284,
1787,
10961,
11,
506,
70802,
11,
328,
86421,
49558,
568,
15454,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_process_or_forward_packets() {
let my_pubkey = solana_sdk::pubkey::new_rand();
let my_pubkey1 = solana_sdk::pubkey::new_rand();
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey, None, true, false,),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey, None, false, false),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey1, None, false, false),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey, Some(my_pubkey1), false, false,),
BufferedPacketsDecision::Forward
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey, Some(my_pubkey1), false, true,),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey, Some(my_pubkey1), true, false,),
BufferedPacketsDecision::Consume
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey1, Some(my_pubkey1), false, false,),
BufferedPacketsDecision::Hold
);
assert_eq!(
BankingStage::consume_or_forward_packets(&my_pubkey1, Some(my_pubkey1), true, false,),
BufferedPacketsDecision::Consume
);
} | rust_cleaned_test_functions.jsonl/5944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 751
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
11305,
8734,
32121,
63569,
368,
341,
286,
1077,
847,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
847,
34014,
792,
16,
284,
2048,
3362,
61783,
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_stream2() {
// generated by KERIOX
let stream = r#"{"vs":"KERI10JSON00012a_","pre":"E4_CHZxqydVAvJEI7beqk3TZwUR92nQydi1nI8UqUTxk","sn":"0","ilk":"icp","sith":"1","keys":["DLfozZ0uGvLED22X3K8lX6ciwhl02jdjt1DQ_EHnJro0","C6KROFI5gWRXhAiIMiHLCDa-Oj09kmVMr2btCE96k_3g"],"nxt":"E99mhvP0pLkGtxymQkspRqcdoIFOqdigCf_F3rpg7rfk","toad":"0","wits":[],"cnfg":[]}-AABAAlxZyoxbADu-x9Ho6EC7valjC4bNn7muWvqC_u0EBd1P9xIeOSxmcYdhyvBg1-o-25ebv66Q3Td5bZ730wqLjBA"#;
assert!(signed_message(stream).is_ok());
assert!(signed_event_stream(stream).is_ok());
assert!(signed_event_stream_validate(stream).is_ok())
} | rust_cleaned_test_functions.jsonl/105158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
17,
368,
341,
262,
442,
7907,
553,
730,
640,
3810,
55,
198,
262,
1077,
4269,
284,
435,
55543,
4913,
11562,
3252,
79842,
40,
16,
15,
5370,
15,
15,
15,
16,
17,
64,
62,
2198,
1726,
3252,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_proto_user_host_port() {
let addr = "ssh://test-user@127.0.0.1:2222";
let parsed_addr = parse_user_host_port(addr).unwrap();
assert_eq!("ssh", parsed_addr.proto.unwrap());
assert_eq!("test-user", parsed_addr.user.unwrap());
assert_eq!("127.0.0.1", parsed_addr.host.unwrap());
assert_eq!("2222", parsed_addr.port.unwrap());
} | rust_cleaned_test_functions.jsonl/56552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37689,
3317,
12848,
8716,
368,
341,
262,
1077,
10789,
284,
330,
25537,
1110,
1944,
8694,
31,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
17,
17,
17,
17,
876,
262,
1077,
15676,
7387,
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_bootstrap() {
let path = Builder::new().prefix("var").tempdir().unwrap();
let raft_path = path.path().join("raft");
let kv_engine = engine_test::kv::new_engine(
path.path().to_str().unwrap(),
None,
&[CF_DEFAULT, CF_RAFT],
None,
)
.unwrap();
let raft_engine =
engine_test::raft::new_engine(raft_path.to_str().unwrap(), None, CF_DEFAULT, None)
.unwrap();
let engines = Engines::new(kv_engine.clone(), raft_engine.clone());
let region = initial_region(1, 1, 1);
assert!(bootstrap_store(&engines, 1, 1).is_ok());
assert!(bootstrap_store(&engines, 1, 1).is_err());
assert!(prepare_bootstrap_cluster(&engines, ®ion).is_ok());
assert!(kv_engine
.get_value(keys::PREPARE_BOOTSTRAP_KEY)
.unwrap()
.is_some());
assert!(kv_engine
.get_value_cf(CF_RAFT, &keys::region_state_key(1))
.unwrap()
.is_some());
assert!(kv_engine
.get_value_cf(CF_RAFT, &keys::apply_state_key(1))
.unwrap()
.is_some());
assert!(raft_engine
.get_value(&keys::raft_state_key(1))
.unwrap()
.is_some());
assert!(clear_prepare_bootstrap_key(&engines).is_ok());
assert!(clear_prepare_bootstrap_cluster(&engines, 1).is_ok());
assert!(is_range_empty(
&kv_engine,
CF_RAFT,
&keys::region_meta_prefix(1),
&keys::region_meta_prefix(2)
)
.unwrap());
assert!(is_range_empty(
&raft_engine,
CF_DEFAULT,
&keys::region_raft_prefix(1),
&keys::region_raft_prefix(2)
)
.unwrap());
} | rust_cleaned_test_functions.jsonl/52507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1009
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88424,
368,
341,
286,
1077,
1815,
284,
20626,
486,
931,
1005,
11849,
445,
947,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
52455,
2638,
284,
1815,
3875,
1005,
5987,
445,
2944,
797,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_messages() {
assert_eq!(
format!(
"{}",
LoggerError::NeverInitialized(String::from("Bad Log Path Provided"))
),
"Bad Log Path Provided"
);
assert_eq!(
format!("{}", LoggerError::AlreadyInitialized),
"Reinitialization of logger not allowed."
);
assert_eq!(
format!("{}", LoggerError::IsInitializing),
"The logger is initializing. Can't perform the requested action right now."
);
assert_eq!(
format!(
"{}",
LoggerError::Write(std::io::Error::new(ErrorKind::Interrupted, "write"))
),
"Failed to write logs. Error: write"
);
} | rust_cleaned_test_functions.jsonl/13481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
23428,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
33673,
394,
35503,
756,
394,
9514,
1454,
486,
26155,
22495,
2242,
486,
1499,
445,
17082,
2835,
7933,
53874,
5455,
310,
2837,
310,
330,
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_filter_array_slice() {
let a = Int32Array::from_slice(&[5, 6, 7, 8, 9]).slice(1, 4);
let b = BooleanArray::from_slice(vec![true, true, false, false, true]).slice(1, 4);
let c = filter(&a, &b).unwrap();
let expected = Int32Array::from_slice(&[6, 9]);
assert_eq!(expected, c.as_ref());
} | rust_cleaned_test_functions.jsonl/64053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
3858,
26488,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
26488,
2099,
58,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
10697,
24963,
7,
16,
11,
220,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const_from_ref() {
const VALUE: &i32 = &1;
const SLICE: &[i32] = core::slice::from_ref(VALUE);
assert!(core::ptr::eq(VALUE, &SLICE[0]))
} | rust_cleaned_test_functions.jsonl/9713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13610,
5673,
7793,
368,
341,
262,
733,
26827,
25,
609,
72,
18,
17,
284,
609,
16,
280,
262,
733,
16797,
5487,
25,
44590,
72,
18,
17,
60,
284,
6200,
486,
24963,
486,
1499,
7793,
98893,
626,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_install_mode_failing() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "target_dir";
let file = "source_file";
let mode_arg = "--mode=999";
at.touch(file);
at.mkdir(dir);
ucmd.arg(file)
.arg(dir)
.arg(mode_arg)
.fails()
.stderr_contains("Invalid mode string: invalid digit found in string");
let dest_file = &format!("{}/{}", dir, file);
assert!(at.file_exists(file));
assert!(!at.file_exists(dest_file));
} | rust_cleaned_test_functions.jsonl/47022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
7302,
761,
14277,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
5419,
284,
330,
5657,
4334,
876,
262,
1077,
1034,
284,
330,
2427... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect() {
use std::str::FromStr;
let socket_address = SocketAddr::from_str("18.34.3.4:7777").unwrap();
let time = Utc::now();
let (public_key, secret_key) = gen_keypair();
// write
let connect = Connect::new(
&public_key,
socket_address,
time,
&user_agent::get(),
&secret_key,
);
// read
assert_eq!(connect.pub_key(), &public_key);
assert_eq!(connect.addr(), socket_address);
assert_eq!(connect.time(), time);
assert!(connect.verify_signature(&public_key));
} | rust_cleaned_test_functions.jsonl/118854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
368,
341,
262,
990,
1460,
486,
495,
486,
3830,
2580,
401,
262,
1077,
7575,
6744,
284,
20954,
13986,
486,
1499,
2895,
445,
16,
23,
13,
18,
19,
13,
18,
13,
19,
25,
22,
22,
22,
22,
182... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poly_map_consuming() {
let h = hlist![9000, "joe", 41f32, "schmoe", 50];
impl Func<i32> for P {
type Output = bool;
fn call(args: i32) -> Self::Output {
args > 100
}
}
impl<'a> Func<&'a str> for P {
type Output = usize;
fn call(args: &'a str) -> Self::Output {
args.len()
}
}
impl Func<f32> for P {
type Output = String;
fn call(args: f32) -> Self::Output {
format!("{}", args)
}
}
struct P;
assert_eq!(h.map(Poly(P)), hlist![true, 3, "41".to_string(), 6, false]);
} | rust_cleaned_test_functions.jsonl/24760 | {
"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,
36133,
5376,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
24,
15,
15,
15,
11,
330,
73,
4644,
497,
220,
19,
16,
69,
18,
17,
11,
330,
21062,
76,
4644,
497,
220,
20,
15,
935,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_i32_alloc_zero_bytes() {
let mut b = Int32BufferBuilder::new(0);
b.append(123).unwrap();
let a = b.finish();
assert_eq!(4, a.len());
} | rust_cleaned_test_functions.jsonl/30960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
5318,
18,
17,
14802,
19359,
12524,
368,
341,
286,
1077,
5206,
293,
284,
1333,
18,
17,
4095,
3297,
486,
931,
7,
15,
317,
286,
293,
2057,
7,
16,
17,
18,
568,
15454,
543,
286,
1077,
264,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mode() {
let f = |x: Gamma| x.mode().unwrap();
let test = [((1.0, 0.1), 0.0), ((1.0, 1.0), 0.0)];
for &(arg, res) in test.iter() {
test_case_special(arg, res, 10e-6, f);
}
let test = [((10.0, 10.0), 0.9), ((10.0, 1.0), 9.0), ((10.0, INF), 0.0)];
for &(arg, res) in test.iter() {
test_case(arg, res, f);
}
} | rust_cleaned_test_functions.jsonl/39875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7302,
368,
341,
286,
1077,
282,
284,
760,
87,
25,
57682,
91,
856,
22981,
1005,
15454,
543,
286,
1077,
1273,
284,
508,
1188,
16,
13,
15,
11,
220,
15,
13,
16,
701,
220,
15,
13,
15,
701,
1781... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_null() {
test_parse_err::<()>(
&[
("n", "expected ident at line 1 column 1"),
("nul", "expected ident at line 1 column 3"),
("nulla", "trailing characters at line 1 column 5"),
],
);
test_parse_ok(
vec![
("null", ()),
],
);
} | rust_cleaned_test_functions.jsonl/88643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15162,
368,
341,
262,
1273,
21039,
9266,
27638,
368,
17055,
286,
609,
9640,
310,
3489,
77,
497,
330,
7325,
3524,
518,
1555,
220,
16,
3250,
220,
16,
4461,
310,
3489,
77,
360,
497,
330,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_record() {
let record = r#"2011-11-11T11:11:11.000000Z REDACTED_ELB_NAME 111.11.11.111:11111 11.1.1.1:11 0.00004 0.012272 0.000039 404 404 0 120 "GET https://11.11.111.111:111/login.action HTTP/1.1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2"#;
assert_eq!(record.split_record(), vec![
"2011-11-11T11:11:11.000000Z",
"REDACTED_ELB_NAME",
"111.11.11.111:11111",
"11.1.1.1:11",
"0.00004",
"0.012272",
"0.000039",
"404",
"404",
"0",
"120",
"GET",
"https://11.11.111.111:111/login.action",
"HTTP/1.1",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv",
"ECDHE-RSA-AES128-GCM-SHA256",
"TLSv1.2",
]);
// Reference: https://github.com/ereichert/elp/issues/18
let record = r#"2011-11-11T11:11:11.000000Z REDACTED_ELB_NAME 111.11.11.111:11111 11.1.1.1:11 0.00004 0.012272 0.000039 404 404 0 120 "GET https://11.11.111.111:111/login.action HTTP/1.1" "\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2"#;
assert_eq!(record.split_record(), vec![
"2011-11-11T11:11:11.000000Z",
"REDACTED_ELB_NAME",
"111.11.11.111:11111",
"11.1.1.1:11",
"0.00004",
"0.012272",
"0.000039",
"404",
"404",
"0",
"120",
"GET",
"https://11.11.111.111:111/login.action",
"HTTP/1.1",
"\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv",
"ECDHE-RSA-AES128-GCM-SHA256",
"TLSv1.2",
]);
} | rust_cleaned_test_functions.jsonl/33952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 947
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
14192,
368,
341,
262,
1077,
3255,
284,
435,
55543,
17,
15,
16,
16,
12,
16,
16,
12,
16,
16,
51,
16,
16,
25,
16,
16,
25,
16,
16,
13,
15,
15,
15,
15,
15,
15,
57,
25810,
6823,
1479,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_config() -> Result<()> {
let c = Config {
read_count: 10,
dir: None,
max_elements: None,
max_bytes: None,
flush_on_evnt: None,
};
let r = WalFactory::new().from_node(1, &NodeConfig::from_config("wal-test-1", c.clone())?);
assert!(r.is_err());
if let Err(Error(ErrorKind::BadOpConfig(s), _)) = r {
assert_eq!(
"WAL operator needs at least one of `max_elements` or `max_bytes` config entries.",
s.as_str()
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5332,
368,
1464,
5714,
71698,
341,
286,
1077,
272,
284,
5532,
341,
310,
1349,
3180,
25,
220,
16,
15,
345,
310,
5419,
25,
2240,
345,
310,
1932,
22801,
25,
2240,
345,
310,
1932,
12524,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_convert_humidity() {
let test_data = [
(0x0000, 0),
// Datasheet setion 5.11 "Conversion of Sensor Output"
(((0b1010_0001 as u16) << 8) | 0b0011_0011, 62968),
];
for td in &test_data {
assert_eq!(convert_humidity(td.0), td.1);
}
} | rust_cleaned_test_functions.jsonl/6823 | {
"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,
34910,
1523,
73926,
368,
341,
286,
1077,
1273,
1769,
284,
2278,
310,
320,
15,
87,
15,
15,
15,
15,
11,
220,
15,
1326,
310,
442,
422,
19346,
3674,
738,
290,
220,
20,
13,
16,
16,
330,
48237,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decoder_invalid_lone_lower_surrogate_partial() {
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [], [0xdc], "");
assert_feed_err!(d, [], [0x00], [], "");
assert_feed_ok!(d, [0x12, 0x34], [0xdc], "\u1234");
assert_feed_err!(d, [], [0x00], [0x56, 0x78], "");
assert_finish_ok!(d, "");
assert_feed_ok!(d, [], [0xdf], "");
assert_feed_err!(d, [], [0xff], [], "");
assert_feed_ok!(d, [0x12, 0x34], [0xdf], "\u1234");
assert_feed_err!(d, [], [0xff], [0x56, 0x78], "");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/15683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
31433,
907,
603,
30425,
49946,
48373,
52068,
368,
341,
286,
1077,
5206,
294,
284,
20076,
62,
16,
21,
11594,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
10071,
508,
15,
48361,
1125,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tcp_transport_mutual_auth() {
test_transport_success(
APTOS_TCP_TRANSPORT.clone(),
Auth::Mutual,
"/ip4/127.0.0.1/tcp/0",
expect_ip4_tcp_noise_addr,
);
} | rust_cleaned_test_functions.jsonl/15625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45562,
46398,
29523,
928,
14014,
368,
341,
262,
1273,
46398,
18632,
1006,
286,
362,
2828,
3126,
50614,
30967,
54800,
15997,
3148,
286,
7366,
486,
51440,
928,
345,
286,
3521,
573,
19,
14,
16,
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 |
#[test]
fn test_create() {
let path = Path::new("test.txt");
let mut mock = MockFileBackend::new();
mock.expect_create()
.with(eq(path))
.times(1)
.returning(|x| Err(Error::new(ErrorKind::Unsupported, "test-error")));
let fs = FileSystem {
inner: Rc::new(mock),
};
let _ = fs.create(path);
} | rust_cleaned_test_functions.jsonl/100440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
445,
1944,
3909,
797,
286,
1077,
5206,
7860,
284,
14563,
1703,
29699,
486,
931,
543,
286,
7860,
25952,
8657,
741,
310,
659,
4197,
69909,
558... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_cred_def_id_as_fully_qualified_with_schema_as_seq_no() {
_cred_def_id_qualified_with_schema_as_seq_no()
.validate()
.unwrap();
} | rust_cleaned_test_functions.jsonl/38096 | {
"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,
42681,
73475,
7844,
842,
11898,
761,
21965,
62,
36335,
6615,
25371,
11898,
14486,
6536,
368,
341,
310,
716,
10844,
7844,
842,
62,
36335,
6615,
25371,
11898,
14486,
6536,
741,
394,
659,
7067,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_quotes() -> Result<()> {
let rolling_stones = r#"
linenum,last_name,first_name
1,Jagger,Mick
2,O"Brian,Mary
3,Richards,Keith
4,L"Etoile,Bennet
5,Watts,Charlie
6,Smith,D"Shawn
7,Wyman,Bill
8,Woods,Ron
9,Jones,Brian
"#;
let file = Cursor::new(rolling_stones);
let df = CsvReader::new(file).with_quote_char(None).finish()?;
assert_eq!(df.shape(), (9, 3));
Ok(())
} | rust_cleaned_test_functions.jsonl/57582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
75637,
368,
1464,
5714,
71698,
341,
286,
1077,
20097,
1261,
3154,
284,
435,
2,
698,
3732,
9018,
92896,
1269,
11,
3896,
1269,
198,
16,
58862,
10114,
27014,
865,
198,
17,
74349,
1,
50088,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_removes() {
let mut map: BiHashMap<String, usize> = BiHashMap::new();
map.insert("ONE".to_string(), 1);
map.insert("TWO".to_string(), 2);
map.insert("THREE".to_string(), 3);
let removed = map.remove_by_key("ONE");
assert_eq!(removed, Some(("ONE".to_string(), 1)));
let removed = map.remove_by_key("ONE");
assert_eq!(removed, None);
let removed = map.remove_by_value(&2);
assert_eq!(removed, Some(("TWO".to_string(), 2)));
let removed = map.remove_by_value(&2);
assert_eq!(removed, None);
} | rust_cleaned_test_functions.jsonl/76189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19194,
10088,
368,
341,
286,
1077,
5206,
2415,
25,
12100,
18497,
3464,
11,
22301,
29,
284,
12100,
18497,
486,
931,
543,
286,
2415,
7030,
445,
5225,
3263,
983,
3904,
1507,
220,
16,
317,
286,
2415... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poll_returns_false_after_all_source_events_are_consumed() {
const EVENT: InternalEvent = InternalEvent::Event(Event::Resize(10, 10));
let source = FakeSource::with_events(&[EVENT, EVENT, EVENT]);
let mut reader = InternalEventReader {
events: VecDeque::new(),
source: Some(Box::new(source)),
};
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
assert!(!reader
.poll(Some(Duration::from_secs(0)), &InternalEventFilter)
.unwrap());
} | rust_cleaned_test_functions.jsonl/101477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
58900,
36015,
19844,
5705,
10347,
19691,
56855,
69870,
291,
368,
341,
286,
733,
12742,
25,
15412,
1556,
284,
15412,
1556,
486,
1556,
30469,
486,
30561,
7,
16,
15,
11,
220,
16,
15,
3237,
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_mem_mut_writer() {
let mut vec = Vec::new();
let mut writer = Cursor::new(&mut vec);
assert_eq!(writer.write(&[0]).unwrap(), 1);
assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3);
assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4);
let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
assert_eq!(&writer.get_ref()[..], b);
} | rust_cleaned_test_functions.jsonl/4219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12976,
29523,
28908,
368,
341,
286,
1077,
5206,
7486,
284,
11312,
486,
931,
543,
286,
1077,
5206,
6916,
284,
28067,
486,
931,
2099,
6984,
7486,
317,
286,
2060,
10714,
10297,
18189,
3836,
2099,
58,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encode() {
use binstruct_codegen::BinEncode;
#[derive(Debug, BinEncode, PartialEq)]
#[binstruct(mod_path = "crate::serialize")]
struct T {
_1: CString,
_2: u32,
_3: CString,
_4: CString,
_5: u16,
_6: CString,
}
let mut bytes: Vec<u8> = vec![];
T {
_1: CString::new("1").unwrap(),
_2: 2,
_3: CString::new("3").unwrap(),
_4: CString::new("4").unwrap(),
_5: 5,
_6: CString::new("6").unwrap(),
}
.encode(&mut bytes);
let mut buf: Vec<u8> = vec![];
buf.put_slice(b"1\0");
buf.put_u32_le(2);
buf.put_slice(b"3\0");
buf.put_slice(b"4\0");
buf.put_u16_le(5);
buf.put_slice(b"6\0");
assert_eq!(bytes, buf);
} | rust_cleaned_test_functions.jsonl/101530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
11224,
368,
341,
220,
990,
9544,
1235,
32018,
486,
28794,
32535,
280,
220,
11506,
27098,
42618,
11,
29344,
32535,
11,
55039,
5563,
220,
11506,
6863,
1235,
23351,
2638,
284,
330,
61711,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syn_sent_rst_bad_ack() {
let mut s = socket_syn_sent();
send!(s, TcpRepr {
control: TcpControl::Rst,
seq_number: REMOTE_SEQ,
ack_number: Some(TcpSeqNumber(1234)),
..SEND_TEMPL
}, Err(Error::Dropped));
assert_eq!(s.state, State::SynSent);
} | rust_cleaned_test_functions.jsonl/1718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
24115,
1710,
267,
34199,
48447,
368,
341,
286,
1077,
5206,
274,
284,
7575,
51393,
24115,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
2524,
25,
64876,
3273,
486,
49,
267,
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_writer_version() {
assert_eq!(WriterVersion::PARQUET_1_0.as_num(), 1);
assert_eq!(WriterVersion::PARQUET_2_0.as_num(), 2);
} | rust_cleaned_test_functions.jsonl/56721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
9438,
368,
341,
286,
2060,
10714,
10297,
6492,
5637,
486,
16567,
5757,
1348,
62,
16,
62,
15,
5357,
4273,
1507,
220,
16,
317,
286,
2060,
10714,
10297,
6492,
5637,
486,
16567,
5757,
1348,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_storage_returns_bogus_error_when_loading_module() {
let mut gas_status = GasStatus::new_unmetered();
let module_id = ModuleId::new(TEST_ADDR, Identifier::new("N").unwrap());
let fun_name = Identifier::new("bar").unwrap();
for error_code in LIST_OF_ERROR_CODES {
let storage = BogusStorage {
bad_status_code: *error_code,
};
let vm = MoveVM::new(vec![]).unwrap();
let mut sess = vm.new_session(&storage);
let err = sess
.execute_function(&module_id, &fun_name, vec![], vec![], &mut gas_status)
.unwrap_err();
assert_eq!(err.status_type(), StatusType::InvariantViolation);
}
} | rust_cleaned_test_functions.jsonl/48437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
58900,
880,
538,
355,
4096,
47636,
57726,
10750,
368,
341,
262,
1077,
5206,
6819,
4773,
284,
20854,
2522,
486,
931,
4907,
59422,
291,
543,
262,
1077,
4688,
842,
284,
13711,
764,
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_sign_verify_detached() {
use randombytes::randombytes;
for i in 0..256usize {
let (pk, sk) = gen_keypair();
let m = randombytes(i);
let sig = sign_detached(&m, &sk);
assert!(verify_detached(&sig, &m, &pk));
}
} | rust_cleaned_test_functions.jsonl/11394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
35638,
24409,
3854,
368,
341,
286,
990,
4194,
9651,
486,
11463,
9651,
280,
286,
369,
600,
304,
220,
15,
496,
17,
20,
21,
51878,
341,
310,
1077,
320,
20819,
11,
1901,
8,
284,
4081,
3097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_sort() {
let mut v = vec![15, 6, 8, 10, 1, 3, 2, 0, -10, 4, -5];
v = merge_sort(v);
assert_eq!(v, vec![-10, -5, 0, 1, 2, 3, 4, 6, 8, 10, 15]);
} | rust_cleaned_test_functions.jsonl/122401 | {
"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,
20888,
18435,
368,
341,
286,
1077,
5206,
348,
284,
7486,
20703,
16,
20,
11,
220,
21,
11,
220,
23,
11,
220,
16,
15,
11,
220,
16,
11,
220,
18,
11,
220,
17,
11,
220,
15,
11,
481,
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_resolve_module() {
let (analysis, pos) = analysis_and_position(
"
//- /lib.rs
mod <|>foo;
//- /foo.rs
// empty
",
);
let symbols = analysis.approximately_resolve_symbol(pos).unwrap().unwrap();
assert_eq_dbg(
r#"ReferenceResolution {
reference_range: [4; 7),
resolves_to: [(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]
}"#,
&symbols,
);
let (analysis, pos) = analysis_and_position(
"
//- /lib.rs
mod <|>foo;
//- /foo/mod.rs
// empty
",
);
let symbols = analysis.approximately_resolve_symbol(pos).unwrap().unwrap();
assert_eq_dbg(
r#"ReferenceResolution {
reference_range: [4; 7),
resolves_to: [(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]
}"#,
&symbols,
);
} | rust_cleaned_test_functions.jsonl/75846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10750,
368,
341,
262,
1077,
320,
34484,
11,
1133,
8,
284,
6358,
8378,
9661,
1006,
286,
6228,
286,
78406,
608,
2740,
25638,
198,
286,
1463,
82639,
29,
7975,
280,
286,
78406,
608,
7975,
256... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_to_string() {
let s = "Hello world".hash_to_string();
assert_eq!(s, "2216321107127430384");
} | rust_cleaned_test_functions.jsonl/6487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2346,
3904,
368,
341,
286,
1077,
274,
284,
330,
9707,
1879,
3263,
8296,
2346,
3904,
543,
286,
2060,
10714,
10297,
82,
11,
330,
17,
17,
16,
21,
18,
17,
16,
16,
15,
22,
16,
17,
22,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_smoke() {
let pid = thread::process_id();
let tc = ThreadsCollector::new(pid, "smoke");
tc.collect();
tc.desc();
monitor_threads("smoke").unwrap();
} | rust_cleaned_test_functions.jsonl/99556 | {
"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,
15874,
4740,
368,
341,
286,
1077,
14814,
284,
4516,
486,
4630,
842,
543,
286,
1077,
17130,
284,
74742,
53694,
486,
931,
37844,
11,
330,
3563,
4740,
797,
286,
17130,
29124,
543,
286,
17130,
30514,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rollback_and_cleanup() {
let (_cluster, client, ctx) = must_new_cluster_and_kv_client();
let (k, v) = (b"key".to_vec(), b"value".to_vec());
let mut ts = 0;
// Prewrite
ts += 1;
let prewrite_start_version = ts;
let mut mutation = Mutation::default();
mutation.set_op(Op::Put);
mutation.set_key(k.clone());
mutation.set_value(v);
must_kv_prewrite(
&client,
ctx.clone(),
vec![mutation],
k.clone(),
prewrite_start_version,
);
// Commit
ts += 1;
let commit_version = ts;
must_kv_commit(
&client,
ctx.clone(),
vec![k.clone()],
prewrite_start_version,
commit_version,
commit_version,
);
// Prewrite puts some locks.
ts += 1;
let prewrite_start_version2 = ts;
let (k2, v2) = (b"key2".to_vec(), b"value2".to_vec());
let mut mut_pri = Mutation::default();
mut_pri.set_op(Op::Put);
mut_pri.set_key(k2.clone());
mut_pri.set_value(v2);
let mut mut_sec = Mutation::default();
mut_sec.set_op(Op::Put);
mut_sec.set_key(k.clone());
mut_sec.set_value(b"foo".to_vec());
must_kv_prewrite(
&client,
ctx.clone(),
vec![mut_pri, mut_sec],
k2.clone(),
prewrite_start_version2,
);
ts += 1;
let scan_lock_max_version = ts;
let mut scan_lock_req = ScanLockRequest::default();
scan_lock_req.set_context(ctx.clone());
scan_lock_req.max_version = scan_lock_max_version;
let scan_lock_resp = client.kv_scan_lock(&scan_lock_req).unwrap();
assert!(!scan_lock_resp.has_region_error());
assert_eq!(scan_lock_resp.locks.len(), 2);
for (lock, key) in scan_lock_resp
.locks
.into_iter()
.zip(vec![k.clone(), k2.clone()])
{
assert_eq!(lock.primary_lock, k2);
assert_eq!(lock.key, key);
assert_eq!(lock.lock_version, prewrite_start_version2);
}
// Rollback
let rollback_start_version = prewrite_start_version2;
let mut rollback_req = BatchRollbackRequest::default();
rollback_req.set_context(ctx.clone());
rollback_req.start_version = rollback_start_version;
rollback_req.set_keys(vec![k2.clone()].into_iter().collect());
let rollback_resp = client.kv_batch_rollback(&rollback_req).unwrap();
assert!(!rollback_resp.has_region_error());
assert!(!rollback_resp.has_error());
rollback_req.set_keys(vec![k].into_iter().collect());
let rollback_resp2 = client.kv_batch_rollback(&rollback_req).unwrap();
assert!(!rollback_resp2.has_region_error());
assert!(!rollback_resp2.has_error());
// Cleanup
let cleanup_start_version = prewrite_start_version2;
let mut cleanup_req = CleanupRequest::default();
cleanup_req.set_context(ctx.clone());
cleanup_req.start_version = cleanup_start_version;
cleanup_req.set_key(k2);
let cleanup_resp = client.kv_cleanup(&cleanup_req).unwrap();
assert!(!cleanup_resp.has_region_error());
assert!(!cleanup_resp.has_error());
// There should be no locks
ts += 1;
let scan_lock_max_version2 = ts;
let mut scan_lock_req = ScanLockRequest::default();
scan_lock_req.set_context(ctx);
scan_lock_req.max_version = scan_lock_max_version2;
let scan_lock_resp = client.kv_scan_lock(&scan_lock_req).unwrap();
assert!(!scan_lock_resp.has_region_error());
assert_eq!(scan_lock_resp.locks.len(), 0);
} | rust_cleaned_test_functions.jsonl/61685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
62,
33559,
8378,
42444,
368,
341,
262,
1077,
5453,
18855,
11,
2943,
11,
5635,
8,
284,
1969,
5921,
28441,
8378,
97066,
8179,
543,
262,
1077,
320,
74,
11,
348,
8,
284,
320,
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... | 2 |
#[test]
fn test_local_date_sanity_check() {
// issue #27
assert_eq!(Local.ymd(2999, 12, 28).day(), 28);
} | rust_cleaned_test_functions.jsonl/73877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
4164,
643,
38270,
7200,
368,
341,
286,
442,
4265,
671,
17,
22,
198,
286,
2060,
10714,
10297,
7319,
13,
1600,
67,
7,
17,
24,
24,
24,
11,
220,
16,
17,
11,
220,
17,
23,
568,
1292,
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 |
#[test]
fn test_eval_nop() {
let cie = make_test_cie();
let ctx = UnwindContext::new();
let expected = ctx.clone();
let instructions = [(Ok(false), CallFrameInstruction::Nop)];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
1089,
453,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
1077,
3601,
284,
5635,
15997,
543,
286,
1077,
11221,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_24() {
assert_eq!(
Solution::swap_pairs(to_list(vec![1, 2, 3, 4])),
to_list(vec![2, 1, 4, 3])
);
assert_eq!(Solution::swap_pairs(to_list(vec![])), to_list(vec![]));
assert_eq!(
Solution::swap_pairs(to_list(vec![1, 2, 3])),
to_list(vec![2, 1, 3])
);
assert_eq!(Solution::swap_pairs(to_list(vec![1])), to_list(vec![1]));
} | rust_cleaned_test_functions.jsonl/102724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
19,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
25741,
36430,
12186,
2019,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
87619,
310,
311,
2019,
25592,
20703,
17,
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_qf_to_pari_qf_to_qf() {
unsafe {
pari_init(10000000, 2);
}
let a: BigInt = str::parse("1347310664179468558147371727982960102805371574927252724399119343247182932538452304549609704350360058405827948976558722087559341859252338031258062288910984654814255199874816496621961922792890687089794760104660404141195904459619180668507135317125790028783030121033883873501532619563806411495141846196437").unwrap();
let b = BigInt::from(2);
let delta = -BigInt::from(3) * BigInt::from(201);
let abd = ABDeltaTriple { a, b, delta };
let pf = BinaryQF::binary_quadratic_form_disc(&abd);
let pari_qf = pf.qf_to_pari_qf();
let pf2 = BinaryQF::pari_qf_to_qf(pari_qf);
assert_eq!(pf, pf2);
} | rust_cleaned_test_functions.jsonl/21403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
69,
2346,
620,
2780,
8976,
69,
2346,
8976,
69,
368,
341,
286,
19860,
341,
310,
66982,
6137,
7,
16,
15,
15,
15,
15,
15,
15,
15,
11,
220,
17,
317,
286,
456,
286,
1077,
264,
25,
62608,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contradiction() {
let mut puzzle = Puzzle::new();
let v0 = puzzle.new_var_with_candidates(&[3]);
let v1 = puzzle.new_var_with_candidates(&[0,1]);
puzzle.equals(v0 + 2 * v1, 4);
let search = puzzle.step();
assert!(search.is_none());
} | rust_cleaned_test_functions.jsonl/73197 | {
"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,
3382,
47026,
2479,
368,
341,
286,
1077,
5206,
24626,
284,
60012,
486,
931,
543,
286,
1077,
348,
15,
284,
24626,
4618,
4612,
6615,
73553,
2099,
58,
18,
2558,
286,
1077,
348,
16,
284,
24626,
4618,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_reader_get_value() {
let buffer = vec![255, 0];
let mut bit_reader = BitReader::from(buffer);
assert_eq!(bit_reader.get_value::<i32>(1), Some(1));
assert_eq!(bit_reader.get_value::<i32>(2), Some(3));
assert_eq!(bit_reader.get_value::<i32>(3), Some(7));
assert_eq!(bit_reader.get_value::<i32>(4), Some(3));
} | rust_cleaned_test_functions.jsonl/115728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
22306,
3062,
3142,
368,
341,
286,
1077,
4147,
284,
7486,
20703,
17,
20,
20,
11,
220,
15,
935,
286,
1077,
5206,
2699,
22306,
284,
6495,
5062,
486,
1499,
12584,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diff_highlight_respects_gitconfig() {
let git_config_contents = b"
[color \"diff\"]
old = red bold
new = green bold
[color \"diff-highlight\"]
oldNormal = ul red bold
oldHighlight = red bold 52
newNormal = ul green bold
newHighlight = green bold 22
";
let git_config_path = "delta__test_diff_highlight.gitconfig";
let opt = features::tests::make_options(
&["--features", "diff-highlight"],
Some(git_config_contents),
Some(git_config_path),
);
assert_eq!(opt.minus_style, "red bold");
assert_eq!(opt.minus_non_emph_style, "ul red bold");
assert_eq!(opt.minus_emph_style, "red bold 52");
assert_eq!(opt.zero_style, "normal");
assert_eq!(opt.plus_style, "green bold");
assert_eq!(opt.plus_non_emph_style, "ul green bold");
assert_eq!(opt.plus_emph_style, "green bold 22");
remove_file(git_config_path).unwrap();
} | rust_cleaned_test_functions.jsonl/18159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
74546,
4918,
7973,
68801,
1676,
368,
341,
286,
1077,
16345,
5332,
16682,
284,
293,
698,
84111,
7245,
13490,
2105,
921,
262,
2310,
284,
2518,
13939,
198,
262,
501,
284,
6176,
13939,
271,
841... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow_overflow() {
let tests = vec![(ScalarFuncSig::Pow, Datum::F64(2.0), Datum::F64(300000000.0))];
let mut ctx = EvalContext::default();
for (sig, arg0, arg1) in tests {
let arg0 = datum_expr(arg0);
let arg1 = datum_expr(arg1);
let mut f = scalar_func_expr(sig, &[arg0, arg1]);
let op = Expression::build(&mut ctx, f).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap_err();
assert!(check_overflow(got).is_ok());
}
} | rust_cleaned_test_functions.jsonl/125533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
79073,
368,
341,
286,
1077,
7032,
284,
7486,
0,
9697,
20639,
9626,
47246,
486,
66584,
11,
68459,
486,
37,
21,
19,
7,
17,
13,
15,
701,
68459,
486,
37,
21,
19,
7,
18,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.