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_extract_version_number() {
let tag = "v0.13-4-g58738c0";
assert_eq!(13u32, extract_local_version_number(tag));
let tag = "v0.13";
assert_eq!(13u32, extract_local_version_number(tag));
} | rust_cleaned_test_functions.jsonl/60759 | {
"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,
39123,
9438,
5500,
368,
341,
286,
1077,
4772,
284,
330,
85,
15,
13,
16,
18,
12,
19,
2371,
20,
23,
22,
18,
23,
66,
15,
876,
286,
2060,
10714,
10297,
16,
18,
84,
18,
17,
11,
8649,
13564,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ser_de_empty() {
let vec = ArrayVec::<[u32; 0]>::new();
assert_tokens(&vec, &[
Token::Seq { len: Some(0) },
Token::SeqEnd,
]);
} | rust_cleaned_test_functions.jsonl/67020 | {
"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,
75861,
2259,
15124,
368,
341,
286,
1077,
7486,
284,
2910,
10050,
27638,
58,
84,
18,
17,
26,
220,
15,
60,
6831,
931,
1428,
286,
2060,
28838,
2099,
4083,
11,
609,
9640,
310,
9660,
486,
20183,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unrecognized_file_type_with_theme() {
let options = get_command_line_options();
let input = ADDED_FILE_INPUT.replace("a.py", "a");
let output = get_line_of_code_from_delta(&input, &options);
assert_has_color_other_than_plus_color(&output, &options);
} | rust_cleaned_test_functions.jsonl/61840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
46067,
2458,
1819,
6615,
19864,
368,
341,
16885,
286,
1077,
2606,
284,
633,
10811,
6528,
8743,
543,
286,
1077,
1946,
284,
9630,
11490,
8087,
21022,
6980,
445,
64,
7197,
497,
330,
64,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_look_at() {
let eye = Point3::new(0.0f64, 0.0, -5.0);
let center = Point3::new(0.0f64, 0.0, 0.0);
let up = Vector3::new(1.0f64, 0.0, 0.0);
let t: Decomposed<Vector3<f64>, Quaternion<f64>> = Transform::look_at(eye, center, up);
let point = Point3::new(1.0f64, 0.0, 0.0);
let view_point = Point3::new(0.0f64, 1.0, 5.0);
assert_ulps_eq!(&t.transform_point(point), &view_point);
} | rust_cleaned_test_functions.jsonl/86461 | {
"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,
24271,
3752,
368,
341,
262,
1077,
7912,
284,
5126,
18,
486,
931,
7,
15,
13,
15,
69,
21,
19,
11,
220,
15,
13,
15,
11,
481,
20,
13,
15,
317,
262,
1077,
4126,
284,
5126,
18,
486,
931,
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_find_st() {
use super::find_st2;
let string_to_find = "foobar.txt".to_string();
let v = find_st2(string_to_find);
assert_eq!(v, ["./temp/temp/temp/foobar.txt", "./temp/fooBAR.txt", "./foobar.txt"])
} | rust_cleaned_test_functions.jsonl/54496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
1261,
368,
341,
286,
990,
2256,
486,
3903,
1261,
17,
280,
286,
1077,
914,
2346,
21814,
284,
330,
50267,
3909,
3263,
983,
3904,
1428,
286,
1077,
348,
284,
1477,
1261,
17,
3609,
2346,
21814... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_images_json_get() {
let mut tmp_path = std::env::temp_dir();
tmp_path.push("test-get-ckenvthslc");
let _ = std::fs::remove_dir_all(&tmp_path);
std::fs::create_dir_all(&tmp_path).unwrap();
let response = super::handle_images_json_get(&tmp_path.to_string_lossy());
assert_eq!(response.status_code, 200);
let (reader, _) = response.data.into_reader_and_size();
let results: Vec<String> = serde_json::from_reader(reader).unwrap();
assert_eq!(results.len(), 0);
{
tmp_path.push("test.jpg");
std::fs::File::create(&tmp_path).unwrap();
tmp_path.pop();
tmp_path.push("test.png");
std::fs::File::create(&tmp_path).unwrap();
tmp_path.pop();
}
let response = super::handle_images_json_get(&tmp_path.to_string_lossy());
assert_eq!(response.status_code, 200);
let (reader, _) = response.data.into_reader_and_size();
let results: Vec<String> = serde_json::from_reader(reader).unwrap();
assert_eq!(results, ["test.jpg", "test.png"]);
assert_eq!(response.status_code, 200);
std::fs::remove_dir_all(&tmp_path).unwrap();
} | rust_cleaned_test_functions.jsonl/132616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
13283,
9455,
3062,
368,
341,
286,
1077,
5206,
4174,
2638,
284,
1460,
486,
3160,
486,
3888,
4334,
543,
286,
4174,
2638,
2552,
445,
1944,
22491,
12,
377,
3160,
339,
3226,
66,
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_pack_bits_by_word() {
let data = [true, true, false, true, false, false];
let ret = [0b00001011u8];
let buf = pack_bits_by_word(&data);
assert_eq!(buf.as_slice(), ret)
} | rust_cleaned_test_functions.jsonl/62510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32995,
20034,
3710,
13533,
368,
341,
286,
1077,
821,
284,
508,
1866,
11,
830,
11,
895,
11,
830,
11,
895,
11,
895,
935,
286,
1077,
2112,
284,
508,
15,
65,
15,
15,
15,
15,
16,
15,
16,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_num_equals() {
let mut cs = TestConstraintSystem::<Bls12>::new();
let a = AllocatedNum::alloc(cs.namespace(|| "a"), || Ok(Fr::from_str("10").unwrap())).unwrap();
let b = AllocatedNum::alloc(cs.namespace(|| "b"), || Ok(Fr::from_str("12").unwrap())).unwrap();
let c = AllocatedNum::alloc(cs.namespace(|| "c"), || Ok(Fr::from_str("10").unwrap())).unwrap();
let not_eq = AllocatedNum::equals(cs.namespace(|| "not_eq"), &a, &b).unwrap();
let eq = AllocatedNum::equals(cs.namespace(|| "eq"), &a, &c).unwrap();
assert!(cs.is_satisfied());
assert_eq!(cs.num_constraints(), 2 * 5);
assert_eq!(not_eq.get_value().unwrap(), false);
assert_eq!(eq.get_value().unwrap(), true);
} | rust_cleaned_test_functions.jsonl/39692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
61664,
368,
341,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
33,
4730,
16,
17,
6831,
931,
1428,
286,
1077,
264,
284,
1674,
39463,
4651,
486,
4742,
41153,
50409,
79453,
330,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_powf() {
let nan: f32 = f32::NAN;
let inf: f32 = f32::INFINITY;
let neg_inf: f32 = f32::NEG_INFINITY;
assert_eq!(1.0f32.powf(1.0), 1.0);
assert_approx_eq!(3.4f32.powf(4.5), 246.408218);
assert_approx_eq!(2.7f32.powf(-3.2), 0.041652);
assert_approx_eq!((-3.1f32).powf(2.0), 9.61);
assert_approx_eq!(5.9f32.powf(-2.0), 0.028727);
assert_eq!(8.3f32.powf(0.0), 1.0);
assert!(nan.powf(2.0).is_nan());
assert_eq!(inf.powf(2.0), inf);
assert_eq!(neg_inf.powf(3.0), neg_inf);
} | rust_cleaned_test_functions.jsonl/8117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
69,
368,
341,
286,
1077,
20021,
25,
282,
18,
17,
284,
282,
18,
17,
486,
45,
1093,
280,
286,
1077,
4132,
25,
282,
18,
17,
284,
282,
18,
17,
486,
687,
55990,
280,
286,
1077,
4184,
260... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_var_expr_stmt() {
cov_mark::check!(test_extract_var_expr_stmt);
check_assist(
extract_variable,
r#"
fn foo() {
$01 + 1$0;
}"#,
r#"
fn foo() {
let $0var_name = 1 + 1;
}"#,
);
check_assist(
extract_variable,
"
fn foo() {
$0{ let x = 0; x }$0
something_else();
}",
"
fn foo() {
let $0var_name = { let x = 0; x };
something_else();
}",
);
} | rust_cleaned_test_functions.jsonl/132830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
4612,
21915,
21824,
368,
341,
286,
21836,
18924,
486,
2028,
10297,
1944,
39123,
4612,
21915,
21824,
317,
286,
1779,
12083,
380,
1006,
310,
8649,
14635,
345,
310,
435,
2,
698,
8822,
15229,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_header_errors() -> Result<()> {
let headers = headers();
match parse_header::<i64>(&headers, "x-bad-num").unwrap_err() {
Error::Http(x) => match *x {
HttpError::RateLimitI64F64 => assert!(true),
_ => assert!(false),
},
_ => assert!(false),
}
match parse_header::<i64>(&headers, "x-bad-unicode").unwrap_err() {
Error::Http(http_err) => match *http_err {
HttpError::RateLimitUtf8 => assert!(true),
_ => assert!(false),
},
_ => assert!(false),
}
Ok(())
} | rust_cleaned_test_functions.jsonl/27073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8757,
20196,
368,
1464,
5714,
71698,
341,
286,
1077,
7102,
284,
7102,
1428,
286,
2432,
4715,
8757,
27638,
72,
21,
19,
44784,
7713,
11,
330,
87,
1455,
329,
31194,
1827,
15454,
9266,
368,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_several_widths() {
for width in 65000..65535 - 127 {
let _keyboard = KeyboardBuilder::new()
.set_most_left_right_white_keys(0, 127)
.unwrap()
.set_width(width)
.unwrap()
.build2d();
}
} | rust_cleaned_test_functions.jsonl/81981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
17539,
7927,
82,
368,
341,
286,
369,
2374,
304,
220,
21,
20,
15,
15,
15,
496,
21,
20,
20,
18,
20,
481,
220,
16,
17,
22,
341,
310,
1077,
716,
41713,
284,
25616,
3297,
486,
931,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_map_file_extension_media_type_with_extension() {
assert_eq!(
map_content_type(Path::new("foo/bar.ts"), Some("text/plain")),
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar.ts"), Some("foo/bar")),
msg::MediaType::Unknown
);
assert_eq!(
map_content_type(
Path::new("foo/bar.tsx"),
Some("application/typescript"),
),
msg::MediaType::TSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.tsx"),
Some("application/javascript"),
),
msg::MediaType::TSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.tsx"),
Some("application/x-typescript"),
),
msg::MediaType::TSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.tsx"),
Some("video/vnd.dlna.mpeg-tts"),
),
msg::MediaType::TSX
);
assert_eq!(
map_content_type(Path::new("foo/bar.tsx"), Some("video/mp2t")),
msg::MediaType::TSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.jsx"),
Some("application/javascript"),
),
msg::MediaType::JSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.jsx"),
Some("application/x-typescript"),
),
msg::MediaType::JSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.jsx"),
Some("application/ecmascript"),
),
msg::MediaType::JSX
);
assert_eq!(
map_content_type(Path::new("foo/bar.jsx"), Some("text/ecmascript")),
msg::MediaType::JSX
);
assert_eq!(
map_content_type(
Path::new("foo/bar.jsx"),
Some("application/x-javascript"),
),
msg::MediaType::JSX
);
} | rust_cleaned_test_functions.jsonl/16769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 918
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
2458,
31035,
29173,
1819,
6615,
31035,
368,
341,
262,
2060,
10714,
33673,
414,
2415,
7495,
1819,
33030,
486,
931,
445,
7975,
49513,
21288,
3975,
4329,
445,
1318,
36971,
30154,
414,
3750,
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_storage_cache_entry() {
let mut cache = EntryCache::default();
let ents = vec![
new_entry(3, 3),
new_entry(4, 4),
new_entry(5, 4),
new_entry(6, 6),
];
cache.append("", &ents);
assert!(cache.entry(1).is_none());
assert!(cache.entry(2).is_none());
for e in &ents {
assert_eq!(e, cache.entry(e.get_index()).unwrap());
}
let res = panic_hook::recover_safe(|| cache.entry(7));
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/12748 | {
"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,
23310,
11529,
9078,
368,
341,
286,
1077,
5206,
6500,
284,
15788,
8233,
486,
2258,
543,
286,
1077,
36852,
284,
7486,
90515,
310,
501,
9078,
7,
18,
11,
220,
18,
1326,
310,
501,
9078,
7,
19,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_update_ready_single_wave() {
let time = test_time();
let mut update = test_update();
update.waves.insert(0, time);
update
.waves
.insert(MAX_SEED, time + Duration::milliseconds(MAX_SEED as i64));
for seed in (100..500).step_by(100) {
assert!(
!update.update_ready(seed, time + Duration::milliseconds((seed as i64) - 1)),
"seed: {}, time: {}, wave start time: {}, wave start seed: {}, {} milliseconds hasn't passed yet",
seed,
time,
time,
0,
seed
);
assert!(
update.update_ready(seed, time + Duration::milliseconds(seed as i64)),
"seed: {}, time: {}, wave start time: {}, wave start seed: {}, update should be ready",
seed,
time + Duration::milliseconds(100),
time,
0,
);
}
} | rust_cleaned_test_functions.jsonl/49366 | {
"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,
8882,
35456,
19487,
60063,
368,
341,
286,
1077,
882,
284,
1273,
3009,
543,
286,
1077,
5206,
2647,
284,
1273,
8882,
543,
16885,
16885,
286,
2647,
1418,
4693,
7030,
7,
15,
11,
882,
317,
286,
2647,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compress() {
new_ucmd!()
.args(&[
"ext_sort.txt",
"-n",
"--compress-program",
"gzip",
"-S",
"10",
])
.succeeds()
.stdout_only_fixture("ext_sort.expected");
} | rust_cleaned_test_functions.jsonl/20533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
9640,
310,
330,
427,
18435,
3909,
756,
310,
6523,
77,
756,
310,
14482,
38360,
66020,
756,
310,
330,
70996,
756,
310,
6523,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunked_pop_chunk() {
let mut chunks = ChunkedVec::<_, 2>::default();
assert!(chunks.pop().is_none());
assert_eq!(chunks.capacity(), 2);
chunks.extend_from_slice(&[1, 2, 3, 4, 5, 6, 7]);
assert_eq!(chunks.len(), 7);
assert_eq!(chunks.capacity(), 8);
chunks.pop_first_chunk().unwrap();
assert_eq!(chunks.len(), 5);
assert_eq!(chunks.get_slice(0..5).unwrap(), &[3, 4, 5, 6, 7][..]);
assert_eq!(chunks.capacity(), 6);
chunks.pop_first_chunk().unwrap();
assert_eq!(chunks.len(), 3);
assert_eq!(chunks.get_slice(0..3).unwrap(), &[5, 6, 7][..]);
assert_eq!(chunks.capacity(), 4);
chunks.pop_first_chunk().unwrap();
assert_eq!(chunks.len(), 1);
assert_eq!(chunks.get_slice(0..1).unwrap(), &[7][..]);
assert_eq!(chunks.capacity(), 2);
chunks.pop_first_chunk().unwrap();
assert_eq!(chunks.len(), 0);
assert_eq!(chunks.capacity(), 0);
assert!(chunks.pop_first_chunk().is_none());
} | rust_cleaned_test_functions.jsonl/80056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
291,
17061,
30539,
368,
341,
286,
1077,
5206,
26757,
284,
45513,
291,
10050,
27638,
6878,
220,
17,
6831,
2258,
543,
286,
2060,
10297,
84263,
8288,
1005,
285,
31488,
1423,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ls_columns() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch(&at.plus_as_string("test-columns-1"));
at.touch(&at.plus_as_string("test-columns-2"));
at.touch(&at.plus_as_string("test-columns-3"));
at.touch(&at.plus_as_string("test-columns-4"));
// Columns is the default
let result = scene.ucmd().succeeds();
#[cfg(not(windows))]
result.stdout_only("test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n");
#[cfg(windows)]
result.stdout_only("test-columns-1 test-columns-2 test-columns-3 test-columns-4\n");
for option in &["-C", "--format=columns"] {
let result = scene.ucmd().arg(option).succeeds();
#[cfg(not(windows))]
result.stdout_only("test-columns-1\ntest-columns-2\ntest-columns-3\ntest-columns-4\n");
#[cfg(windows)]
result.stdout_only("test-columns-1 test-columns-2 test-columns-3 test-columns-4\n");
}
for option in &["-C", "--format=columns"] {
scene
.ucmd()
.arg("-w=40")
.arg(option)
.succeeds()
.stdout_only("test-columns-1 test-columns-3\ntest-columns-2 test-columns-4\n");
}
} | rust_cleaned_test_functions.jsonl/71196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 612
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53174,
22590,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
280,
262,
518,
42129,
2099,
266,
60540,
11898,
3904,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_json_object_expression_with_string_literal_key() {
let n = ObjectExpr {
base: BaseNode::default(),
with: None,
properties: vec![Property {
base: BaseNode::default(),
key: PropertyKey::StringLit(StringLit {
base: BaseNode::default(),
value: "a".to_string(),
}),
value: Some(Expression::StringLit(StringLit {
base: BaseNode::default(),
value: "hello".to_string(),
})),
}],
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"ObjectExpression","properties":[{"type":"Property","key":{"type":"StringLiteral","value":"a"},"value":{"type":"StringLiteral","value":"hello"}}]}"#
);
let deserialized: ObjectExpr = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
5314,
28068,
6615,
3904,
34100,
3097,
368,
341,
262,
1077,
308,
284,
3002,
16041,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
448,
25,
2240,
345,
286,
5888,
25,
7486,
20703,
3052... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dot() {
let vec1 = Vec3::new(0.0, 1.0, 2.0);
let vec2 = Vec3::new(2.0, 1.0, 0.0);
assert_eq!(vec1.dot(&vec2), 1.0);
assert_eq!(vec2.dot(&vec1), 1.0);
assert_eq!(vec2.dot(&vec2), 5.0);
} | rust_cleaned_test_functions.jsonl/39244 | {
"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,
30941,
368,
341,
286,
1077,
7486,
16,
284,
11312,
18,
486,
931,
7,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
317,
286,
1077,
7486,
17,
284,
11312,
18,
486,
931,
7,
17,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_limbs_equal_limb() {
for zero in ZEROES {
assert_eq!(limbs_equal_limb_constant_time(zero, 0), LimbMask::True);
}
for nonzero in NONZEROES {
assert_eq!(limbs_equal_limb_constant_time(nonzero, 0), LimbMask::False);
}
static EQUAL: &[(&[Limb], Limb)] = &[
(&[1], 1),
(&[MAX], MAX),
(&[1, 0], 1),
(&[MAX, 0, 0], MAX),
(&[0b100], 0b100),
(&[0b100, 0], 0b100),
];
for &(a, b) in EQUAL {
assert_eq!(limbs_equal_limb_constant_time(a, b), LimbMask::True);
}
static UNEQUAL: &[(&[Limb], Limb)] = &[
(&[0], 1),
(&[2], 1),
(&[3], 1),
(&[1, 1], 1),
(&[0b100, 0b100], 0b100),
(&[1, 0, 0b100, 0, 0, 0, 0, 0], 1),
(&[1, 0, 0, 0, 0, 0, 0, 0b100], 1),
(&[MAX, MAX], MAX),
(&[MAX, 1], MAX),
];
for &(a, b) in UNEQUAL {
assert_eq!(limbs_equal_limb_constant_time(a, b), LimbMask::False);
}
} | rust_cleaned_test_functions.jsonl/10663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 699
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58191,
1279,
11478,
907,
20828,
368,
341,
286,
369,
7168,
304,
54593,
1570,
341,
310,
2060,
10714,
10297,
4659,
1279,
11478,
907,
20828,
34967,
3009,
13174,
2328,
11,
220,
15,
701,
13589,
65,
1268... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_prune_table() {
use std::net::Ipv4Addr;
solana_logger::setup();
let mut table = ConnectionTable::default();
let num_entries = 5;
let max_connections_per_ip = 10;
let sockets: Vec<_> = (0..num_entries)
.into_iter()
.map(|i| SocketAddr::new(IpAddr::V4(Ipv4Addr::new(i, 0, 0, 0)), 0))
.collect();
for (i, socket) in sockets.iter().enumerate() {
table
.try_add_connection(socket, i as u64, max_connections_per_ip)
.unwrap();
}
let new_size = 3;
let pruned = table.prune_oldest(new_size);
assert_eq!(pruned, num_entries as usize - new_size);
for v in table.table.values() {
for x in v {
assert!(x.last_update() >= (num_entries as u64 - new_size as u64));
}
}
assert_eq!(table.table.len(), new_size);
assert_eq!(table.total_size, new_size);
for socket in sockets.iter().take(num_entries as usize).skip(new_size - 1) {
table.remove_connection(socket);
}
info!("{:?}", table);
assert_eq!(table.total_size, 0);
} | rust_cleaned_test_functions.jsonl/61952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
2886,
5237,
368,
341,
286,
990,
1460,
486,
4711,
486,
80656,
19,
13986,
280,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5206,
1965,
284,
11032,
2556,
486,
2258,
543,
286,
1077,
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... | 5 |
#[test]
fn test_build_request_json_config_options() {
let commitment_config = CommitmentConfig {
commitment: CommitmentLevel::Max,
};
let addr = json!("deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx");
// Test request with CommitmentConfig and no params
let test_request = RpcRequest::GetRecentBlockhash;
let request = test_request.build_request_json(1, json!([commitment_config.clone()]));
assert_eq!(request["params"], json!([commitment_config.clone()]));
// Test request with CommitmentConfig and params
let test_request = RpcRequest::GetBalance;
let request =
test_request.build_request_json(1, json!([addr.clone(), commitment_config.clone()]));
assert_eq!(request["params"], json!([addr, commitment_config]));
} | rust_cleaned_test_functions.jsonl/57072 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
7893,
9455,
5332,
8743,
368,
341,
286,
1077,
15155,
5332,
284,
9205,
478,
2648,
341,
310,
15155,
25,
9205,
478,
4449,
486,
5974,
345,
286,
2605,
286,
1077,
10789,
284,
2951,
17223,
33754,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_power_state_frame_when_switching_channel_while_connected() {
let mut m = MockObjects::new();
let mut me = m.make_mlme();
me.make_client_station();
let mut client = me.get_bound_client().expect("client should be present");
// Pretend that client is associated by starting LostBssCounter
client.move_to_associated_state();
// clear the LostBssCounter timeout.
m.fake_scheduler.deadlines.clear();
// Send scan request to trigger channel switch
me.on_sme_scan(scan_req());
assert_eq!(me.ctx.device.channel().primary, SCAN_CHANNEL_PRIMARY);
// Verify that power state frame is sent
assert_eq!(m.fake_device.wlan_queue.len(), 1);
#[rustfmt::skip]
assert_eq!(&m.fake_device.wlan_queue[0].0[..], &[
// Data header:
0b0100_10_00, 0b00010001, // FC
0, 0, // Duration
6, 6, 6, 6, 6, 6, // addr1
7, 7, 7, 7, 7, 7, // addr2
6, 6, 6, 6, 6, 6, // addr3
0x10, 0, // Sequence Control
][..]);
m.fake_device.wlan_queue.clear();
// There should be one scheduled event for end of channel period
assert_eq!(m.fake_scheduler.deadlines.len(), 1);
let (id, _deadline) = m.fake_scheduler.next_event().expect("expect scheduled event");
me.handle_timed_event(id);
assert_eq!(me.ctx.device.channel(), MAIN_CHANNEL);
// Verify that power state frame is sent
assert_eq!(m.fake_device.wlan_queue.len(), 1);
#[rustfmt::skip]
assert_eq!(&m.fake_device.wlan_queue[0].0[..], &[
// Data header:
0b0100_10_00, 0b00000001, // FC
0, 0, // Duration
6, 6, 6, 6, 6, 6, // addr1
7, 7, 7, 7, 7, 7, // addr2
6, 6, 6, 6, 6, 6, // addr3
0x20, 0, // Sequence Control
][..]);
} | rust_cleaned_test_functions.jsonl/87192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 953
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
20421,
4387,
8929,
47636,
27652,
287,
14571,
86069,
43276,
368,
341,
286,
1077,
5206,
296,
284,
14563,
11543,
486,
931,
543,
286,
1077,
5206,
752,
284,
296,
10117,
76567,
2660,
543,
286,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cache_derived_key() {
let cdk = CacheDerivedKey::new("12345678", &[1, 1, 1, 1]);
let ret = cdk.get_derived_key("1234");
assert!(ret.is_err());
assert_eq!(format!("{}", ret.err().unwrap()), "password_incorrect");
let ret = cdk.get_derived_key("12345678").unwrap();
assert_eq!(hex::encode(ret), "01010101");
} | rust_cleaned_test_functions.jsonl/106106 | {
"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,
11529,
35345,
2221,
3097,
368,
341,
286,
1077,
272,
7584,
284,
19479,
67843,
1592,
486,
931,
445,
16,
17,
18,
19,
20,
21,
22,
23,
497,
44590,
16,
11,
220,
16,
11,
220,
16,
11,
220,
16,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arena_new() {
let a = Arena::<usize>::new();
assert!(a.is_empty());
assert_eq!(0, a.len());
assert_eq!(0, a.capacity());
} | rust_cleaned_test_functions.jsonl/30750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
30527,
5921,
368,
341,
286,
1077,
264,
284,
27047,
27638,
51878,
6831,
931,
543,
286,
2060,
10297,
64,
2079,
15124,
1423,
286,
2060,
10714,
10297,
15,
11,
264,
19406,
1423,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_struct_field_completion() {
assert_debug_snapshot!(
do_ref_completion(
r"
struct A { the_field: u32 }
fn foo(a: A) {
a.<|>
}
",
),
@r###"
⋮[
⋮ CompletionItem {
⋮ label: "the_field",
⋮ source_range: [94; 94),
⋮ delete: [94; 94),
⋮ insert: "the_field",
⋮ kind: Field,
⋮ detail: "u32",
⋮ },
⋮]
"###
);
} | rust_cleaned_test_functions.jsonl/117149 | {
"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,
15126,
5013,
60164,
368,
341,
286,
2060,
15446,
53265,
33673,
286,
653,
7793,
60164,
1006,
394,
435,
698,
394,
2036,
362,
314,
279,
5013,
25,
575,
18,
17,
456,
394,
5168,
15229,
2877,
25,
362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_packed_to_unpacked() {
let mut test = TestUnpacked::new();
test.varints = vec![17i32, 1000];
test_deserialize("22 03 11 e8 07", &test);
let mut test = TestUnpacked::new();
test.sfixed32s = vec![17i32, 1000];
test_deserialize("2a 08 11 00 00 00 e8 03 00 00", &test);
} | rust_cleaned_test_functions.jsonl/47067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
620,
11191,
2346,
4907,
50321,
368,
341,
262,
1077,
5206,
1273,
284,
3393,
1806,
50321,
486,
931,
543,
262,
1273,
19526,
21042,
284,
7486,
20703,
16,
22,
72,
18,
17,
11,
220,
16,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_phase_key() {
let main = Key(hex::decode(
"588ba9eef353778b074413a0140205d90d7479e36e0dd4ee35bb729d26131ef1",
)
.unwrap());
let dk11 = derive_phase_key(
&EitherSide::from("side1"),
&main,
&Phase(String::from("phase1")),
);
assert_eq!(
hex::encode(&*dk11),
"3af6a61d1a111225cc8968c6ca6265efe892065c3ab46de79dda21306b062990"
);
let dk12 = derive_phase_key(
&EitherSide::from("side1"),
&main,
&Phase(String::from("phase2")),
);
assert_eq!(
hex::encode(&*dk12),
"88a1dd12182d989ff498022a9656d1e2806f17328d8bf5d8d0c9753e4381a752"
);
let dk21 = derive_phase_key(
&EitherSide::from("side2"),
&main,
&Phase(String::from("phase1")),
);
assert_eq!(
hex::encode(&*dk21),
"a306627b436ec23bdae3af8fa90c9ac927780d86be1831003e7f617c518ea689"
);
let dk22 = derive_phase_key(
&EitherSide::from("side2"),
&main,
&Phase(String::from("phase2")),
);
assert_eq!(
hex::encode(&*dk22),
"bf99e3e16420f2dad33f9b1ccb0be1462b253d639dacdb50ed9496fa528d8758"
);
} | rust_cleaned_test_functions.jsonl/89674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 841
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
37593,
3097,
368,
341,
286,
1077,
1887,
284,
5309,
44660,
486,
18196,
1006,
310,
330,
20,
23,
23,
4645,
24,
68,
823,
18,
20,
18,
22,
22,
23,
65,
15,
22,
19,
19,
16,
18,
64,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cdc_tso_failure() {
let mut suite = TestSuite::new(3);
let mut req = ChangeDataRequest::default();
req.region_id = 1;
req.set_region_epoch(suite.get_context(1).take_region_epoch());
let (event_feed_wrap, receive_event) = new_event_feed(&suite.cdc_cli, &req);
// Make sure region 1 is registered.
let event = receive_event(false);
match event {
// it should always outputs an Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
_ => panic!("unknown event"),
}
suite.cluster.pd_client.trigger_tso_failure();
// Make sure resolved ts can be advanced normally even with few tso failures.
for _ in 0..10 {
let event = receive_event(true);
match event {
Event_oneof_event::ResolvedTs(ts) => assert_ne!(0, ts),
_ => panic!("unknown event"),
}
}
event_feed_wrap.as_ref().replace(None);
suite.stop();
} | rust_cleaned_test_functions.jsonl/3782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7628,
528,
704,
43618,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
18,
626,
262,
1077,
5206,
4232,
284,
10388,
1043,
1900,
486,
2258,
543,
262,
4232,
42976,
842,
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_command_with_no_args() {
new_ucmd!()
.args(&["-n", "19", "echo"])
.run()
.stdout_is("\n");
} | rust_cleaned_test_functions.jsonl/15167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
6615,
6536,
8384,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
77,
497,
330,
16,
24,
497,
330,
3047,
14108,
286,
659,
6108,
741,
286,
659,
36358,
6892,
4921,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decoding() {
assert_eq!(Label::from_raw_bytes(b"abc").unwrap().to_string(), "abc");
assert_eq!(
Label::from_raw_bytes(b"xn--zs9h").unwrap().to_string(),
"🦀"
);
assert_eq!(
Label::from_raw_bytes(b"xn--rust--icon-9447i")
.unwrap()
.to_string(),
"rust-🦀-icon"
);
} | rust_cleaned_test_functions.jsonl/5049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
3700,
368,
341,
286,
2060,
10714,
10297,
2476,
486,
1499,
16067,
12524,
1883,
1,
13683,
1827,
15454,
1005,
983,
3904,
1507,
330,
13683,
797,
286,
2060,
10714,
33673,
310,
9402,
486,
1499,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_module_specifiers() {
let (mut runtime, state_snapshot, _) = setup(
false,
json!({
"target": "esnext",
"module": "esnext",
"lib": ["deno.ns", "deno.window"],
"noEmit": true,
}),
&[(
"file:///a.ts",
r#"
import { A } from ".";
"#,
1,
LanguageId::TypeScript,
)],
);
let specifier = resolve_url("file:///a.ts").expect("could not resolve url");
let result = request(
&mut runtime,
state_snapshot,
RequestMethod::GetDiagnostics(vec![specifier]),
);
assert!(result.is_ok());
let response = result.unwrap();
assert_eq!(
response,
json!({
"file:///a.ts": [{
"start": {
"line": 1,
"character": 8
},
"end": {
"line": 1,
"character": 30
},
"fileName": "file:///a.ts",
"messageText": "\'A\' is declared but its value is never read.",
"sourceLine": " import { A } from \".\";",
"category": 2,
"code": 6133,
"reportsUnnecessary": true,
}]
})
);
} | rust_cleaned_test_functions.jsonl/23623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 654
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
10750,
13594,
11836,
368,
341,
262,
1077,
320,
6984,
15592,
11,
1584,
53265,
11,
27439,
284,
6505,
1006,
414,
895,
345,
414,
2951,
0,
2262,
286,
330,
5657,
788,
330,
288,
3600,
756,
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_from_hash4() -> Result<()> {
let addr = Address::from_hash("redridinghood", AddressType::P2SH, Hash160::new([0; 20]));
assert_eq!(
addr.cash_addr(),
"redridinghood:pqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxmg9w0gt"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/16400 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
8950,
19,
368,
1464,
5714,
71698,
341,
286,
1077,
10789,
284,
9177,
486,
1499,
8950,
445,
1151,
49680,
5694,
497,
9177,
929,
486,
47,
17,
8590,
11,
6531,
16,
21,
15,
486,
931,
2561,
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_unseen() {
match parse_response(b"* OK [UNSEEN 3] Message 3 is first unseen\r\n").unwrap() {
(
_,
Response::Data {
status: Status::Ok,
code: Some(ResponseCode::Unseen(3)),
information: Some("Message 3 is first unseen"),
},
) => {}
rsp => panic!("unexpected response {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/8538 | {
"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,
4907,
28312,
368,
341,
286,
2432,
4715,
9655,
1883,
61593,
10402,
508,
1861,
925,
953,
220,
18,
60,
4856,
220,
18,
374,
1156,
63133,
12016,
1699,
1827,
15454,
368,
341,
310,
2399,
394,
716,
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... | 2 |
#[test]
fn test_sub_imm_mem() {
assert_emit!(0x83, 0x28, 1; emit_sub_imm_mem(MachineMode::Int32, RAX, 1));
assert_emit!(0x48, 0x83, 0x28, 1; emit_sub_imm_mem(MachineMode::Ptr, RAX, 1));
assert_emit!(0x49, 0x83, 0x29, 1; emit_sub_imm_mem(MachineMode::Ptr, R9, 1));
assert_emit!(0x49, 0x83, 0x28, 1; emit_sub_imm_mem(MachineMode::Ptr, R8, 1));
assert_emit!(0x41, 0x80, 0x28, 1; emit_sub_imm_mem(MachineMode::Int8, R8, 1));
} | rust_cleaned_test_functions.jsonl/85477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
71370,
12976,
368,
341,
286,
2060,
69082,
10297,
15,
87,
23,
18,
11,
220,
15,
87,
17,
23,
11,
220,
16,
26,
16691,
5228,
71370,
12976,
3189,
3814,
3636,
486,
1072,
18,
17,
11,
431,
2954... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_iter_many_zero_length() {
let re = Regex::new(r"\d*").unwrap();
let ms = re.find_iter("a1bbb2").collect::<Vec<_>>();
assert_eq!(ms, vec![(0, 0), (1, 2), (3, 3), (4, 4), (5, 6)]);
} | rust_cleaned_test_functions.jsonl/123807 | {
"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,
21814,
11723,
22101,
19359,
5118,
368,
341,
286,
1077,
312,
284,
26146,
486,
931,
2601,
11934,
67,
9,
1827,
15454,
543,
286,
1077,
9829,
284,
312,
2658,
11723,
445,
64,
16,
53151,
17,
1827,
1738... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_skipping_code_blocks() {
Command::cargo_bin("specdown")
.unwrap()
.arg("--no-colour")
.arg("run")
.arg("--running-dir")
.arg(".specdown")
.arg("docs/specs/skipping_code_blocks.md")
.assert()
.success();
} | rust_cleaned_test_functions.jsonl/104103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
33811,
5654,
4136,
25201,
368,
341,
262,
7348,
486,
66715,
21816,
445,
9535,
2923,
1138,
286,
659,
15454,
741,
286,
659,
858,
21549,
2152,
19459,
413,
1138,
286,
659,
858,
445,
6108,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display() {
let version = Version::parse("1.2.3-rc1").unwrap();
assert_eq!(format!("{:20}", version), "1.2.3-rc1 ");
assert_eq!(format!("{:*^20}", version), "*****1.2.3-rc1******");
assert_eq!(format!("{:.4}", version), "1.2.");
} | rust_cleaned_test_functions.jsonl/43103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
2319,
284,
6079,
486,
6400,
445,
16,
13,
17,
13,
18,
12,
1287,
16,
1827,
15454,
543,
286,
2060,
10714,
10297,
2243,
88928,
25,
17,
15,
9545,
2319,
701,
330,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tile_motion_vectors_write() {
let (fi, mut fs, mut fb, frame_rate) = setup(160, 144);
{
let ti = TilingInfo::from_target_tiles(
fi.sb_size_log2(),
fi.width,
fi.height,
frame_rate,
2,
2,
false,
);
let iter = ti.tile_iter_mut(&mut fs, &mut fb);
let mut tile_states = iter.map(|ctx| ctx.ts).collect::<Vec<_>>();
{
let me_stats = &mut tile_states[0].me_stats[0];
me_stats[5][8].mv = MotionVector { col: 42, row: 38 };
println!("{:?}", me_stats[5][8].mv);
}
{
let me_stats = &mut tile_states[5].me_stats[2];
me_stats[2][3].mv = MotionVector { col: 2, row: 14 };
}
}
// check that writes on tiled views affected the underlying motion vectors
let me_stats = &fs.frame_me_stats[0];
assert_eq!(MotionVector { col: 42, row: 38 }, me_stats[5][8].mv);
let me_stats = &fs.frame_me_stats[2];
let mix = (128 >> MI_SIZE_LOG2) + 3;
let miy = (64 >> MI_SIZE_LOG2) + 2;
assert_eq!(MotionVector { col: 2, row: 14 }, me_stats[miy][mix].mv);
} | rust_cleaned_test_functions.jsonl/30660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29844,
65460,
49158,
9165,
368,
341,
262,
1077,
320,
9983,
11,
5206,
8619,
11,
5206,
25469,
11,
4034,
9246,
8,
284,
6505,
7,
16,
21,
15,
11,
220,
16,
19,
19,
626,
262,
341,
6926,
414,
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_withdraw_stake() {
let stake_pubkey = Pubkey::new_rand();
let stake_lamports = 42;
let stake_account = Account::new_ref_data_with_space(
stake_lamports,
&StakeState::Uninitialized,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let mut clock = Clock::default();
let to = Pubkey::new_rand();
let to_account = Account::new_ref(1, 0, &system_program::id());
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, false, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&HashSet::default(),
),
Err(InstructionError::MissingRequiredSignature)
);
// signed keyed account and uninitialized should work
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
let signers = vec![stake_pubkey].into_iter().collect();
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&signers,
),
Ok(())
);
assert_eq!(stake_account.borrow().lamports, 0);
// reset balance
stake_account.borrow_mut().lamports = stake_lamports;
// lockup
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
let custodian = Pubkey::new_rand();
stake_keyed_account
.initialize(
&Authorized::auto(&stake_pubkey),
&Lockup {
unix_timestamp: 0,
epoch: 0,
custodian,
},
&Rent::free(),
)
.unwrap();
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports + 1,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&signers,
),
Err(InstructionError::InsufficientFunds)
);
let vote_pubkey = Pubkey::new_rand();
let vote_account = RefCell::new(vote_state::create_account(
&vote_pubkey,
&Pubkey::new_rand(),
0,
100,
));
let vote_keyed_account = KeyedAccount::new(&vote_pubkey, false, &vote_account);
vote_keyed_account
.set_state(&VoteStateVersions::Current(Box::new(VoteState::default())))
.unwrap();
assert_eq!(
stake_keyed_account.delegate(
&vote_keyed_account,
&clock,
&StakeHistory::default(),
&Config::default(),
&signers,
),
Ok(())
);
// simulate rewards
stake_account.borrow_mut().lamports += 10;
// withdrawal before deactivate works for rewards amount
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
assert_eq!(
stake_keyed_account.withdraw(
10,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&signers,
),
Ok(())
);
// simulate rewards
stake_account.borrow_mut().lamports += 10;
// withdrawal of rewards fails if not in excess of stake
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
assert_eq!(
stake_keyed_account.withdraw(
10 + 1,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&signers
),
Err(InstructionError::InsufficientFunds)
);
// deactivate the stake before withdrawal
assert_eq!(stake_keyed_account.deactivate(&clock, &signers), Ok(()));
// simulate time passing
clock.epoch += 100;
// Try to withdraw more than what's available
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports + 10 + 1,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&signers
),
Err(InstructionError::InsufficientFunds)
);
// Try to withdraw all lamports
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports + 10,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&signers
),
Ok(())
);
assert_eq!(stake_account.borrow().lamports, 0);
} | rust_cleaned_test_functions.jsonl/39442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2996
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
7633,
1261,
726,
368,
341,
286,
1077,
18279,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
1077,
18279,
13500,
284,
8615,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_subscribe() {
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests()));
let validator_voting_keypairs: Vec<_> = (0..10)
.map(|_| ValidatorVoteKeypairs::new(Keypair::new(), Keypair::new(), Keypair::new()))
.collect();
let GenesisConfigInfo { genesis_config, .. } =
create_genesis_config_with_vote_accounts(10_000, &validator_voting_keypairs, 100);
let exit = Arc::new(AtomicBool::new(false));
let bank = Bank::new(&genesis_config);
let bank_forks = BankForks::new(bank);
let bank = bank_forks.get(0).unwrap().clone();
let bank_forks = Arc::new(RwLock::new(bank_forks));
// Setup RPC
let mut rpc = RpcSolPubSubImpl::default_with_bank_forks(bank_forks.clone());
let session = create_session();
let (subscriber, _id_receiver, receiver) = Subscriber::new_test("voteNotification");
// Setup Subscriptions
let subscriptions = RpcSubscriptions::new(&exit, bank_forks, block_commitment_cache);
rpc.subscriptions = Arc::new(subscriptions);
rpc.vote_subscribe(session, subscriber);
// Create some voters at genesis
let vote_tracker = VoteTracker::new(&bank);
let (votes_sender, votes_receiver) = unbounded();
let (vote_tracker, validator_voting_keypairs) =
(Arc::new(vote_tracker), validator_voting_keypairs);
let vote_slots = vec![1, 2];
validator_voting_keypairs.iter().for_each(|keypairs| {
let node_keypair = &keypairs.node_keypair;
let vote_keypair = &keypairs.vote_keypair;
let vote_tx = vote_transaction::new_vote_transaction(
vote_slots.clone(),
Hash::default(),
Hash::default(),
node_keypair,
vote_keypair,
vote_keypair,
);
votes_sender.send(vec![vote_tx]).unwrap();
});
// Process votes and check they were notified.
ClusterInfoVoteListener::get_and_process_votes_for_tests(
&votes_receiver,
&vote_tracker,
0,
&rpc.subscriptions,
)
.unwrap();
let (response, _) = robust_poll_or_panic(receiver);
assert_eq!(
response,
r#"{"jsonrpc":"2.0","method":"voteNotification","params":{"result":{"hash":"11111111111111111111111111111111","slots":[1,2],"timestamp":null},"subscription":0}}"#
);
} | rust_cleaned_test_functions.jsonl/16584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
88935,
368,
341,
286,
1077,
2504,
36346,
478,
11529,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
55243,
33441,
478,
8233,
486,
931,
5478,
32509,
25138,
286,
1077,
22935,
2273,
11519,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strong_pattern() {
let output = inline_parse(&String::from("**hoge**"));
assert_eq!(
output,
String::from(r#"<strong class="flav-md-strong">hoge</strong>"#)
);
} | rust_cleaned_test_functions.jsonl/22203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
644,
21260,
368,
341,
310,
1077,
2550,
284,
7381,
21039,
2099,
703,
486,
1499,
91389,
71,
40532,
334,
4010,
310,
2060,
10714,
33673,
394,
2550,
345,
394,
923,
486,
1499,
2601,
2,
22476,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cluster_spy_gossip() {
let thread_pool = ThreadPoolBuilder::new().build().unwrap();
//check that gossip doesn't try to push to invalid addresses
let node = Node::new_localhost();
let (spy, _, _) = ClusterInfo::spy_node(solana_sdk::pubkey::new_rand(), 0);
let cluster_info = Arc::new(ClusterInfo::new(
node.info,
Arc::new(Keypair::new()),
SocketAddrSpace::Unspecified,
));
cluster_info.insert_info(spy);
cluster_info.gossip.refresh_push_active_set(
&cluster_info.id(),
cluster_info.my_shred_version(),
&HashMap::new(), // stakes
None, // gossip validators
&SocketAddrSpace::Unspecified,
);
let reqs = cluster_info.generate_new_gossip_requests(
&thread_pool,
None, // gossip_validators
&HashMap::new(), // stakes
true, // generate_pull_requests
);
//assert none of the addrs are invalid.
reqs.iter().all(|(addr, _)| {
let res = ContactInfo::is_valid_address(addr, &SocketAddrSpace::Unspecified);
assert!(res);
res
});
} | rust_cleaned_test_functions.jsonl/26023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 635
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28441,
643,
3288,
1889,
41473,
368,
341,
286,
1077,
4516,
15709,
284,
72716,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
442,
2028,
429,
57487,
3171,
944,
1430,
311,
4484,
311,
8318,
14230,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_label_resolution() {
assert_eq!(Encoding::for_label(b"utf-8"), Some(UTF_8));
assert_eq!(Encoding::for_label(b"UTF-8"), Some(UTF_8));
assert_eq!(
Encoding::for_label(b" \t \n \x0C \n utf-8 \r \n \t \x0C "),
Some(UTF_8)
);
assert_eq!(Encoding::for_label(b"utf-8 _"), None);
assert_eq!(Encoding::for_label(b"bogus"), None);
assert_eq!(Encoding::for_label(b"bogusbogusbogusbogus"), None);
} | rust_cleaned_test_functions.jsonl/90243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6106,
39849,
368,
341,
286,
2060,
10714,
10297,
14690,
486,
1958,
6106,
1883,
1,
4762,
12,
23,
3975,
4329,
7,
8561,
62,
23,
1106,
286,
2060,
10714,
10297,
14690,
486,
1958,
6106,
1883,
1,
8561,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commit_ok() {
test_commit_ok_imp(b"x", b"v", b"y", b"z");
let long_value = "v".repeat(SHORT_VALUE_MAX_LEN + 1).into_bytes();
test_commit_ok_imp(b"x", &long_value, b"y", b"z");
} | rust_cleaned_test_functions.jsonl/47472 | {
"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,
36346,
19817,
368,
341,
286,
1273,
36346,
19817,
36788,
1883,
65438,
497,
293,
1,
85,
497,
293,
1,
88,
497,
293,
1,
89,
3071,
286,
1077,
1293,
3142,
284,
330,
85,
3263,
30624,
3759,
70702,
747... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_matmul_normal() {
// blas is used
with(|g: &mut ag::Graph<f32>| {
let a: ag::Tensor<f32> = g.ones(&[2, 3, 4, 2]);
let b: ag::Tensor<f32> = g.ones(&[2, 3, 2, 3]);
let c = g.batch_matmul(a, b);
let shape = &[2, 3, 4, 3];
let size = shape.iter().product();
let ans = NdArray::<_>::from_shape_vec(ndarray::IxDyn(shape), vec![2f32; size]).unwrap();
let ret = c.eval(&[]).unwrap();
ret.all_close(&ans, 1e-4);
});
} | rust_cleaned_test_functions.jsonl/22773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
16610,
24160,
13973,
368,
341,
262,
442,
48577,
374,
1483,
198,
262,
448,
22428,
70,
25,
609,
6984,
933,
486,
11212,
63895,
18,
17,
69844,
341,
286,
1077,
264,
25,
933,
486,
25336,
63895,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minimal_tree() {
let mut binary_tree = BinaryTree::<i32>::new();
let arr: Vec<i32> = (0..10).collect();
binary_tree.add_vector(&arr);
assert_eq!(binary_tree.height(), 4);
} | rust_cleaned_test_functions.jsonl/15600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
2861,
11663,
368,
341,
286,
1077,
5206,
7868,
11663,
284,
98070,
27638,
72,
18,
17,
6831,
931,
543,
286,
1077,
2890,
25,
11312,
21897,
18,
17,
29,
284,
320,
15,
496,
16,
15,
568,
17384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_chunk_request_messages() {
// Create a coordinator for a validator node
let mut validator_coordinator = test_utils::create_validator_coordinator();
// Constants for the chunk requests
let peer_network_id = PeerNetworkId::random();
let current_epoch = 0;
let chunk_limit = 250;
let timeout_ms = 1000;
// Create chunk requests with a known version higher than the target
let known_version = 100;
let target_version = 10;
let chunk_requests = create_chunk_requests(
known_version,
current_epoch,
chunk_limit,
target_version,
timeout_ms,
);
// Verify invalid request errors are thrown
verify_all_chunk_requests_are_invalid(
&mut validator_coordinator,
&peer_network_id,
&chunk_requests,
);
// Create chunk requests with a current epoch higher than the target epoch
let known_version = 0;
let current_epoch = 100;
let chunk_requests = create_chunk_requests(
known_version,
current_epoch,
chunk_limit,
target_version,
timeout_ms,
);
// Verify invalid request errors are thrown
verify_all_chunk_requests_are_invalid(
&mut validator_coordinator,
&peer_network_id,
&chunk_requests[1..2], // Ignore waypoint request
);
let chunk_limit = 0;
let chunk_requests = create_chunk_requests(
known_version,
current_epoch,
chunk_limit,
target_version,
timeout_ms,
);
// Verify invalid request errors are thrown
verify_all_chunk_requests_are_invalid(
&mut validator_coordinator,
&peer_network_id,
&chunk_requests,
);
let chunk_limit = 0;
let chunk_requests = create_chunk_requests(
known_version,
current_epoch,
chunk_limit,
target_version,
timeout_ms,
);
// Verify invalid request errors are thrown
verify_all_chunk_requests_are_invalid(
&mut validator_coordinator,
&peer_network_id,
&chunk_requests,
);
} | rust_cleaned_test_functions.jsonl/84047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
30539,
7893,
23428,
368,
341,
286,
442,
4230,
264,
30284,
369,
264,
22935,
2436,
198,
286,
1077,
5206,
22935,
11393,
17442,
284,
1273,
17309,
486,
3182,
64959,
11393,
17442,
1428,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tree_from_many() {
let mt = MerkleTree::new(TEST);
// This golden hash will need to be updated whenever the contents of `TEST` change in any
// changes
let bytes = hex::decode("b40c847546fdceea166f927fc46c5ca33c3638236a36275c1346d3dffb84e1bc")
.unwrap();
let expected = Hash::new(&bytes);
assert_eq!(mt.get_root(), Some(&expected));
} | rust_cleaned_test_functions.jsonl/112980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
5673,
22101,
368,
341,
286,
1077,
11965,
284,
8755,
23089,
6533,
486,
931,
50320,
317,
286,
442,
1096,
20748,
5175,
686,
1184,
311,
387,
6049,
15356,
279,
8794,
315,
1565,
10033,
63,
2297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_null_offset() {
let b = UInt8Array::from(vec![Some(1), None, Some(3)]);
let b = b.slice(1, 2).data();
let arrays = vec![b.as_ref()];
let mut a = MutableArrayData::new(arrays, false, 2);
a.extend(0, 0, 2);
let result = a.freeze();
let array = UInt8Array::from(Arc::new(result));
let expected = UInt8Array::from(vec![None, Some(3)]);
assert_eq!(array, expected);
} | rust_cleaned_test_functions.jsonl/102336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
15162,
6917,
368,
341,
286,
1077,
293,
284,
22275,
23,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
701,
2240,
11,
4329,
7,
18,
41958,
286,
1077,
293,
284,
293,
14530,
7,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neg() {
let ctx = FieldCtx::new();
for _ in 0..100 {
let x = rand_elem();
let neg_x = ctx.neg(&x);
let zero = ctx.add(&x, &neg_x);
assert!(zero.is_zero());
}
} | rust_cleaned_test_functions.jsonl/99468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
368,
341,
286,
1077,
5635,
284,
8601,
23684,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
341,
310,
1077,
856,
284,
10382,
28179,
543,
310,
1077,
4184,
3212,
284,
5635,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_row_iter() {
let mat = m!(1, 2; 3, 4; 5, 6);
let mut iter = mat.row_iter();
let row1 = iter.next();
assert_eq!(row1, Some(m![1, 2]));
let row2 = iter.next();
assert_eq!(row2, Some(m![3, 4]));
let row3 = iter.next();
assert_eq!(row3, Some(m![5, 6]));
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/61504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
11723,
368,
341,
286,
1077,
5517,
284,
296,
10297,
16,
11,
220,
17,
26,
220,
18,
11,
220,
19,
26,
220,
20,
11,
220,
21,
626,
286,
1077,
5206,
5367,
284,
5517,
11547,
11723,
1428,
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_resize_winapi() {
let (width, height) = size().unwrap();
set_size(30, 30).unwrap();
assert_eq!((30, 30), size().unwrap());
// reset to previous size
set_size(width, height).unwrap();
assert_eq!((width, height), size().unwrap());
} | rust_cleaned_test_functions.jsonl/47954 | {
"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,
53370,
25672,
2068,
368,
341,
286,
1077,
320,
3098,
11,
2608,
8,
284,
1379,
1005,
15454,
1428,
286,
738,
2368,
7,
18,
15,
11,
220,
18,
15,
568,
15454,
543,
286,
2060,
10714,
0,
1188,
18,
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_worst_case_encoded_tx_goldens() {
let ff_tx = vec![0xffu8; PACKET_DATA_SIZE];
let tx58 = bs58::encode(&ff_tx).into_string();
assert_eq!(tx58.len(), MAX_BASE58_SIZE);
let tx64 = base64::encode(&ff_tx);
assert_eq!(tx64.len(), MAX_BASE64_SIZE);
} | rust_cleaned_test_functions.jsonl/6340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
65296,
19096,
73069,
17805,
54696,
724,
368,
341,
286,
1077,
25539,
17805,
284,
7486,
20703,
15,
9020,
84,
23,
26,
73205,
7896,
4098,
935,
286,
1077,
9854,
20,
23,
284,
17065,
20,
23,
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_write_f64() {
assert_eq!(F64(3.0).to_string(), "3.0");
assert_eq!(F64(3.0).pretty().to_string(), "3.0");
assert_eq!(F64(3.1).to_string(), "3.1");
assert_eq!(F64(3.1).pretty().to_string(), "3.1");
assert_eq!(F64(-1.5).to_string(), "-1.5");
assert_eq!(F64(-1.5).pretty().to_string(), "-1.5");
assert_eq!(F64(0.5).to_string(), "0.5");
assert_eq!(F64(0.5).pretty().to_string(), "0.5");
assert_eq!(F64(f64::NAN).to_string(), "null");
assert_eq!(F64(f64::NAN).pretty().to_string(), "null");
assert_eq!(F64(f64::INFINITY).to_string(), "null");
assert_eq!(F64(f64::INFINITY).pretty().to_string(), "null");
assert_eq!(F64(f64::NEG_INFINITY).to_string(), "null");
assert_eq!(F64(f64::NEG_INFINITY).pretty().to_string(), "null");
} | rust_cleaned_test_functions.jsonl/22704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
761,
21,
19,
368,
341,
286,
2060,
10714,
10297,
37,
21,
19,
7,
18,
13,
15,
568,
983,
3904,
1507,
330,
18,
13,
15,
797,
286,
2060,
10714,
10297,
37,
21,
19,
7,
18,
13,
15,
568,
3295... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scope_resolution_on_second_level_block_scope() {
let module_scope = ModuleScope::new();
let contract_scope = ContractScope::new(module_scope);
let block_scope_1 =
BlockScope::from_contract_scope(Span::new(0, 0), Rc::clone(&contract_scope));
let block_scope_2 = BlockScope::from_block_scope(
Span::new(0, 0),
BlockScopeType::IfElse,
Rc::clone(&block_scope_1),
);
assert_eq!(block_scope_1, block_scope_2.borrow().function_scope());
assert_eq!(contract_scope, block_scope_2.borrow().contract_scope());
} | rust_cleaned_test_functions.jsonl/14885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
39849,
4470,
29644,
8274,
7113,
23199,
368,
341,
286,
1077,
4688,
23199,
284,
13711,
10803,
486,
931,
543,
286,
1077,
5116,
23199,
284,
19185,
10803,
486,
931,
19123,
23199,
317,
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_get_bank_snapshot_infos() {
solana_logger::setup();
let temp_snapshots_dir = tempfile::TempDir::new().unwrap();
let min_slot = 10;
let max_slot = 20;
common_create_bank_snapshot_files(temp_snapshots_dir.path(), min_slot, max_slot);
let bank_snapshot_infos = get_bank_snapshots(temp_snapshots_dir.path());
assert_eq!(bank_snapshot_infos.len() as Slot, max_slot - min_slot);
} | rust_cleaned_test_functions.jsonl/67604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
35733,
53265,
47779,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2730,
74175,
27634,
4334,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
1308,
27563,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_and_regaddr_addr() {
let compiled = compile("SET HL 50\nSET A 255\nWRITE64 A\nSET HL 100\nSET C 345\nWRITE64 C\nSET B 100\nAND (B) (50)");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.hl.value, 100);
assert_eq!(out_cpu.a.value, 255);
assert_eq!(out_cpu.b.value, 100);
assert_eq!(out_cpu.c.value, 345);
assert_eq!(out_cpu.memory.read_64bit(50), 255);
assert_eq!(out_cpu.memory.read_64bit(100), 89);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
4920,
6214,
7387,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
52487,
220,
20,
15,
1699,
5884,
362,
220,
17,
20,
20,
1699,
32781,
21,
19,
362,
1699,
5884,
52487,
220,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_secure_bn_ctx() {
let mut cxt = BigNumContext::new_secure().unwrap();
let a = BigNum::from_u32(8).unwrap();
let b = BigNum::from_u32(3).unwrap();
let mut remainder = BigNum::new().unwrap();
remainder.nnmod(&a, &b, &mut cxt).unwrap();
assert!(remainder.eq(&BigNum::from_u32(2).unwrap()));
} | rust_cleaned_test_functions.jsonl/52801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73088,
58112,
15147,
368,
341,
286,
1077,
5206,
272,
2252,
284,
6164,
4651,
1972,
486,
931,
73088,
1005,
15454,
543,
286,
1077,
264,
284,
6164,
4651,
486,
1499,
7300,
18,
17,
7,
23,
568,
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... | 1 |
#[test]
fn test_mean() {
assert_eq!(Arcsine::new_unchecked(0.0, 1.0).mean(), 0.5);
assert_eq!(Arcsine::new_unchecked(-1.0, 1.0).mean(), -0.5);
assert_eq!(Arcsine::new_unchecked(-1.0, 2.0).mean(), 0.0);
} | rust_cleaned_test_functions.jsonl/107411 | {
"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,
16933,
368,
341,
286,
2060,
10714,
10297,
36809,
82,
482,
486,
931,
4907,
7549,
7,
15,
13,
15,
11,
220,
16,
13,
15,
568,
14287,
1507,
220,
15,
13,
20,
317,
286,
2060,
10714,
10297,
36809,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sysvar_invalid_id_without_feature() {
let mut feature_set = FeatureSet::all_enabled();
feature_set
.active
.remove(&feature_set::rent_for_sysvars::id());
feature_set
.inactive
.insert(feature_set::rent_for_sysvars::id());
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let mut invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
invoke_context.feature_set = Arc::new(feature_set);
// Attempt to create system account in account already owned by another program
let from = Pubkey::new_unique();
let from_account = RefCell::new(AccountSharedData::new(100, 0, &system_program::id()));
let to = Pubkey::new_unique();
let to_account = RefCell::new(AccountSharedData::new(0, 0, &system_program::id()));
let signers = [from, to].iter().cloned().collect::<HashSet<_>>();
let to_address = to.into();
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&to, false, &to_account),
&to_address,
50,
2,
&sysvar::id(),
&signers,
&invoke_context,
);
assert_eq!(result, Err(SystemError::InvalidProgramId.into()));
} | rust_cleaned_test_functions.jsonl/106196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
20344,
947,
31433,
842,
39904,
17069,
368,
341,
286,
1077,
5206,
4565,
2602,
284,
19998,
1649,
486,
541,
18220,
543,
286,
4565,
2602,
198,
310,
659,
3028,
198,
310,
659,
5399,
2099,
12753,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotate_polygon_holes() {
let ls1 = LineString::from(vec![
(5.0, 1.0),
(4.0, 2.0),
(4.0, 3.0),
(5.0, 4.0),
(6.0, 4.0),
(7.0, 3.0),
(7.0, 2.0),
(6.0, 1.0),
(5.0, 1.0),
]);
let ls2 = LineString::from(vec![(5.0, 1.3), (5.5, 2.0), (6.0, 1.3), (5.0, 1.3)]);
let poly1 = Polygon::new(ls1, vec![ls2]);
let rotated = poly1.translate(17.0, 18.0);
let correct_outside = vec![
Coordinate::from((22.0, 19.0)),
Coordinate::from((21.0, 20.0)),
Coordinate::from((21.0, 21.0)),
Coordinate::from((22.0, 22.0)),
Coordinate::from((23.0, 22.0)),
Coordinate::from((24.0, 21.0)),
Coordinate::from((24.0, 20.0)),
Coordinate::from((23.0, 19.0)),
Coordinate::from((22.0, 19.0)),
];
let correct_inside = vec![
Coordinate::from((22.0, 19.3)),
Coordinate::from((22.5, 20.0)),
Coordinate::from((23.0, 19.3)),
Coordinate::from((22.0, 19.3)),
];
assert_eq!(rotated.exterior.0, correct_outside);
assert_eq!(rotated.interiors[0].0, correct_inside);
} | rust_cleaned_test_functions.jsonl/94518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 782
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
73542,
1523,
7151,
368,
341,
286,
1077,
19597,
16,
284,
7083,
703,
486,
1499,
25592,
90515,
310,
320,
20,
13,
15,
11,
220,
16,
13,
15,
1326,
310,
320,
19,
13,
15,
11,
220,
17,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq_root_of_unity() {
use fff::SqrtField;
assert_eq!(Fq::S, 1);
assert_eq!(
Fq::multiplicative_generator(),
Fq::from_repr(FqRepr::from(2)).unwrap()
);
assert_eq!(
Fq::multiplicative_generator().pow([
0xdcff7fffffffd555,
0xf55ffff58a9ffff,
0xb39869507b587b12,
0xb23ba5c279c2895f,
0x258dd3db21a5d66b,
0xd0088f51cbff34d
]),
Fq::root_of_unity()
);
assert_eq!(Fq::root_of_unity().pow([1 << Fq::S]), Fq::one());
assert!(Fq::multiplicative_generator().sqrt().is_none());
} | rust_cleaned_test_functions.jsonl/2337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
12993,
3575,
62,
2439,
368,
341,
286,
990,
282,
542,
486,
50,
8140,
1877,
401,
286,
2060,
10714,
10297,
37,
80,
486,
50,
11,
220,
16,
317,
286,
2060,
10714,
33673,
310,
434,
80,
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_fr_mul_assign() {
let mut tmp = Fr([
0x6b7e9b8faeefc81a,
0xe30a8463f348ba42,
0xeff3cb67a8279c9c,
0x3d303651bd7c774d,
]);
tmp.mul_assign(&Fr([
0x13ae28e3bc35ebeb,
0xa10f4488075cae2c,
0x8160e95a853c3b5d,
0x5ae3f03b561a841d,
]));
assert!(
tmp == Fr([
0x23717213ce710f71,
0xdbee1fe53a16e1af,
0xf565d3e1c2a48000,
0x4426507ee75df9d7
])
);
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
0xe5,
]);
for _ in 0..1000000 {
let a = Fr::random(&mut rng);
let b = Fr::random(&mut rng);
let c = Fr::random(&mut rng);
let mut tmp1 = a;
tmp1.mul_assign(&b);
tmp1.mul_assign(&c);
let mut tmp2 = b;
tmp2.mul_assign(&c);
tmp2.mul_assign(&a);
assert_eq!(tmp1, tmp2);
}
for _ in 0..1000000 {
let r = Fr::random(&mut rng);
let mut a = Fr::random(&mut rng);
let mut b = Fr::random(&mut rng);
let mut c = Fr::random(&mut rng);
let mut tmp1 = a;
tmp1.add_assign(&b);
tmp1.add_assign(&c);
tmp1.mul_assign(&r);
a.mul_assign(&r);
b.mul_assign(&r);
c.mul_assign(&r);
a.add_assign(&b);
a.add_assign(&c);
assert_eq!(tmp1, a);
}
} | rust_cleaned_test_functions.jsonl/100648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 956
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
24944,
20688,
368,
341,
262,
1077,
5206,
4174,
284,
2869,
8956,
286,
220,
15,
87,
21,
65,
22,
68,
24,
65,
23,
3632,
68,
823,
66,
23,
16,
64,
345,
286,
220,
15,
8371,
18,
15,
64,
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_result() {
let mut s = String::new();
let e = (html! {
: Ok::<&str, &str>("pass");
: Err::<&str, &str>("fail");
: Ok::<&str, &str>("hidden");
: Err::<&str, &str>("fail2");
})
.write_to_string(&mut s)
.err()
.unwrap();
assert_eq!(s, "pass");
assert!(e.write.is_none());
assert_eq!(e.render.len(), 2);
assert_eq!(&e.render[0].to_string(), "fail");
assert_eq!(&e.render[1].to_string(), "fail2");
} | rust_cleaned_test_functions.jsonl/89533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5287,
368,
341,
262,
1077,
5206,
274,
284,
923,
486,
931,
543,
262,
1077,
384,
284,
320,
1551,
0,
341,
286,
549,
7622,
27638,
5,
495,
11,
609,
495,
13211,
6385,
797,
286,
549,
15495,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_array_fields() {
let message_type = "
message test_schema {
REQUIRED BYTE_ARRAY binary;
REQUIRED FIXED_LEN_BYTE_ARRAY (20) fixed_binary;
}
";
let parquet_group_type = parse_message_type(message_type).unwrap();
let parquet_schema = SchemaDescriptor::new(Arc::new(parquet_group_type));
let converted_arrow_schema =
parquet_to_arrow_schema(&parquet_schema, &None).unwrap();
let arrow_fields = vec![
Field::new("binary", DataType::Binary, false),
Field::new("fixed_binary", DataType::FixedSizeBinary(20), false),
];
assert_eq!(&arrow_fields, converted_arrow_schema.fields());
} | rust_cleaned_test_functions.jsonl/130361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
3858,
12132,
368,
341,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
310,
66577,
35377,
17724,
7868,
280,
310,
66577,
91549,
15536,
27349,
17724,
320,
17,
15,
8,
8356,
3176... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file() {
let root_id = Uuid::new_v4();
let path = Path::new(root_id, &["Main.enso"]);
let data = Vec::from("hello".as_bytes());
test_request(
|client| client.write_file(&path, &data),
(),
ToServerPayloadOwned::WriteFile { contents: data.clone(), path: path.clone() },
FromServerPayloadOwned::Success {},
);
} | rust_cleaned_test_functions.jsonl/126693 | {
"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,
9165,
2458,
368,
341,
286,
1077,
3704,
842,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
1815,
284,
7933,
486,
931,
9206,
842,
11,
609,
1183,
6202,
7639,
704,
15049,
286,
1077,
821,
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_builtin() {
assert!(INT.is_built_in());
assert!(DOUBLE.is_built_in());
assert!(BOOL.is_built_in());
assert!(!Dart::Void.is_built_in());
} | rust_cleaned_test_functions.jsonl/33189 | {
"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,
73829,
368,
341,
286,
2060,
10297,
3221,
2079,
880,
11227,
1243,
1423,
286,
2060,
10297,
77647,
2079,
880,
11227,
1243,
1423,
286,
2060,
10297,
10395,
2079,
880,
11227,
1243,
1423,
286,
2060,
0,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_numeric_less_than_unknown_attribute() {
let schemaReplicant = SchemaReplicant::default();
let causetq = r#"[:find ?x :where [?x _ ?y] [(< ?y 10)]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT DISTINCT `all_Causets00`.e AS `?x` FROM `all_Causets` AS `all_Causets00` WHERE `all_Causets00`.v < 10");
assert_eq!(args, vec![]);
} | rust_cleaned_test_functions.jsonl/90705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29418,
50747,
51613,
57507,
16791,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
1428,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
3447,
3903,
937,
87,
549,
2870,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_iter() {
let boolean = BooleanArray::from_slice(&[false, false, true, true]).boxed();
let int = Int32Array::from_slice(&[42, 28, 19, 31]).boxed();
let fields = vec![
Field::new("b", DataType::Boolean, false),
Field::new("c", DataType::Int32, false),
];
let array = StructArray::from_data(
DataType::Struct(fields),
vec![boolean.clone(), int.clone()],
None,
);
for (i, item) in array.iter().enumerate() {
let expected = Some(vec![
new_scalar(boolean.as_ref(), i),
new_scalar(int.as_ref(), i),
]);
assert_eq!(expected, item);
}
} | rust_cleaned_test_functions.jsonl/17120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
11723,
368,
341,
262,
1077,
2710,
284,
6992,
1857,
486,
1499,
26488,
2099,
58,
3849,
11,
895,
11,
830,
11,
830,
10697,
79075,
543,
262,
1077,
526,
284,
1333,
18,
17,
1857,
486,
1499,
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... | 2 |
#[test]
fn test_relative() {
let prog = [
109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0,
99,
];
test_run(Intcode::from(prog), &[], &prog);
} | rust_cleaned_test_functions.jsonl/76320 | {
"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,
29286,
368,
341,
262,
1077,
29271,
284,
2278,
286,
220,
16,
15,
24,
11,
220,
16,
11,
220,
17,
15,
19,
11,
481,
16,
11,
220,
16,
15,
15,
16,
11,
220,
16,
15,
15,
11,
220,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_into_cbytes() {
let value = Value::new_normal(1_u8);
assert_eq!(value.as_bytes(), vec![0, 0, 0, 1, 1]);
} | rust_cleaned_test_functions.jsonl/41645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
45514,
666,
9651,
368,
341,
286,
1077,
897,
284,
5162,
486,
931,
13973,
7,
16,
7300,
23,
317,
286,
2060,
10714,
10297,
957,
5357,
12524,
1507,
7486,
20703,
15,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_is_unicast_in_subnet() {
// Valid unicast in subnet
let subnet =
Subnet::new(Ipv4Addr::new([1, 2, 0, 0]), 16).expect("1.2.0.0/16 is a valid subnet");
assert!(Ipv4Addr::new([1, 2, 3, 4]).is_unicast_in_subnet(&subnet));
assert!(!Ipv4Addr::new([2, 2, 3, 4]).is_unicast_in_subnet(&subnet));
let subnet =
Subnet::new(Ipv6Addr::from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 64)
.expect("1::/64 is a valid subnet");
assert!(Ipv6Addr::from([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
.is_unicast_in_subnet(&subnet));
assert!(!Ipv6Addr::from([2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
.is_unicast_in_subnet(&subnet));
// Unspecified address
assert!(!Ipv4::UNSPECIFIED_ADDRESS
.is_unicast_in_subnet(&Subnet::new(Ipv4::UNSPECIFIED_ADDRESS, 16).unwrap()));
assert!(!Ipv6::UNSPECIFIED_ADDRESS
.is_unicast_in_subnet(&Subnet::new(Ipv6::UNSPECIFIED_ADDRESS, 64).unwrap()));
// The "31- or 32-bit prefix" exception doesn't apply to the unspecified
assert!(!Ipv4::UNSPECIFIED_ADDRESS
.is_unicast_in_subnet(&Subnet::new(Ipv4::UNSPECIFIED_ADDRESS, 31).unwrap()));
assert!(!Ipv4::UNSPECIFIED_ADDRESS
.is_unicast_in_subnet(&Subnet::new(Ipv4::UNSPECIFIED_ADDRESS, 32).unwrap()));
assert!(!Ipv4Addr::new([1, 2, 0, 0])
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([1, 2, 0, 0]), 16).unwrap()));
assert!(Ipv4Addr::new([1, 2, 3, 0])
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([1, 2, 3, 0]), 31).unwrap()));
assert!(Ipv4Addr::new([1, 2, 3, 0])
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([1, 2, 3, 0]), 32).unwrap()));
assert!(!Ipv4::LIMITED_BROADCAST_ADDRESS
.get()
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([128, 0, 0, 0]), 1).unwrap()));
assert!(!Ipv4Addr::new([1, 2, 255, 255])
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([1, 2, 0, 0]), 16).unwrap()));
assert!(Ipv4Addr::new([1, 2, 255, 255])
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([1, 2, 255, 254]), 31).unwrap()));
assert!(Ipv4Addr::new([1, 2, 255, 255])
.is_unicast_in_subnet(&Subnet::new(Ipv4Addr::new([1, 2, 255, 255]), 32).unwrap()));
// Multicast
assert!(!Ipv4Addr::new([224, 0, 0, 1]).is_unicast_in_subnet(&Ipv4::MULTICAST_SUBNET));
assert!(!Ipv6Addr::from([0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
.is_unicast_in_subnet(&Ipv6::MULTICAST_SUBNET));
assert!(!Ipv4Addr::new([240, 0, 0, 1]).is_unicast_in_subnet(&Ipv4::CLASS_E_SUBNET));
} | rust_cleaned_test_functions.jsonl/31864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1616
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
62,
3525,
559,
1243,
95681,
368,
341,
286,
442,
7818,
650,
35446,
304,
51457,
198,
286,
1077,
51457,
4035,
310,
3719,
4711,
486,
931,
8972,
30168,
19,
13986,
486,
931,
2561,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_serialize() {
let mut buffer: Vec<u8> = vec![0; VoteState::size_of()];
let mut vote_state = VoteState::default();
vote_state
.votes
.resize(MAX_LOCKOUT_HISTORY, Lockout::default());
assert!(vote_state.serialize(&mut buffer[0..4]).is_err());
vote_state.serialize(&mut buffer).unwrap();
assert_eq!(VoteState::deserialize(&buffer).unwrap(), vote_state);
} | rust_cleaned_test_functions.jsonl/69960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
88686,
368,
341,
286,
1077,
5206,
4147,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
26,
34034,
1397,
486,
2141,
3575,
33800,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
486,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_failed_stores() {
let debugger = new_debugger();
debugger.set_store_id(100);
let engine = &debugger.engines.kv;
let get_region_stores = |engine: &Arc<DB>, region_id: u64| {
get_region_state(engine, region_id)
.get_region()
.get_peers()
.iter()
.map(|p| p.get_store_id())
.collect::<Vec<_>>()
};
init_region_state(engine.as_inner(), 1, &[11, 12, 13, 14]);
init_region_state(engine.as_inner(), 2, &[21, 22, 23]);
// Only remove specified stores from region 1.
debugger
.remove_failed_stores(vec![13, 14, 21, 23], Some(vec![1]))
.unwrap();
// 13 and 14 should be removed from region 1.
assert_eq!(get_region_stores(engine.as_inner(), 1), &[11, 12]);
// 21 and 23 shouldn't be removed from region 2.
assert_eq!(get_region_stores(engine.as_inner(), 2), &[21, 22, 23]);
// Remove specified stores from all regions.
debugger.remove_failed_stores(vec![11, 23], None).unwrap();
assert_eq!(get_region_stores(engine.as_inner(), 1), &[12]);
assert_eq!(get_region_stores(engine.as_inner(), 2), &[21, 22]);
// Should fail when the store itself is in the failed list.
init_region_state(engine.as_inner(), 3, &[100, 31, 32, 33]);
debugger.remove_failed_stores(vec![100], None).unwrap_err();
} | rust_cleaned_test_functions.jsonl/33467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
35060,
1261,
4589,
368,
341,
286,
1077,
44473,
284,
501,
15446,
1389,
543,
286,
44473,
980,
14809,
842,
7,
16,
15,
15,
317,
286,
1077,
4712,
284,
609,
8349,
1389,
90413,
1543,
5202,
85,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_ex_axis_keep_dim() {
let x = ndarray::array![[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]].into_ndarray();
let y = map_ex_axis_keep_dim(&x, Axis(1), |x| x.mean_axis(Axis(1)).unwrap());
assert_eq!(y, ndarray::array![[[2.5, 3.5, 4.5]]].into_dyn());
} | rust_cleaned_test_functions.jsonl/114646 | {
"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,
5376,
2702,
23567,
50293,
10791,
368,
341,
262,
1077,
856,
284,
66883,
486,
1653,
0,
15505,
58,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
1125,
508,
19,
13,
15,
11,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expressions() {
test_synced(move || {
let expr1 = ConstantExpression::new(&23);
assert_eq!(expr1.value().get::<i32>().unwrap(), 23);
let expr2 = ConstantExpression::for_value(&"hello".to_value());
assert_eq!(expr2.value().get::<String>().unwrap(), "hello");
let expr1 = ConstantExpression::new(&23);
assert_eq!(expr1.value().get::<i32>().unwrap(), 23);
assert_eq!(expr1.value_as::<i32>(), 23);
let expr2 = ConstantExpression::for_value(&"hello".to_value());
assert_eq!(expr2.value().get::<String>().unwrap(), "hello");
assert_eq!(expr2.value_as::<String>(), "hello");
});
} | rust_cleaned_test_functions.jsonl/50743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
39873,
368,
341,
286,
1273,
23008,
291,
34081,
1369,
341,
310,
1077,
15169,
16,
284,
19305,
9595,
486,
931,
2099,
17,
18,
317,
310,
2060,
10714,
10297,
9413,
16,
2824,
1005,
455,
27638,
72... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bpe_exact() {
// Given
let bpe_pairs = generate_bpe_pair_vocab();
let test_tuples = [
(
"hello",
(
vec!["h@@".to_owned(), "ell@@".to_owned(), "o".to_owned()],
vec![1, 3, 1],
),
),
(
"hellllo",
(
vec![
"h@@".to_owned(),
"ell@@".to_owned(),
"ll@@".to_owned(),
"o".to_owned(),
],
vec![1, 3, 2, 1],
),
),
(
"helo",
(
vec!["h@@".to_owned(), "el@@".to_owned(), "o".to_owned()],
vec![1, 2, 1],
),
),
("42", (vec!["4@@".to_owned(), "2".to_owned()], vec![1, 1])),
("1", (vec!["1".to_owned()], vec![1])),
("", (vec![], vec![])),
];
for (input, expected_output) in &test_tuples {
assert_eq!(ctrl_bpe(input, &bpe_pairs), *expected_output);
}
} | rust_cleaned_test_functions.jsonl/13641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 858
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
375,
71084,
368,
341,
286,
442,
286,
16246,
198,
286,
1077,
293,
375,
36430,
284,
6923,
880,
375,
14445,
52823,
1428,
286,
1077,
1273,
89269,
284,
2278,
310,
2399,
394,
330,
14990,
756,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_anonymization_config_from_file() {
let mut file = fs::File::create("/tmp/anon_config.yml").unwrap();
file.write(b"{}").unwrap();
assert_eq!(
get_anonymization_config_from_file("/tmp/anon_config.yml").unwrap(),
Anonymization {
replace: None,
keep: None,
keep_private_tags: None,
force: Some(true),
dicom_version: None
}
)
} | rust_cleaned_test_functions.jsonl/76495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12008,
7831,
2022,
5332,
5673,
2458,
368,
341,
286,
1077,
5206,
1034,
284,
8619,
486,
1703,
486,
3182,
4283,
5173,
55492,
263,
5332,
33936,
1827,
15454,
543,
286,
1034,
3836,
1883,
1,
6257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_descending_buffer(){
unsafe {
let v = vec!(4i32, 3, 2, 1);
assert!(is_descending_buffer(v.as_ptr(), v.len()));
let v = vec!(1i32);
assert!(is_descending_buffer(v.as_ptr(), v.len()));
let v : Vec<i32> = vec!();
assert!(is_descending_buffer(v.as_ptr(), v.len()));
let v = vec!(1i32, 2);
assert!(!is_descending_buffer(v.as_ptr(), v.len()));
let v = vec!(1i32, 2, 3);
assert!(!is_descending_buffer(v.as_ptr(), v.len()));
let v = vec!(2i32, 3, 1);
assert!(!is_descending_buffer(v.as_ptr(), v.len()));
let v = vec!(3i32, 1, 2);
assert!(!is_descending_buffer(v.as_ptr(), v.len()));
}
} | rust_cleaned_test_functions.jsonl/133545 | {
"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,
6892,
10986,
2459,
7776,
3032,
286,
19860,
341,
310,
1077,
348,
284,
7486,
10297,
19,
72,
18,
17,
11,
220,
18,
11,
220,
17,
11,
220,
16,
317,
310,
2060,
10297,
285,
10986,
2459,
7776,
3747,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_spec_constant_op() {
let mut v = ZERO_BOUND_HEADER.to_vec();
v.append(&mut vec![0x34, 0x00, 0x05, 0x00]); // OpTypeFloat
v.append(&mut vec![0x01, 0x00, 0x00, 0x00]); // result type: 1
v.append(&mut vec![0x02, 0x00, 0x00, 0x00]); // result id: 2
v.append(&mut vec![0x7e, 0x00, 0x00, 0x00]); // OpSNegate
v.append(&mut vec![0x03, 0x00, 0x00, 0x00]); // id ref: 3
let mut c = RetainingConsumer::new();
{
let p = Parser::new(&v, &mut c);
assert_matches!(p.parse(), Ok(()));
}
assert_eq!(1, c.insts.len());
let inst = &c.insts[0];
assert_eq!("SpecConstantOp", inst.class.opname);
assert_eq!(Some(1), inst.result_type);
assert_eq!(Some(2), inst.result_id);
assert_eq!(vec![dr::Operand::LiteralSpecConstantOpInteger(spirv::Op::SNegate),
dr::Operand::IdRef(3)],
inst.operands);
} | rust_cleaned_test_functions.jsonl/85752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
13594,
34967,
10287,
368,
341,
286,
1077,
5206,
348,
284,
54593,
73644,
20330,
2389,
13251,
543,
286,
348,
2057,
2099,
6984,
7486,
20703,
15,
87,
18,
19,
11,
220,
15,
87,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_existing_user_email() {
use cargo_registry::schema::emails;
use chrono::NaiveDateTime;
use diesel::update;
let (app, _) = TestApp::init().empty();
// email directly into the database and we want to test the verification flow here.
let email = "potahto@example.com";
let user = app.db(|conn| {
let u = NewUser {
..new_user("arbitrary_username")
};
let u = u
.create_or_update(Some(email), &app.as_inner().emails, conn)
.unwrap();
update(Email::belonging_to(&u))
// Users created before we added verification will have
// `NULL` in the `token_generated_at` column.
.set(emails::token_generated_at.eq(None::<NaiveDateTime>))
.execute(conn)
.unwrap();
MockCookieUser::new(&app, u)
});
let json = user.show_me();
assert_eq!(json.user.email.unwrap(), "potahto@example.com");
assert!(!json.user.email_verified);
assert!(!json.user.email_verification_sent);
} | rust_cleaned_test_functions.jsonl/34239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62630,
3317,
9172,
368,
341,
262,
990,
25652,
50650,
486,
17349,
486,
51376,
280,
262,
990,
80372,
486,
16193,
533,
7689,
280,
262,
990,
32780,
486,
2386,
401,
262,
1077,
320,
676,
11,
27439,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resizing_array_random_queue_sample() {
let mut queue: ResizingArrayRandomizedQueue<u32> = RandomizedQueue::new();
assert!(queue.is_empty());
for i in 0 .. 10 {
queue.enqueue(i);
}
let mut matches = 0i32;
for _ in 0 .. 10 {
if queue.sample() == queue.sample() {
matches += 1;
}
}
assert!(matches <= 10);
assert_eq!(queue.size(), 10);
} | rust_cleaned_test_functions.jsonl/29073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
4849,
3858,
22644,
10841,
17491,
368,
341,
262,
1077,
5206,
7177,
25,
1800,
4849,
1857,
13999,
1506,
7554,
34837,
18,
17,
29,
284,
10612,
1506,
7554,
486,
931,
1428,
262,
2060,
10297,
4584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_completion_detail_from_macro_generated_struct_fn_doc_attr() {
check_detail_and_documentation(
r#"
macro_rules! bar {
() => {
struct Bar;
impl Bar {
#[doc = "Do the foo"]
fn foo(&self) {}
}
}
}
bar!();
fn foo() {
let bar = Bar;
bar.fo$0;
}
"#,
DetailAndDocumentation { detail: "fn(&self)", documentation: "Do the foo" },
);
} | rust_cleaned_test_functions.jsonl/128375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60164,
14480,
5673,
58810,
67313,
15126,
15246,
18869,
10422,
368,
341,
286,
1779,
14480,
8378,
26231,
367,
1006,
310,
435,
2,
698,
32606,
21407,
0,
3619,
341,
262,
1719,
589,
341,
286,
2036,
4716... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_mul() {
let one = scalar_from_u64::<Bls12>(1);
let two = scalar_from_u64::<Bls12>(2);
let three = scalar_from_u64::<Bls12>(3);
let four = scalar_from_u64::<Bls12>(4);
let five = scalar_from_u64::<Bls12>(5);
let six = scalar_from_u64::<Bls12>(6);
let a = vec![one, two, three];
let b = vec![four, five, six];
let res = vec_mul::<Bls12>(&a, &b);
let expected = scalar_from_u64::<Bls12>(32);
assert_eq!(expected, res);
} | rust_cleaned_test_functions.jsonl/102228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
24944,
368,
341,
286,
1077,
825,
284,
17274,
5673,
7300,
21,
19,
27638,
33,
4730,
16,
17,
2235,
16,
317,
286,
1077,
1378,
284,
17274,
5673,
7300,
21,
19,
27638,
33,
4730,
16,
17,
2235,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_right_shift() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("9 >> 1")?, 4);
Ok(())
} | rust_cleaned_test_functions.jsonl/112271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10539,
22230,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
543,
262,
2060,
10714,
10297,
8512,
31710,
27638,
3221,
13211,
24,
3578,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_multiple_predicate_1() {
let predicate: Vec<_> = (0..=1)
.map(|offset| {
move || {
RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(offset)
.push_fn_call_for_test(is_even_fn_meta(), 1, FieldTypeTp::LongLong)
.build_for_test()
}
})
.collect();
for predicates in vec![
// Swap predicates should produce same results.
vec![predicate[0](), predicate[1]()],
vec![predicate[1](), predicate[0]()],
] {
let src_exec = make_src_executor_using_fixture_2();
let mut exec = BatchSelectionExecutor::new_for_test(src_exec, predicates);
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[0]);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert!(r.is_drained.unwrap());
}
} | rust_cleaned_test_functions.jsonl/119698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
97474,
62,
16,
368,
341,
23459,
286,
1077,
24283,
25,
11312,
32399,
29,
284,
320,
15,
496,
28,
16,
340,
310,
659,
2186,
22428,
3176,
91,
341,
394,
3271,
1369,
341,
503,
431,
19958,
9595... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_header_with_quality() {
let a: Accept = header::Header::parse_header([b"text/plain; charset=utf-8; q=0.5".to_vec()].as_slice()).unwrap();
let b = Accept(vec![
shared::QualityItem{item: mime::Mime(mime::TopLevel::Text, mime::SubLevel::Plain, vec![(mime::Attr::Charset, mime::Value::Utf8)]), quality: 0.5f32},
]);
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/51465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8757,
6615,
55074,
368,
341,
262,
1077,
264,
25,
20829,
284,
4247,
486,
4047,
486,
6400,
8757,
2561,
65,
66251,
36971,
26,
11617,
22264,
12,
23,
26,
2804,
28,
15,
13,
20,
3263,
983,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_serialize() {
solana_logger::setup();
let (_accounts_dir, paths) = get_temp_accounts_paths(4).unwrap();
let accounts = Accounts::new(paths);
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 100, 0);
check_accounts(&accounts, &pubkeys, 100);
accounts.add_root(0);
let mut writer = Cursor::new(vec![]);
serialize_into(
&mut writer,
&AccountsDBSerialize::new(&*accounts.accounts_db, 0),
)
.unwrap();
let copied_accounts = TempDir::new().unwrap();
// Simulate obtaining a copy of the AppendVecs from a tarball
copy_append_vecs(&accounts.accounts_db, copied_accounts.path()).unwrap();
let buf = writer.into_inner();
let mut reader = BufReader::new(&buf[..]);
let (_accounts_dir, daccounts_paths) = get_temp_accounts_paths(2).unwrap();
let daccounts = Accounts::new(daccounts_paths.clone());
assert!(daccounts
.accounts_from_stream(&mut reader, &daccounts_paths, copied_accounts.path())
.is_ok());
check_accounts(&daccounts, &pubkeys, 100);
assert_eq!(accounts.bank_hash_at(0), daccounts.bank_hash_at(0));
} | rust_cleaned_test_functions.jsonl/50622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
88686,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
5453,
26206,
4334,
11,
12716,
8,
284,
633,
11771,
55665,
24152,
7,
19,
568,
15454,
543,
286,
1077,
9618,
284,
40655,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_asin() {
let tests = vec![
(ScalarFuncSig::Asin, Datum::F64(0.0_f64), 0.0_f64),
(
ScalarFuncSig::Asin,
Datum::F64(1f64),
f64::consts::PI / 2.0_f64,
),
(
ScalarFuncSig::Asin,
Datum::F64(-1f64),
-f64::consts::PI / 2.0_f64,
),
(
ScalarFuncSig::Asin,
Datum::F64(f64::consts::SQRT_2 / 2.0_f64),
f64::consts::PI / 4.0_f64,
),
];
let tests_invalid_f64 = vec![
(ScalarFuncSig::Asin, Datum::F64(f64::INFINITY), Datum::Null),
(ScalarFuncSig::Asin, Datum::F64(f64::NAN), Datum::Null),
(ScalarFuncSig::Asin, Datum::F64(2f64), Datum::Null),
(ScalarFuncSig::Asin, Datum::F64(-2f64), Datum::Null),
];
let mut ctx = EvalContext::default();
for (sig, arg, exp) in tests {
let arg = datum_expr(arg);
let f = scalar_func_expr(sig, &[arg]);
let op = Expression::build(&mut ctx, f).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert!((got.f64() - exp).abs() < f64::EPSILON);
}
for (sig, arg, exp) in tests_invalid_f64 {
let arg = datum_expr(arg);
let f = scalar_func_expr(sig, &[arg]);
let op = Expression::build(&mut ctx, f).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/125534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 975
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
258,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
20639,
9626,
47246,
486,
2121,
258,
11,
68459,
486,
37,
21,
19,
7,
15,
13,
15,
761,
21,
19,
701,
220,
15,
13,
15,
761,
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... | 3 |
#[test]
fn test_ccsds_parser_iterator() {
let slice = [0x00,0x3,0xFF,0xFF,0x00,0x01,0xFF,0xFF];
let mut parser = CcsdsParser::new();
let n = 100;
for _ in 0..n {
parser.recv_slice(&slice);
}
for _ in 0..n {
let packet = parser.next();
assert_ne!(packet, None);
let mut bytes = BytesMut::new();
bytes.extend_from_slice(&slice);
assert_eq!(packet.unwrap(), bytes);
}
} | rust_cleaned_test_functions.jsonl/105752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28955,
82,
5356,
18517,
13491,
368,
972,
262,
1077,
15983,
284,
508,
15,
87,
15,
15,
11,
15,
87,
18,
11,
15,
9264,
11,
15,
9264,
11,
15,
87,
15,
15,
11,
15,
87,
15,
16,
11,
15,
9264,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_flutter_allow() {
let config = Config::default();
assert!(!flutter_allow(&config, "releases/releases_windows.json"));
assert!(!flutter_allow(&config, "releases/releases_linux.json"));
assert!(flutter_allow(
&config,
"releases/stable/linux/flutter_linux_1.17.0-stable.tar.xz"
));
assert!(flutter_allow(
&config,
"flutter/069b3cf8f093d44ec4bae1319cbfdc4f8b4753b6/android-arm/artifacts.zip"
));
assert!(flutter_allow(
&config,
"flutter/fonts/03bdd42a57aff5c496859f38d29825843d7fe68e/fonts.zip"
));
assert!(!flutter_allow(&config, "flutter/coverage/lcov.info"));
} | rust_cleaned_test_functions.jsonl/30036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68089,
55731,
368,
341,
286,
1077,
2193,
284,
5532,
486,
2258,
543,
286,
2060,
0,
3471,
14972,
55731,
2099,
1676,
11,
330,
265,
28299,
58187,
58220,
4323,
4010,
286,
2060,
0,
3471,
14972,
55731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_leaf_broken() {
let mut cache = Cache::new();
let leaf1 = Blueprint::new(BuilderLeaf::new());
let leaf2 = Blueprint::new(BuilderLeaf::new());
println!("BuilderLeaf: {:?}; {:?}", leaf1, leaf2);
println!("Ptr: {:?}; {:?}", leaf1.id(), leaf2.id());
// Ensure same builder results in same artifact
assert_eq!(cache.get(&leaf1), cache.get(&leaf1));
// Ensure different builder result in different artifacts
assert_ne!(cache.get(&leaf1), cache.get(&leaf2));
} | rust_cleaned_test_functions.jsonl/130973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38909,
880,
81709,
368,
341,
10217,
5206,
6500,
284,
19479,
486,
931,
1428,
10217,
15933,
16,
284,
30003,
486,
931,
7,
3297,
31461,
486,
931,
1423,
10217,
15933,
17,
284,
30003,
486,
931,
7,
329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ord() {
let x = RingBuf::new();
let mut y = RingBuf::new();
y.push_back(1);
y.push_back(2);
y.push_back(3);
assert!(x < y);
assert!(y > x);
assert!(x <= x);
assert!(x >= x);
} | rust_cleaned_test_functions.jsonl/125105 | {
"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,
67324,
368,
341,
286,
1077,
856,
284,
21525,
15064,
486,
931,
543,
286,
1077,
5206,
379,
284,
21525,
15064,
486,
931,
543,
286,
379,
2552,
3895,
7,
16,
317,
286,
379,
2552,
3895,
7,
17,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_neq_scalar() {
cmp_i64_scalar!(
neq_scalar,
vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
8,
vec![true, true, false, true, true, true, true, false, true, true]
);
} | rust_cleaned_test_functions.jsonl/36017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
13925,
80,
41652,
368,
341,
286,
26089,
5318,
21,
19,
41652,
33673,
310,
834,
80,
41652,
345,
310,
7486,
20703,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
11,
220,
16,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addition() -> Result<(), Box<dyn Error>> {
TestSample {
source: StringLiteral("+++"),
expected_result: Some(BinaryLiteral(&[3][..])),
expected_output: None,
input_data: None,
}.run()
} | rust_cleaned_test_functions.jsonl/20219 | {
"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,
2891,
680,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
262,
3393,
17571,
341,
286,
2530,
25,
923,
17350,
445,
62730,
4461,
286,
3601,
5287,
25,
4329,
77833,
17350,
2099,
58,
18,
1457,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_setup_jailed_folder() {
let env = create_env();
// Error case: non UTF-8 paths.
let bad_string: &[u8] = &[0, 102, 111, 111, 0];
assert_eq!(
format!("{}", env.setup_jailed_folder(bad_string).err().unwrap()),
"Failed to decode string from byte array: data provided contains an interior nul byte at byte pos 0"
);
// Error case: inaccessible path - can't be triggered with unit tests running as root.
// assert_eq!(
// Success case.
let foo_dir = TempDir::new().unwrap();
let mut foo_path = foo_dir.as_path().as_os_str().as_bytes().to_vec();
foo_path.push(0);
foo_dir.remove().unwrap();
assert!(env.setup_jailed_folder(foo_path.as_slice()).is_ok());
let metadata = fs::metadata(
CStr::from_bytes_with_nul(foo_path.as_slice())
.unwrap()
.to_str()
.unwrap(),
)
.unwrap();
// The mode bits will also have S_IFDIR set because the path belongs to a directory.
assert_eq!(
metadata.permissions().mode(),
FOLDER_PERMISSIONS | libc::S_IFDIR
);
assert_eq!(metadata.st_uid(), env.uid);
assert_eq!(metadata.st_gid(), env.gid);
// Can't safely test that permissions remain unchanged by umask settings without affecting
// the umask of the whole unit test process.
// And changing the umask in the Python integration tests is unsafe because of pytest's
// process management; it can't be isolated from side effects.
} | rust_cleaned_test_functions.jsonl/44157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 760
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
5374,
5687,
15268,
368,
341,
286,
1077,
6105,
284,
1855,
15879,
1428,
286,
442,
4600,
1142,
25,
2477,
20076,
12,
23,
12716,
624,
286,
1077,
3873,
3904,
25,
44590,
84,
23,
60,
284,
44590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constant_condition_with_side_effect2() {
test("(b=true)?x=1:x=2;", "b=true,x=1");
test("(b=false)?x=1:x=2;", "b=false,x=2");
test("if (b=/ab/) x=1;", "b=/ab/;x=1");
test_same("var b;b=f();b?x=1:x=2;");
test_same("var b=f();b?x=1:x=2;");
} | rust_cleaned_test_functions.jsonl/374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
27656,
6615,
30862,
27125,
17,
368,
341,
262,
1273,
31732,
65,
11265,
11843,
87,
28,
16,
35254,
28,
17,
32503,
330,
65,
11265,
12803,
28,
16,
797,
262,
1273,
31732,
65,
12219,
11843,
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... | 1 |
#[test]
fn test_error_output() {
Command::cargo_bin("rrrocket")
.unwrap()
.args(&[
"-n",
"-c",
"--dry-run",
"non-exist/assets/fuzz-string-too-long.replay",
])
.assert()
.failure()
.code(1)
.stderr(predicate::str::contains(
"Unable to read replay from non-exist/assets/fuzz-string-too-long.replay",
));
} | rust_cleaned_test_functions.jsonl/88727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
7645,
368,
341,
286,
7348,
486,
66715,
21816,
445,
634,
46790,
1138,
310,
659,
15454,
741,
310,
659,
2116,
2099,
9640,
394,
6523,
77,
756,
394,
6523,
66,
756,
394,
14482,
53210,
22973,
756... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.