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_header_to_string() {
let header = Header::new("Test".to_string(), "Value".to_string());
assert_eq!(header.to_string(), "Test: Value".to_string());
} | rust_cleaned_test_functions.jsonl/80462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
2346,
3904,
368,
341,
286,
1077,
4247,
284,
12104,
486,
931,
445,
2271,
3263,
983,
3904,
1507,
330,
1130,
3263,
983,
3904,
1423,
286,
2060,
10714,
10297,
2708,
2389,
3904,
1507,
330,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_index() {
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
assert_eq!(v1[0], 1.0f64);
assert_eq!(v1[1], 2.0f64);
assert_eq!(v1[2], 3.0f64);
} | rust_cleaned_test_functions.jsonl/120489 | {
"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,
3560,
368,
972,
286,
1077,
348,
16,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
13,
15,
69,
21,
19,
736,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_api() {
for offset in [0, 1, u32::MAX as u64] {
let mut index = IndexEntry::new(solana_sdk::pubkey::new_rand());
if offset != 0 {
index.set_storage_offset(offset);
}
assert_eq!(index.storage_offset(), offset);
assert_eq!(index.storage_capacity_when_created_pow2(), 0);
for pow in [1, 255, 0] {
index.set_storage_capacity_when_created_pow2(pow);
assert_eq!(index.storage_offset(), offset);
assert_eq!(index.storage_capacity_when_created_pow2(), pow);
}
}
} | rust_cleaned_test_functions.jsonl/61655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
368,
341,
286,
369,
4347,
304,
508,
15,
11,
220,
16,
11,
575,
18,
17,
486,
10586,
438,
575,
21,
19,
60,
341,
310,
1077,
5206,
1922,
284,
8008,
5874,
486,
931,
80608,
3362,
61783,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_sum() {
let db = Connection::open_in_memory().unwrap();
db.create_aggregate_function("my_sum", 1, true, Sum)
.unwrap();
let no_result = "SELECT my_sum(i) FROM (SELECT 2 AS i WHERE 1 <> 1)";
let result: Option<i64> = db.query_row(no_result, NO_PARAMS, |r| r.get(0)).unwrap();
assert!(result.is_none());
let single_sum = "SELECT my_sum(i) FROM (SELECT 2 AS i UNION ALL SELECT 2)";
let result: i64 = db.query_row(single_sum, NO_PARAMS, |r| r.get(0)).unwrap();
assert_eq!(4, result);
let dual_sum = "SELECT my_sum(i), my_sum(j) FROM (SELECT 2 AS i, 1 AS j UNION ALL SELECT \
2, 1)";
let result: (i64, i64) = db
.query_row(dual_sum, NO_PARAMS, |r| Ok((r.get(0)?, r.get(1)?)))
.unwrap();
assert_eq!((4, 2), result);
} | rust_cleaned_test_functions.jsonl/41671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
368,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
543,
286,
2927,
2520,
20587,
14240,
9174,
445,
2408,
10160,
497,
220,
16,
11,
830,
11,
8116,
340,
310,
659,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_extend_density_regular() {
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
for k in &[2, 4, 8] {
for j in &[10, 20, 50] {
let count: usize = k * j;
let mut tracker_full = DensityTracker::new();
let mut partial_trackers: Vec<DensityTracker> = Vec::with_capacity(count / k);
for i in 0..count {
if i % k == 0 {
partial_trackers.push(DensityTracker::new());
}
let index: usize = i / k;
if rng.gen() {
tracker_full.add_element();
partial_trackers[index].add_element();
}
if !partial_trackers[index].bv.is_empty() {
let idx = rng.gen_range(0, partial_trackers[index].bv.len());
let offset: usize = partial_trackers
.iter()
.take(index)
.map(|t| t.bv.len())
.sum();
tracker_full.inc(offset + idx);
partial_trackers[index].inc(idx);
}
}
let mut tracker_combined = DensityTracker::new();
for tracker in partial_trackers.into_iter() {
tracker_combined.extend(tracker, false);
}
assert_eq!(tracker_combined, tracker_full);
}
}
} | rust_cleaned_test_functions.jsonl/45399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1068
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
53349,
49443,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
11,
220,
15,
42459,
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... | 8 |
#[test]
fn test_regex() {
assert_eq!(js_parser_rs::parse("= /ab+b/g;".chars()), Ok(vec![TokenType::Equal, TokenType::Literal(LiteralType::Regex(String::from("ab+b"), RegexIdentifier::Global)),TokenType::Semicolon]));
assert_eq!(js_parser_rs::parse("( /ab+b/g)".chars()), Ok(vec![TokenType::LeftParen, TokenType::Literal(LiteralType::Regex(String::from("ab+b"), RegexIdentifier::Global)),TokenType::RightParen]));
assert_eq!(js_parser_rs::parse("= /ab+b/;".chars()), Ok(vec![TokenType::Equal, TokenType::Literal(LiteralType::Regex(String::from("ab+b"), RegexIdentifier::None)),TokenType::Semicolon]));
assert_eq!(js_parser_rs::parse(": /ab+b/g;".chars()), Ok(vec![TokenType::Colon, TokenType::Literal(LiteralType::Regex(String::from("ab+b"), RegexIdentifier::Global)),TokenType::Semicolon]));
assert_eq!(js_parser_rs::parse(", /ab+b/g;".chars()), Ok(vec![TokenType::Comma, TokenType::Literal(LiteralType::Regex(String::from("ab+b"), RegexIdentifier::Global)),TokenType::Semicolon]));
assert_eq!(js_parser_rs::parse(", /*a*/ /ab+b/g;".chars()), Ok(vec![TokenType::Comma, TokenType::Literal(LiteralType::Regex(String::from("ab+b"), RegexIdentifier::Global)),TokenType::Semicolon]));
assert_eq!(js_parser_rs::parse(", /ab\\/b/g".chars()), Ok(vec![TokenType::Comma, TokenType::Literal(LiteralType::Regex(String::from("ab/b"), RegexIdentifier::Global))]));
assert_eq!(js_parser_rs::parse(", /ab\\\\b/g".chars()), Ok(vec![TokenType::Comma, TokenType::Literal(LiteralType::Regex(String::from("ab\\b"), RegexIdentifier::Global))]));
assert_eq!(js_parser_rs::parse(", /^h\\d$/i".chars()), Ok(vec![TokenType::Comma, TokenType::Literal(LiteralType::Regex(String::from("^h\\d$"), RegexIdentifier::Ignore))]));
} | rust_cleaned_test_functions.jsonl/61526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
368,
341,
262,
2060,
10714,
10297,
2519,
18517,
47115,
486,
6400,
445,
28,
608,
370,
35093,
4846,
26,
3263,
19255,
11858,
7622,
25592,
20703,
75611,
486,
2993,
11,
56582,
486,
17350,
4957,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gnome_sort() {
let vect: Vec<i32> = vec![9, 7, 5, 3, 2, 0];
let expect: Vec<i32> = vec![0, 2, 3, 5, 7, 9];
let vect2: Vec<i32> = vec![-1, 0, 4, 5, 9, 25];
let expect2: Vec<i32> = vec![-1, 0, 4, 5, 9, 25];
let vect3: Vec<i32> = vec![84, 29, 0, 34, 23, 9, 8];
let expect3: Vec<i32> = vec![0, 8, 9, 23, 29, 34, 84];
let mut vector = vect.to_vec();
gnome_sort(&mut vector);
assert_eq!(vector, expect);
let mut vector2 = vect2.to_vec();
gnome_sort(&mut vector2);
assert_eq!(vector2, expect2);
let mut vector3 = vect3.to_vec();
gnome_sort(&mut vector3);
assert_eq!(vector3, expect3);
} | rust_cleaned_test_functions.jsonl/134347 | {
"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,
1889,
17081,
18435,
368,
341,
310,
1077,
55635,
25,
11312,
21897,
18,
17,
29,
284,
7486,
20703,
24,
11,
220,
22,
11,
220,
20,
11,
220,
18,
11,
220,
17,
11,
220,
15,
935,
310,
1077,
1720,
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_fmt_for_record_6() -> Result<(), score::TryFromIntError> {
let standard_fields = StandardFields::new("sq0", 8, 13);
let record: Record<6> = Record::new(standard_fields, OptionalFields::default());
assert_eq!(record.to_string(), "sq0\t8\t13\t.\t0\t.");
let mut standard_fields = StandardFields::new("sq0", 8, 13);
standard_fields.strand = Some(Strand::Forward);
let record: Record<6> = Record::new(standard_fields, OptionalFields::default());
assert_eq!(record.to_string(), "sq0\t8\t13\t.\t0\t+");
let standard_fields = StandardFields::new("sq0", 8, 13);
let record: Record<6> = Record::new(
standard_fields,
OptionalFields::from(vec![String::from("ndls")]),
);
assert_eq!(record.to_string(), "sq0\t8\t13\t.\t0\t.\tndls");
Ok(())
} | rust_cleaned_test_functions.jsonl/36911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
5478,
14192,
62,
21,
368,
1464,
5714,
68843,
5456,
486,
21453,
3830,
1072,
1454,
29,
341,
286,
1077,
5297,
12132,
284,
11766,
8941,
486,
931,
445,
28343,
15,
497,
220,
23,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_https_url() {
let url = "https://github.com/user/repo.git";
let expected_repo = Repo {
url: RepoUrl::Https(url::Url::parse(url).unwrap()),
};
assert_eq!(Repo::parse(url), expected_repo);
} | rust_cleaned_test_functions.jsonl/31147 | {
"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,
26817,
2903,
368,
341,
286,
1077,
2515,
284,
330,
2428,
1110,
5204,
905,
11739,
10758,
5368,
32799,
876,
286,
1077,
3601,
37784,
284,
71509,
341,
310,
2515,
25,
71509,
2864,
486,
92869,
6522,
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_have() {
let mut r = Reader::new();
r.state = State::Len;
let data = vec![0u8, 0, 0, 5, 4, 0, 0, 0, 1];
test_message(data, Message::Have(1));
} | rust_cleaned_test_functions.jsonl/46448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
67301,
368,
341,
286,
1077,
5206,
435,
284,
25166,
486,
931,
543,
286,
435,
3467,
284,
3234,
486,
11271,
280,
286,
1077,
821,
284,
7486,
20703,
15,
84,
23,
11,
220,
15,
11,
220,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_submodule() {
let mut cfg = TestConfig::default();
let mut updated_cfg = cfg.clone();
updated_cfg.submodule_field.field1 = 12345;
updated_cfg.submodule_field.field2 = true;
let diff = cfg.diff(&updated_cfg);
{
let mut diff = diff.clone();
assert_eq!(diff.len(), 1);
let mut sub_diff: ConfigChange =
diff.remove("submodule_field").map(Into::into).unwrap();
assert_eq!(sub_diff.len(), 2);
assert_eq!(sub_diff.remove("field1").map(Into::into), Some(12345u64));
assert_eq!(sub_diff.remove("field2").map(Into::into), Some(true));
}
cfg.update(diff);
assert_eq!(
cfg.submodule_field, updated_cfg.submodule_field,
"submodule should be updated"
);
assert_eq!(cfg, updated_cfg, "cfg should be updated");
} | rust_cleaned_test_functions.jsonl/3711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5228,
4352,
368,
341,
286,
1077,
5206,
13286,
284,
3393,
2648,
486,
2258,
543,
286,
1077,
5206,
6049,
18343,
284,
13286,
15997,
1428,
286,
6049,
18343,
4309,
4352,
5013,
16454,
16,
284,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_reference() {
#[serde_as]
#[derive(Debug, Serialize)]
struct S1<'a>(#[serde_as(as = "Vec<DisplayFromStr>")] &'a Vec<u32>);
check_serialization(
S1(&vec![1, 2]),
expect![[r#"
[
"1",
"2"
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S1a<'a>(#[serde_as(as = "&Vec<DisplayFromStr>")] &'a Vec<u32>);
check_serialization(
S1(&vec![1, 2]),
expect![[r#"
[
"1",
"2"
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S1Mut<'a>(#[serde_as(as = "Vec<DisplayFromStr>")] &'a mut Vec<u32>);
check_serialization(
S1(&vec![1, 2]),
expect![[r#"
[
"1",
"2"
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S1aMut<'a>(#[serde_as(as = "&mut Vec<DisplayFromStr>")] &'a mut Vec<u32>);
check_serialization(
S1(&vec![1, 2]),
expect![[r#"
[
"1",
"2"
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S2<'a>(#[serde_as(as = "&[DisplayFromStr]")] &'a [u32]);
check_serialization(
S2(&[1, 2]),
expect![[r#"
[
"1",
"2"
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S3<'a>(
#[serde_as(as = "&BTreeMap<DisplayFromStr, DisplayFromStr>")] &'a BTreeMap<bool, u32>,
);
let bmap = vec![(false, 123), (true, 456)].into_iter().collect();
check_serialization(
S3(&bmap),
expect![[r#"
{
"false": "123",
"true": "456"
}"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S4<'a>(#[serde_as(as = "&Vec<(_, DisplayFromStr)>")] &'a BTreeMap<bool, u32>);
let bmap = vec![(false, 123), (true, 456)].into_iter().collect();
check_serialization(
S4(&bmap),
expect![[r#"
[
[
false,
"123"
],
[
true,
"456"
]
]"#]],
);
#[serde_as]
#[derive(Debug, Serialize)]
struct S5<'a>(
#[serde_as(as = "&BTreeMap<DisplayFromStr, &Vec<(_, _)>>")]
&'a Vec<(u32, &'a BTreeMap<bool, String>)>,
);
let bmap0 = vec![(false, "123".to_string()), (true, "456".to_string())]
.into_iter()
.collect();
let bmap1 = vec![(true, "Hello".to_string()), (false, "World".to_string())]
.into_iter()
.collect();
let vec = vec![(111, &bmap0), (999, &bmap1)];
check_serialization(
S5(&vec),
expect![[r#"
{
"111": [
[
false,
"123"
],
[
true,
"456"
]
],
"999": [
[
false,
"World"
],
[
true,
"Hello"
]
]
}"#]],
);
} | rust_cleaned_test_functions.jsonl/45733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2051
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
25433,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
39900,
5563,
262,
2036,
328,
16,
18291,
64,
2235,
13353,
47024,
11898,
36951,
284,
330,
10050,
27,
7020,
3830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signer_too_few_pre_signed() {
let data = "Hello world".as_bytes();
let signers = Signer::generate_signers(8, 2);
let identifier = SignatureIdentifier { id: 0, index: 1 };
let shares = signers
.iter()
.take(1)
.enumerate()
.map(|(i, signer)| (i, signer.sign(data, &identifier)))
.collect();
let sig = signers[0].combine_signatures(&shares, &identifier);
assert!(signers[0].verify_signature(&sig, &data));
let data = "Another thing to sign...".as_bytes();
let _ = signers[0].sign(data, &identifier);
} | rust_cleaned_test_functions.jsonl/104906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
261,
2346,
78,
761,
365,
10442,
55617,
368,
341,
286,
1077,
821,
284,
330,
9707,
1879,
3263,
300,
12524,
543,
286,
1077,
1841,
388,
284,
7075,
261,
486,
19366,
11172,
388,
7,
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_fx33_bcd() {
let mut machine = Machine::new(TestContext::new());
machine.register_set(0xB, 195);
machine.idx = 0xAB;
machine.test_opcode(0xFB33);
// Should store the BCD of V[X] to the right memory locations
assert_eq!(machine.memory_get(0xAB), 1);
assert_eq!(machine.memory_get(0xAB + 1), 9);
assert_eq!(machine.memory_get(0xAB + 2), 5);
// Should increment program counter by two
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62691,
18,
18,
880,
4385,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
9929,
2602,
7,
15,
14377,
11,
220,
16,
24,
20,
317,
262,
5662,
51806,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noop_block_after_reconfiguration() {
let executor = TestExecutor::new();
let mut parent_block_id = executor.committed_block_id();
let first_txn = encode_reconfiguration_transaction(gen_address(1));
let first_block_id = gen_block_id(1);
let output1 = executor
.execute_block((first_block_id, vec![first_txn]), parent_block_id)
.unwrap();
parent_block_id = first_block_id;
let second_block = TestBlock::new(10, 10, gen_block_id(2));
let output2 = executor
.execute_block((second_block.id, second_block.txns), parent_block_id)
.unwrap();
assert_eq!(output1.root_hash(), output2.root_hash());
} | rust_cleaned_test_functions.jsonl/12647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
453,
7113,
19844,
1288,
21138,
368,
341,
262,
1077,
31558,
284,
3393,
25255,
486,
931,
543,
262,
1077,
5206,
2681,
7113,
842,
284,
31558,
905,
5483,
7113,
842,
543,
262,
1077,
1156,
92299,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invert() {
let mut image: GrayImage =
ImageBuffer::from_raw(3, 2, vec![00u8, 01u8, 02u8, 10u8, 11u8, 12u8]).unwrap();
let expected: GrayImage =
ImageBuffer::from_raw(3, 2, vec![255u8, 254u8, 253u8, 245u8, 244u8, 243u8]).unwrap();
invert(&mut image);
assert_pixels_eq!(&image, &expected);
} | rust_cleaned_test_functions.jsonl/26658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
1621,
368,
341,
286,
1077,
5206,
2168,
25,
23366,
1906,
4035,
310,
4654,
4095,
486,
1499,
16067,
7,
18,
11,
220,
17,
11,
7486,
20703,
15,
15,
84,
23,
11,
220,
15,
16,
84,
23,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_base64() {
#[derive(Deserialize)]
struct Test {
#[serde(deserialize_with = "deserialize_base64")]
v: Vec<u8>,
}
let data = json!({
"v": "SGVsbG8gV29ybGQ=",
});
let decoded: Test = serde_json::from_value(data).unwrap();
assert_eq!(
String::from_utf8(decoded.v).unwrap(),
"Hello World".to_string()
);
} | rust_cleaned_test_functions.jsonl/131354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
7651,
21,
19,
368,
341,
286,
11506,
27098,
7,
64465,
5563,
286,
2036,
3393,
341,
310,
11506,
47024,
34590,
9050,
6615,
284,
330,
66777,
7651,
21,
19,
5422,
310,
348,
25,
11312,
3483... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple() {
struct Entry;
impl Debug for Entry {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_map()
.entry(&"bar", &true)
.entry(&10, &format_args!("{}/{}", 10, 20))
.finish()
}
}
struct KeyValue;
impl Debug for KeyValue {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_map()
.key(&"bar")
.value(&true)
.key(&10)
.value(&format_args!("{}/{}", 10, 20))
.finish()
}
}
assert_eq!(debug3::pprint(Entry), debug3::pprint(KeyValue));
assert_eq!(debug3::pprint(Entry), debug3::pprint(KeyValue));
assert_eq!("{\"bar\": true, 10: 10/20}", debug3::pprint(Entry));
} | rust_cleaned_test_functions.jsonl/124754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
368,
341,
286,
2036,
15788,
401,
286,
11605,
11091,
369,
15788,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
5376,
741,
503,
659,
4085,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_char_p_to_string() {
let s = std::ffi::CString::new("foo").unwrap();
let ptr = s.as_c_str().as_ptr();
assert_eq!("foo", char_p_to_string(ptr).unwrap());
} | rust_cleaned_test_functions.jsonl/61357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9232,
620,
2346,
3904,
368,
341,
286,
1077,
274,
284,
1460,
486,
53799,
486,
63677,
486,
931,
445,
7975,
1827,
15454,
543,
286,
1077,
10087,
284,
274,
5357,
666,
2895,
1005,
300,
4348,
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 |
#[test]
fn test_merge_blob_into_tree_into_unmodified_blob() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let ours = commit! {
foo < "default foo contents"
};
let theirs = commit! {
foo {
bar < "bar contents"
}
};
repo.three_way_merge(ours, theirs)?;
assert_eq!(cat!(repo: "foo/bar"), "bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94165 | {
"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,
20888,
45908,
45514,
11663,
45514,
4907,
27162,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
0,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_find_struct_function_refs_outside_module() {
check(
r#"
mod foo {
pub struct Foo;
impl Foo {
pub fn new$0() -> Foo { Foo }
}
}
fn main() {
let _f = foo::Foo::new();
}
"#,
expect![[r#"
new Function FileId(0) 54..81 61..64
FileId(0) 126..129
"#]],
);
} | rust_cleaned_test_functions.jsonl/60658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
15126,
9174,
60638,
6068,
2929,
10750,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
2593,
15229,
341,
262,
6675,
2036,
33428,
401,
262,
11605,
33428,
341,
286,
6675,
5168,
501,
3,
15,
368... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_unset_default_repository() {
run_async_test(async {
ffx_config::set((CONFIG_KEY_ROOT, ConfigLevel::User), json!({})).await.unwrap();
// Initially there's no default.
assert_eq!(get_default_repository().await.unwrap(), None);
// Setting the default should write to the config.
set_default_repository("foo").await.unwrap();
assert_eq!(
ffx_config::get::<Value, _>(CONFIG_KEY_DEFAULT_REPOSITORY).await.unwrap(),
json!("foo"),
);
assert_eq!(get_default_repository().await.unwrap(), Some("foo".into()));
set_default_repository("foo.bar").await.unwrap();
assert_eq!(
ffx_config::get::<Value, _>(CONFIG_KEY_DEFAULT_REPOSITORY).await.unwrap(),
json!("foo.bar"),
);
assert_eq!(get_default_repository().await.unwrap(), Some("foo.bar".into()));
// Unset removes the default repository from the config.
unset_default_repository().await.unwrap();
assert_eq!(
ffx_config::get::<Option<Value>, _>(CONFIG_KEY_DEFAULT_REPOSITORY).await.unwrap(),
None,
);
assert_eq!(get_default_repository().await.unwrap(), None);
// Unsetting the repo again returns an error.
assert!(unset_default_repository().await.is_err());
});
} | rust_cleaned_test_functions.jsonl/98263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 757
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2602,
98109,
9993,
47301,
368,
341,
286,
1598,
28346,
4452,
18285,
341,
310,
282,
8298,
5332,
486,
746,
1188,
24652,
6600,
16197,
11,
5532,
4449,
486,
1474,
701,
2951,
0,
2306,
92,
4579,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_de_externally_tagged_enum() -> Result<(), Box<EvalAltResult>> {
#[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
enum MyEnum {
VariantUnit,
#[cfg(not(feature = "no_index"))]
VariantUnitTuple(),
VariantNewtype(i32),
#[cfg(not(feature = "no_index"))]
VariantTuple(i32, i32),
VariantEmptyStruct {},
VariantStruct {
a: i32,
},
}
let d = Dynamic::from("VariantUnit".to_string());
assert_eq!(MyEnum::VariantUnit, from_dynamic(&d).unwrap());
#[cfg(not(feature = "no_index"))]
{
let array: Array = vec![];
let mut map_outer = Map::new();
map_outer.insert("VariantUnitTuple".into(), array.into());
assert_eq!(
MyEnum::VariantUnitTuple(),
from_dynamic(&map_outer.into()).unwrap()
);
}
let mut map_outer = Map::new();
map_outer.insert("VariantNewtype".into(), (123 as INT).into());
assert_eq!(
MyEnum::VariantNewtype(123),
from_dynamic(&map_outer.into()).unwrap()
);
#[cfg(not(feature = "no_index"))]
{
let array: Array = vec![(123 as INT).into(), (456 as INT).into()];
let mut map_outer = Map::new();
map_outer.insert("VariantTuple".into(), array.into());
assert_eq!(
MyEnum::VariantTuple(123, 456),
from_dynamic(&map_outer.into()).unwrap()
);
}
let map_inner = Map::new();
let mut map_outer = Map::new();
map_outer.insert("VariantEmptyStruct".into(), map_inner.into());
assert_eq!(
MyEnum::VariantEmptyStruct {},
from_dynamic(&map_outer.into()).unwrap()
);
let mut map_inner = Map::new();
map_inner.insert("a".into(), (123 as INT).into());
let mut map_outer = Map::new();
map_outer.insert("VariantStruct".into(), map_inner.into());
assert_eq!(
MyEnum::VariantStruct { a: 123 },
from_dynamic(&map_outer.into()).unwrap()
);
Ok(())
} | rust_cleaned_test_functions.jsonl/97336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
2259,
62,
4301,
745,
9372,
3556,
31054,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
48440,
5563,
262,
11506,
47024,
1500,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_r_square() {
let z = c(1, 2);
assert_eq!(z.r_square(), (c(1, 2) * c(1, 2).conj()).Re());
} | rust_cleaned_test_functions.jsonl/103786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
39794,
368,
341,
262,
1077,
1147,
284,
272,
7,
16,
11,
220,
17,
317,
262,
2060,
10714,
10297,
89,
1746,
39794,
1507,
320,
66,
7,
16,
11,
220,
17,
8,
353,
272,
7,
16,
11,
220,
17,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_1st_level_def_lookup_on_1st_level_block_scope() {
let module_scope = ModuleScope::new();
let contract_scope = ContractScope::new(module_scope);
let block_scope_1 =
BlockScope::from_contract_scope("".to_string(), Rc::clone(&contract_scope));
block_scope_1
.borrow_mut()
.add_var("some_thing".to_string(), FixedSize::Base(Base::Bool));
assert_eq!(
Some(FixedSize::Base(Base::Bool)),
block_scope_1
.borrow()
.variable_def("some_thing".to_string())
);
} | rust_cleaned_test_functions.jsonl/23878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
267,
8274,
7844,
27464,
4470,
62,
16,
267,
8274,
7113,
23199,
368,
341,
286,
1077,
4688,
23199,
284,
13711,
10803,
486,
931,
543,
286,
1077,
5116,
23199,
284,
19185,
10803,
486,
931,
191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duplicate_payment_hash_one_failure_one_success() {
// Topology : A --> B --> C --> D
// we forward one of the payments onwards to D.
let chanmon_cfgs = create_chanmon_cfgs(4);
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
let mut config = test_default_channel_config();
config.channel_options.forwarding_fee_base_msat = 196;
let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs,
&[Some(config.clone()), Some(config.clone()), Some(config.clone()), Some(config.clone())]);
let mut nodes = create_network(4, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let chan_2 = create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known());
create_announced_chan_between_nodes(&nodes, 2, 3, InitFeatures::known(), InitFeatures::known());
let node_max_height = nodes.iter().map(|node| node.blocks.lock().unwrap().len()).max().unwrap() as u32;
connect_blocks(&nodes[0], node_max_height - nodes[0].best_block_info().1);
connect_blocks(&nodes[1], node_max_height - nodes[1].best_block_info().1);
connect_blocks(&nodes[2], node_max_height - nodes[2].best_block_info().1);
connect_blocks(&nodes[3], node_max_height - nodes[3].best_block_info().1);
let (our_payment_preimage, duplicate_payment_hash, _) = route_payment(&nodes[0], &vec!(&nodes[1], &nodes[2])[..], 900000);
let payment_secret = nodes[3].node.create_inbound_payment_for_hash(duplicate_payment_hash, None, 7200, 0).unwrap();
// We reduce the final CLTV here by a somewhat arbitrary constant to keep it under the one-byte
// script push size limit so that the below script length checks match
// ACCEPTED_HTLC_SCRIPT_WEIGHT.
let route = get_route(&nodes[0].node.get_our_node_id(), &nodes[0].net_graph_msg_handler.network_graph,
&nodes[3].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &Vec::new(), 900000, TEST_FINAL_CLTV - 40, nodes[0].logger).unwrap();
send_along_route_with_secret(&nodes[0], route, &[&[&nodes[1], &nodes[2], &nodes[3]]], 900000, duplicate_payment_hash, payment_secret);
let commitment_txn = get_local_commitment_txn!(nodes[2], chan_2.2);
assert_eq!(commitment_txn[0].input.len(), 1);
check_spends!(commitment_txn[0], chan_2.3);
mine_transaction(&nodes[1], &commitment_txn[0]);
check_closed_broadcast!(nodes[1], true);
check_added_monitors!(nodes[1], 1);
check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
connect_blocks(&nodes[1], TEST_FINAL_CLTV - 40 + MIN_CLTV_EXPIRY_DELTA as u32 - 1); // Confirm blocks until the HTLC expires
let htlc_timeout_tx;
{ // Extract one of the two HTLC-Timeout transaction
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 4);
check_spends!(node_txn[0], chan_2.3);
check_spends!(node_txn[1], commitment_txn[0]);
assert_eq!(node_txn[1].input.len(), 1);
check_spends!(node_txn[2], commitment_txn[0]);
assert_eq!(node_txn[2].input.len(), 1);
assert_eq!(node_txn[1].input[0].previous_output, node_txn[2].input[0].previous_output);
check_spends!(node_txn[3], commitment_txn[0]);
assert_ne!(node_txn[1].input[0].previous_output, node_txn[3].input[0].previous_output);
assert_eq!(node_txn[1].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
assert_eq!(node_txn[2].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
assert_eq!(node_txn[3].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
htlc_timeout_tx = node_txn[1].clone();
}
nodes[2].node.claim_funds(our_payment_preimage);
mine_transaction(&nodes[2], &commitment_txn[0]);
check_added_monitors!(nodes[2], 2);
check_closed_event!(nodes[2], 1, ClosureReason::CommitmentTxConfirmed);
let events = nodes[2].node.get_and_clear_pending_msg_events();
match events[0] {
MessageSendEvent::UpdateHTLCs { .. } => {},
_ => panic!("Unexpected event"),
}
match events[1] {
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
_ => panic!("Unexepected event"),
}
let htlc_success_txn: Vec<_> = nodes[2].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
assert_eq!(htlc_success_txn.len(), 5);
check_spends!(htlc_success_txn[0], commitment_txn[0]);
check_spends!(htlc_success_txn[1], commitment_txn[0]);
assert_eq!(htlc_success_txn[0].input.len(), 1);
assert_eq!(htlc_success_txn[0].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
assert_eq!(htlc_success_txn[1].input.len(), 1);
assert_eq!(htlc_success_txn[1].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
assert_ne!(htlc_success_txn[0].input[0].previous_output, htlc_success_txn[1].input[0].previous_output);
assert_eq!(htlc_success_txn[2], commitment_txn[0]);
assert_eq!(htlc_success_txn[3], htlc_success_txn[0]);
assert_eq!(htlc_success_txn[4], htlc_success_txn[1]);
assert_ne!(htlc_success_txn[0].input[0].previous_output, htlc_timeout_tx.input[0].previous_output);
mine_transaction(&nodes[1], &htlc_timeout_tx);
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1);
expect_pending_htlcs_forwardable!(nodes[1]);
let htlc_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
assert!(htlc_updates.update_add_htlcs.is_empty());
assert_eq!(htlc_updates.update_fail_htlcs.len(), 1);
let first_htlc_id = htlc_updates.update_fail_htlcs[0].htlc_id;
assert!(htlc_updates.update_fulfill_htlcs.is_empty());
assert!(htlc_updates.update_fail_malformed_htlcs.is_empty());
check_added_monitors!(nodes[1], 1);
nodes[0].node.handle_update_fail_htlc(&nodes[1].node.get_our_node_id(), &htlc_updates.update_fail_htlcs[0]);
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
{
commitment_signed_dance!(nodes[0], nodes[1], &htlc_updates.commitment_signed, false, true);
}
expect_payment_failed_with_update!(nodes[0], duplicate_payment_hash, false, chan_2.0.contents.short_channel_id, true);
// Solve 2nd HTLC by broadcasting on B's chain HTLC-Success Tx from C
// Note that the fee paid is effectively double as the HTLC value (including the nodes[1] fee
mine_transaction(&nodes[1], &htlc_success_txn[0]);
expect_payment_forwarded!(nodes[1], Some(196*2), true);
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert_eq!(updates.update_fulfill_htlcs.len(), 1);
assert_ne!(updates.update_fulfill_htlcs[0].htlc_id, first_htlc_id);
assert!(updates.update_fail_malformed_htlcs.is_empty());
check_added_monitors!(nodes[1], 1);
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &updates.update_fulfill_htlcs[0]);
commitment_signed_dance!(nodes[0], nodes[1], &updates.commitment_signed, false);
let events = nodes[0].node.get_and_clear_pending_events();
match events[0] {
Event::PaymentSent { ref payment_preimage } => {
assert_eq!(*payment_preimage, our_payment_preimage);
}
_ => panic!("Unexpected event"),
}
} | rust_cleaned_test_functions.jsonl/16908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2885
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
26696,
8950,
11667,
43618,
11667,
18632,
368,
341,
197,
322,
6909,
2449,
549,
362,
3844,
425,
3844,
356,
3844,
422,
198,
11120,
197,
322,
582,
4637,
825,
315,
279,
14173,
59425,
311,
422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_exclude_domains() {
let hf = HostFile::new("./fixtures/hosts.txt").unwrap();
let s = hf.exclude_domains();
assert_eq!("127.0.0.1 localhost\n\n", s);
} | rust_cleaned_test_functions.jsonl/32899 | {
"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,
88668,
70199,
368,
341,
262,
1077,
43242,
284,
16102,
1703,
486,
931,
13988,
45247,
14,
44692,
3909,
1827,
15454,
543,
262,
1077,
274,
284,
43242,
89941,
70199,
543,
262,
2060,
10714,
17223,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ensure_supported_version() {
assert!(ensure_supported_version("test", ScmpVersion::from((2, 4, 0))).is_ok());
assert!(ensure_supported_version("test", ScmpVersion::from((100, 100, 100))).is_err());
} | rust_cleaned_test_functions.jsonl/126630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
27289,
57885,
9438,
368,
341,
286,
2060,
10297,
27289,
57885,
9438,
445,
1944,
497,
2463,
1307,
5637,
486,
1499,
1188,
17,
11,
220,
19,
11,
220,
15,
36334,
285,
19817,
1423,
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_lexer_int_lit() {
let msg = r#"10"#;
let mess = lex_opt(msg, |p| p.next_int_lit_opt());
assert_eq!(10, mess);
} | rust_cleaned_test_functions.jsonl/40099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
38815,
4042,
98399,
368,
341,
286,
1077,
3750,
284,
435,
55543,
16,
15,
57676,
280,
286,
1077,
9435,
284,
22429,
15032,
8119,
11,
760,
79,
91,
281,
4529,
4042,
98399,
15032,
1423,
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 |
#[test]
fn test_constructor() {
let t = r#"
x = 73
y = 121
"#;
let cfg = Some(toml::from_str(t).unwrap());
let _ = __construct(cfg);
} | rust_cleaned_test_functions.jsonl/58919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66210,
368,
341,
262,
1077,
259,
284,
435,
2,
698,
262,
856,
284,
220,
22,
18,
198,
262,
379,
284,
220,
16,
17,
16,
198,
262,
5869,
280,
262,
1077,
13286,
284,
4329,
1155,
316,
75,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_flags() {
let app = built_with_version();
let actual_flags = flags(&app);
assert_eq!(actual_flags.len(), 2);
assert_eq!(actual_flags[0].get_long(), Some("help"));
assert_eq!(actual_flags[1].get_long(), Some("version"));
let sc_flags = flags(find_subcommand_with_path(&app, vec!["test"]));
assert_eq!(sc_flags.len(), 2);
assert_eq!(sc_flags[0].get_long(), Some("file"));
assert_eq!(sc_flags[1].get_long(), Some("help"));
} | rust_cleaned_test_functions.jsonl/91 | {
"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,
14130,
368,
341,
286,
1077,
906,
284,
5798,
6615,
9438,
543,
286,
1077,
5042,
14130,
284,
8042,
2099,
676,
626,
286,
2060,
10714,
10297,
11944,
14130,
19406,
1507,
220,
17,
317,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_create_database() {
let stmt = Statement::CreateDatabase {
if_not_exists: true,
name: Identifier {
name: String::from("column"),
quote: Some('`'),
},
engine: "".to_string(),
options: vec![],
};
assert_eq!(
format!("{}", stmt),
r#"CREATE DATABASE IF NOT EXISTS `column`"#
);
} | rust_cleaned_test_functions.jsonl/94668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
8657,
27341,
368,
341,
262,
1077,
20020,
284,
21756,
486,
4021,
5988,
341,
286,
421,
7913,
9766,
25,
830,
345,
286,
829,
25,
34621,
341,
310,
829,
25,
923,
486,
1499,
445,
6229,
4461,
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_js_integration() {
let alice_secret: [u8; 32] = [
56, 4, 190, 47, 42, 57, 72, 25, 194, 75, 105, 248, 146, 43, 60, 53, 55, 165, 30, 61,
122, 57, 95, 197, 210, 123, 95, 97, 215, 28, 193, 92,
];
let bob_secret: [u8; 32] = [
64, 218, 126, 251, 171, 87, 50, 212, 196, 55, 166, 65, 195, 199, 64, 229, 128, 129,
243, 144, 211, 52, 77, 159, 48, 167, 45, 8, 79, 228, 116, 101,
];
let nonce: Nonce = [0u8; 24].as_ref().into();
let alice = Keypair::from_secret_key(alice_secret.into());
let bob = Keypair::from_secret_key(bob_secret.into());
let mut cipher = Cipher::new(&alice.secret, &bob.public);
let plaintext: [u8; 2] = [21, 31];
let mut buffer = plaintext.to_vec();
let tag = cipher.encrypt_in_place_detached(&mut buffer, b"", &nonce);
println!("Enc: {:#?}", &buffer);
assert_eq!([63 as u8, 106 as u8].to_vec(), buffer);
} | rust_cleaned_test_functions.jsonl/17467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
90250,
368,
341,
286,
1077,
70433,
21962,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
2278,
310,
220,
20,
21,
11,
220,
19,
11,
220,
16,
24,
15,
11,
220,
19,
22,
11,
220,
19,
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_get_profile() {
let client = test_client();
let token = login(&client);
let response = &mut client
.get(format!("/api/profiles/{}", USERNAME))
.header(token_header(token))
.dispatch();
let value = response_json_value(response);
let username = value
.get("profile")
.and_then(|profile| profile.get("username"))
.and_then(|username| username.as_str())
.expect("must have 'username' field");
assert_eq!(username, USERNAME);
} | rust_cleaned_test_functions.jsonl/125461 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
13789,
368,
341,
262,
1077,
2943,
284,
1273,
8179,
543,
262,
1077,
3950,
284,
5858,
2099,
2972,
317,
262,
1077,
2033,
284,
609,
6984,
2943,
198,
286,
659,
455,
20698,
0,
4283,
2068,
23580,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double() {
let res = get_chunks_of_tabs("sd\tasd\t\taa");
assert_eq!(res, vec![(2, 3), (6, 8)]);
} | rust_cleaned_test_functions.jsonl/102571 | {
"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,
24598,
368,
341,
286,
1077,
592,
284,
633,
65470,
3575,
57953,
445,
13446,
4955,
79102,
4955,
59,
2565,
64,
3071,
286,
2060,
10714,
10297,
416,
11,
7486,
0,
9697,
17,
11,
220,
18,
701,
320,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_truncate() -> Result<()> {
let k: Key<Provider> = Key::random()?;
let v0 = DBView::load(k.clone(), empty::<ReadResult>())?;
let mut writes = vec![];
let id = RecordId::random::<Provider>()?;
writes.push(v0.writer(id).truncate()?);
let v1 = DBView::load(k, writes.iter().map(write_to_read))?;
assert_eq!(v1.all().len(), 1);
assert_eq!(v1.absolute_balance(), (1, 1));
assert_eq!(v1.chain_ctrs(), vec![(id, 0u64)].into_iter().collect());
assert_eq!(v1.gc().len(), 0);
assert_eq!(v1.reader().prepare_read(&id)?, PreparedRead::RecordIsEmpty);
Ok(())
} | rust_cleaned_test_functions.jsonl/125338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26900,
368,
1464,
5714,
71698,
341,
262,
1077,
595,
25,
5309,
27,
5179,
29,
284,
5309,
486,
11463,
94136,
262,
1077,
348,
15,
284,
5952,
851,
486,
1078,
5969,
15997,
1507,
4287,
27638,
441... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stop_sending_early_response() {
let (mut hconn, mut peer_conn) = connect(Client);
let request_stream_id = hconn
.fetch("GET", "https", "something.com", "/", &[])
.unwrap();
assert_eq!(request_stream_id, 0);
let out = hconn.process(None, now());
peer_conn.conn.process(out.dgram(), now());
// Get DataWritable for the request stream so that we can write the request body.
let data_writable = |e| matches!(e, Http3Event::DataWritable { .. });
assert!(hconn.events().any(data_writable));
let sent = hconn.send_request_body(request_stream_id, &[0u8; 10000]);
assert_eq!(sent, Ok(10000));
let out = hconn.process(None, now());
let _ = peer_conn.conn.process(out.dgram(), now());
read_request(&mut peer_conn.conn, request_stream_id);
// Stop sending with early_response.
assert_eq!(
Ok(()),
peer_conn
.conn
.stream_stop_sending(request_stream_id, Error::EarlyResponse.code())
);
// send response - 200 Content-Length: 3
// with content: 'abc'.
let _ = peer_conn.conn.stream_send(
request_stream_id,
&[
// headers
0x01, 0x06, 0x00, 0x00, 0xd9, 0x54, 0x01, 0x33, // a data frame
0x0, 0x3, 0x61, 0x62, 0x63,
],
);
peer_conn.conn.stream_close_send(request_stream_id).unwrap();
let out = peer_conn.conn.process(None, now());
hconn.process(out.dgram(), now());
let mut response_headers = false;
let mut response_body = false;
let http_events = hconn.events();
for e in http_events {
match e {
Http3Event::StopSending { stream_id, error } => {
assert_eq!(stream_id, request_stream_id);
assert_eq!(error, Error::EarlyResponse.code());
// assert that we cannot send any more request data.
assert_eq!(
Err(Error::AlreadyClosed),
hconn.send_request_body(request_stream_id, &[0u8; 10])
);
}
Http3Event::HeaderReady { stream_id } => {
assert_eq!(stream_id, request_stream_id);
let h = hconn.read_response_headers(stream_id);
assert_eq!(
h,
Ok((
vec![
(String::from(":status"), String::from("200")),
(String::from("content-length"), String::from("3"))
],
false
))
);
response_headers = true;
}
Http3Event::DataReadable { stream_id } => {
assert_eq!(stream_id, request_stream_id);
let mut buf = [0u8; 100];
let (amount, fin) = hconn
.read_response_data(now(), stream_id, &mut buf)
.unwrap();
assert_eq!(fin, true);
assert_eq!(amount, 3);
assert_eq!(buf[..3], [0x61, 0x62, 0x63]);
response_body = true;
}
_ => {}
}
}
assert!(response_headers);
assert!(response_body);
// after this stream will be removed from hconn. We will check this by trying to read
// from the stream and that should fail.
let mut buf = [0u8; 100];
let res = hconn.read_response_data(now(), request_stream_id, &mut buf);
assert!(res.is_err());
assert_eq!(res.unwrap_err(), Error::InvalidStreamId);
hconn.close(now(), 0, "");
} | rust_cleaned_test_functions.jsonl/10932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
643,
2459,
62,
22140,
9655,
368,
341,
286,
1077,
320,
6984,
305,
5148,
11,
5206,
14397,
17241,
8,
284,
4564,
46851,
317,
286,
1077,
1681,
12673,
842,
284,
305,
5148,
198,
310,
659,
9641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_prune_1_not_executed() {
let mut block_tree = create_block_tree();
block_tree.mark_as_committed(id(1), ()).unwrap();
let to_store = block_tree.prune();
assert!(to_store.is_empty());
assert_heads(&block_tree, vec![1]);
assert_eq!(block_tree.last_committed_id, id(0));
for i in 1..=11 {
let block = block_tree.get_block(id(i));
match i {
1 | 2 | 3 | 4 | 5 => assert!(block.is_some()),
_ => assert!(block.is_none()),
}
}
} | rust_cleaned_test_functions.jsonl/87732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
2886,
62,
16,
7913,
18430,
2774,
368,
341,
262,
1077,
5206,
2504,
11663,
284,
1855,
7113,
11663,
543,
262,
2504,
11663,
18406,
11898,
2965,
5483,
3724,
7,
16,
701,
1719,
568,
15454,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_exec_negate_statement() {
let header = make_test_header(EndianSlice::new(&[], LittleEndian));
let initial_registers = LineRow::new(&header);
let opcode = LineInstruction::NegateStatement;
let mut expected_registers = initial_registers;
expected_registers.is_stmt = !initial_registers.is_stmt;
assert_exec_opcode(header, initial_registers, opcode, expected_registers, false);
} | rust_cleaned_test_functions.jsonl/3375 | {
"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,
18430,
28209,
349,
37404,
368,
341,
286,
1077,
4247,
284,
1281,
4452,
8757,
7,
43231,
33236,
486,
931,
2099,
12995,
14671,
43231,
1106,
286,
1077,
2856,
78360,
284,
7083,
3102,
486,
931,
2099,
270... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_vote_next_vote() {
let mut local = VoteState::default();
let vote = Vote {
slots: vec![0],
hash: Hash::default(),
timestamp: None,
};
local.process_vote_unchecked(&vote);
assert_eq!(local.votes.len(), 1);
let vote = Tower::new_vote(&local, 1, Hash::default(), Some(0));
assert_eq!(vote.0.slots, vec![1]);
assert_eq!(vote.1, 1);
} | rust_cleaned_test_functions.jsonl/77043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
54360,
11257,
54360,
368,
341,
286,
1077,
5206,
2205,
284,
34034,
1397,
486,
2258,
543,
286,
1077,
6910,
284,
34034,
341,
310,
15711,
25,
7486,
20703,
15,
1259,
310,
5175,
25,
6531,
486,
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_decode_lsl_w_imm() {
assert_eq!(
decode_32(0xea4f0848),
Instruction::LSL_imm {
params: Reg2ShiftNParams {
rd: Reg::R8,
rm: Reg::R8,
shift_n: 1,
setflags: SetFlags::False,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
907,
3226,
1670,
71370,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
19,
69,
15,
23,
19,
23,
1326,
286,
29051,
486,
7268,
43,
71370,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_with_writes_of_different_sizes() {
hash_with_writes_of_different_sizes(Sha256::new(), INPUT_BLOCK_SIZE_SHA256);
hash_with_writes_of_different_sizes(Sha384::new(), INPUT_BLOCK_SIZE_SHA512);
hash_with_writes_of_different_sizes(Sha512::new(), INPUT_BLOCK_SIZE_SHA512);
} | rust_cleaned_test_functions.jsonl/23447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
6615,
1670,
23262,
3575,
82741,
32159,
368,
341,
286,
5175,
6615,
1670,
23262,
3575,
82741,
32159,
7,
62316,
17,
20,
21,
486,
931,
1507,
26149,
18756,
4098,
38096,
17,
20,
21,
317,
286,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_name() {
assert_eq!(
Network::try_from_name("6chars").unwrap(),
Network::Other {
name: NetworkName::try_from("6chars").unwrap(),
explorer_url: None,
}
);
assert!(matches!(
Network::try_from_name("7seven7").unwrap_err(),
Error::InvalidNetworkName("network name cannot exceed 6 characters")
));
assert!(matches!(
Network::try_from_name("täst").unwrap_err(),
Error::InvalidNetworkName("network name must only contain characters `0-9` and `a-z`")
));
assert!(matches!(
Network::try_from_name(" ").unwrap_err(),
Error::InvalidNetworkName("network name must only contain characters `0-9` and `a-z`")
));
assert!(matches!(
Network::try_from_name("").unwrap_err(),
Error::InvalidNetworkName("network name must not be empty")
));
} | rust_cleaned_test_functions.jsonl/64590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
1269,
368,
341,
262,
2060,
10714,
33673,
414,
8141,
486,
1539,
5673,
1269,
445,
21,
19255,
1827,
15454,
3148,
414,
8141,
486,
11409,
341,
286,
829,
25,
8141,
675,
486,
1539,
5673,
445,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_author_within_content() {
let documents = load_document("../tests/Gossiping_M.1173456473.A.F4F.html");
assert_eq!(
parse_author(&documents).unwrap(),
("julysecond".to_owned(), Some("還是台灣好".to_owned()))
);
} | rust_cleaned_test_functions.jsonl/87148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
22938,
72385,
7495,
368,
341,
286,
1077,
9293,
284,
2795,
26231,
17409,
23841,
15792,
41473,
287,
1245,
13,
16,
16,
22,
18,
19,
20,
21,
19,
22,
18,
875,
991,
19,
37,
2564,
797,
286,
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_content_type() {
let resp = HttpResponse::build(StatusCode::OK)
.content_type("text/plain")
.body(Body::Empty);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
"text/plain"
)
} | rust_cleaned_test_functions.jsonl/2948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
1819,
368,
341,
286,
1077,
9039,
284,
17580,
486,
5834,
7,
15872,
486,
3925,
340,
310,
659,
1796,
1819,
445,
1318,
36971,
1138,
310,
659,
2599,
5349,
1076,
486,
3522,
317,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_single_func_foldr_consuming() {
let h = hlist![1, 2, 3];
let folded = h.foldr(&|acc, i| i * acc, 1);
assert_eq!(folded, 6)
} | rust_cleaned_test_functions.jsonl/41567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
9596,
61187,
81,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
47035,
284,
305,
55031,
81,
2099,
91,
4475,
11,
600,
91,
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 |
#[test]
fn test_gen_range_float() {
let mut r = rng(101);
for _ in 0..1000 {
let a = r.gen_range(-4.5..1.7);
assert!((-4.5..1.7).contains(&a));
let a = r.gen_range(-1.1..=-0.3);
assert!((-1.1..=-0.3).contains(&a));
assert_eq!(r.gen_range(0.0f32..=0.0), 0.);
assert_eq!(r.gen_range(-11.0..=-11.0), -11.);
assert_eq!(r.gen_range(3_000_000.0..=3_000_000.0), 3_000_000.);
}
} | rust_cleaned_test_functions.jsonl/10498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
9698,
17586,
368,
341,
286,
1077,
5206,
435,
284,
28422,
7,
16,
15,
16,
317,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
1077,
264,
284,
435,
22822,
9698,
4080,
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... | 2 |
#[test]
fn test_shrink_reset_uncleaned_roots() {
let accounts = AccountsDB::new_single();
accounts.reset_uncleaned_roots();
assert_eq!(
*accounts.shrink_candidate_slots.lock().unwrap(),
vec![] as Vec<Slot>
);
accounts.add_root(0);
accounts.add_root(1);
accounts.add_root(2);
accounts.reset_uncleaned_roots();
let actual_slots = accounts.shrink_candidate_slots.lock().unwrap().clone();
assert_eq!(actual_slots, vec![] as Vec<Slot>);
accounts.reset_uncleaned_roots();
let mut actual_slots = accounts.shrink_candidate_slots.lock().unwrap().clone();
actual_slots.sort_unstable();
assert_eq!(actual_slots, vec![0, 1, 2]);
accounts.accounts_index.clear_roots();
let mut actual_slots = (0..5)
.map(|_| accounts.next_shrink_slot())
.collect::<Vec<_>>();
actual_slots.sort();
assert_eq!(actual_slots, vec![None, None, Some(0), Some(1), Some(2)],);
} | rust_cleaned_test_functions.jsonl/121932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
34365,
18983,
76576,
2675,
291,
26608,
2412,
368,
341,
286,
1077,
9618,
284,
40655,
3506,
486,
931,
19487,
1428,
286,
9618,
13857,
76576,
2675,
291,
26608,
2412,
543,
286,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rng_output() {
crate::init().unwrap();
// Test that we get at least a few distinct values from the RNG if we generate
// against mis-implementing Generator so that it returns the same value every
// time.
let mut generator = Generator;
let values: HashSet<u64> = (0..1000).map(|_| generator.next_u64()).collect();
assert!(values.len() > 1);
} | rust_cleaned_test_functions.jsonl/64556 | {
"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,
66849,
7645,
368,
341,
262,
17717,
486,
2327,
1005,
15454,
1428,
262,
442,
3393,
429,
582,
633,
518,
3245,
264,
2421,
12460,
2750,
504,
279,
72606,
421,
582,
6923,
7213,
262,
442,
2348,
5786,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclude() {
let tmp_dir = TempDir::new().expect("failed to make tempdir");
Exporter::new(
PathBuf::from("tests/testdata/input/main-samples/"),
tmp_dir.path().to_path_buf(),
)
.run()
.expect("exporter returned error");
let excluded_note = tmp_dir
.path()
.clone()
.join(PathBuf::from("excluded-note.md"));
assert!(
!excluded_note.exists(),
"exluded-note.md was found in tmpdir, but should be absent due to .export-ignore rules"
);
} | rust_cleaned_test_functions.jsonl/116595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88668,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
16091,
311,
1281,
2730,
3741,
3071,
262,
22191,
261,
486,
931,
1006,
286,
7933,
15064,
486,
1499,
445,
23841,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_onix3_oapen_subjects() {
let mut test_subject = WorkSubjects {
subject_code: "AAB".to_string(),
subject_type: SubjectType::BIC,
subject_ordinal: 1,
};
// Test BIC output
let output = generate_test_output(&test_subject);
assert!(output.contains(r#"<Subject>"#));
assert!(output.contains(r#" <SubjectSchemeIdentifier>12</SubjectSchemeIdentifier>"#));
assert!(output.contains(r#" <SubjectCode>AAB</SubjectCode>"#));
// Test BISAC output
test_subject.subject_code = "AAA000000".to_string();
test_subject.subject_type = SubjectType::BISAC;
let output = generate_test_output(&test_subject);
assert!(output.contains(r#"<Subject>"#));
assert!(output.contains(r#" <SubjectSchemeIdentifier>10</SubjectSchemeIdentifier>"#));
assert!(output.contains(r#" <SubjectCode>AAA000000</SubjectCode>"#));
// Test LCC output
test_subject.subject_code = "JA85".to_string();
test_subject.subject_type = SubjectType::LCC;
let output = generate_test_output(&test_subject);
assert!(output.contains(r#"<Subject>"#));
assert!(output.contains(r#" <SubjectSchemeIdentifier>04</SubjectSchemeIdentifier>"#));
assert!(output.contains(r#" <SubjectCode>JA85</SubjectCode>"#));
// Test Thema output
test_subject.subject_code = "JWA".to_string();
test_subject.subject_type = SubjectType::THEMA;
let output = generate_test_output(&test_subject);
assert!(output.contains(r#"<Subject>"#));
assert!(output.contains(r#" <SubjectSchemeIdentifier>93</SubjectSchemeIdentifier>"#));
assert!(output.contains(r#" <SubjectCode>JWA</SubjectCode>"#));
// Test keyword output
test_subject.subject_code = "keyword1".to_string();
test_subject.subject_type = SubjectType::KEYWORD;
let output = generate_test_output(&test_subject);
assert!(output.contains(r#"<Subject>"#));
assert!(output.contains(r#" <SubjectSchemeIdentifier>20</SubjectSchemeIdentifier>"#));
assert!(output.contains(r#" <SubjectHeadingText>keyword1</SubjectHeadingText>"#));
// Custom subjects are not output
test_subject.subject_code = "custom1".to_string();
test_subject.subject_type = SubjectType::CUSTOM;
let output = generate_test_output(&test_subject);
assert_eq!(output, "".to_string());
} | rust_cleaned_test_functions.jsonl/67623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1053
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4470,
941,
18,
14179,
391,
268,
28834,
82,
368,
341,
286,
1077,
5206,
1273,
28834,
284,
5547,
90417,
341,
310,
3832,
4136,
25,
330,
32,
1867,
3263,
983,
3904,
3148,
310,
3832,
1819,
25,
17450,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_touch_reference() {
let scenario = TestScenario::new("touch");
let (at, mut _ucmd) = (scenario.fixtures.clone(), scenario.ucmd());
let file_a = "test_touch_reference_a";
let file_b = "test_touch_reference_b";
let start_of_year = str_to_filetime("%Y%m%d%H%M", "201501010000");
at.touch(file_a);
set_file_times(&at, file_a, start_of_year, start_of_year);
assert!(at.file_exists(file_a));
for &opt in &["-r", "--ref", "--reference"] {
scenario
.ccmd("touch")
.args(&[opt, file_a, file_b])
.succeeds()
.no_stderr();
assert!(at.file_exists(file_b));
let (atime, mtime) = get_file_times(&at, file_b);
assert_eq!(atime, mtime);
assert_eq!(atime, start_of_year);
assert_eq!(mtime, start_of_year);
let _ = remove_file(file_b);
}
} | rust_cleaned_test_functions.jsonl/96645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
25433,
368,
341,
262,
1077,
15048,
284,
3393,
54031,
486,
931,
445,
22020,
797,
262,
1077,
320,
266,
11,
5206,
716,
1754,
2277,
8,
284,
320,
61422,
67785,
18513,
15997,
1507,
15048,
56334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_block_tree_gc() {
let block_store = build_empty_tree();
let genesis = block_store.root();
let mut cur_node = block_store.get_block(genesis.id()).unwrap();
let mut added_blocks = vec![];
let mut inserter = TreeInserter::new(block_store.clone());
for round in 1..100 {
if round == 1 {
cur_node = inserter.insert_block_with_qc(
QuorumCert::certificate_for_genesis(),
cur_node.as_ref(),
round,
);
} else {
cur_node = inserter.insert_block(cur_node.as_ref(), round);
}
added_blocks.push(cur_node.clone());
}
for (i, block) in added_blocks.iter().enumerate() {
assert_eq!(block_store.len(), 100 - i);
assert_eq!(block_store.pruned_blocks_in_mem(), min(i, 10));
block_store.prune_tree(block.id());
}
} | rust_cleaned_test_functions.jsonl/85838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
11663,
49423,
368,
341,
1066,
262,
1077,
2504,
14809,
284,
1936,
15124,
11663,
543,
262,
1077,
59366,
284,
2504,
14809,
12576,
543,
262,
1077,
5206,
2847,
5084,
284,
2504,
14809,
670,
7113,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_override() {
let mut vm: VimMachine<KeyEvent> = VimMachine::default();
let mut ctx = VimContext::default();
// Check the original Normal mode mapping.
let mov = mv!(MoveType::ScreenLine(MoveDir1D::Next));
vm.input_key(key!('g'));
vm.input_key(key!('j'));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// Override "gj" so that it doesn't do screen line movement.
let step = edit_end!(MoveType::Line(MoveDir1D::Next));
add_mapping(&mut vm, &NMAP, "gj", &step);
// Normal mode "gj" should be overridden now.
let mov = mv!(MoveType::Line(MoveDir1D::Next));
vm.input_key(key!('g'));
vm.input_key(key!('j'));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// Other Normal mode mappings beginning with "g" should still work.
let mov = mv!(MoveType::ScreenLine(MoveDir1D::Previous));
vm.input_key(key!('g'));
vm.input_key(key!('k'));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
let mov = mv!(MoveType::ScreenLinePos(MovePosition::Beginning), 0);
vm.input_key(key!('g'));
vm.input_key(key!('0'));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Normal);
// Visual mode "gj" should still be the original mapping.
let mov = mv!(MoveType::ScreenLine(MoveDir1D::Next));
ctx.persist.shape = Some(TargetShape::CharWise);
vm.input_key(key!('v'));
assert_pop2!(vm, CURRENT_POS, ctx);
assert_eq!(vm.mode(), VimMode::Visual);
vm.input_key(key!('g'));
vm.input_key(key!('j'));
assert_pop2!(vm, mov, ctx);
assert_eq!(vm.mode(), VimMode::Visual);
} | rust_cleaned_test_functions.jsonl/74582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48576,
368,
341,
286,
1077,
5206,
10995,
25,
94484,
21605,
42003,
1556,
29,
284,
94484,
21605,
486,
2258,
543,
286,
1077,
5206,
5635,
284,
94484,
1972,
486,
2258,
1428,
286,
442,
4248,
279,
4024,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_list() {
let mut decoder = Decoder::new(from_str("[]").unwrap());
let v: Vec<()> = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, vec![]);
let mut decoder = Decoder::new(from_str("[null]").unwrap());
let v: Vec<()> = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, vec![()]);
let mut decoder = Decoder::new(from_str("[true]").unwrap());
let v: Vec<bool> = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, vec![true]);
let mut decoder = Decoder::new(from_str("[true]").unwrap());
let v: Vec<bool> = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, vec![true]);
let mut decoder = Decoder::new(from_str("[3, 1]").unwrap());
let v: Vec<int> = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, vec![3, 1]);
let mut decoder = Decoder::new(from_str("[[3], [1, 2]]").unwrap());
let v: Vec<Vec<uint>> = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, vec![vec![3], vec![1, 2]]);
} | rust_cleaned_test_functions.jsonl/111032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
2019,
368,
341,
286,
1077,
5206,
24551,
284,
50472,
486,
931,
17016,
2895,
445,
1294,
1827,
15454,
1423,
286,
1077,
348,
25,
11312,
71698,
284,
3714,
69129,
486,
18196,
2099,
6984,
24551,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_powf() {
let c = Complex64::new(2.0, -1.0);
let expected = Complex64::new(-0.8684746, -16.695934);
assert!(close_to_tol(c.powf(3.5), expected, 1e-5));
assert!(close_to_tol(Pow::pow(c, 3.5_f64), expected, 1e-5));
assert!(close_to_tol(Pow::pow(c, 3.5_f32), expected, 1e-5));
} | rust_cleaned_test_functions.jsonl/105682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
69,
368,
341,
310,
1077,
272,
284,
22096,
21,
19,
486,
931,
7,
17,
13,
15,
11,
481,
16,
13,
15,
317,
310,
1077,
3601,
284,
22096,
21,
19,
486,
931,
4080,
15,
13,
23,
21,
23,
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_suback() {
let return_codes = [SubscribeReturnCodes::Success(QoS::ExactlyOnce)]
.iter()
.cloned()
.collect();
let packet = Suback::new(Pid::try_from(12321).unwrap(), return_codes).into();
assert_decode_slice!(Packet::Suback(_), &packet, 5);
} | rust_cleaned_test_functions.jsonl/59354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
473,
368,
341,
262,
1077,
470,
38482,
284,
508,
28573,
5598,
20871,
486,
7188,
6253,
72743,
486,
65357,
12522,
5563,
286,
659,
2015,
741,
286,
659,
564,
19684,
741,
286,
659,
17384,
543,
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_binary_array() {
let values: [u8; 12] = [
b'h', b'e', b'l', b'l', b'o', b'p', b'a', b'r', b'q', b'u', b'e', b't',
];
let offsets: [i32; 4] = [0, 5, 5, 12];
let array_data = ArrayData::builder(DataType::Utf8)
.len(3)
.add_buffer(Buffer::from(offsets.to_byte_slice()))
.add_buffer(Buffer::from(&values[..]))
.build();
let binary_array = BinaryArray::from(array_data);
assert_eq!(3, binary_array.len());
assert_eq!(0, binary_array.null_count());
assert_eq!([b'h', b'e', b'l', b'l', b'o'], binary_array.value(0));
assert_eq!("hello", binary_array.get_string(0));
assert_eq!([] as [u8; 0], binary_array.value(1));
assert_eq!("", binary_array.get_string(1));
assert_eq!(
[b'p', b'a', b'r', b'q', b'u', b'e', b't'],
binary_array.value(2)
);
assert_eq!("parquet", binary_array.get_string(2));
assert_eq!(5, binary_array.value_offset(2));
assert_eq!(7, binary_array.value_length(2));
for i in 0..3 {
assert!(binary_array.is_valid(i));
assert!(!binary_array.is_null(i));
}
// Test binary array with offset
let array_data = ArrayData::builder(DataType::Utf8)
.len(4)
.offset(1)
.add_buffer(Buffer::from(offsets.to_byte_slice()))
.add_buffer(Buffer::from(&values[..]))
.build();
let binary_array = BinaryArray::from(array_data);
assert_eq!(
[b'p', b'a', b'r', b'q', b'u', b'e', b't'],
binary_array.value(1)
);
assert_eq!("parquet", binary_array.get_string(1));
assert_eq!(5, binary_array.value_offset(0));
assert_eq!(0, binary_array.value_length(0));
assert_eq!(5, binary_array.value_offset(1));
assert_eq!(7, binary_array.value_length(1));
} | rust_cleaned_test_functions.jsonl/19350 | {
"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,
31761,
3858,
368,
341,
286,
1077,
2750,
25,
508,
84,
23,
26,
220,
16,
17,
60,
284,
2278,
310,
293,
38882,
516,
293,
47868,
516,
293,
63866,
516,
293,
63866,
516,
293,
93472,
516,
293,
6,
79,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_detect_row() {
for forest_rows in 1..63 {
// Test top
let top_pos = (2 << forest_rows) - 2;
let row_result = super::detect_row(top_pos, forest_rows);
assert_eq!(row_result, forest_rows);
// Test others
for row in 0..forest_rows {
let pos = super::row_offset(row, forest_rows);
let row_result = super::detect_row(pos, forest_rows);
assert_eq!(row, row_result);
}
}
} | rust_cleaned_test_functions.jsonl/18271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
8530,
368,
341,
286,
369,
13638,
10949,
304,
220,
16,
496,
21,
18,
341,
310,
442,
3393,
1909,
198,
310,
1077,
1909,
6479,
284,
320,
17,
1115,
13638,
10949,
8,
481,
220,
17,
280,
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... | 3 |
#[test]
fn test_highlighting_injected_html_in_javascript() {
let source = vec!["const s = html `<div>${a < b}</div>`;"].join("\n");
assert_eq!(
&to_token_vector(&source, get_language("javascript"), &JS_SHEET).unwrap(),
&[vec![
("const", vec![Scope::Keyword]),
(" ", vec![]),
("s", vec![Scope::Variable]),
(" ", vec![]),
("=", vec![Scope::Operator]),
(" ", vec![]),
("html", vec![Scope::Function]),
(" ", vec![]),
("`<", vec![Scope::String]),
("div", vec![Scope::String, Scope::Tag]),
(">", vec![Scope::String]),
(
"${",
vec![Scope::String, Scope::Embedded, Scope::PunctuationSpecial]
),
("a", vec![Scope::String, Scope::Embedded, Scope::Variable]),
(" ", vec![Scope::String, Scope::Embedded]),
("<", vec![Scope::String, Scope::Embedded, Scope::Operator]),
(" ", vec![Scope::String, Scope::Embedded]),
("b", vec![Scope::String, Scope::Embedded, Scope::Variable]),
(
"}",
vec![Scope::String, Scope::Embedded, Scope::PunctuationSpecial]
),
("</", vec![Scope::String]),
("div", vec![Scope::String, Scope::Tag]),
(">`", vec![Scope::String]),
(";", vec![Scope::PunctuationDelimiter]),
]]
);
} | rust_cleaned_test_functions.jsonl/98767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 770
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74546,
287,
1243,
28303,
9564,
1243,
5374,
6173,
368,
341,
262,
1077,
2530,
284,
7486,
0,
1183,
1024,
274,
284,
5272,
30586,
611,
37680,
64,
366,
293,
5361,
611,
43626,
26,
5521,
5987,
4921,
77,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool() -> Result<()> {
// create an array natively
let array = BooleanArray::from(vec![None, Some(true), Some(false)]);
// export it
let array = ArrowArray::try_from(array.data().as_ref().clone())?;
let data = Arc::new(ArrayData::try_from(array)?);
let array = make_array(data);
// perform some operation
let array = array.as_any().downcast_ref::<BooleanArray>().unwrap();
let array = kernels::boolean::not(&array)?;
// verify
assert_eq!(
array,
BooleanArray::from(vec![None, Some(false), Some(true)])
);
Ok(())
} | rust_cleaned_test_functions.jsonl/8336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
368,
1464,
5714,
71698,
341,
286,
442,
1855,
458,
1334,
308,
7887,
198,
286,
1077,
1334,
284,
6992,
1857,
486,
1499,
25592,
20703,
4064,
11,
4329,
3715,
701,
4329,
3576,
7252,
626,
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... | 4 |
#[test]
fn test_resolved_region_heap() {
let mut heap = ResolvedRegionHeap {
heap: BinaryHeap::new(),
};
heap.push(5, 5.into());
heap.push(4, 4.into());
heap.push(6, 6.into());
heap.push(3, 3.into());
let (ts, regions) = heap.pop(0);
assert_eq!(ts, TimeStamp::max());
assert!(regions.is_empty());
let (ts, regions) = heap.pop(2);
assert_eq!(ts, 3.into());
assert_eq!(regions.len(), 2);
assert!(regions.contains(&3));
assert!(regions.contains(&4));
// Pop outliers more then it has.
let (ts, regions) = heap.pop(3);
assert_eq!(ts, 5.into());
assert_eq!(regions.len(), 2);
assert!(regions.contains(&5));
assert!(regions.contains(&6));
// Empty regions
let (ts, regions) = heap.to_hash_set();
assert_eq!(ts, TimeStamp::max());
assert!(regions.is_empty());
let mut heap1 = ResolvedRegionHeap {
heap: BinaryHeap::new(),
};
heap1.push(5, 5.into());
heap1.push(4, 4.into());
heap1.push(6, 6.into());
heap1.push(3, 3.into());
let (ts, regions) = heap1.pop(1);
assert_eq!(ts, 3.into());
assert_eq!(regions.len(), 1);
assert!(regions.contains(&3));
let (ts, regions) = heap1.to_hash_set();
assert_eq!(ts, 4.into());
assert_eq!(regions.len(), 3);
assert!(regions.contains(&4));
assert!(regions.contains(&5));
assert!(regions.contains(&6));
heap1.reset_and_shrink_to(3);
assert_eq!(3, heap1.heap.capacity());
assert!(heap1.heap.is_empty());
heap1.push(1, 1.into());
heap1.clear();
assert!(heap1.heap.is_empty());
} | rust_cleaned_test_functions.jsonl/29102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 938
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
8731,
20627,
33059,
368,
341,
286,
1077,
5206,
17364,
284,
1800,
8731,
14091,
27909,
341,
310,
17364,
25,
17718,
27909,
486,
931,
3148,
286,
2605,
286,
17364,
2552,
7,
20,
11,
220,
20,
398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ast_name() {
let alloc = bumpalo::Bump::new();
let id = method::MethodType::from_ast_name(&alloc, "meth");
assert_eq!("meth", id.to_raw_string());
} | rust_cleaned_test_functions.jsonl/55621 | {
"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,
5673,
48019,
1269,
368,
341,
286,
1077,
5574,
284,
27575,
12529,
486,
33,
1510,
486,
931,
543,
286,
1077,
877,
284,
1714,
486,
3523,
929,
486,
1499,
48019,
1269,
2099,
4742,
11,
330,
68891,
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 |
#[test]
fn test_barrier() {
// solid.
for _ in 0..1_000 {
task::block_on(async move {
const N: usize = 10;
let barrier = Arc::new(Barrier::new(N));
let (tx, mut rx) = unbounded();
for _ in 0..N - 1 {
let c = barrier.clone();
let mut tx = tx.clone();
task::spawn(async move {
let res = c.wait().await;
tx.send(res.is_leader()).await.unwrap();
});
}
// so we shouldn't get anything from the port
let res = rx.try_next();
assert!(match res {
Err(_err) => true,
_ => false,
});
let mut leader_found = barrier.wait().await.is_leader();
for _ in 0..N - 1 {
if rx.next().await.unwrap() {
assert!(!leader_found);
leader_found = true;
}
}
assert!(leader_found);
});
}
} | rust_cleaned_test_functions.jsonl/24732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82355,
368,
341,
16885,
286,
442,
6437,
382,
286,
369,
716,
304,
220,
15,
496,
16,
62,
15,
15,
15,
341,
310,
3383,
486,
4574,
4470,
18285,
3271,
341,
394,
733,
451,
25,
22301,
284,
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... | 6 |
#[test]
fn test_child_slots_of_same_parent() {
let ledger_path = get_tmp_ledger_path!();
{
let blocktree = Arc::new(
Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger"),
);
let genesis_block = create_genesis_block(10_000).genesis_block;
let bank0 = Bank::new(&genesis_block);
let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank0));
let mut bank_forks = BankForks::new(0, bank0);
bank_forks.working_bank().freeze();
let mut blob_slot_1 = Blob::default();
blob_slot_1.set_slot(1);
blob_slot_1.set_parent(0);
blocktree.insert_data_blobs(&vec![blob_slot_1]).unwrap();
assert!(bank_forks.get(1).is_none());
ReplayStage::generate_new_bank_forks(
&blocktree,
&mut bank_forks,
&leader_schedule_cache,
);
assert!(bank_forks.get(1).is_some());
let mut blob_slot_2 = Blob::default();
blob_slot_2.set_slot(2);
blob_slot_2.set_parent(0);
blocktree.insert_data_blobs(&vec![blob_slot_2]).unwrap();
assert!(bank_forks.get(2).is_none());
ReplayStage::generate_new_bank_forks(
&blocktree,
&mut bank_forks,
&leader_schedule_cache,
);
assert!(bank_forks.get(1).is_some());
assert!(bank_forks.get(2).is_some());
}
let _ignored = remove_dir_all(&ledger_path);
} | rust_cleaned_test_functions.jsonl/111165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 910
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17268,
54161,
3575,
33574,
15960,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
9344,
284,
19689,
486,
931,
1006,
394,
8362,
9344,
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_all() {
assert!(Seals::all().len() == 5);
assert!(!Seals::all().is_empty());
assert!(Seals::all().is_all());
assert!(Seals::all().contains(Seals::empty()));
assert!(Seals::all().contains(Seals::all()));
assert!(Seals::all().contains(Seal::Seal));
assert!(Seals::all().contains(Seal::Shrink));
assert!(Seals::all().contains(Seal::Grow));
assert!(Seals::all().contains(Seal::Write));
assert!(Seals::all().contains(Seal::FutureWrite));
} | rust_cleaned_test_functions.jsonl/34329 | {
"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,
5705,
368,
341,
197,
6948,
10297,
1514,
1127,
486,
541,
1005,
2892,
368,
621,
220,
20,
317,
197,
6948,
0,
3471,
1514,
1127,
486,
541,
1005,
285,
15124,
1423,
197,
6948,
10297,
1514,
1127,
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_inner_2() {
let elem: Element = XML.parse().unwrap();
let mut sub = super::find_subnodes(&elem, "Containers");
sub = super::find_subnodes(&sub[0], "Container");
sub = super::find_subnodes(&sub[0], "Properties");
sub = super::find_subnodes(&sub[0], "LeaseStatus");
if let Ok(inner) = super::inner_text(&sub[0]) {
assert_eq!(inner, "unlocked");
} else {
panic!("should have found CharacterNode");
}
} | rust_cleaned_test_functions.jsonl/124949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34345,
62,
17,
368,
341,
286,
1077,
11750,
25,
8543,
284,
11874,
4632,
1005,
15454,
1428,
286,
1077,
5206,
1186,
284,
2256,
486,
3903,
5228,
20008,
2099,
18871,
11,
330,
74632,
797,
286,
1186,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_make_parent_path() {
let mut buf = [0; 20];
let mut buf = SliceVec::empty(&mut buf);
buf.replace(b"").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"..");
buf.replace(b"abc").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"");
buf.replace(b"abc").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"");
buf.replace(b"/abc/def").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"/abc");
buf.replace(b"/abc").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"/");
buf.replace(b"/").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"/");
buf.replace(b"//abc/def").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"//abc");
buf.replace(b"//abc").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"//");
buf.replace(b"//").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"//");
buf.replace(b"..").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"../..");
buf.replace(b"../..").unwrap();
buf.make_parent_path().unwrap();
assert_eq!(buf.as_ref(), b"../../..");
} | rust_cleaned_test_functions.jsonl/26324 | {
"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,
28230,
15960,
2638,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
26,
220,
17,
15,
935,
286,
1077,
5206,
6607,
284,
56476,
10050,
486,
3194,
2099,
6984,
6607,
626,
286,
6607,
6980,
1883,
1,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all() {
// generate keys
let private = PrivateKey::<Secp256k1>::new();
let public_key = PublicKey::from(&private);
// generate a new token
let metadata = b"This is my metadata";
let token = NizkpTokenEngine::generate(metadata);
// randomize token
let (r, anon_token) = NizkpTokenEngine::randomize(&token);
// sign randomized token
let signed = NizkpTokenEngine::sign_randomized(&anon_token, &private).unwrap();
// Verify signature and remove randomization
let signed = NizkpTokenEngine::verify_signature_and_unrandomize(
token,
anon_token,
signed,
&public_key,
r,
);
assert!(signed.is_some());
// verify personalized token
assert!(signed.unwrap().verify(&private));
} | rust_cleaned_test_functions.jsonl/112770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
368,
341,
286,
442,
6923,
6894,
198,
286,
1077,
869,
284,
9679,
1592,
27638,
8430,
79,
17,
20,
21,
74,
16,
6831,
931,
543,
286,
1077,
584,
3097,
284,
70280,
486,
1499,
2099,
1996,
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_hash_x_is_seed() {
let mut dag = AlgebraicGraph::new(&FieldElement::generator(), 1024, 2);
let index = dag.expression(RE::X);
assert_eq!(dag[index].hash, dag.seed);
} | rust_cleaned_test_functions.jsonl/127883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
3212,
6892,
33809,
368,
341,
286,
1077,
5206,
28069,
284,
76443,
292,
11212,
486,
931,
2099,
1877,
1691,
486,
35851,
1507,
220,
16,
15,
17,
19,
11,
220,
17,
317,
286,
1077,
1922,
284,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_folds_n6_k3() {
let idxs = ShuffledIndices(vec![0, 1, 2, 3, 4, 5]);
let folds = collect_folds(Folds::new(&idxs, 3));
assert_eq!(folds, vec![
(vec![2, 3, 4, 5], vec![0, 1]),
(vec![0, 1, 4, 5], vec![2, 3]),
(vec![0, 1, 2, 3], vec![4, 5])
]);
} | rust_cleaned_test_functions.jsonl/54453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
18431,
1089,
21,
4698,
18,
368,
341,
286,
1077,
7187,
82,
284,
1417,
42335,
31941,
25592,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
2558,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_overflow() {
let input = &[77031, 837799, 8400511, 63728127];
pollster::block_on(assert_execute_gpu(input, &[350, 524, OVERFLOW, OVERFLOW]));
} | rust_cleaned_test_functions.jsonl/113622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
79073,
368,
341,
286,
1077,
1946,
284,
44590,
22,
22,
15,
18,
16,
11,
220,
23,
18,
22,
22,
24,
24,
11,
220,
23,
19,
15,
15,
20,
16,
16,
11,
220,
21,
18,
22,
17,
23,
16,
17,
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_rfind() {
assert_eq!("hello".rfind('l'), Some(3));
assert_eq!("hello".rfind(|c:char| c == 'o'), Some(4));
assert!("hello".rfind('x').is_none());
assert!("hello".rfind(|c:char| c == 'x').is_none());
assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30));
assert_eq!("ประเทศไทย中华Việt Nam".rfind(|c: char| c == '华'), Some(30));
} | rust_cleaned_test_functions.jsonl/11075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3903,
368,
341,
262,
2060,
10714,
17223,
14990,
3263,
81,
3903,
492,
75,
4567,
4329,
7,
18,
1106,
262,
2060,
10714,
17223,
14990,
3263,
81,
3903,
22428,
66,
25,
1762,
91,
272,
621,
364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_paths() {
env::set_var("FREERTOS_SRC", "some/path");
env::set_var("TARGET", "thumbv8m.main-none-eabihf");
let mut b = Builder::new();
assert_eq!(b.freertos_dir.to_str().unwrap(), "some/path");
} | rust_cleaned_test_functions.jsonl/7077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24152,
368,
341,
262,
6105,
486,
746,
4612,
445,
37,
787,
3399,
3126,
29409,
497,
330,
14689,
50976,
797,
262,
6105,
486,
746,
4612,
445,
45583,
497,
330,
25036,
85,
23,
76,
8880,
24887,
5655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_group_pattern_by_separator_token() {
parse_macro(
r#"
macro_rules! foo {
($ ($ i:ident),*) => ($ (
mod $ i {}
)*);
($ ($ i:ident)#*) => ($ (
fn $ i() {}
)*);
($ i:ident ,# $ j:ident) => (
struct $ i;
struct $ j;
)
}
"#,
)
.assert_expand_items("foo! { foo, bar }", "mod foo {} mod bar {}")
.assert_expand_items("foo! { foo# bar }", "fn foo () {} fn bar () {}")
.assert_expand_items("foo! { Foo,# Bar }", "struct Foo ; struct Bar ;");
} | rust_cleaned_test_functions.jsonl/28710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
6288,
21260,
3710,
58204,
6458,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
1711,
600,
25,
1713,
701,
3764,
589,
1711,
2399,
394,
1463... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_evex_reserved_bits() {
for info in decoder_tests(false, false) {
if info.code().op_code().encoding() != EncodingKind::EVEX {
continue;
}
let mut bytes = to_vec_u8(info.hex_bytes()).unwrap();
let evex_index = get_evex_index(&bytes);
for i in 1..2 {
bytes[evex_index + 1] = (bytes[evex_index + 1] & !8) | (i << 3) as u8;
{
let mut decoder = Decoder::new(info.bitness(), &bytes, info.decoder_options());
let instruction = decoder.decode();
assert_eq!(instruction.code(), Code::INVALID);
assert_ne!(decoder.last_error(), DecoderError::None);
}
{
let mut decoder = Decoder::new(info.bitness(), &bytes, info.decoder_options() ^ DecoderOptions::NO_INVALID_CHECK);
let instruction = decoder.decode();
assert_eq!(instruction.code(), Code::INVALID);
assert_ne!(decoder.last_error(), DecoderError::None);
}
}
}
} | rust_cleaned_test_functions.jsonl/82761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43713,
327,
74913,
20034,
368,
341,
2023,
3546,
304,
24551,
32509,
3576,
11,
895,
8,
341,
197,
743,
3546,
10210,
1005,
453,
4136,
1005,
17159,
368,
961,
29330,
10629,
486,
46010,
3257,
341,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_signer_invalid_data() {
let data = "Hello world".as_bytes();
let signers = Signer::generate_signers(N, T);
let identifier = SignatureIdentifier { id: 0, index: 1 };
dbg!(signers.len());
let shares: BTreeMap<_, _> = signers
.iter()
.take(T)
.enumerate()
.map(|(i, signer)| (i, signer.sign(data, &identifier)))
.collect();
dbg!(&shares);
let sig = signers[0].combine_signatures(&shares, &identifier);
dbg!(&sig);
let data = "Some other data".as_bytes();
assert!(signers[0].verify_signature(&sig, &data));
} | rust_cleaned_test_functions.jsonl/104903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
261,
31433,
1769,
368,
341,
286,
1077,
821,
284,
330,
9707,
1879,
3263,
300,
12524,
543,
286,
1077,
1841,
388,
284,
7075,
261,
486,
19366,
11172,
388,
8204,
11,
350,
317,
286,
1077,
12816... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ifft() {
use crate::bignum::utils::ifft;
let vec = create_vec_2();
let n = vec.len();
let res = ifft(vec, n);
assert!(res == create_vec_1());
} | rust_cleaned_test_functions.jsonl/121026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
723,
368,
341,
310,
990,
17717,
486,
65,
92160,
486,
6031,
486,
333,
723,
280,
310,
1077,
7486,
284,
1855,
13251,
62,
17,
543,
310,
1077,
308,
284,
7486,
19406,
543,
310,
1077,
592,
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 |
#[test]
fn test_validate_schema_id_for_invalid_fully_qualified() {
let id = SchemaId("schema:sov:NcYxiDXkpYi6ov5FcYDi1e:2:1.0".to_string());
id.validate().unwrap_err();
} | rust_cleaned_test_functions.jsonl/130831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
25371,
842,
5478,
31433,
761,
21965,
62,
36335,
368,
341,
310,
1077,
877,
284,
12539,
764,
445,
17349,
25,
84293,
37694,
66,
56,
11665,
16591,
48495,
56,
72,
21,
859,
20,
47330,
56,
21685... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_malformed_fuzzed() {
println!();
test_assets::download_test_files(&cmp::get_fuzzed_asset_defs(),
"test-assets", true).unwrap();
println!();
use lewton::VorbisError::*;
use lewton::audio::AudioReadError::*;
use lewton::header::HeaderReadError::*;
ensure_malformed!("27_really_minimized_testcase_crcfix.ogg", BadAudio(AudioBadFormat));
ensure_malformed!("32_minimized_crash_testcase.ogg", BadHeader(HeaderBadFormat));
ensure_malformed!("35_where_did_my_memory_go_repacked.ogg", BadHeader(HeaderBadFormat));
ensure_malformed!("bug-42-sample009.ogg", BadAudio(AudioBadFormat));
ensure_malformed!("bug-42-sample012.ogg", BadAudio(AudioBadFormat));
} | rust_cleaned_test_functions.jsonl/7146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
278,
10155,
761,
8889,
291,
368,
341,
81168,
0,
543,
18185,
53299,
486,
12885,
4452,
10931,
2099,
7293,
486,
455,
761,
8889,
291,
42299,
56535,
3148,
197,
197,
1,
1944,
75158,
497,
830,
568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_min_transaction_price_for_identity_owner_not_met() {
let payment_service = PaymentsService::new();
let constraint = _single_identity_owner();
let fees = _fees();
let requester_info =
RequesterInfo {
role: None,
sig_count: 1,
is_owner: false,
is_off_ledger_signature: false,
};
let res = payment_service.get_request_info_with_min_price(&constraint, &requester_info, &fees);
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/38442 | {
"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,
3062,
7260,
28884,
9040,
5478,
46244,
29027,
7913,
44517,
368,
341,
286,
1077,
8160,
12267,
284,
57876,
1860,
486,
931,
1428,
286,
1077,
21568,
284,
716,
15338,
46244,
29027,
543,
286,
1077,
12436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uuid() {
#[derive(Serialize, Deserialize, Debug)]
struct S {
#[serde(deserialize_with = "uuid_opt_from_string")]
uuid: Option<Uuid>,
}
let json = r#"{
"uuid":"2fec40ac-525b-4192-871a-39d784945055"
}"#;
let s: S = serde_json::from_str(json).unwrap();
assert_eq!(
s.uuid,
Some(Uuid::from_str("2fec40ac-525b-4192-871a-39d784945055").unwrap())
);
let json = r#"{
"uuid":""
}"#;
let s: S = serde_json::from_str(json).unwrap();
assert!(s.uuid.is_none());
} | rust_cleaned_test_functions.jsonl/76864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25540,
368,
341,
286,
11506,
27098,
3759,
9050,
11,
48440,
11,
11091,
5563,
286,
2036,
328,
341,
310,
11506,
47024,
34590,
9050,
6615,
284,
330,
17128,
15032,
5673,
3904,
5422,
310,
16040,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_mvn_reg_w() {
assert_eq!(
decode_32(0xea6f5507),
Instruction::MVN_reg {
params: Reg2ShiftParams {
rd: Reg::R5,
rm: Reg::R7,
setflags: SetFlags::False,
shift_n: 20,
shift_t: SRType::LSL,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
717,
28138,
4920,
1670,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
21,
69,
20,
20,
15,
22,
1326,
286,
29051,
486,
66626,
45,
4920,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uncommitted_entry_after_leader_election() {
let l = default_logger();
let config = &Config {
id: 1,
max_uncommitted_size: 12,
..Config::default()
};
let mut nt = Network::new_with_config(vec![None, None, None, None, None], config, &l);
let data = b"hello world!".to_vec();
let mut entry = Entry::default();
entry.data = data;
let msg = new_message_with_entries(1, 1, MessageType::MsgPropose, vec![entry]);
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
// create a uncommitted entry on node2
nt.cut(1, 3);
nt.cut(1, 4);
nt.cut(1, 5);
nt.send(vec![msg]);
// now isolate master and make node2 as master
nt.isolate(1);
nt.ignore(MessageType::MsgAppend);
nt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]);
// which means max_uncommitted_size is a soft limit
assert_eq!(nt.peers.get_mut(&2).unwrap().state, raft::StateRole::Leader);
assert_eq!(nt.peers.get_mut(&2).unwrap().uncommitted_size(), 0);
} | rust_cleaned_test_functions.jsonl/19205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
97446,
9078,
19844,
79991,
2204,
1170,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
2193,
284,
609,
2648,
341,
286,
877,
25,
220,
16,
345,
286,
1932,
4907,
97446,
2368,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_accounts_insufficient_funds() {
let mut accounts: Vec<(Pubkey, Account)> = Vec::new();
let mut error_counters = ErrorCounters::default();
let keypair = Keypair::new();
let key0 = keypair.pubkey();
let account = Account::new(1, 0, &Pubkey::default());
accounts.push((key0, account));
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
vec![native_loader::id()],
instructions,
);
let fee_calculator = FeeCalculator::new(10);
assert_eq!(fee_calculator.calculate_fee(tx.message()), 10);
let loaded_accounts =
load_accounts_with_fee(tx, &accounts, &fee_calculator, &mut error_counters);
assert_eq!(error_counters.insufficient_funds, 1);
assert_eq!(loaded_accounts.len(), 1);
assert_eq!(
loaded_accounts[0].clone(),
(
Err(TransactionError::InsufficientFundsForFee),
Some(HashAgeKind::Extant)
),
);
} | rust_cleaned_test_functions.jsonl/70684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
55665,
34386,
26683,
761,
42950,
368,
341,
286,
1077,
5206,
9618,
25,
11312,
28706,
29162,
792,
11,
8615,
16018,
284,
11312,
486,
931,
543,
286,
1077,
5206,
1465,
85632,
284,
4600,
2507,
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... | 1 |
#[test]
fn test_vec3_floor() {
assert_eq!(
Vec3::new(1.35, 1.5, -1.5).floor(),
Vec3::new(1.0, 1.0, -2.0)
);
assert_eq!(
Vec3::new(f32::INFINITY, f32::NEG_INFINITY, 0.0).floor(),
Vec3::new(f32::INFINITY, f32::NEG_INFINITY, 0.0)
);
assert!(Vec3::new(f32::NAN, 0.0, 0.0).floor().x.is_nan());
assert_eq!(
Vec3::new(-2000000.123, 10000000.123, 1000.9).floor(),
Vec3::new(-2000001.0, 10000000.0, 1000.0)
);
} | rust_cleaned_test_functions.jsonl/75057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
60044,
368,
341,
262,
2060,
10714,
33673,
286,
11312,
18,
486,
931,
7,
16,
13,
18,
20,
11,
220,
16,
13,
20,
11,
481,
16,
13,
20,
568,
30449,
3148,
286,
11312,
18,
486,
931,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_program_spec_duplicate() {
let mut context_builder = ContextBuilder::new();
context_builder.log_in(&[RoleType::SpecCreator]);
let conn = context_builder.db_conn();
let hw_spec = HardwareSpecFactory::default().name("HW 1").insert(conn);
// We'll test collisions against this
ProgramSpecFactory::default()
.name("program 1")
.hardware_spec(&hw_spec)
.insert(conn);
let values_list: InputValue = InputValue::list(
[1, 2, 3].iter().map(|v| InputValue::scalar(*v)).collect(),
);
let runner = QueryRunner::new(context_builder);
assert_eq!(
runner.query(
QUERY,
hashmap! {
"hardwareSpecId" => InputValue::scalar(hw_spec.id.to_string()),
"name" => InputValue::scalar("Program 1"),
"description" => InputValue::scalar("description!"),
"input" => values_list.clone(),
"expectedOutput" => values_list,
}
),
(
serde_json::Value::Null,
vec![json!({
"locations": [{"line": 9, "column": 9}],
"message": "This resource already exists",
"path": ["createProgramSpec"],
})]
)
);
} | rust_cleaned_test_functions.jsonl/90807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 623
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25096,
13594,
70434,
368,
341,
262,
1077,
5206,
2266,
28532,
284,
9608,
3297,
486,
931,
543,
262,
2266,
28532,
1665,
1243,
2099,
58,
9030,
929,
486,
8327,
31865,
2558,
262,
1077,
4534,
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_run() {
let args = args::RequestLogAnalyzerArgs {
filenames: vec![String::from("src/test/simple-1.log")],
conditions: filter::FilterConditions {
include_terms: None,
exclude_terms: None,
latest_time: None,
},
graphite_server: None,
graphite_port: Some(2003),
graphite_prefix: None,
prometheus_listen: None,
influxdb_write_url: None,
influxdb_tags: None,
quiet: false,
};
let result = run(&args);
assert_eq!(result.count, 2);
let timing = result.timing.unwrap();
assert_eq!(timing.min, 7);
assert_eq!(timing.max, 10);
assert!(result.error.is_some());
} | rust_cleaned_test_functions.jsonl/123035 | {
"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,
14007,
368,
341,
286,
1077,
2827,
284,
2827,
486,
1900,
2201,
54911,
4117,
341,
310,
40540,
25,
7486,
20703,
703,
486,
1499,
445,
3548,
12697,
67195,
12,
16,
1665,
899,
1259,
310,
4682,
25,
4051... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dict_of() {
let mut a = Assert::new();
a.globals_add(validate_module);
a.eq("({1: 2}, '1: 2')", "with_int_dict({1: 2})");
a.fail(r#"with_int_dict(1)"#, BAD);
a.fail(r#"with_int_dict({1: "str"})"#, BAD);
a.fail(r#"with_int_dict({1: {}})"#, BAD);
let expected = r#"({1: [2, 3], 4: [5]}, "1: 2, 3 + 4: 5")"#;
let test = r#"with_list_dict({1: [2, 3], 4: [5]})"#;
a.eq(expected, test);
let expected = r#"({1: {2: 3, 4: 5}, 6: {7: 8}}, "1: 2:3, 4:5 + 6: 7:8")"#;
let test = r#"with_dict_dict({1: {2: 3, 4: 5}, 6: {7: 8}})"#;
a.eq(expected, test);
} | rust_cleaned_test_functions.jsonl/65896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5243,
3575,
368,
341,
286,
1077,
5206,
264,
284,
5319,
486,
931,
543,
286,
264,
1302,
16616,
2891,
94244,
10750,
317,
286,
264,
26662,
445,
2306,
16,
25,
220,
17,
2137,
364,
16,
25,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_with_corrupt_data_returns_decoder_error() {
let mut memdb = MemoryDB::<KeccakHasher, PrefixedKey<_>, DBValue>::default();
let mut root = Default::default();
{
let mut t = RefTrieDBMut::new(&mut memdb, &mut root);
t.insert(b"A", b"ABC").unwrap();
t.insert(b"B", b"ABCBA").unwrap();
}
let t = RefTrieDB::new(&memdb, &root).unwrap();
// query for an invalid data type to trigger an error
let q = |x: &[u8]| x.len() < 64;
let lookup = RefLookup { db: t.db(), query: q, hash: root };
let query_result = lookup.look_up(NibbleSlice::new(b"A"));
assert_eq!(query_result.unwrap().unwrap(), true);
} | rust_cleaned_test_functions.jsonl/123832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
6615,
14734,
6585,
1769,
58900,
49843,
4096,
368,
1476,
197,
10217,
5206,
1833,
1999,
284,
13850,
3506,
27638,
6608,
84262,
6370,
261,
11,
42588,
3286,
1592,
32399,
8066,
5952,
1130,
6831,
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_unconf_chan() {
let nodes = create_network(2);
create_announced_chan_between_nodes(&nodes, 0, 1);
let channel_state = nodes[0].node.channel_state.lock().unwrap();
assert_eq!(channel_state.by_id.len(), 1);
assert_eq!(channel_state.short_to_id.len(), 1);
mem::drop(channel_state);
let mut headers = Vec::new();
let mut header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
headers.push(header.clone());
for _i in 2..100 {
header = BlockHeader { version: 0x20000000, prev_blockhash: header.bitcoin_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
headers.push(header.clone());
}
while !headers.is_empty() {
nodes[0].node.block_disconnected(&headers.pop().unwrap());
}
let channel_state = nodes[0].node.channel_state.lock().unwrap();
assert_eq!(channel_state.by_id.len(), 0);
assert_eq!(channel_state.short_to_id.len(), 0);
} | rust_cleaned_test_functions.jsonl/17484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
6135,
45552,
368,
341,
2394,
197,
10217,
7798,
284,
1855,
20966,
7,
17,
317,
197,
39263,
51870,
19453,
45552,
48302,
14896,
2099,
20008,
11,
220,
15,
11,
220,
16,
626,
197,
10217,
5496,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simplest_actor() {
init_test_log();
let system = ActorSystem::create(ActorSystemConfig::default().thread_pool_size(2));
// We spawn the actor using a closure. Note that because of a bug in the Rust compiler
// as of 2019-07-12 regarding type inference we have to specify all of the types manually
// but when that bug goes away this will be even simpler.
let aid = system
.spawn()
.with((), |_: (), _: Context, _: Message| {
async { Ok(Status::done(())) }
})
.unwrap();
// Send a message to the actor.
aid.send_new(11).unwrap();
// The actor will get two messages including the Start message.
await_received(&aid, 2, 1000).unwrap();
system.trigger_and_await_shutdown(None);
} | rust_cleaned_test_functions.jsonl/1272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
267,
54818,
368,
341,
286,
2930,
4452,
5224,
1428,
286,
1077,
1849,
284,
24718,
2320,
486,
3182,
7,
18870,
2320,
2648,
486,
2258,
1005,
4528,
15709,
2368,
7,
17,
3237,
286,
442,
1205,
180... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_to_nonexisting_wallet() {
let (mut testkit, api) = create_testkit();
let (tx_alice, alice) = api.create_wallet(ALICE_NAME);
let (tx_bob, _) = api.create_wallet(BOB_NAME);
// when a transfer occurs.
testkit.create_block_with_tx_hashes(&[tx_alice.object_hash()]);
let wallet = api.get_wallet(tx_alice.author()).unwrap();
assert_eq!(wallet.balance, 100);
api.assert_no_wallet(tx_bob.author());
let tx = alice.transfer(
SERVICE_ID,
Transfer {
to: author_address(&tx_bob),
amount: 10,
seed: 0,
},
);
api.transfer(&tx);
testkit.create_block_with_tx_hashes(&[tx.object_hash()]);
api.assert_tx_status(
tx.object_hash(),
&json!({
"type": "service_error",
"code": 2,
"description": "Receiver doesn\'t exist.\n\nCan be emitted by `Transfer` or `Issue`.",
"runtime_id": 0,
"call_site": {
"call_type": "method",
"instance_id": SERVICE_ID,
"method_id": 0,
},
}),
);
// Check that Alice's balance doesn't change.
let wallet = api.get_wallet(tx_alice.author()).unwrap();
assert_eq!(wallet.balance, 100);
} | rust_cleaned_test_functions.jsonl/40478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
2346,
21637,
36895,
62308,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
1855,
4452,
8226,
1428,
262,
1077,
320,
3998,
8418,
558,
11,
70433,
8,
284,
6330,
2520,
62308,
462... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_33() {
let key = "a17f09716219bdffc93a189e410a6a3e6477fbb05c7c35956c3c0c5f342355fa";
let nonce = "0850307998642501c025e3873ebac3cc";
let expected_output =
"d3a58c49e9fe1ecf2eca169f4d4131cde27279053d562d0429a08ec701aaa39e";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
18,
18,
368,
341,
310,
1077,
1376,
284,
330,
64,
16,
22,
69,
15,
24,
22,
16,
21,
17,
16,
24,
8940,
77887,
24,
18,
64,
16,
23,
24,
68,
19,
16,
15,
64,
21,
64,
18,
68,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_enum_config() {
#[derive(Clone, Default, ModuleConfig)]
struct TestConfig {
pub switch_a: Switch,
pub switch_b: Switch,
pub switch_c: Switch,
}
#[derive(Debug, PartialEq, Clone)]
enum Switch {
On,
Off,
}
impl Default for Switch {
fn default() -> Self {
Self::Off
}
}
impl<'a> ModuleConfig<'a> for Switch {
fn from_config(config: &'a Value) -> Option<Self> {
match config.as_str()? {
"on" => Some(Self::On),
"off" => Some(Self::Off),
_ => None,
}
}
}
let config = toml::toml! {
switch_a = "on"
switch_b = "any"
};
let mut rust_config = TestConfig {
switch_a: Switch::Off,
switch_b: Switch::Off,
switch_c: Switch::Off,
};
rust_config.load_config(&config);
assert_eq!(rust_config.switch_a, Switch::On);
assert_eq!(rust_config.switch_b, Switch::Off);
assert_eq!(rust_config.switch_c, Switch::Off);
} | rust_cleaned_test_functions.jsonl/8241 | {
"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,
12411,
31054,
5332,
368,
341,
286,
11506,
27098,
65297,
11,
7899,
11,
13711,
2648,
5563,
286,
2036,
3393,
2648,
341,
310,
6675,
3398,
4306,
25,
15586,
345,
310,
6675,
3398,
880,
25,
15586,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unescape() {
let line = " Mary had\ta little \n\t lamb\t";
let output = unescape(line).expect("error processing string");
assert_eq!(output, line);
} | rust_cleaned_test_functions.jsonl/85266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12998,
368,
341,
286,
1077,
1555,
284,
330,
10244,
256,
1030,
59,
2565,
2632,
220,
1124,
77,
4955,
38306,
4955,
876,
286,
1077,
2550,
284,
650,
12998,
8797,
568,
17119,
445,
841,
8692,
914... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ls_deref_command_line() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("some_file");
at.symlink_file("some_file", "sym_file");
scene
.ucmd()
.arg("sym_file")
.succeeds()
.stdout_is("sym_file\n");
// -l changes the default to no dereferencing
scene
.ucmd()
.arg("-l")
.arg("sym_file")
.succeeds()
.stdout_contains("sym_file ->");
scene
.ucmd()
.arg("--dereference-command-line-symlink-to-dir")
.arg("sym_file")
.succeeds()
.stdout_is("sym_file\n");
scene
.ucmd()
.arg("-l")
.arg("--dereference-command-line-symlink-to-dir")
.arg("sym_file")
.succeeds()
.stdout_contains("sym_file ->");
scene
.ucmd()
.arg("--dereference-command-line")
.arg("sym_file")
.succeeds()
.stdout_is("sym_file\n");
let result = scene
.ucmd()
.arg("-l")
.arg("--dereference-command-line")
.arg("sym_file")
.succeeds();
assert!(!result.stdout_str().contains("->"));
let result = scene.ucmd().arg("-lH").arg("sym_file").succeeds();
assert!(!result.stdout_str().contains("sym_file ->"));
scene
.ucmd()
.arg("-l")
.arg("--dereference-command-line")
.succeeds()
.stdout_contains("sym_file ->");
} | rust_cleaned_test_functions.jsonl/71222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 788
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53174,
814,
43970,
10811,
6528,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,
262,
518,
42129,
445,
14689,
2458,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ordering() {
let _context = crate::quick_init().unwrap();
let x = UnifiedBox::new(1u64).unwrap();
let y = UnifiedBox::new(2u64).unwrap();
assert!(x < y);
} | rust_cleaned_test_functions.jsonl/47359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7869,
287,
368,
341,
286,
1077,
716,
2147,
284,
17717,
486,
27763,
6137,
1005,
15454,
543,
286,
1077,
856,
284,
72434,
1611,
486,
931,
7,
16,
84,
21,
19,
568,
15454,
543,
286,
1077,
379,
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_long() {
assert_eq!(
Variant::VSingle(5.1).divide(Variant::VLong(2)).unwrap(),
Variant::VSingle(2.55)
);
} | rust_cleaned_test_functions.jsonl/84608 | {
"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,
17799,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
10888,
7,
20,
13,
16,
568,
59394,
12410,
15341,
486,
53,
6583,
7,
17,
4579,
15454,
3148,
503,
39292,
486,
53,
10888,
7,
17,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stream_parsing_actor() {
use StreamParsingActor::{Actor, Input, DEFAULT_DEVICE};
use std::sync::mpsc::channel;
let (tx, rx) = channel();
let cfg = Actor {
device: DEFAULT_DEVICE.to_string(),
state_tx: tx,
};
let actor = cfg.start(); // returns StreamParsingActor::Handle
use std::thread::sleep;
use std::time::Duration;
sleep(Duration::from_millis(100));
// We can use auto-derived traits on Input
actor.send(dbg!(Input::SendState));
println!("Ticked {} times in 100ms", rx.recv().unwrap());
actor.stop();
} | rust_cleaned_test_functions.jsonl/13775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
620,
28598,
54818,
368,
341,
262,
990,
9203,
68839,
18870,
22964,
18870,
11,
5571,
11,
11955,
18094,
2315,
262,
990,
1460,
486,
12996,
486,
1307,
2388,
486,
10119,
280,
262,
1077,
320,
3998... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.