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_template_2() {
assert_eq!(
parse(include_str!("../fixtures/template-2.txt"), document),
Ok((
Node::element(
Element::new("div")
.with_attr("class", "field field--checkbox")
.with_nodes(vec![
Element::new("label")
.with_attr("for", "my-checkbox")
.with_node(Text::new("Checkbox"))
.into(),
Element::new("input")
.with_attr("id", "my-checkbox")
.with_attr("class", "input input--checkbox")
.with_attr("type", "checkbox")
.with_attr("checked", true)
.into(),
Element::new("span")
.with_attr("class", "description")
.with_node(Text::new("Description."))
.into(),
]),
)
.into(),
""
)),
);
} | rust_cleaned_test_functions.jsonl/58309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8693,
62,
17,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
77863,
2895,
17223,
1244,
45247,
37094,
12,
17,
3909,
3975,
2197,
1326,
286,
7622,
94702,
310,
6018,
486,
6101,
1006,
394,
8543,
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_read_access() {
let mut mapper = MapperDebug::new();
let mut bus = Bus::new();
mapper.poke_chr(0x1FF, 255);
let (d, b) = bus.read(&mut mapper, 0x1FF);
assert_eq!(255, d);
} | rust_cleaned_test_functions.jsonl/6017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
12759,
368,
341,
286,
1077,
5206,
24501,
284,
45734,
7939,
486,
931,
543,
286,
1077,
5206,
5828,
284,
18598,
486,
931,
1428,
286,
24501,
556,
4740,
68993,
7,
15,
87,
16,
1748,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_types_url_3() {
let module_url = Url::parse("https://example.com/mod.js").unwrap();
let source_code = r#"/// <reference types="https://deno.land/mod.d.ts" />
console.log("foo");"#
.as_bytes()
.to_owned();
let result = get_types_url(&module_url, &source_code, None);
assert_eq!(
result,
Some(Url::parse("https://deno.land/mod.d.ts").unwrap())
);
} | rust_cleaned_test_functions.jsonl/81714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9763,
2903,
62,
18,
368,
341,
262,
1077,
4688,
2903,
284,
22840,
486,
6400,
445,
2428,
1110,
8687,
905,
38479,
2857,
1827,
15454,
543,
262,
1077,
2530,
4136,
284,
435,
55543,
2575,
366,
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_parse_history_rejects_invalid_type() {
let expected_bytes = br#"{
"data": {
"name": "Platform version map",
"type": "some-type",
"versions": []
},
"schema_id": "https://fuchsia.dev/schema/version_history-ef02ef45.json"
}"#;
assert_eq!(
&parse_version_history(&expected_bytes[..]).unwrap_err().to_string(),
"invalid value: string \"some-type\", expected version_history"
);
} | rust_cleaned_test_functions.jsonl/30912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19802,
1288,
583,
82,
31433,
1819,
368,
341,
286,
1077,
3601,
12524,
284,
1411,
55543,
515,
310,
330,
691,
788,
341,
394,
330,
606,
788,
330,
17296,
2319,
2415,
756,
394,
330,
1313,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chained_byte_source() {
let random_bytes: Vec<u8> = (0..127).map(|_| random::<u8>()).collect();
// read 127 bytes from a non-chained source
let output_x = {
let input_x = Cursor::new(random_bytes.clone());
let mut reader = Fr32Reader::new(input_x);
let mut buf_x = Vec::new();
reader.read_to_end(&mut buf_x).expect("could not seek");
buf_x
};
for n in 1..127 {
let random_bytes = random_bytes.clone();
// read 127 bytes from a n-byte buffer and then the rest
let output_y = {
let input_y =
Cursor::new(random_bytes.iter().take(n).cloned().collect::<Vec<u8>>()).chain(
Cursor::new(random_bytes.iter().skip(n).cloned().collect::<Vec<u8>>()),
);
let mut reader = Fr32Reader::new(input_y);
let mut buf_y = Vec::new();
reader.read_to_end(&mut buf_y).expect("could not seek");
buf_y
};
assert_eq!(&output_x, &output_y, "should have written same bytes");
assert_eq!(
output_x.clone().into_boxed_slice(),
bit_vec_padding(random_bytes)
);
}
} | rust_cleaned_test_functions.jsonl/25672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2627,
19737,
10347,
368,
341,
286,
1077,
4194,
12524,
25,
11312,
34837,
23,
29,
284,
320,
15,
496,
16,
17,
22,
568,
2186,
22428,
35395,
4194,
27638,
84,
23,
29,
6011,
17384,
1428,
286,
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... | 2 |
#[test]
fn test_list_nodes_empty_ok() {
let pool = create_connection_pool_and_migrate();
let registry = DieselRegistry::new(pool);
let nodes = registry
.list_nodes(&[])
.expect("Failed to retrieve nodes")
.collect::<Vec<_>>();
assert_eq!(nodes.len(), 0);
} | rust_cleaned_test_functions.jsonl/106291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
14896,
15124,
19817,
368,
341,
286,
1077,
7314,
284,
1855,
15866,
15709,
8378,
717,
34479,
543,
286,
1077,
19424,
284,
53794,
15603,
486,
931,
41838,
626,
286,
1077,
7798,
284,
19424,
198,
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_find_trait_methods() {
let (analysis, pos) = fixture::position(
r#"
trait Foo {
fn bar() {$0}
fn baz() {}
}
"#,
);
let refs = analysis.find_all_methods(pos.file_id).unwrap();
check_result(&refs, &[19..=22, 35..=38]);
} | rust_cleaned_test_functions.jsonl/73292 | {
"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,
21814,
78491,
36084,
368,
341,
286,
1077,
320,
34484,
11,
1133,
8,
284,
12507,
486,
3487,
1006,
310,
435,
2,
698,
310,
17567,
33428,
341,
394,
5168,
3619,
368,
13924,
15,
532,
394,
5168,
50247,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_and_align() {
assert_eq!(
"%10s"
.parse::<CFormatSpec>()
.unwrap()
.format_string("test".to_string()),
" test".to_string()
);
assert_eq!(
"%-10s"
.parse::<CFormatSpec>()
.unwrap()
.format_string("test".to_string()),
"test ".to_string()
);
assert_eq!(
"%#10x"
.parse::<CFormatSpec>()
.unwrap()
.format_number(&BigInt::from(0x1337)),
" 0x1337".to_string()
);
assert_eq!(
"%-#10x"
.parse::<CFormatSpec>()
.unwrap()
.format_number(&BigInt::from(0x1337)),
"0x1337 ".to_string()
);
} | rust_cleaned_test_functions.jsonl/37680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
8378,
37015,
368,
341,
286,
2060,
10714,
33673,
310,
5962,
16,
15,
82,
698,
394,
659,
6400,
27638,
34,
4061,
8327,
18949,
394,
659,
15454,
741,
394,
659,
2243,
3904,
445,
1944,
3263,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_contains() {
let outer = Range::with_prefix(vec![1]);
let inner = Range::with_prefix(vec![1, 2]);
assert!(outer.contains(&inner, &Collator::default()));
assert!(!inner.contains(&outer, &Collator::default()));
let outer = Range::with_prefix(vec![1, 2]);
let inner = Range::new(vec![1, 2], 1..3);
assert!(outer.contains(&inner, &Collator::default()));
assert!(!inner.contains(&outer, &Collator::default()));
let outer = Range::with_prefix(vec![1, 2, 2]);
let inner = Range::new(vec![1, 2], 1..2);
assert!(!outer.contains(&inner, &Collator::default()));
assert!(!inner.contains(&outer, &Collator::default()));
let outer = Range::new(vec![1, 2], 3..4);
let inner = Range::with_prefix(vec![1, 2, 3]);
assert!(outer.contains(&inner, &Collator::default()));
assert!(!inner.contains(&outer, &Collator::default()));
} | rust_cleaned_test_functions.jsonl/43370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
63598,
368,
341,
286,
1077,
15955,
284,
16437,
486,
4197,
13974,
25592,
20703,
16,
2558,
286,
1077,
9179,
284,
16437,
486,
4197,
13974,
25592,
20703,
16,
11,
220,
17,
2558,
286,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ranges() {
let (analysis, file_id) = single_file(
r#"
#[derive(Clone, Debug)]
struct Foo {
pub x: i32,
pub y: i32,
}"#,
);
// The "x"
let highlights = &analysis
.highlight_range(FileRange { file_id, range: TextRange::offset_len(82.into(), 1.into()) })
.unwrap();
assert_eq!(&highlights[0].highlight.to_string(), "field");
} | rust_cleaned_test_functions.jsonl/19547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58748,
368,
341,
262,
1077,
320,
34484,
11,
1034,
842,
8,
284,
3175,
2458,
1006,
286,
435,
2,
698,
310,
11506,
27098,
65297,
11,
11091,
5563,
310,
2036,
33428,
341,
394,
6675,
856,
25,
600,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inline_self_cycle() {
let grammar = parser::parse_grammar(
r#"
grammar;
extern { }
#[inline] A: () = A;
"#,
)
.unwrap();
let grammar = lower_helper(&Session::test(), grammar, true).unwrap();
assert!(inline_order(&grammar).is_err());
} | rust_cleaned_test_functions.jsonl/43646 | {
"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,
41871,
25637,
39079,
368,
341,
262,
1077,
31428,
284,
6729,
486,
6400,
62,
41094,
1006,
286,
435,
2,
698,
262,
31428,
280,
262,
15637,
314,
456,
262,
11506,
5057,
60,
362,
25,
1719,
284,
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_live_count() {
let brd = testing_board(0);
assert_eq!(brd.living_neighbors(0, 0), 2);
assert_eq!(brd.living_neighbors(2, 2), 3);
} | rust_cleaned_test_functions.jsonl/24656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55203,
3180,
368,
341,
262,
1077,
1411,
67,
284,
7497,
23919,
7,
15,
317,
262,
2060,
10714,
10297,
1323,
67,
918,
2249,
55925,
7,
15,
11,
220,
15,
701,
220,
17,
317,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_cow() {
let borrowed: &[_] = &["borrowed", "(slice)"];
let owned = vec!["owned", "(vec)"];
assert_eq!(Vec::from(Cow::Borrowed(borrowed)), vec!["borrowed", "(slice)"]);
assert_eq!(Vec::from(Cow::Owned(owned)), vec!["owned", "(vec)"]);
} | rust_cleaned_test_functions.jsonl/24445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
666,
363,
368,
341,
262,
1077,
45564,
25,
609,
13496,
60,
284,
609,
1183,
71141,
291,
497,
11993,
24963,
8,
6332,
262,
1077,
12938,
284,
7486,
0,
1183,
18332,
497,
11993,
4083,
8,
6332,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serdes_bad_pk() {
let pk = Secp256r1Point::generator();
let mut s = serde_json::to_string(&pk).expect("Failed in serialization");
// we make sure that the string encodes invalid point:
s = s.replace("2770", "2780");
let des_pk: Secp256r1Point = serde_json::from_str(&s).expect("Failed in deserialization");
assert_eq!(des_pk, pk);
} | rust_cleaned_test_functions.jsonl/12356 | {
"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,
75861,
5799,
34199,
33321,
368,
341,
286,
1077,
22458,
284,
4520,
79,
17,
20,
21,
81,
16,
2609,
486,
35851,
543,
286,
1077,
5206,
274,
284,
61570,
9455,
486,
983,
3904,
2099,
20819,
568,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scalar_eq_non_std() {
scalar_ne_test!(ScalarValue::Float32, Some(1.0), Some(2.0));
scalar_ne_test!(ScalarValue::Float64, Some(1.0), Some(2.0));
} | rust_cleaned_test_functions.jsonl/1006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
10714,
21637,
15656,
368,
341,
1789,
286,
17274,
13925,
4452,
10297,
20639,
1130,
486,
5442,
18,
17,
11,
4329,
7,
16,
13,
15,
701,
4329,
7,
17,
13,
15,
1106,
286,
17274,
13925,
4452,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_thread_many_events() {
let mut builder = tokio::runtime::Builder::new();
let mut runtime = builder
.threaded_scheduler()
.core_threads(16)
.enable_all()
.build()
.unwrap();
runtime.block_on(async {
do_test_multi_thread_many_events().await.unwrap();
});
} | rust_cleaned_test_functions.jsonl/14584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
10814,
22101,
19691,
368,
341,
286,
1077,
5206,
7363,
284,
9628,
815,
486,
22255,
486,
3297,
486,
931,
543,
286,
1077,
5206,
15592,
284,
7363,
198,
310,
659,
4528,
291,
53646,
741,
310,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show() {
let mut map: TreeMap<int, int> = TreeMap::new();
let empty: TreeMap<int, int> = TreeMap::new();
map.insert(1, 2);
map.insert(3, 4);
let map_str = format!("{}", map);
assert!(map_str == "{1: 2, 3: 4}".to_string());
assert_eq!(format!("{}", empty), "{}".to_string());
} | rust_cleaned_test_functions.jsonl/66373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15267,
368,
341,
286,
1077,
5206,
2415,
25,
76883,
4159,
11,
526,
29,
284,
76883,
486,
931,
543,
286,
1077,
4287,
25,
76883,
4159,
11,
526,
29,
284,
76883,
486,
931,
1428,
286,
2415,
7030,
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_start_as_follower() {
let l = default_logger();
let r = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l);
assert_eq!(r.state, StateRole::Follower);
} | rust_cleaned_test_functions.jsonl/62291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
11898,
761,
29034,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
1125,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_static_all() {
let client = Client::new(rocket()).expect("valid rocket");
assert_all(&client, "both", REGULAR_FILES, true);
assert_all(&client, "both", HIDDEN_FILES, true);
assert_all(&client, "both", INDEXED_DIRECTORIES, true);
} | rust_cleaned_test_functions.jsonl/100211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
5705,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
7,
46790,
6011,
17119,
445,
1891,
24306,
797,
286,
2060,
5705,
2099,
2972,
11,
330,
21028,
497,
13676,
7081,
48010,
11,
830,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_when_quorum_becomes_less() {
let l = default_logger();
let mut network = Network::new(vec![None, None], &l);
let mut m = Message::default();
m.from = 1;
m.to = 1;
m.set_msg_type(MessageType::MsgHup);
network.send(vec![m]);
assert_eq!(network.peers[&1].raft_log.committed, 1);
// Read index on the peer.
let mut m = Message::default();
m.to = 1;
m.set_msg_type(MessageType::MsgReadIndex);
let mut e = Entry::default();
e.data = b"abcdefg".to_vec();
m.set_entries(vec![e].into());
network.dispatch(vec![m]).unwrap();
// Broadcast heartbeats.
let heartbeats = network.read_messages();
network.dispatch(heartbeats).unwrap();
// Drop heartbeat response from peer 2.
let heartbeat_responses = network.read_messages();
assert_eq!(heartbeat_responses.len(), 1);
network
.peers
.get_mut(&1)
.unwrap()
.apply_conf_change(&remove_node(2))
.unwrap();
assert!(!network.peers[&1].read_states.is_empty());
} | rust_cleaned_test_functions.jsonl/19203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
47636,
11280,
33006,
880,
757,
20347,
50747,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
3922,
284,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
1125,
609,
75,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extensions_from_path() {
use CompressionFormat::*;
let path = Path::new("bolovo.tar.gz");
let extensions: Vec<Extension> = extensions_from_path(path);
let formats: Vec<&CompressionFormat> = extensions.iter().flat_map(Extension::iter).collect::<Vec<_>>();
assert_eq!(formats, vec![&Tar, &Gzip]);
} | rust_cleaned_test_functions.jsonl/39966 | {
"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,
60498,
5673,
2638,
368,
341,
286,
990,
66161,
4061,
56162,
286,
1077,
1815,
284,
7933,
486,
931,
445,
30046,
21715,
28048,
20963,
3071,
286,
1077,
19721,
25,
11312,
27,
12049,
29,
284,
19721,
5673... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disk_full_followers_with_hibernate_regions() {
let mut cluster = new_node_cluster(0, 2);
// To ensure the thread has full store disk usage infomation.
cluster.cfg.raft_store.store_batch_system.pool_size = 1;
cluster.pd_client.disable_default_operator();
let _ = cluster.run_conf_change();
cluster.must_put(b"k1", b"v1");
// Add a peer which is almost disk full should be allowed.
fail::cfg(get_fp(DiskUsage::AlmostFull, 2), "return").unwrap();
cluster.pd_client.must_add_peer(1, new_peer(2, 2));
must_get_equal(&cluster.get_engine(2), b"k1", b"v1");
let tick_dur = cluster.cfg.raft_store.raft_base_tick_interval.0;
let election_timeout = cluster.cfg.raft_store.raft_election_timeout_ticks;
thread::sleep(tick_dur * 2 * election_timeout as u32);
fail::remove(get_fp(DiskUsage::AlmostFull, 2));
thread::sleep(tick_dur * 2);
cluster.must_put(b"k2", b"v2");
must_get_equal(&cluster.get_engine(2), b"k2", b"v2");
} | rust_cleaned_test_functions.jsonl/64929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41687,
16372,
43490,
388,
6615,
1523,
18818,
58035,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
17,
317,
262,
442,
2014,
5978,
279,
4516,
702,
2480,
3553,
13364,
104... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_renaming_of_expression() {
// Given: x + y * x
let mut expression = il::Expression::add(
il::expr_scalar("x", 64),
il::Expression::mul(il::expr_scalar("y", 64), il::expr_scalar("x", 64)).unwrap(),
)
.unwrap();
let mut versioning = ScalarVersioning::new();
versioning.start_new_scope();
versioning.new_version(&il::scalar("x", 64));
versioning.new_version(&il::scalar("y", 64));
expression.rename_scalars(&mut versioning).unwrap();
// Expected: x_1 + y_1 * x_1
assert_eq!(
expression,
il::Expression::add(
expr_scalar_ssa("x", 64, 1),
il::Expression::mul(expr_scalar_ssa("y", 64, 1), expr_scalar_ssa("x", 64, 1))
.unwrap(),
)
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/60300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
77,
6469,
3575,
28068,
368,
341,
286,
442,
16246,
25,
856,
488,
379,
353,
856,
198,
286,
1077,
5206,
7493,
284,
3815,
486,
9595,
486,
718,
1006,
310,
3815,
486,
9413,
41652,
445,
87,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repeat_until_loops_loops_v2() {
let client = graph_serializer(GraphSON::V2);
drop_vertices(&client, "test_repeat_until_loops").unwrap();
drop_vertices(&client, "test_repeat_until_loops_child").unwrap();
let g = traversal().with_remote(client);
let v1 = g
.add_v("test_repeat_until_loops")
.property("name", "a")
.to_list()
.unwrap();
let e1 = g
.add_v("test_repeat_until_loops_child")
.property("name", "b")
.to_list()
.unwrap();
let e2 = g
.add_v("test_repeat_until_loops_child")
.property("name", "c")
.to_list()
.unwrap();
g.add_e("child").from(&v1[0]).to(&e1[0]).to_list().unwrap();
g.add_e("child").from(&e1[0]).to(&e2[0]).to_list().unwrap();
let results = g
.v(v1[0].id())
.repeat(__.out("child"))
.until(__.loops(()).is(2))
.to_list()
.unwrap();
assert_eq!(results.len(), 1);
assert_eq!(results[0], e2[0]);
} | rust_cleaned_test_functions.jsonl/26301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41975,
44352,
5560,
3721,
5560,
3721,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
5943,
37720,
2099,
2972,
11,
330,
1944,
41975,
44352,
5560,
3721,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prg_rom() {
let mut builder = RomBuilder::new();
assert_eq!(&builder.build_rom().prg_rom, &vec![]);
builder.set_prg_page_count(4);
assert_eq!(&builder.build_rom().prg_rom, &builder.prg_rom);
} | rust_cleaned_test_functions.jsonl/104403 | {
"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,
620,
1984,
81383,
368,
972,
286,
1077,
5206,
7363,
284,
11774,
3297,
486,
931,
1647,
286,
2060,
10714,
0,
2099,
17850,
13239,
81383,
1005,
649,
70,
81383,
11,
609,
4083,
0,
1294,
3079,
286,
7363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_winning_post_empty_sector_challenge() -> Result<()> {
let rng = &mut XorShiftRng::from_seed(TEST_SEED);
let prover_fr: DefaultTreeDomain = Fr::random(rng).into();
let mut prover_id = [0u8; 32];
prover_id.copy_from_slice(AsRef::<[u8]>::as_ref(&prover_fr));
let sector_count = 0;
let sector_size = SECTOR_SIZE_2_KIB;
let (_, _, _, _) =
create_seal::<_, SectorShape2KiB>(rng, sector_size, prover_id, true, &ARBITRARY_POREP_ID)?;
let random_fr: DefaultTreeDomain = Fr::random(rng).into();
let mut randomness = [0u8; 32];
randomness.copy_from_slice(AsRef::<[u8]>::as_ref(&random_fr));
let config = PoStConfig {
sector_size: sector_size.into(),
sector_count,
challenge_count: WINNING_POST_CHALLENGE_COUNT,
typ: PoStType::Winning,
priority: false,
};
assert!(generate_winning_post_sector_challenge::<SectorShape2KiB>(
&config,
&randomness,
sector_count as u64,
prover_id
)
.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/4376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
19770,
6333,
15124,
62651,
87406,
368,
1464,
5714,
71698,
341,
262,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
50320,
3620,
1479,
626,
262,
1077,
462,
423,
415... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_characters_per_minute_is_undefined_if_not_started() {
let content_with_15_chars = "abcde fghijklmn";
let unit = TrainingSession {
lesson_content: content_with_15_chars.to_string(),
finished_chars: Vec::from_iter(content_with_15_chars.chars()),
remaining_chars: VecDeque::new(),
current_char: None,
last_input_result: InputResult::Correct,
start_time: None,
end_time: None,
errors: 0,
};
assert_eq!(unit.typing_speed(), TypingSpeed::CharactersPerMinute(0))
} | rust_cleaned_test_functions.jsonl/58817 | {
"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,
79060,
5678,
76944,
6892,
62,
9614,
11119,
7913,
55679,
368,
341,
286,
1077,
2213,
6615,
62,
16,
20,
37418,
284,
330,
13683,
450,
282,
866,
59779,
21775,
876,
286,
1077,
4982,
284,
16151,
5283,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_response_pdu_len() {
let mut buf = BytesMut::new();
buf.extend_from_slice(&[0x66, 0x01, 99]);
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
let mut buf = BytesMut::new();
buf.extend_from_slice(&[0x66, 0x00, 99, 0x00]);
assert!(get_response_pdu_len(&buf).is_err());
buf[1] = 0x01;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
buf[1] = 0x02;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
buf[1] = 0x03;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
buf[1] = 0x04;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
buf[1] = 0x05;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x06;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x07;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(2));
// TODO: 0x08
buf[1] = 0x0B;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x0C;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
buf[1] = 0x0F;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x10;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(5));
// TODO: 0x11
// TODO: 0x14
// TODO: 0x15
buf[1] = 0x16;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(7));
buf[1] = 0x17;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(101));
buf[1] = 0x18;
buf[2] = 0x01; // byte count Hi
buf[3] = 0x00; // byte count Lo
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(259));
// TODO: 0x2B
for i in 0x81..0xAB {
buf[1] = i;
assert_eq!(get_response_pdu_len(&buf).unwrap(), Some(2));
}
} | rust_cleaned_test_functions.jsonl/17495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1057
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9655,
95249,
6043,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
931,
543,
286,
6607,
15831,
5673,
26488,
2099,
58,
15,
87,
21,
21,
11,
220,
15,
87,
15,
16,
11,
220,
24,
24,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_schema_merge() -> Result<()> {
let merged = Schema::try_merge(&[
Schema::new(vec![
Field::new("first_name", DataType::Utf8, false),
Field::new("last_name", DataType::Utf8, false),
Field::new(
"address",
DataType::Struct(vec![Field::new("zip", DataType::UInt16, false)]),
false,
),
]),
Schema::new_with_metadata(
vec![
// nullable merge
Field::new("last_name", DataType::Utf8, true),
Field::new(
"address",
DataType::Struct(vec![
// add new nested field
Field::new("street", DataType::Utf8, false),
// nullable merge on nested field
Field::new("zip", DataType::UInt16, true),
]),
false,
),
// new field
Field::new("number", DataType::Utf8, true),
],
[("foo".to_string(), "bar".to_string())]
.iter()
.cloned()
.collect::<HashMap<String, String>>(),
),
])?;
assert_eq!(
merged,
Schema::new_with_metadata(
vec![
Field::new("first_name", DataType::Utf8, false),
Field::new("last_name", DataType::Utf8, true),
Field::new(
"address",
DataType::Struct(vec![
Field::new("zip", DataType::UInt16, true),
Field::new("street", DataType::Utf8, false),
]),
false,
),
Field::new("number", DataType::Utf8, true),
],
[("foo".to_string(), "bar".to_string())]
.iter()
.cloned()
.collect::<HashMap<String, String>>()
)
);
// support merge union fields
assert_eq!(
Schema::try_merge(&[
Schema::new(vec![Field::new(
"c1",
DataType::Union(vec![
Field::new("c11", DataType::Utf8, true),
Field::new("c12", DataType::Utf8, true),
]),
false
),]),
Schema::new(vec![Field::new(
"c1",
DataType::Union(vec![
Field::new("c12", DataType::Utf8, true),
Field::new("c13", DataType::Time64(TimeUnit::Second), true),
]),
false
),])
])?,
Schema::new(vec![Field::new(
"c1",
DataType::Union(vec![
Field::new("c11", DataType::Utf8, true),
Field::new("c12", DataType::Utf8, true),
Field::new("c13", DataType::Time64(TimeUnit::Second), true),
]),
false
),]),
);
// incompatible field should throw error
assert!(Schema::try_merge(&[
Schema::new(vec![
Field::new("first_name", DataType::Utf8, false),
Field::new("last_name", DataType::Utf8, false),
]),
Schema::new(vec![Field::new("last_name", DataType::Int64, false),])
])
.is_err());
// incompatible metadata should throw error
assert!(Schema::try_merge(&[
Schema::new_with_metadata(
vec![Field::new("first_name", DataType::Utf8, false)],
[("foo".to_string(), "bar".to_string()),]
.iter()
.cloned()
.collect::<HashMap<String, String>>()
),
Schema::new_with_metadata(
vec![Field::new("last_name", DataType::Utf8, false)],
[("foo".to_string(), "baz".to_string()),]
.iter()
.cloned()
.collect::<HashMap<String, String>>()
)
])
.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/107638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2839
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
20888,
368,
1464,
5714,
71698,
341,
286,
1077,
26001,
284,
12539,
486,
1539,
20888,
2099,
9640,
310,
12539,
486,
931,
25592,
90515,
394,
8601,
486,
931,
445,
3896,
1269,
497,
33172,
486,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insert_lines_single_offset()
{
let tmpdir = assert_memfs_setup!();
let file = tmpdir.mash("file");
// Seed the file
assert!(vfs::append_lines(&file, &["foo3"]).is_ok());
// Insert before with offset = 0
assert!(file::insert_lines(&file, &["foo2"], r"foo3", 0).is_ok());
assert_eq!(vfs::read_lines(&file).unwrap(), vec!["foo2".to_string(), "foo3".to_string(),]);
// Insert after with offset = 1
assert!(file::insert_lines(&file, &["foo4"], r"foo3", 1).is_ok());
assert_eq!(vfs::read_lines(&file).unwrap(), vec![
"foo2".to_string(),
"foo3".to_string(),
"foo4".to_string(),
]);
// Insert before negative with offset = -1
assert!(file::insert_lines(&file, &["foo1"], r"foo3", -1).is_ok());
assert_eq!(vfs::read_lines(&file).unwrap(), vec![
"foo1".to_string(),
"foo2".to_string(),
"foo3".to_string(),
"foo4".to_string(),
]);
assert_remove_all!(&tmpdir);
} | rust_cleaned_test_functions.jsonl/110971 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
18323,
19487,
6917,
741,
262,
341,
286,
1077,
4174,
3741,
284,
2060,
12976,
3848,
21363,
0,
543,
286,
1077,
1034,
284,
4174,
3741,
744,
988,
445,
1192,
3071,
286,
442,
35822,
279,
1034,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disk_resolver_new_from_catalog() {
let test_folder = testutils::setup_test_folder("disk_resolver_new_from_catalog");
let paths = [
test_folder.path().join("p"),
test_folder.path().join("p").join("48"),
test_folder.path().join("parts"),
test_folder.path().join("parts").join("s"),
test_folder.path().join("extra"),
];
for path in &paths {
std::fs::create_dir(path).unwrap();
}
let mut resolver = DiskResolver::new_from_catalog(test_folder.path()).unwrap();
resolver.add_path(test_folder.path().join("extra")).unwrap();
assert_eq!(5, resolver.base_paths.len());
for path in &paths {
assert!(resolver
.base_paths
.iter()
.find(|&p| { p == path })
.is_some());
}
} | rust_cleaned_test_functions.jsonl/32873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41687,
91578,
5921,
5673,
47310,
368,
341,
286,
1077,
1273,
15268,
284,
1273,
6031,
486,
15188,
4452,
15268,
445,
30496,
91578,
5921,
5673,
47310,
797,
286,
1077,
12716,
284,
2278,
310,
1273,
15268,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_discriminant_send_sync() {
enum Regular {
A,
B(i32),
}
enum NotSendSync {
A(*const i32),
}
fn is_send_sync<T: Send + Sync>() {}
is_send_sync::<Discriminant<Regular>>();
is_send_sync::<Discriminant<NotSendSync>>();
} | rust_cleaned_test_functions.jsonl/11253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
6283,
85296,
13565,
23008,
368,
341,
262,
7618,
28800,
341,
286,
362,
345,
286,
425,
1956,
18,
17,
1326,
262,
456,
262,
7618,
2806,
11505,
12154,
341,
286,
362,
4071,
1024,
600,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_score_clips() {
let x = b"AA";
let y = b"CC";
let kmer_len = 5;
let window_len = 5;
let base_score = Scoring::from_scores(-1, -1, 1, -1);
{
let scoring = Scoring {
xclip_prefix: 0,
yclip_prefix: 0,
..base_score.clone()
};
let mut al = pairwise::banded::Aligner::with_scoring(scoring, kmer_len, window_len);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
{
let scoring = Scoring {
xclip_prefix: 0,
yclip_suffix: 0,
..base_score.clone()
};
let mut al = pairwise::banded::Aligner::with_scoring(scoring, kmer_len, window_len);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
{
let scoring = Scoring {
xclip_suffix: 0,
yclip_prefix: 0,
..base_score.clone()
};
let mut al = pairwise::banded::Aligner::with_scoring(scoring, kmer_len, window_len);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
{
let scoring = Scoring {
xclip_suffix: 0,
yclip_suffix: 0,
..base_score
};
let mut al = pairwise::banded::Aligner::with_scoring(scoring, kmer_len, window_len);
let alignment = al.custom(x, y);
assert_eq!(alignment.score, 0);
}
} | rust_cleaned_test_functions.jsonl/126771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 943
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
10405,
6794,
3077,
368,
341,
286,
1077,
856,
284,
293,
1,
6029,
876,
286,
1077,
379,
284,
293,
1,
3706,
876,
286,
1077,
595,
1174,
6043,
284,
220,
20,
280,
286,
1077,
3241,
6043,
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_no_origin_response() {
let cors = Cors::build().finish();
let req = TestRequest::default().method(Method::GET).finish();
let resp: HttpResponse = HttpResponse::Ok().into();
let resp = cors.response(&req, resp).unwrap().response();
assert!(
resp.headers()
.get(header::ACCESS_CONTROL_ALLOW_ORIGIN)
.is_none()
);
let req = TestRequest::with_header("Origin", "https://www.example.com")
.method(Method::OPTIONS)
.finish();
let resp = cors.response(&req, resp).unwrap().response();
assert_eq!(
&b"https://www.example.com"[..],
resp.headers()
.get(header::ACCESS_CONTROL_ALLOW_ORIGIN)
.unwrap()
.as_bytes()
);
} | rust_cleaned_test_functions.jsonl/90071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
34043,
9655,
368,
341,
286,
1077,
43911,
284,
52518,
486,
5834,
1005,
30150,
1428,
286,
1077,
4232,
284,
3393,
1900,
486,
2258,
1005,
4393,
35419,
486,
3806,
568,
30150,
543,
286,
1077,
9039... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_passwd() {
// Test wether the passwd file can be parsed and recreated without throwing an exception
use std::convert::TryInto;
use std::fs::File;
use std::io::{prelude::*, BufReader};
let file = File::open("/etc/passwd").unwrap();
let reader = BufReader::new(file);
for (n, line) in reader.lines().enumerate() {
let lineorig: String = line.unwrap();
let linecopy = lineorig.clone();
let pass_struc = User::new_from_string(linecopy, n.try_into().unwrap()).unwrap();
assert_eq!(
lineorig,
format!("{}", pass_struc)
);
}
} | rust_cleaned_test_functions.jsonl/112401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
88667,
368,
341,
262,
442,
3393,
289,
2723,
279,
52037,
1034,
646,
387,
15676,
323,
36580,
2041,
21244,
458,
4683,
198,
262,
990,
1460,
486,
14166,
486,
21453,
26591,
280,
262,
990,
1460,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_perch() {
assert_query!("(30yd^2 + 1/4) to perch", 1, perch);
assert_query!("(1acre / 160) to perch", 1, perch);
assert_query!("(1rd * 1rd) to perch", 1, perch);
} | rust_cleaned_test_functions.jsonl/14328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5678,
331,
368,
341,
262,
2060,
5738,
17223,
7,
18,
15,
40121,
61,
17,
488,
220,
16,
14,
19,
8,
311,
41883,
497,
220,
16,
11,
41883,
317,
262,
2060,
5738,
17223,
7,
16,
28474,
608,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_requested_attrs_constructed_correctly_preformatted() {
let _setup = SetupDefaults::init();
let expected_req_attrs = _expected_req_attrs();
let req_attrs_string = serde_json::to_string(&expected_req_attrs).unwrap();
let request = ProofRequestData::create()
.set_nonce().unwrap()
.set_requested_attributes(req_attrs_string).unwrap();
assert_eq!(request.requested_attributes, expected_req_attrs);
} | rust_cleaned_test_functions.jsonl/65274 | {
"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,
72709,
39578,
64803,
291,
31550,
398,
10442,
49878,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16273,
486,
2327,
1428,
286,
1077,
3601,
17644,
39578,
284,
716,
7325,
17644,
39578,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_data_multibase() {
let method = test_method();
let mut new = method.clone();
*new.key_data_mut() = MethodData::PublicKeyMultibase("diff".into());
let diff = method.diff(&new).unwrap();
assert!(diff.id.is_none());
assert!(diff.controller.is_none());
assert!(diff.key_type.is_none());
assert!(diff.properties.is_none());
assert_eq!(
diff.key_data,
Some(DiffMethodData::PublicKeyMultibase(Some(DiffString(Some(
"diff".to_string()
)))))
);
let merge = method.merge(diff).unwrap();
assert_eq!(merge, new);
} | rust_cleaned_test_functions.jsonl/124423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
1769,
26290,
98746,
368,
341,
262,
1077,
1714,
284,
1273,
9032,
543,
262,
1077,
5206,
501,
284,
1714,
15997,
543,
262,
353,
931,
4735,
1769,
29523,
368,
284,
6730,
1043,
486,
61822,
40404,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_hex() {
assert_eq!("".to_string(), encode_hex(&[]));
assert_eq!("00".to_string(), encode_hex(&[0x00]));
assert_eq!("ab".to_string(), encode_hex(&[0xab]));
assert_eq!(
"01 a2 1a fe".to_string(),
encode_hex(&[0x01, 0xa2, 0x1a, 0xfe])
);
} | rust_cleaned_test_functions.jsonl/43982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
32655,
368,
341,
286,
2060,
10714,
17223,
3263,
983,
3904,
1507,
16164,
32655,
2099,
1294,
1106,
286,
2060,
10714,
17223,
15,
15,
3263,
983,
3904,
1507,
16164,
32655,
2099,
58,
15,
87,
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_term_dictionary_simple() -> crate::Result<()> {
let directory = RAMDirectory::create();
let path = PathBuf::from("TermDictionary");
{
let write = directory.open_write(&path)?;
let mut term_dictionary_builder = TermDictionaryBuilder::create(write)?;
term_dictionary_builder.insert("abc".as_bytes(), &make_term_info(34u64))?;
term_dictionary_builder.insert("abcd".as_bytes(), &make_term_info(346u64))?;
term_dictionary_builder.finish()?;
}
let file = directory.open_read(&path)?;
let term_dict: TermDictionary = TermDictionary::open(file)?;
assert_eq!(term_dict.get("abc").unwrap().doc_freq, 34u32);
assert_eq!(term_dict.get("abcd").unwrap().doc_freq, 346u32);
let mut stream = term_dict.stream();
{
{
let (k, v) = stream.next().unwrap();
assert_eq!(k.as_ref(), "abc".as_bytes());
assert_eq!(v.doc_freq, 34u32);
}
assert_eq!(stream.key(), "abc".as_bytes());
assert_eq!(stream.value().doc_freq, 34u32);
}
{
{
let (k, v) = stream.next().unwrap();
assert_eq!(k, "abcd".as_bytes());
assert_eq!(v.doc_freq, 346u32);
}
assert_eq!(stream.key(), "abcd".as_bytes());
assert_eq!(stream.value().doc_freq, 346u32);
}
assert!(!stream.advance());
Ok(())
} | rust_cleaned_test_functions.jsonl/101245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 802
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
42605,
30015,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
6220,
284,
22038,
9310,
486,
3182,
543,
286,
1077,
1815,
284,
7933,
15064,
486,
1499,
445,
17249,
8517,
797,
286,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_stack_stops_at_foreign_author() {
let (_dir, repo) = init_repo();
let old_commits = empty_commit_chain(&repo, "HEAD", &[], 3);
repo.config()
.unwrap()
.set_str("user.name", "nobody2")
.unwrap();
let new_commits = empty_commit_chain(&repo, "HEAD", &[old_commits.last().unwrap()], 2);
assert_stack_matches_chain(
2,
&working_stack(&repo, None, false, &empty_slog()).unwrap(),
&new_commits,
);
} | rust_cleaned_test_functions.jsonl/21469 | {
"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,
15528,
1261,
3721,
3752,
78983,
22938,
368,
341,
286,
1077,
5453,
3741,
11,
15867,
8,
284,
2930,
37784,
543,
286,
1077,
2310,
25149,
1199,
284,
4287,
36346,
30583,
2099,
23476,
11,
330,
35433,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_generation() {
let dir1 = TempDir::new("test").unwrap().into_path();
let dir2 = TempDir::new("test").unwrap().into_path();
let fqdn = "example.com".to_string();
write_default_keyfiles(&dir1, 10, Some(&fqdn), DEFAULT_SEED).unwrap();
write_default_keyfiles(&dir2, 10, Some(&fqdn), DEFAULT_SEED).unwrap();
{
let pub1 = read_default_pubfiles(&dir1).unwrap();
let pub2 = read_default_pubfiles(&dir2).unwrap();
assert_eq!(pub1.len(), 10);
assert_eq!(pub2.len(), 10);
assert_eq!(&pub1[..], &pub2[..]);
}
{
let bin1 = read_default_root_entropies(&dir1).unwrap();
let bin2 = read_default_root_entropies(&dir2).unwrap();
assert_eq!(bin1.len(), 10);
assert_eq!(bin2.len(), 10);
assert_eq!(&bin1[..], &bin2[..]);
}
} | rust_cleaned_test_functions.jsonl/89559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
64191,
368,
341,
286,
1077,
5419,
16,
284,
19944,
6184,
486,
931,
445,
1944,
1827,
15454,
1005,
18122,
2638,
543,
286,
1077,
5419,
17,
284,
19944,
6184,
486,
931,
445,
1944,
1827,
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... | 1 |
#[test]
fn test_ecdsa_pool_handle_invalid_unvalidated() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
with_test_replica_logger(|logger| {
let mut ecdsa_pool =
EcdsaPoolImpl::new(pool_config, logger, MetricsRegistry::new());
let time_source = FastForwardTimeSource::new();
let msg_id = {
let ecdsa_dealing =
create_ecdsa_dealing(dummy_idkg_transcript_id_for_tests(200));
let msg_id = ecdsa_dealing.message_hash();
ecdsa_pool.insert(UnvalidatedArtifact {
message: EcdsaMessage::EcdsaSignedDealing(ecdsa_dealing),
peer_id: NODE_1,
timestamp: time_source.get_relative_time(),
});
msg_id
};
check_state(&ecdsa_pool, &[msg_id.clone()], &[]);
ecdsa_pool.apply_changes(vec![EcdsaChangeAction::HandleInvalid(
msg_id,
"test".to_string(),
)]);
check_state(&ecdsa_pool, &[], &[]);
})
})
} | rust_cleaned_test_functions.jsonl/26789 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 736
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
15709,
10630,
31433,
4907,
59590,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
448,
4452,
25533,
15317,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extensible_uper() {
// https://asn1.io/asn1playground/
// value Extensible ::= abc { "" }
serialize_and_deserialize_uper(10, &[0x00, 0x00], &Extensible::Abc(String::default()));
serialize_and_deserialize_uper(
106,
&[
0x03, 0x12, 0x19, 0x5b, 0x1b, 0x1b, 0xc8, 0x15, 0xdb, 0xdc, 0x9b, 0x19, 0x08, 0x40,
],
&Extensible::Abc("Hello World!".to_string()),
);
serialize_and_deserialize_uper(18, &[0x40, 0x40, 0x00], &Extensible::Def(0));
serialize_and_deserialize_uper(26, &[0x40, 0x81, 0x4e, 0x40], &Extensible::Def(1337));
// value Extensible ::= ghi:0
serialize_and_deserialize_uper(32, &[0x80_u8, 0x02, 0x01, 0x00], &Extensible::Ghi(0));
// value Extensible ::= ghi:27
serialize_and_deserialize_uper(32, &[0x80_u8, 0x02, 0x01, 0x1B], &Extensible::Ghi(27));
serialize_and_deserialize_uper(
40,
&[0x80_u8, 0x03, 0x02, 0x05, 0x39],
&Extensible::Ghi(1337),
);
serialize_and_deserialize_uper(
120,
&[
0x82, 0x0d, 0x0c, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x61, 0x67, 0x61, 0x69, 0x6e,
0x21,
],
&Extensible::Mno("Hello again!".to_string()),
);
} | rust_cleaned_test_functions.jsonl/106150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 692
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9927,
36764,
62,
3466,
368,
341,
262,
442,
3703,
1110,
65536,
16,
4245,
14,
65536,
16,
1363,
1951,
5894,
262,
442,
897,
9447,
36764,
64154,
220,
39022,
314,
1591,
456,
262,
24235,
8378,
15768,
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_v8x16_shuffle() {
unsafe {
let a = [0_u8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
let b = [
16_u8, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
];
let vec_a: v128 = transmute(a);
let vec_b: v128 = transmute(b);
let vec_r = v8x16_shuffle::<0, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30>(
vec_a, vec_b,
);
let e = [0_u8, 16, 2, 18, 4, 20, 6, 22, 8, 24, 10, 26, 12, 28, 14, 30];
let vec_e: v128 = transmute(e);
compare_bytes(vec_r, vec_e);
}
} | rust_cleaned_test_functions.jsonl/9075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
23,
87,
16,
21,
73484,
368,
341,
286,
19860,
341,
310,
1077,
264,
284,
508,
15,
7300,
23,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_existing() {
let _setup = SetupMocks::init();
let handle = create_connection("test_serialize_deserialize").unwrap();
let _pw_did = get_pw_did(handle).unwrap();
let first_string = to_string(handle).unwrap();
let handle = from_string(&first_string).unwrap();
let _pw_did = get_pw_did(handle).unwrap();
let second_string = to_string(handle).unwrap();
assert_eq!(first_string, second_string);
} | rust_cleaned_test_functions.jsonl/20879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
62630,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
1855,
15866,
445,
1944,
88686,
15768,
9050,
1827,
15454,
1428,
286,
1077,
716,
31862,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dns_hosts() {
let json_str = r#"
{
"dns": {
"hosts": {
"example.com": [
"192.168.0.1",
"192.168.0.2"
]
}
}
}
"#;
let mut config = crate::config::json::from_string(json_str.to_string()).unwrap();
let hosts = config.dns.as_ref().unwrap().hosts.as_ref().unwrap();
let ips = vec!["192.168.0.1".to_string(), "192.168.0.2".to_string()];
assert_eq!(hosts.get("example.com").unwrap(), &ips);
let config = crate::config::json::to_internal(&mut config).unwrap();
assert_eq!(
config
.dns
.unwrap()
.hosts
.get("example.com")
.unwrap()
.values
.as_slice(),
&ips
);
} | rust_cleaned_test_functions.jsonl/72137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71125,
61129,
368,
341,
262,
1077,
2951,
2895,
284,
435,
2,
698,
262,
341,
286,
330,
45226,
788,
341,
310,
330,
44692,
788,
341,
394,
330,
8687,
905,
788,
2278,
503,
330,
16,
24,
17,
13,
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_f_port_could_be_absent_in_data_payload() {
let bytes = &[0x04, 0x03, 0x02, 0x01, 0x00, 0xff, 0x04];
let data_payload = DataPayload::new(bytes, true);
assert!(data_payload.is_some());
assert!(data_payload.unwrap().f_port().is_none());
} | rust_cleaned_test_functions.jsonl/81590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
8716,
666,
616,
21263,
31170,
306,
1243,
1769,
32813,
368,
341,
262,
1077,
5820,
284,
44590,
15,
87,
15,
19,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
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_in_annotated_module() {
let mock = new_mock!(TestTrait);
given! {
<mock as TestTrait>::func |_| true then_return 12 always;
}
assert_eq!(mock.func(1), 12);
} | rust_cleaned_test_functions.jsonl/90515 | {
"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,
1243,
62,
3401,
657,
10750,
368,
341,
286,
1077,
7860,
284,
501,
34134,
10297,
2271,
49257,
626,
286,
2661,
0,
341,
310,
366,
16712,
438,
3393,
49257,
6831,
2830,
66091,
830,
1221,
12511,
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 |
#[test]
fn test_avro_3405_writer_add_metadata_failure() {
let schema = Schema::parse_str(SCHEMA).unwrap();
let mut writer = Writer::new(&schema, Vec::new());
let mut record = Record::new(&schema).unwrap();
record.put("a", 27i64);
record.put("b", "foo");
writer.append(record.clone()).unwrap();
match writer.add_user_metadata("stringKey".to_string(), String::from("value2")) {
Err(e @ Error::FileHeaderAlreadyWritten) => {
assert_eq!(e.to_string(), "The file metadata is already flushed.")
}
Err(e) => panic!(
"Unexpected error occurred while writing user metadata: {:?}",
e
),
Ok(_) => panic!("Expected an error that metadata cannot be added after adding data"),
}
} | rust_cleaned_test_functions.jsonl/37667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26173,
299,
62,
18,
19,
15,
20,
28908,
2891,
22220,
43618,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
59461,
35839,
568,
15454,
543,
286,
1077,
5206,
6916,
284,
29404,
486,
931,
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... | 2 |
#[test]
fn test_include_and_exclude_match_include() {
let include = Some(vec![String::from("ext4")]);
let exclude = Some(vec![String::from("squashfs")]);
let opt = Options {
include,
exclude,
..Default::default()
};
let m = mount_info("ext4", "/mnt/foo", false, false);
assert!(is_included(&m, &opt));
} | rust_cleaned_test_functions.jsonl/7075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
8378,
88668,
10708,
37878,
368,
341,
310,
1077,
2924,
284,
4329,
25592,
20703,
703,
486,
1499,
445,
427,
19,
899,
2558,
310,
1077,
21687,
284,
4329,
25592,
20703,
703,
486,
1499,
445,
97407... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ship_within_days() {
assert_eq!(
15,
Solution::ship_within_days(vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5)
);
assert_eq!(6, Solution::ship_within_days(vec![3, 2, 2, 4, 1, 4], 3));
assert_eq!(3, Solution::ship_within_days(vec![1, 2, 3, 1, 1], 4));
} | rust_cleaned_test_functions.jsonl/61820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31042,
72385,
28353,
368,
341,
262,
2060,
10714,
33673,
286,
220,
16,
20,
345,
286,
12478,
486,
5270,
72385,
28353,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
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_pt1() {
assert_eq!(
(112, 848),
Solver::run_on(
"
.#.
..#
###
",
)
);
} | rust_cleaned_test_functions.jsonl/16149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20124,
16,
368,
341,
286,
2060,
10714,
33673,
310,
320,
16,
16,
17,
11,
220,
23,
19,
23,
1326,
310,
68295,
486,
6108,
4470,
1006,
394,
6228,
394,
659,
2,
624,
394,
5241,
4956,
394,
65287,
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 |
#[test]
fn test_fr_squaring() {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..1000000 {
let a = Fs::rand(&mut rng);
let mut tmp = a;
tmp.square();
let mut tmp2 = a;
tmp2.mul_assign(&a);
assert_eq!(tmp, tmp2);
}
} | rust_cleaned_test_functions.jsonl/95514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
643,
446,
3249,
368,
341,
41693,
14808,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
20,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_exchange_password_with_json_response() {
let client = new_client();
let token = client
.exchange_password(
&ResourceOwnerUsername::new("user".to_string()),
&ResourceOwnerPassword::new("pass".to_string()),
)
.add_scope(Scope::new("read".to_string()))
.add_scope(Scope::new("write".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=password&username=user&password=pass&scope=read+write",
None,
HttpResponse {
status_code: StatusCode::OK,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "{\
\"access_token\": \"12/34\", \
\"token_type\": \"bearer\", \
\"scope\": \"read write\"\
}"
.to_string()
.into_bytes(),
},
))
.unwrap();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(BasicTokenType::Bearer, *token.token_type());
assert_eq!(
Some(&vec![
Scope::new("read".to_string()),
Scope::new("write".to_string()),
]),
token.scopes()
);
assert_eq!(None, token.expires_in());
assert!(token.refresh_token().is_none());
} | rust_cleaned_test_functions.jsonl/18597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 935
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
10122,
6615,
9455,
9655,
368,
341,
262,
1077,
2943,
284,
501,
8179,
543,
262,
1077,
3950,
284,
2943,
198,
286,
659,
39568,
10122,
1006,
310,
609,
4783,
13801,
11115,
486,
931,
445,
872,
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_concurrent_contains_key() {
let map = HashMap::new();
let mut content = [0; NUM_ENTRIES];
{
let guard = map.guard();
for k in 0..NUM_ENTRIES {
map.insert(k, k, &guard);
content[k] = k;
}
}
test(content, Arc::new(map));
} | rust_cleaned_test_functions.jsonl/63384 | {
"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,
3382,
3231,
63598,
3097,
368,
341,
262,
1077,
2415,
284,
10528,
486,
931,
543,
262,
1077,
5206,
2213,
284,
508,
15,
26,
15943,
87695,
935,
262,
341,
286,
1077,
7616,
284,
2415,
73529,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pop_value_success() {
let size = 1;
let mut stack = super::Stack::init(size);
stack.push(String::from("a"));
let poppped = match stack.pop() {
Some(val) => val,
None => String::from("")
};
assert_eq!(poppped, String::from("a"));
} | rust_cleaned_test_functions.jsonl/70595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
3142,
18632,
368,
341,
262,
1077,
1379,
284,
220,
16,
280,
262,
1077,
5206,
5611,
284,
2256,
486,
4336,
486,
2327,
6856,
317,
262,
5611,
2552,
2242,
486,
1499,
445,
64,
4010,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unbond_too_much_rel() {
let mut stakes = new_stakes(&[(KEY1, 999), (KEY2, 1)]);
let total = 999 + 1;
assert_eq!(
Err(Error::UnbondTooLarge),
stakes.unbond(
&PublicKey::new(KEY1),
Some(U512::from(super::MAX_REL_DECREASE * total / 1_000_000 + 1))
),
"Successfully unbonded more than the maximum amount."
);
assert_eq!(
Ok(U512::from(super::MAX_REL_DECREASE * total / 1_000_000)),
stakes.unbond(
&PublicKey::new(KEY1),
Some(U512::from(super::MAX_REL_DECREASE * total / 1_000_000))
),
"Failed to unbond the maximum amount."
);
} | rust_cleaned_test_functions.jsonl/22345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
64239,
2346,
78,
717,
1387,
13557,
368,
341,
286,
1077,
5206,
44425,
284,
501,
1261,
2050,
2099,
9697,
4784,
16,
11,
220,
24,
24,
24,
701,
320,
4784,
17,
11,
220,
16,
41958,
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_different_reads() {
let mut headers = Headers::new();
headers.set_raw("Content-Length", "10");
headers.set_raw("Content-Type", "text/plain");
let ContentLength(_) = *headers.get::<ContentLength>().unwrap();
let ContentType(_) = *headers.get::<ContentType>().unwrap();
} | rust_cleaned_test_functions.jsonl/108098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82741,
66628,
368,
341,
286,
1077,
5206,
7102,
284,
21426,
486,
931,
543,
286,
7102,
980,
16067,
445,
2762,
52493,
497,
330,
16,
15,
797,
286,
7102,
980,
16067,
445,
2762,
10804,
497,
330,
1318,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smoke_basin_example() {
let input = utils::read_file_lines("input/day9_1.txt".to_string());
assert_eq!(Day9::smoke_basin(input), 15);
} | rust_cleaned_test_functions.jsonl/18886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
880,
50310,
39304,
368,
341,
286,
1077,
1946,
284,
12439,
486,
878,
2458,
18323,
445,
1355,
44739,
24,
62,
16,
3909,
3263,
983,
3904,
1423,
286,
2060,
10714,
10297,
10159,
24,
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 |
#[test]
fn test_process_register() {
let mut rng = ThreadRng256 {};
let dummy_user_presence = |_| panic!("Unexpected user presence check in CTAP1");
let mut ctap_state = CtapState::new(&mut rng, dummy_user_presence, START_CLOCK_VALUE);
let application = [0x0A; 32];
let message = create_register_message(&application);
ctap_state.u2f_up_state.consume_up(START_CLOCK_VALUE);
ctap_state.u2f_up_state.grant_up(START_CLOCK_VALUE);
let response = Ctap1Command::process_command(&message, &mut ctap_state, START_CLOCK_VALUE);
// Certificate and private key are missing
assert_eq!(response, Err(Ctap1StatusCode::SW_INTERNAL_EXCEPTION));
let fake_key = [0x41u8; key_material::ATTESTATION_PRIVATE_KEY_LENGTH];
assert!(ctap_state
.persistent_store
.set_attestation_private_key(&fake_key)
.is_ok());
ctap_state.u2f_up_state.consume_up(START_CLOCK_VALUE);
ctap_state.u2f_up_state.grant_up(START_CLOCK_VALUE);
let response = Ctap1Command::process_command(&message, &mut ctap_state, START_CLOCK_VALUE);
// Certificate is still missing
assert_eq!(response, Err(Ctap1StatusCode::SW_INTERNAL_EXCEPTION));
let fake_cert = [0x99u8; 100]; // Arbitrary length
assert!(ctap_state
.persistent_store
.set_attestation_certificate(&fake_cert[..])
.is_ok());
ctap_state.u2f_up_state.consume_up(START_CLOCK_VALUE);
ctap_state.u2f_up_state.grant_up(START_CLOCK_VALUE);
let response =
Ctap1Command::process_command(&message, &mut ctap_state, START_CLOCK_VALUE).unwrap();
assert_eq!(response[0], Ctap1Command::LEGACY_BYTE);
assert_eq!(response[66], CREDENTIAL_ID_SIZE as u8);
assert!(ctap_state
.decrypt_credential_source(response[67..67 + CREDENTIAL_ID_SIZE].to_vec(), &application)
.unwrap()
.is_some());
const CERT_START: usize = 67 + CREDENTIAL_ID_SIZE;
assert_eq!(
&response[CERT_START..CERT_START + fake_cert.len()],
&fake_cert[..]
);
} | rust_cleaned_test_functions.jsonl/55436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1041
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14000,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
17292,
3317,
56403,
284,
66091,
21975,
17223,
29430,
1196,
9362,
1779,
304,
18572,
2537,
16,
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_parse_unit_header_32_ok() {
let expected_rest = &[1, 2, 3, 4, 5, 6, 7, 8, 9];
let encoding = Encoding {
format: Format::Dwarf32,
version: 4,
address_size: 4,
};
let mut expected_unit = UnitHeader {
encoding,
unit_length: 0,
debug_abbrev_offset: DebugAbbrevOffset(0x0807_0605),
entries_buf: EndianSlice::new(expected_rest, LittleEndian),
};
let section = Section::with_endian(Endian::Little)
.unit(&mut expected_unit, &[])
.append_bytes(expected_rest);
let buf = section.get_contents().unwrap();
let rest = &mut EndianSlice::new(&buf, LittleEndian);
assert_eq!(parse_unit_header(rest), Ok(expected_unit));
assert_eq!(*rest, EndianSlice::new(expected_rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/101999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14832,
8757,
62,
18,
17,
19817,
368,
341,
286,
1077,
3601,
32231,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_best_location() {
let grid1 = asteroids_from_str("
.#..#
.....
#####
....#
...##
");
assert_eq!(best_location(&grid1), Location {coord: (3, 4), n_reachable: 8});
let grid2 = asteroids_from_str("
......#.#.
#..#.#....
..#######.
.#.#.###..
.#..#.....
..#....#.#
#..#....#.
.##.#..###
##...#..#.
.#....####
");
assert_eq!(best_location(&grid2), Location {coord: (5,8), n_reachable: 33});
let grid3 = asteroids_from_str("
#.#...#.#.
.###....#.
.#....#...
##.#.#.#.#
....#.#.#.
.##..###.#
..#...##..
..##....##
......#...
.####.###.
");
assert_eq!(best_location(&grid3), Location {coord: (1,2), n_reachable: 35});
let grid4 = asteroids_from_str("
.#..#..###
####.###.#
....###.#.
..###.##.#
##.##.#.#.
....###..#
..#.#..#.#
#..#.#.###
.##...##.#
.....#.#..
");
assert_eq!(best_location(&grid4), Location {coord: (6,3), n_reachable: 41});
let grid5 = asteroids_from_str("
.#..##.###...#######
##.############..##.
.#.######.########.#
.###.#######.####.#.
#####.##.#.##.###.##
..#####..#.#########
####################
#.####....###.#.#.##
##.#################
#####.##.###..####..
..######..##.#######
####.##.####...##..#
.#####..#.######.###
##...#.##########...
#.##########.#######
.####.#.###.###.#.##
....##.##.###..#####
.#.#.###########.###
#.#.#.#####.####.###
###.##.####.##.#..##
");
assert_eq!(best_location(&grid5), Location {coord: (11,13), n_reachable: 210});
} | rust_cleaned_test_functions.jsonl/46215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33101,
13126,
368,
341,
10217,
5827,
16,
284,
84222,
5673,
2895,
70576,
197,
197,
43326,
496,
4956,
197,
197,
1934,
624,
197,
197,
77344,
197,
197,
1934,
4956,
197,
197,
1112,
22614,
197,
797,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_subslice() {
// empty slice
assert!(valid_subslice("", 0, 0, &[]).is_ok());
// the only possible non-empty slice
assert!(valid_subslice("", 0, 1, &[1]).is_ok());
// valid empty slice
assert!(valid_subslice("", 1, 0, &[1]).is_ok());
// just some valid cases
assert!(valid_subslice("", 0, 4, &[1, 2, 3, 4]).is_ok());
assert!(valid_subslice("", 1, 3, &[1, 2, 3, 4]).is_ok());
assert!(valid_subslice("", 2, 2, &[1, 2, 3, 4]).is_ok());
// invalid longer-than-the-heap subslices
assert!(valid_subslice("", 3, 2, &[1, 2, 3, 4]).is_err());
assert!(valid_subslice("", 0, 5, &[1, 2, 3, 4]).is_err());
assert!(valid_subslice("", 4, 1, &[1, 2, 3, 4]).is_err());
} | rust_cleaned_test_functions.jsonl/109057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
5228,
24963,
368,
341,
286,
442,
4287,
15983,
198,
286,
2060,
10297,
1891,
5228,
24963,
19814,
220,
15,
11,
220,
15,
11,
609,
1294,
568,
285,
19817,
1423,
286,
442,
279,
1172,
3204,
2477,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_state() {
crate::utils::setup_logger();
let state = "discussion";
let mut content = r#"sdfsdf
sdfsdf
state: sdfsdfsdf
dsfsdf
sdf
authors: nope"#;
let mut result = update_state(content, state, true).unwrap();
let mut expected = r#"sdfsdf
sdfsdf
state: discussion
dsfsdf
sdf
authors: nope"#;
assert_eq!(expected, result);
content = r#"sdfsdf
= sdfgsd
state: fgsdfg
:state: prediscussion
dsfsdf
sdf
:state: nope"#;
result = update_state(content, state, false).unwrap();
expected = r#"sdfsdf
= sdfgsd
state: fgsdfg
:state: discussion
dsfsdf
sdf
:state: nope"#;
assert_eq!(expected, result);
content = r#"sdfsdf
= sdfgsd
state: fgsdfg
:state:
dsfsdf
sdf
:state: nope"#;
result = update_state(content, state, false).unwrap();
expected = r#"sdfsdf
= sdfgsd
state: fgsdfg
:state: discussion
dsfsdf
sdf
:state: nope"#;
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/2869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
4387,
368,
341,
286,
17717,
486,
6031,
486,
15188,
27413,
1428,
286,
1077,
1584,
284,
330,
69869,
876,
286,
1077,
5206,
2213,
284,
435,
55543,
82,
34378,
2940,
198,
82,
34378,
2940,
198,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_usize() {
assert_eq!(WordOffset::try_from(0), Ok(WordOffset(0)));
assert_eq!(WordOffset::try_from(1), Err(UnalignedError(1)));
assert_eq!(WordOffset::try_from(7), Err(UnalignedError(7)));
assert_eq!(WordOffset::try_from(8), Ok(WordOffset(8)));
} | rust_cleaned_test_functions.jsonl/57288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
11306,
551,
368,
341,
286,
2060,
10714,
10297,
10879,
6446,
486,
1539,
5673,
7,
15,
701,
7622,
7,
10879,
6446,
7,
15,
4945,
286,
2060,
10714,
10297,
10879,
6446,
486,
1539,
5673,
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_string_min_max_1() {
let a = Utf8Array::<i32>::from(&[None, None, Some("b"), Some("a")]);
assert_eq!(Some("a"), min_string(&a));
assert_eq!(Some("b"), max_string(&a));
} | rust_cleaned_test_functions.jsonl/112095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
7260,
6345,
62,
16,
368,
341,
262,
1077,
264,
284,
43432,
23,
1857,
27638,
72,
18,
17,
6831,
1499,
2099,
58,
4064,
11,
2240,
11,
4329,
445,
65,
3975,
4329,
445,
64,
899,
2558,
262,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_js_doc_tag_param() {
assert_eq!(
serde_json::to_value(JsDoc::from(
"@param a maybe doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "param",
"name": "a",
"doc": "maybe doc\n\nnew paragraph",
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@param {string} a maybe doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "param",
"name": "a",
"type": "string",
"doc": "maybe doc\n\nnew paragraph",
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from("@param {string} a".to_string()))
.unwrap(),
json!({
"tags": [{
"kind": "param",
"name": "a",
"type": "string",
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@arg {string} a maybe doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "param",
"name": "a",
"type": "string",
"doc": "maybe doc\n\nnew paragraph",
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@argument {string} a maybe doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "param",
"name": "a",
"type": "string",
"doc": "maybe doc\n\nnew paragraph",
}]
})
);
} | rust_cleaned_test_functions.jsonl/119530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 904
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
18869,
9372,
4090,
368,
341,
262,
2060,
10714,
33673,
414,
61570,
9455,
486,
983,
3142,
16368,
82,
9550,
486,
1499,
1006,
286,
8428,
903,
264,
7196,
4629,
1699,
1699,
931,
14311,
3263,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_files_single_valid_with_unicode_bom() {
let mut file: NamedTempFile = NamedTempFile::new().unwrap();
write!(file, "\u{FEFF}{{ \"foo\": \"bar\" }}").unwrap();
assert_cli::Assert::main_binary()
.with_args(&[file.path().to_str().unwrap()])
.succeeds()
.unwrap();
} | rust_cleaned_test_functions.jsonl/47573 | {
"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,
10931,
19487,
8337,
6615,
54662,
880,
316,
368,
341,
262,
1077,
5206,
1034,
25,
40459,
12151,
1703,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
262,
3270,
10297,
1192,
11,
2917,
84,
90,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arc_dist() {
// start at 5 go all the way around the arc anti-clockwise until
// you reach 5. You will have traveled 5 less then the entire arc plus one
// for the reserved zero value
assert_eq!(wrapped_distance(10, 5), u32::MAX - 4);
assert_eq!(wrapped_distance(5, 10), 5);
assert_eq!(
wrapped_distance(u32::MAX, Wrapping(u32::MAX) + Wrapping(5)),
5
);
assert_eq!(wrapped_distance(u32::MAX, 0), 1);
assert_eq!(wrapped_distance(0, MAX_HALF_LENGTH), MAX_HALF_LENGTH);
} | rust_cleaned_test_functions.jsonl/75431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62914,
16031,
368,
341,
262,
442,
1191,
518,
220,
20,
728,
678,
279,
1616,
2163,
279,
15580,
7147,
54288,
4482,
3080,
198,
262,
442,
498,
5545,
220,
20,
13,
1446,
686,
614,
30696,
220,
20,
268... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_splice_forget() {
let mut v = vec![1, 2, 3, 4, 5];
let a = [10, 11, 12];
std::mem::forget(v.splice(2..4, a.iter().cloned()));
assert_eq!(v, &[1, 2]);
} | rust_cleaned_test_functions.jsonl/24434 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
4754,
5478,
455,
368,
341,
262,
1077,
5206,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
264,
284,
508,
16,
15,
11,
220,
16,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mem_instructions() {
let context = Context::create();
let module = context.create_module("testing");
let builder = context.create_builder();
let void_type = context.void_type();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let fn_type = void_type.fn_type(&[f32_ptr_type.into(), f32_type.into()], false);
let function = module.add_function("mem_inst", fn_type, None);
let basic_block = context.append_basic_block(&function, "entry");
builder.position_at_end(&basic_block);
let arg1 = function.get_first_param().unwrap().into_pointer_value();
let arg2 = function.get_nth_param(1).unwrap().into_float_value();
assert!(arg1.get_first_use().is_none());
assert!(arg2.get_first_use().is_none());
let f32_val = f32_type.const_float(::std::f64::consts::PI);
let store_instruction = builder.build_store(arg1, f32_val);
let load = builder.build_load(arg1, "");
let load_instruction = load.as_instruction_value().unwrap();
assert_eq!(store_instruction.get_volatile().unwrap(), false);
assert_eq!(load_instruction.get_volatile().unwrap(), false);
store_instruction.set_volatile(true).unwrap();
load_instruction.set_volatile(true).unwrap();
assert_eq!(store_instruction.get_volatile().unwrap(), true);
assert_eq!(load_instruction.get_volatile().unwrap(), true);
store_instruction.set_volatile(false).unwrap();
load_instruction.set_volatile(false).unwrap();
assert_eq!(store_instruction.get_volatile().unwrap(), false);
assert_eq!(load_instruction.get_volatile().unwrap(), false);
assert_eq!(store_instruction.get_alignment().unwrap(), 0);
assert_eq!(load_instruction.get_alignment().unwrap(), 0);
assert!(store_instruction.set_alignment(16).is_ok());
assert!(load_instruction.set_alignment(16).is_ok());
assert_eq!(store_instruction.get_alignment().unwrap(), 16);
assert_eq!(load_instruction.get_alignment().unwrap(), 16);
assert!(store_instruction.set_alignment(0).is_ok());
assert!(load_instruction.set_alignment(0).is_ok());
assert_eq!(store_instruction.get_alignment().unwrap(), 0);
assert_eq!(load_instruction.get_alignment().unwrap(), 0);
assert!(store_instruction.set_alignment(14).is_err());
assert_eq!(store_instruction.get_alignment().unwrap(), 0);
let fadd_instruction = builder.build_float_add(load.into_float_value(), f32_val, "").as_instruction_value().unwrap();
assert!(fadd_instruction.get_volatile().is_err());
assert!(fadd_instruction.set_volatile(false).is_err());
assert!(fadd_instruction.get_alignment().is_err());
assert!(fadd_instruction.set_alignment(16).is_err());
} | rust_cleaned_test_functions.jsonl/92683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1044
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12976,
82427,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
8840,
797,
262,
1077,
7363,
284,
2266,
2520,
28532,
1428,
262,
1077,
737,
1819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_42() {
Interpreter::default().enter(|vm| {
let source = String::from("print('Hello world')");
let vars = vm.new_scope_with_builtins();
let result = eval(&vm, &source, vars, "<unittest>").expect("this should pass");
assert!(vm.is_none(&result));
})
} | rust_cleaned_test_functions.jsonl/40985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
62,
19,
17,
368,
341,
286,
82493,
486,
2258,
1005,
1950,
22428,
7338,
91,
341,
310,
1077,
2530,
284,
923,
486,
1499,
445,
1350,
492,
9707,
1879,
77933,
310,
1077,
19942,
284,
10995,
4618,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_items_reverse() {
let vec = vec![1, 2, 3];
let mut vec2 : Vec<i32> = vec![];
for i in vec.into_iter().rev() {
vec2.push(i);
}
assert!(vec2 == vec![3, 2, 1]);
} | rust_cleaned_test_functions.jsonl/98388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
12134,
43277,
368,
341,
286,
1077,
7486,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
5206,
7486,
17,
549,
11312,
21897,
18,
17,
29,
284,
7486,
0,
15078,
286,
369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scroll_left_right() {
let t = ["1234567890123456789012345678901234567890"];
let texts = gen_texts(&t);
let mut pane = gen_pane!(OpenOptions::new().write(true).open("/dev/null").unwrap());
pane.load(texts.clone());
let width: u16 = 4;
let height: u16 = 2;
pane.replace_termsize_getter(Box::new(TestTerminal::new(width, height)));
let stride_page = width;
let stride_hpage = width / 2;
// in range
{
assert_eq!(pane.position(), (0, 0));
assert_eq!(pane.scroll_right(&ScrollStep::Char(1)).unwrap(), 1);
assert_eq!(pane.scroll_right(&ScrollStep::Char(2)).unwrap(), 2);
assert_eq!(pane.position(), (3, 0));
assert_eq!(pane.scroll_left(&ScrollStep::Char(1)).unwrap(), 1);
assert_eq!(pane.scroll_left(&ScrollStep::Char(2)).unwrap(), 2);
assert_eq!(pane.position(), (0, 0));
assert_eq!(
pane.scroll_right(&ScrollStep::HalfPage(1)).unwrap(),
stride_hpage
);
assert_eq!(
pane.scroll_right(&ScrollStep::HalfPage(2)).unwrap(),
stride_hpage * 2
);
assert_eq!(pane.position(), (stride_hpage * 3, 0));
assert_eq!(
pane.scroll_left(&ScrollStep::HalfPage(1)).unwrap(),
stride_hpage
);
assert_eq!(
pane.scroll_left(&ScrollStep::HalfPage(2)).unwrap(),
stride_hpage * 2
);
assert_eq!(pane.position(), (0, 0));
assert_eq!(
pane.scroll_right(&ScrollStep::Page(1)).unwrap(),
stride_page
);
assert_eq!(
pane.scroll_right(&ScrollStep::Page(2)).unwrap(),
stride_page * 2
);
assert_eq!(pane.position(), (stride_page * 3, 0));
assert_eq!(pane.scroll_left(&ScrollStep::Page(1)).unwrap(), stride_page);
assert_eq!(
pane.scroll_left(&ScrollStep::Page(2)).unwrap(),
stride_page * 2
);
assert_eq!(pane.position(), (0, 0));
}
// out of range
{
// need to consider right margin
assert_eq!(
pane.scroll_right(&ScrollStep::Page(10)).unwrap(),
texts.borrow()[0].len() as u16 - width + Pane::MARGIN_RIGHT_WIDTH
);
assert_eq!(
pane.position(),
(
texts.borrow()[0].len() as u16 - width + Pane::MARGIN_RIGHT_WIDTH,
0
)
);
let (w, _) = pane.position();
assert_eq!(pane.scroll_left(&ScrollStep::Page(10)).unwrap(), w,);
assert_eq!(pane.position(), (0, 0));
}
let t = ["1234567890123456789012345678901234567890", ""];
let texts = gen_texts(&t);
pane.load(texts.clone());
assert_eq!(pane.goto_absolute_line(1).unwrap(), 1);
assert_eq!(pane.scroll_right(&ScrollStep::Char(10)).unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/1679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1761
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41407,
9579,
10539,
368,
341,
286,
1077,
259,
284,
4383,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
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_signal() {
let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
unsafe { signal(Signal::SIGINT, SigHandler::SigIgn) }.unwrap();
raise(Signal::SIGINT).unwrap();
assert_eq!(unsafe { signal(Signal::SIGINT, SigHandler::SigDfl) }.unwrap(), SigHandler::SigIgn);
let handler = SigHandler::Handler(test_sigaction_handler);
assert_eq!(unsafe { signal(Signal::SIGINT, handler) }.unwrap(), SigHandler::SigDfl);
raise(Signal::SIGINT).unwrap();
assert!(SIGNALED.load(Ordering::Relaxed));
assert_eq!(unsafe { signal(Signal::SIGINT, SigHandler::SigDfl) }.unwrap(), handler);
// Restore default signal handler
unsafe { signal(Signal::SIGINT, SigHandler::SigDfl) }.unwrap();
} | rust_cleaned_test_functions.jsonl/32451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21137,
368,
341,
262,
1077,
716,
76,
284,
3504,
50,
17754,
1245,
22867,
21003,
1005,
17119,
445,
38099,
2684,
70498,
553,
2441,
1273,
3071,
262,
19860,
314,
8286,
3759,
25719,
486,
50631,
3221,
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_split_number_with_io_blksize() {
let (at, mut ucmd) = at_and_ucmd!();
let file_read = |f| {
let mut s = String::new();
at.open(f).read_to_string(&mut s).unwrap();
s
};
ucmd.args(&["-n", "5", "asciilowercase.txt", "---io-blksize", "1024"])
.succeeds();
assert_eq!(file_read("xaa"), "abcde");
assert_eq!(file_read("xab"), "fghij");
assert_eq!(file_read("xac"), "klmno");
assert_eq!(file_read("xad"), "pqrst");
assert_eq!(file_read("xae"), "uvwxyz\n");
} | rust_cleaned_test_functions.jsonl/25872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
5500,
6615,
16939,
51969,
2141,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
6443,
284,
760,
69,
91,
341,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_frame_mask() {
let mut buf = BytesMut::from(&[0b0000_0001u8, 0b1000_0001u8][..]);
buf.extend(b"0001");
buf.extend(b"1");
let mut buf = PayloadBuffer::new(once(Ok(buf.freeze())));
assert!(Frame::parse(&mut buf, false, 1024).is_err());
let frame = extract(Frame::parse(&mut buf, true, 1024));
assert!(!frame.finished);
assert_eq!(frame.opcode, OpCode::Text);
assert_eq!(frame.payload, vec![1u8].into());
} | rust_cleaned_test_functions.jsonl/55891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8929,
9999,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
2099,
58,
15,
65,
15,
15,
15,
15,
62,
15,
15,
15,
16,
84,
23,
11,
220,
15,
65,
16,
15,
15,
15,
62,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_decode_phantom_data() {
use std::marker::PhantomData;
#[derive(Debug, RustcDecodable, RustcEncodable, Eq, PartialEq)]
struct Foo<P> {
phantom_data: PhantomData<P>
}
let f: Foo<u8> = Foo {
phantom_data: PhantomData
};
let s = super::encode(&f).unwrap();
let d: Foo<u8> = super::decode(&s).unwrap();
assert_eq!(f, d);
} | rust_cleaned_test_functions.jsonl/22768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
15227,
9782,
30002,
1769,
368,
341,
286,
990,
1460,
486,
27742,
486,
3357,
30002,
1043,
401,
286,
11506,
27098,
42618,
11,
33789,
66,
4900,
69129,
11,
33789,
66,
7408,
69129,
11,
33122,
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_try_read() {
test_executor!(async move {
let lock = RwLock::new(());
let read_guard = lock.write().await.unwrap();
let write_result = lock.try_read();
match write_result {
Err(TryLockError::WouldSuspend) => (),
Ok(_) => assert!(
false,
"try_read should not succeed while read_guard is in scope"
),
Err(_) => assert!(false, "unexpected error"),
}
drop(read_guard);
});
} | rust_cleaned_test_functions.jsonl/134537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
6443,
368,
341,
286,
1273,
81207,
10297,
7692,
3271,
341,
310,
1077,
5296,
284,
55294,
11989,
486,
931,
7,
1423,
310,
1077,
1349,
36796,
284,
5296,
3836,
1005,
11421,
55395,
1428,
310,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_no_unicast_cipher() {
let mut a_wpa = make_wpa1_ie();
a_wpa.unicast_cipher_list = vec![];
assert_eq!(is_legacy_wpa_compatible(&a_wpa), false);
} | rust_cleaned_test_functions.jsonl/23524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
62,
3525,
559,
76692,
368,
341,
286,
1077,
5206,
264,
1670,
6595,
284,
1281,
1670,
6595,
16,
62203,
543,
286,
264,
1670,
6595,
13,
3525,
559,
76692,
2019,
284,
7486,
0,
15078,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_init_apps_from_system() {
use crate::config;
use config::Config;
let _ = env_logger::try_init();
// Init apps from test-fixtures/webapps and verify in test-apps-dir.
let current = env::current_dir().unwrap();
let root_path = format!("{}/test-fixtures/webapps", current.display());
let test_dir = format!("{}/test-fixtures/test-apps-dir", current.display());
// This dir is created during the test.
// Tring to remove it at the beginning to make the test at local easy.
let _ = remove_dir_all(Path::new(&test_dir));
if let Err(err) = fs::create_dir_all(PathBuf::from(test_dir.clone())) {
println!("{:?}", err);
}
println!("Register from: {}", &root_path);
let config = Config {
root_path: root_path.clone(),
data_path: test_dir,
uds_path: String::from("uds_path"),
cert_type: String::from("production"),
updater_socket: String::from("updater_socket"),
};
let registry = match AppsRegistry::initialize(&config, 80) {
Ok(v) => v,
Err(err) => {
panic!("err: {:?}", err);
}
};
println!("registry.count: {}", registry.count());
assert_eq!(4, registry.count());
let test_json = Path::new(&root_path).join("webapps.json");
if let Ok(test_items) = read_webapps(&test_json) {
for item in &test_items {
assert!(registry.get_first_by_name(&item.get_name()).is_some());
assert_eq!(
registry
.get_by_manifest_url(&item.get_manifest_url())
.unwrap()
.get_name(),
item.get_name()
);
assert_eq!(
registry
.get_by_update_url(&item.get_update_url())
.unwrap()
.get_name(),
item.get_name()
);
}
} else {
panic!("Wrong apps config in data.");
}
} | rust_cleaned_test_functions.jsonl/114193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 965
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
69899,
5673,
17687,
368,
341,
262,
990,
17717,
486,
1676,
280,
262,
990,
2193,
486,
2648,
401,
262,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
1428,
262,
442,
15690,
10500,
504,
1273,
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... | 5 |
#[test]
fn test_convert_error_info() {
let error_info = error_info!();
assert_eq!(
convert_error_info(&format!("ret=0xfffffffffffffffe"), &error_info),
"ret=ENOENT(no such file or directory)\n".to_string()
);
} | rust_cleaned_test_functions.jsonl/121863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
4096,
3109,
368,
341,
262,
1077,
1465,
3109,
284,
1465,
3109,
0,
543,
262,
2060,
10714,
33673,
286,
5508,
4096,
3109,
2099,
2243,
17223,
2122,
28,
15,
41798,
26886,
1859,
3975,
609,
841,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_drain() {
// Empty iter
{
let mut d: VecDeque<i32> = VecDeque::new();
{
let mut iter = d.drain(..);
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
assert_eq!(iter.size_hint(), (0, Some(0)));
}
assert!(d.is_empty());
}
// simple iter
{
let mut d = VecDeque::new();
for i in 0..5 {
d.push_back(i);
}
assert_eq!(d.drain(..).collect::<Vec<_>>(), [0, 1, 2, 3, 4]);
assert!(d.is_empty());
}
// wrapped iter
{
let mut d = VecDeque::new();
for i in 0..5 {
d.push_back(i);
}
for i in 6..9 {
d.push_front(i);
}
assert_eq!(d.drain(..).collect::<Vec<_>>(), [8, 7, 6, 0, 1, 2, 3, 4]);
assert!(d.is_empty());
}
// partially used
{
let mut d: VecDeque<_> = VecDeque::new();
for i in 0..5 {
d.push_back(i);
}
for i in 6..9 {
d.push_front(i);
}
{
let mut it = d.drain(..);
assert_eq!(it.size_hint(), (8, Some(8)));
assert_eq!(it.next(), Some(8));
assert_eq!(it.size_hint(), (7, Some(7)));
assert_eq!(it.next_back(), Some(4));
assert_eq!(it.size_hint(), (6, Some(6)));
assert_eq!(it.next(), Some(7));
assert_eq!(it.size_hint(), (5, Some(5)));
}
assert!(d.is_empty());
}
} | rust_cleaned_test_functions.jsonl/73708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 922
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
368,
341,
262,
442,
22228,
5367,
198,
262,
341,
286,
1077,
5206,
294,
25,
11312,
73891,
21897,
18,
17,
29,
284,
11312,
73891,
486,
931,
1428,
286,
341,
310,
1077,
5206,
5367,
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... | 6 |
#[test]
fn test_sgxdb_put_clone_from_root() {
let mut nodes_map: HashMap<i32, Node<Item4>> = HashMap::new();
let mut nodes = Nodes {
nodes_map,
size: 0,
root_id: 0,
content_size: 0,
next_id: 0,
m: 0,
};
let mut tree = MerkleBTree::new_empty(3, &mut nodes);
tree.put(Item4 { key: 1, value: 0 }, &mut nodes);
tree.put(Item4 { key: 2, value: 1 }, &mut nodes);
tree.put(Item4 { key: 3, value: 2 }, &mut nodes);
tree.put(Item4 { key: 4, value: 2 }, &mut nodes);
tree.put(Item4 { key: 5, value: 2 }, &mut nodes);
tree.put(Item4 { key: 6, value: 2 }, &mut nodes);
tree.put(Item4 { key: 7, value: 2 }, &mut nodes);
assert_valid_tree(&nodes, 7);
assert_valid_tree_node_item4(&vec![0], 1, 2, &vec![4], false, &nodes);
assert_valid_tree_node_item4(&vec![0, 0], 1, 2, &vec![2], true, &nodes);
assert_valid_tree_node_item4(&vec![0, 1], 1, 2, &vec![6], true, &nodes);
assert_valid_tree_node_item4(&vec![0, 0, 0], 1, 0, &vec![1], true, &nodes);
assert_valid_tree_node_item4(&vec![0, 0, 1], 1, 0, &vec![3], true, &nodes);
assert_valid_tree_node_item4(&vec![0, 1, 0], 1, 0, &vec![5], true, &nodes);
assert_valid_tree_node_item4(&vec![0, 1, 1], 1, 0, &vec![7], true, &nodes);
println!("-------------------put before------------------------");
nodes.iterator();
println!("nodes.merkleroot: {:?}", nodes.merkleroot());
println!("{:?}", nodes.nodes_map);
let mut subnodes = tree.put_clone(Item4 { key: 7, value: 1 }, &mut nodes);
println!("-------------------put after------------------------");
println!("nodes.merkleroot: {:?}", nodes.merkleroot());
println!("subnodes.merkleroot:{:?}", subnodes.merkleroot());
nodes.iterator();
println!("-------------------subnodes put------------------------");
tree.put(Item4 { key: 7, value: 1 }, &mut subnodes);
println!("subnodes.merkleroot:{:?}", subnodes.merkleroot());
println!("subnodes.nodemap:{:?}", subnodes.nodes_map);
} | rust_cleaned_test_functions.jsonl/11987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 893
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76318,
54555,
15557,
54742,
5673,
12993,
368,
341,
262,
1077,
5206,
7798,
5376,
25,
10528,
21897,
18,
17,
11,
6018,
31857,
19,
2452,
284,
10528,
486,
931,
543,
262,
1077,
5206,
7798,
284,
52501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syn_us_cr() {
let context = Context::new(
String::from("us"),
None,
Tokens::new(HashMap::new(), HashMap::new(), HashMap::new()),
);
assert_eq!(
syn_us_cr(&Name::new(String::from(""), 0, None, &context), &context),
vec![]
);
// original name priority == 0
let results = vec![
Name::new(
String::from("County Road 123"),
1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("CR 123"),
-1,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_us_cr(
&Name::new(String::from("County Road 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_us_cr(
&Name::new(String::from("CR 123"), 0, None, &context),
&context
),
results
);
// original name priority < 0
let results = vec![
Name::new(
String::from("County Road 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("CR 123"),
-2,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_us_cr(
&Name::new(String::from("County Road 123"), -1, None, &context),
&context
),
results
);
// original name priority > 0
let results = vec![
Name::new(
String::from("County Road 123"),
2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("CR 123"),
-1,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_us_cr(
&Name::new(String::from("County Road 123"), 1, None, &context),
&context
),
results
);
} | rust_cleaned_test_functions.jsonl/25026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
11306,
32331,
368,
341,
286,
1077,
2266,
284,
9608,
486,
931,
1006,
310,
923,
486,
1499,
445,
355,
4461,
310,
2240,
345,
310,
58166,
486,
931,
7,
18497,
486,
931,
1507,
10528,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_external_ip_mapper_new_external_ip_mapper_with_implicit_local_ip() -> Result<()> {
// Mixing inpicit and explicit local IPs not allowed
let result = ExternalIpMapper::new(
CandidateType::Unspecified,
&["1.2.3.4".to_owned(), "1.2.3.5/10.0.0.1".to_owned()],
);
assert!(result.is_err(), "should fail");
// Mixing inpicit and explicit local IPs not allowed
let result = ExternalIpMapper::new(
CandidateType::Unspecified,
&["1.2.3.5/10.0.0.1".to_owned(), "1.2.3.4".to_owned()],
);
assert!(result.is_err(), "should fail");
Ok(())
} | rust_cleaned_test_functions.jsonl/23594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47432,
10385,
76664,
5921,
47432,
10385,
76664,
6615,
62,
30940,
13564,
10385,
368,
1464,
5714,
71698,
341,
262,
442,
96599,
304,
15587,
275,
323,
11464,
2205,
96319,
537,
5420,
198,
262,
1077,
1102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transpose() {
if !crate::platform::sse41_detected() {
return;
}
#[target_feature(enable = "sse4.1")]
unsafe fn transpose_wrapper(vecs: &mut [__m128i; DEGREE]) {
transpose_vecs(vecs);
}
let mut matrix = [[0 as u32; DEGREE]; DEGREE];
for i in 0..DEGREE {
for j in 0..DEGREE {
matrix[i][j] = (i * DEGREE + j) as u32;
}
}
unsafe {
let mut vecs: [__m128i; DEGREE] = core::mem::transmute(matrix);
transpose_wrapper(&mut vecs);
matrix = core::mem::transmute(vecs);
}
for i in 0..DEGREE {
for j in 0..DEGREE {
// Reversed indexes from above.
assert_eq!(matrix[j][i], (i * DEGREE + j) as u32);
}
}
} | rust_cleaned_test_functions.jsonl/54811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
2900,
368,
341,
286,
421,
753,
61711,
486,
15734,
486,
64513,
19,
16,
98876,
368,
341,
310,
470,
280,
286,
555,
286,
11506,
5657,
17069,
93509,
284,
330,
64513,
19,
13,
16,
5422,
286,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cf_lock_without_range_prop() {
let path = Builder::new().prefix("test-raftstore").tempdir().unwrap();
let path_str = path.path().to_str().unwrap();
let db_opts = DBOptions::new();
let mut cf_opt = ColumnFamilyOptions::new();
cf_opt.set_no_range_properties(true);
let cfs_opts = ALL_CFS
.iter()
.map(|cf| {
if cf != &CF_LOCK {
CFOptions::new(cf, ColumnFamilyOptions::new())
} else {
CFOptions::new(cf, cf_opt.clone())
}
})
.collect();
let engine = engine_test::kv::new_engine_opt(path_str, db_opts, cfs_opts).unwrap();
let mut region = Region::default();
region.set_id(1);
region.set_start_key(vec![]);
region.set_end_key(vec![]);
region.mut_peers().push(Peer::default());
region.mut_region_epoch().set_version(2);
region.mut_region_epoch().set_conf_ver(5);
let (tx, rx) = mpsc::sync_channel(100);
let mut cfg = Config::default();
cfg.region_max_size = ReadableSize(100);
cfg.region_split_size = ReadableSize(60);
cfg.batch_split_limit = 5;
let mut runnable = SplitCheckRunner::new(
engine.clone(),
tx.clone(),
CoprocessorHost::new(tx.clone()),
cfg.clone(),
);
for cf in LARGE_CFS {
for i in 0..7 {
let s = keys::data_key(format!("{:04}", i).as_bytes());
engine.put_cf(cf, &s, &s).unwrap();
}
engine.flush_cf(cf, true).unwrap();
}
for policy in &[CheckPolicy::Scan, CheckPolicy::Approximate] {
runnable.run(SplitCheckTask::split_check(region.clone(), true, *policy));
must_split_at_impl(&rx, ®ion, vec![], true);
}
drop(engine);
drop(runnable);
// Reopen the engine and all cfs have range properties.
let cfs_opts = ALL_CFS
.iter()
.map(|cf| {
let mut cf_opts = ColumnFamilyOptions::new();
cf_opts.set_no_range_properties(true);
CFOptions::new(cf, cf_opts)
})
.collect();
let engine = engine_test::kv::new_engine_opt(path_str, DBOptions::new(), cfs_opts).unwrap();
let mut runnable =
SplitCheckRunner::new(engine.clone(), tx.clone(), CoprocessorHost::new(tx), cfg);
// Flush a sst of CF_LOCK with range properties.
for i in 7..15 {
let s = keys::data_key(format!("{:04}", i).as_bytes());
engine.put_cf(CF_LOCK, &s, &s).unwrap();
}
engine.flush_cf(CF_LOCK, true).unwrap();
for policy in &[CheckPolicy::Scan, CheckPolicy::Approximate] {
runnable.run(SplitCheckTask::split_check(region.clone(), true, *policy));
must_split_at_impl(&rx, ®ion, vec![], true);
}
} | rust_cleaned_test_functions.jsonl/23782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71143,
9818,
39904,
9698,
21663,
368,
341,
286,
1077,
1815,
284,
20626,
486,
931,
1005,
11849,
445,
1944,
12,
2944,
4314,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
1815,
2895,
284,
1815,
3875... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_fmt_chunkedarray() {
let ca = Int32Chunked::new("Date", &[Some(1), None, Some(3)]);
println!("{:?}", ca);
assert_eq!(
r#"shape: (3,)
ChunkedArray: 'Date' [Int32]
[
1
null
3
]"#,
format!("{:?}", ca)
);
let ca = Utf8Chunked::new("name", &["a", "b"]);
println!("{:?}", ca);
assert_eq!(
r#"shape: (2,)
ChunkedArray: 'name' [str]
[
"a"
"b"
]"#,
format!("{:?}", ca)
);
} | rust_cleaned_test_functions.jsonl/4393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
30539,
291,
1653,
368,
341,
286,
1077,
2162,
284,
1333,
18,
17,
28304,
291,
486,
931,
445,
1916,
497,
44590,
8373,
7,
16,
701,
2240,
11,
4329,
7,
18,
41958,
286,
13751,
88928,
25,
52652... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_affine_shear_z_does_not_change_last_coordinate() {
let shear_z_with_x = 3;
let shear_z_with_y = 11;
let matrix = Matrix4x4::from_affine_shear_z(shear_z_with_x, shear_z_with_y);
let unit_w = Vector4::unit_w();
let expected = unit_w;
let result = matrix * unit_w;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
643,
86060,
6415,
96374,
7913,
15947,
12195,
68649,
368,
341,
286,
1077,
64244,
6415,
6615,
3212,
284,
220,
18,
280,
286,
1077,
64244,
6415,
6615,
4178,
284,
220,
16,
16,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_properties_step_v2() {
let client = graph_serializer(GraphSON::V2);
let vertex = create_vertex(&client, "Traversal");
let g = traversal().with_remote(client);
let results = g.v(vertex.id()).properties(()).to_list().unwrap();
assert_eq!(1, results.len());
assert_eq!("Traversal", results[0].get::<String>().unwrap());
let results = g.v(vertex.id()).properties("name").to_list().unwrap();
assert_eq!(1, results.len());
assert_eq!("Traversal", results[0].get::<String>().unwrap());
let results = g.v(vertex.id()).properties("fake").to_list().unwrap();
assert_eq!(0, results.len());
} | rust_cleaned_test_functions.jsonl/26283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25158,
11946,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
1077,
11936,
284,
1855,
26611,
2099,
2972,
11,
330,
76276,
3071,
262,
1077,
342,
284,
563... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_null() {
test_parse_err::<()>(&[
("n", "EOF while parsing a value at line 1 column 1"),
("nul", "EOF while parsing a value at line 1 column 3"),
("nulla", "trailing characters at line 1 column 5"),
]);
test_parse_ok(vec![("null", ())]);
} | rust_cleaned_test_functions.jsonl/29827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15162,
368,
341,
262,
1273,
21039,
9266,
27638,
21620,
2099,
9640,
286,
3489,
77,
497,
330,
23483,
1393,
22314,
264,
897,
518,
1555,
220,
16,
3250,
220,
16,
4461,
286,
3489,
77,
360,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_op3() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert!(engine.eval::<bool>("true && (false || 123)").is_err());
assert_eq!(engine.eval::<bool>("true && (true || 123)")?, true);
assert!(engine.eval::<bool>("123 && (false || true)").is_err());
assert_eq!(engine.eval::<bool>("false && (true || 123)")?, false);
Ok(())
} | rust_cleaned_test_functions.jsonl/57126 | {
"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,
22159,
10287,
18,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10297,
8512,
31710,
27638,
2641,
13211,
1866,
1009,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_non_finite() {
for i in 0u32..1 << 23 {
let f = f32::from_bits((((1 << 8) - 1) << 23) + i);
assert!(!f.is_finite(), "f={}", f);
ryu::Buffer::new().format_finite(f);
}
} | rust_cleaned_test_functions.jsonl/58233 | {
"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,
21637,
761,
15856,
368,
341,
262,
369,
600,
304,
220,
15,
84,
18,
17,
496,
16,
1115,
220,
17,
18,
341,
286,
1077,
282,
284,
282,
18,
17,
486,
1499,
20034,
66844,
16,
1115,
220,
23,
8,
481,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_update_discussion_link() {
crate::utils::setup_logger();
let link = "https://github.com/oxidecomputer/rfd/pulls/2019";
let mut content = r#"sdfsdf
sdfsdf
discussion: https://github.com/oxidecomputer/rfd/pulls/1
dsfsdf
sdf
authors: nope"#;
let mut result = update_discussion_link(content, link, true).unwrap();
let mut expected = r#"sdfsdf
sdfsdf
discussion: https://github.com/oxidecomputer/rfd/pulls/2019
dsfsdf
sdf
authors: nope"#;
assert_eq!(expected, result);
content = r#"sdfsdf
= sdfgsd
discussion: fgsdfg
:discussion: https://github.com/oxidecomputer/rfd/pulls/1
dsfsdf
sdf
:discussion: nope"#;
result = update_discussion_link(content, link, false).unwrap();
expected = r#"sdfsdf
= sdfgsd
discussion: fgsdfg
:discussion: https://github.com/oxidecomputer/rfd/pulls/2019
dsfsdf
sdf
:discussion: nope"#;
assert_eq!(expected, result);
content = r#"sdfsdf
= sdfgsd
discussion: fgsdfg
:discussion:
dsfsdf
sdf
:discussion: nope"#;
result = update_discussion_link(content, link, false).unwrap();
expected = r#"sdfsdf
= sdfgsd
discussion: fgsdfg
:discussion: https://github.com/oxidecomputer/rfd/pulls/2019
dsfsdf
sdf
:discussion: nope"#;
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/2868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
37745,
17405,
7233,
368,
341,
286,
17717,
486,
6031,
486,
15188,
27413,
1428,
286,
1077,
2656,
284,
330,
2428,
1110,
5204,
905,
14,
54089,
43111,
7382,
6902,
4322,
70423,
14,
17,
15,
16,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peek_returns_reference_to_head_element_but_does_not_remove_it() {
let mut list: SimpleLinkedList<u32> = SimpleLinkedList::new();
assert_eq!(list.peek(), None, "No element should be contained in list");
list.push(2);
assert_eq!(list.peek(), Some(&2), "Element must be 2");
assert_eq!(list.peek(), Some(&2), "Element must be still 2");
list.push(3);
assert_eq!(list.peek(), Some(&3), "Head element is now 3");
assert_eq!(list.pop(), Some(3), "Element must be 3");
assert_eq!(list.peek(), Some(&2), "Head element is now 2");
assert_eq!(list.pop(), Some(2), "Element must be 2");
assert_eq!(list.peek(), None, "No element should be contained in list");
} | rust_cleaned_test_functions.jsonl/112944 | {
"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,
62,
29107,
58900,
25433,
2346,
13138,
7894,
86874,
96374,
7913,
18193,
14631,
368,
341,
262,
1077,
5206,
1140,
25,
8993,
33915,
34837,
18,
17,
29,
284,
8993,
33915,
486,
931,
543,
262,
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_checked_sum_for_capitalization_normal() {
assert_eq!(
AccountsDb::checked_sum_for_capitalization(vec![1, 2].into_iter()),
3
);
} | rust_cleaned_test_functions.jsonl/1404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
10160,
5478,
16388,
2174,
2022,
13973,
368,
341,
286,
2060,
10714,
33673,
310,
40655,
7994,
486,
7549,
10160,
5478,
16388,
2174,
2022,
25592,
20703,
16,
11,
220,
17,
936,
18122,
11723,
14702,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_space() {
let tests = vec![
(Datum::I64(0), Datum::Bytes(b"".to_vec())),
(Datum::U64(0), Datum::Bytes(b"".to_vec())),
(Datum::I64(3), Datum::Bytes(b" ".to_vec())),
(Datum::I64(-1), Datum::Bytes(b"".to_vec())),
(Datum::U64(u64::max_value()), Datum::Null),
(Datum::I64(i64::from(MAX_BLOB_WIDTH) + 1), Datum::Null),
(
Datum::I64(i64::from(MAX_BLOB_WIDTH)),
Datum::Bytes(vec![super::SPACE; MAX_BLOB_WIDTH as usize]),
),
];
for (len, exp) in tests {
let got = eval_func(ScalarFuncSig::Space, &[len]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/9120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14663,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
40,
21,
19,
7,
15,
701,
68459,
486,
7078,
1883,
69355,
983,
13251,
73727,
310,
320,
68036,
486,
52,
21,
19,
7,
15,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_include_and_exclude_match_both() {
// TODO The same filesystem type in both `include` and
// not.
let include = Some(vec![String::from("ext4")]);
let exclude = Some(vec![String::from("ext4")]);
let opt = Options {
include,
exclude,
..Default::default()
};
let m = mount_info("ext4", "/mnt/foo", false, false);
assert!(!is_included(&m, &opt));
} | rust_cleaned_test_functions.jsonl/46583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
8378,
88668,
10708,
88819,
368,
341,
310,
442,
5343,
576,
1852,
38389,
943,
304,
2176,
1565,
997,
63,
323,
18574,
310,
442,
537,
624,
310,
1077,
2924,
284,
4329,
25592,
20703,
703,
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... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.