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_msgpack_encoding() {
use crate::Msgpack;
let path = reset("msgpack");
#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq)]
struct Testing {
a: i32,
b: String,
}
let cfg = Config::new(path.clone());
let store = Store::new(cfg).unwrap();
let bucket = store.bucket::<&str, Msgpack<Testing>>(None).unwrap();
assert!(path::Path::new(path.as_str()).exists());
bucket
.set(
"testing",
Msgpack(Testing {
a: 1,
b: "field".into(),
}),
)
.unwrap();
let v = bucket.get("testing").unwrap();
assert_eq!(
v.unwrap().0,
Testing {
a: 1,
b: "field".into(),
}
);
} | rust_cleaned_test_functions.jsonl/111962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6483,
4748,
37613,
368,
341,
262,
990,
17717,
486,
6611,
4748,
280,
262,
1077,
1815,
284,
7585,
445,
3236,
4748,
3071,
262,
11506,
27098,
42618,
11,
61570,
486,
15680,
11,
61570,
486,
64465,
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_lloyd2d() {
let mut rng = unseeded_stdrng();
let points = generate_points(1000, &mut rng);
let (clusters, stats) = lloyd(&points, 4, 0.001, 100, &mut rng);
assert!(clusters.len() == 4);
for i in 0..clusters.len() {
assert!(clusters[i].members.len() > 0);
}
assert!(stats.mean_d_from_centroid.iter().all(|d| *d > 0f64));
assert!(stats.centroids.iter().any(|p| p[0] >= 0f64 && p[1] >= 0f64));
assert!(stats.centroids.iter().any(|p| p[0] >= 0f64 && p[1] < 0f64));
assert!(stats.centroids.iter().any(|p| p[0] < 0f64 && p[1] < 0f64));
assert!(stats.centroids.iter().any(|p| p[0] < 0f64 && p[1] >= 0f64));
} | rust_cleaned_test_functions.jsonl/48196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
25796,
17,
67,
368,
341,
286,
1077,
5206,
28422,
284,
650,
22602,
291,
1261,
3612,
968,
543,
286,
1077,
3501,
284,
6923,
12928,
7,
16,
15,
15,
15,
11,
609,
6984,
28422,
626,
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... | 6 |
#[test]
fn test_cluster_info_new() {
let d = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
let cluster_info = ClusterInfo::new_with_invalid_keypair(d.clone());
assert_eq!(d.id, cluster_info.id());
} | rust_cleaned_test_functions.jsonl/11657 | {
"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,
28441,
3109,
5921,
368,
341,
286,
1077,
294,
284,
9180,
1731,
486,
931,
62,
8301,
2099,
38198,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
1507,
11441,
1423,
286,
1077,
10652,
3109,
284,
35380,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_logentry() {
let mut logentry = LogEntry::default();
let mut meta = Meta::default();
assert_eq_dbg!(normalize_logentry(&mut logentry, &mut meta), Ok(()));
assert!(!meta.has_errors());
} | rust_cleaned_test_functions.jsonl/84682 | {
"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,
15124,
5224,
4085,
368,
341,
262,
1077,
5206,
1487,
4085,
284,
2835,
5874,
486,
2258,
543,
262,
1077,
5206,
8823,
284,
15819,
486,
2258,
1428,
262,
2060,
10714,
44124,
10297,
30590,
5224,
4085,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stxw() {
disasm!("entrypoint:\n stxw [r2+0x5], r8\n");
disasm!("entrypoint:\n stxw [r2-0x5], r8\n");
} | rust_cleaned_test_functions.jsonl/68751 | {
"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,
1261,
87,
86,
368,
341,
262,
827,
10530,
17223,
4085,
2768,
7190,
77,
262,
357,
87,
86,
508,
81,
17,
10,
15,
87,
20,
1125,
435,
23,
1699,
797,
262,
827,
10530,
17223,
4085,
2768,
7190,
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 |
#[test]
fn test_tuple() {
assert_eq!(
<(bool, bool)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false)
])),
Ok((true, false))
);
assert_eq!(
<(bool, bool, bool)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false)
])),
Ok((true, false, false))
);
assert_eq!(
<(bool, bool, bool, bool)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true)
])),
Ok((true, false, false, true))
);
assert_eq!(
<(bool, bool, bool, bool, String)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string())
])),
Ok((true, false, false, true, "foo".to_string()))
);
assert_eq!(
<(bool, bool, bool, bool, String, bool)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false)
])),
Ok((true, false, false, true, "foo".to_string(), false))
);
assert_eq!(
<(bool, bool, bool, bool, String, bool, bool)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false),
Record::Bool(false)
])),
Ok((true, false, false, true, "foo".to_string(), false, false))
);
assert_eq!(
<(bool, bool, bool, bool, String, bool, bool, bool)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false),
Record::Bool(false),
Record::Bool(false)
])),
Ok((
true,
false,
false,
true,
"foo".to_string(),
false,
false,
false
))
);
assert_eq!(
<(bool, bool, bool, bool, String, bool, bool, bool, bool)>::from_record(&Record::Tuple(
vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true)
]
)),
Ok((
true,
false,
false,
true,
"foo".to_string(),
false,
false,
false,
true
))
);
assert_eq!(
<(bool, bool, bool, bool, String, bool, bool, bool, bool, bool)>::from_record(
&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::Bool(true)
])
),
Ok((
true,
false,
false,
true,
"foo".to_string(),
false,
false,
false,
true,
true
))
);
assert_eq!(
<(
bool,
bool,
bool,
bool,
String,
bool,
bool,
bool,
bool,
bool,
bool
)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::Bool(true),
Record::Bool(true)
])),
Ok((
true,
false,
false,
true,
"foo".to_string(),
false,
false,
false,
true,
true,
true
))
);
assert_eq!(
<(
bool,
bool,
bool,
bool,
String,
bool,
bool,
bool,
bool,
bool,
bool,
bool
)>::from_record(&Record::Tuple(vec![
Record::Bool(true),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::String("foo".to_string()),
Record::Bool(false),
Record::Bool(false),
Record::Bool(false),
Record::Bool(true),
Record::Bool(true),
Record::Bool(true),
Record::Bool(false)
])),
Ok((
true,
false,
false,
true,
"foo".to_string(),
false,
false,
false,
true,
true,
true,
false
))
);
} | rust_cleaned_test_functions.jsonl/8014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
368,
341,
262,
2060,
10714,
33673,
286,
366,
7,
2641,
11,
1807,
8,
6831,
1499,
14192,
2099,
6471,
486,
28681,
25592,
90515,
310,
13583,
486,
11233,
3715,
1326,
310,
13583,
486,
11233,
3576,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_current_user_saved_albums_add() {
let mut oauth = SpotifyOAuth::default().scope("user-library-modify").build();
match get_token(&mut oauth) {
Some(token_info) => {
let client_credential = SpotifyClientCredentials::default()
.token_info(token_info)
.build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let mut album_ids = vec![];
let album_id1 = String::from("6akEvsycLGftJxYudPjmqK");
let album_id2 = String::from("628oezqK2qfmCjC6eXNors");
album_ids.push(album_id2);
album_ids.push(album_id1);
let result = spotify.current_user_saved_albums_add(&album_ids);
assert!(result.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
3317,
53709,
53241,
82,
2891,
368,
341,
262,
1077,
5206,
46415,
284,
40537,
57850,
486,
2258,
1005,
4186,
445,
872,
52421,
17078,
1437,
1827,
5834,
543,
262,
2432,
633,
6458,
2099,
6984,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_append() {
let catalog = Catalog::new();
let (client, origin) = create_sig0_ready_client(catalog);
// append a record
let mut record = Record::with(
Name::from_str("new.example.com").unwrap(),
RecordType::A,
Duration::minutes(5).num_seconds() as u32,
);
record.set_rdata(RData::A(Ipv4Addr::new(100, 10, 100, 10)));
// first check the must_exist option
let result = client
.append(record.clone(), origin.clone(), true)
.expect("append failed");
assert_eq!(result.response_code(), ResponseCode::NXRRSet);
// next append to a non-existent RRset
let result = client
.append(record.clone(), origin.clone(), false)
.expect("append failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
// verify record contents
let result = client
.query(record.name(), record.dns_class(), record.rr_type())
.expect("query failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
assert_eq!(result.answers().len(), 1);
assert_eq!(result.answers()[0], record);
// will fail if already set and not the same value.
let mut record = record.clone();
record.set_rdata(RData::A(Ipv4Addr::new(101, 11, 101, 11)));
let result = client
.append(record.clone(), origin.clone(), true)
.expect("create failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
let result = client
.query(record.name(), record.dns_class(), record.rr_type())
.expect("query failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
assert_eq!(result.answers().len(), 2);
assert!(
result
.answers()
.iter()
.any(|rr| if let RData::A(ip) = *rr.rdata() {
ip == Ipv4Addr::new(100, 10, 100, 10)
} else {
false
})
);
assert!(
result
.answers()
.iter()
.any(|rr| if let RData::A(ip) = rr.rdata() {
*ip == Ipv4Addr::new(101, 11, 101, 11)
} else {
false
})
);
let result = client
.append(record.clone(), origin.clone(), true)
.expect("create failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
let result = client
.query(record.name(), record.dns_class(), record.rr_type())
.expect("query failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
assert_eq!(result.answers().len(), 2);
} | rust_cleaned_test_functions.jsonl/17411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
368,
341,
262,
1077,
16403,
284,
31221,
486,
931,
543,
262,
1077,
320,
2972,
11,
6238,
8,
284,
1855,
29252,
15,
35456,
8179,
1337,
7750,
626,
262,
442,
8737,
264,
3255,
198,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_move_right_doesnt_go_over() {
let mut player_bar = Bar::new(
Position::new(0, 0),
Dimensions::new(5, 1),
Dimensions::new(10, 10),
);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 1);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 2);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 3);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 4);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 5);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 5);
player_bar.move_right();
assert_eq!(player_bar.position.x(), 5);
} | rust_cleaned_test_functions.jsonl/40729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
10539,
96374,
406,
25515,
15431,
368,
341,
286,
1077,
5206,
2781,
14388,
284,
4716,
486,
931,
1006,
310,
12380,
486,
931,
7,
15,
11,
220,
15,
1326,
310,
32023,
486,
931,
7,
20,
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_extract_nobase() -> Result<(), String> {
let (f1, f2) = same_files();
match extract(&f1) {
Some(result) => {
println!("{:?}", &result);
Ok(())
}
None => Err("Should be none".to_owned()),
}
} | rust_cleaned_test_functions.jsonl/122899 | {
"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,
39123,
1089,
674,
519,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
320,
69,
16,
11,
282,
17,
8,
284,
1852,
10931,
543,
286,
2432,
8649,
2099,
69,
16,
8,
341,
310,
4329,
4456,
8,
589,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_bools() {
let bools = vec!(false, false, true, false, false, true, true, false);
assert_eq!(from_bytes([0b00100110]).to_bools(), bools);
} | rust_cleaned_test_functions.jsonl/12147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
22159,
82,
368,
341,
286,
1077,
1807,
82,
284,
7486,
10297,
3849,
11,
895,
11,
830,
11,
895,
11,
895,
11,
830,
11,
830,
11,
895,
317,
286,
2060,
10714,
10297,
1499,
12524,
2561,
15,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stdin_all_repeated_prepend() {
new_ucmd!()
.args(&["--all-repeated=prepend"]).pipe_in_fixture(INPUT)
.run().stdout_is_fixture("sorted-all-repeated-prepend.expected");
} | rust_cleaned_test_functions.jsonl/23103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
5705,
1288,
41954,
10442,
3740,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
541,
5504,
41954,
28,
55906,
45014,
13768,
1243,
74409,
57911,
340,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rlp_stream_size_limit() {
for limit in 40..270 {
let item = [0u8; 1];
let mut stream = RlpStream::new();
while stream.append_raw_checked(&item, 1, limit) {}
assert_eq!(stream.drain().len(), limit);
}
} | rust_cleaned_test_functions.jsonl/96998 | {
"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,
1710,
13545,
12673,
2368,
14763,
368,
341,
2023,
3930,
304,
220,
19,
15,
496,
17,
22,
15,
341,
197,
10217,
1509,
284,
508,
15,
84,
23,
26,
220,
16,
935,
197,
10217,
5206,
4269,
284,
431,
135... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decrypt_it_w_pass() {
let test_content1: Vec<u8> = vec![0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x00, 0x09, 0x00, 0x00, 0x00];
let test_content2: Vec<u8> = vec![0x00, 0x05, 0x00, 0x00, 0x00, 0x1F, 0x7C, 0xB5, 0x7E, 0xFB,
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00];
let (mut crypter, header, encrypted_database) = setup("test/test_password.kdb".to_string(),
Some("test".to_string()),
None);
let mut db_tmp: Vec<u8> = vec![];
match crypter.decrypt_database(&header, encrypted_database) {
Ok(e) => db_tmp = e,
Err(_) => assert!(false),
};
let db_len = db_tmp.len();
let test1 = &db_tmp[0..16];
let test2 = &db_tmp[db_len - 16..db_len];
assert_eq!(test_content1, test1);
assert_eq!(test_content2, test2);
} | rust_cleaned_test_functions.jsonl/83231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
14631,
1670,
15464,
368,
341,
262,
1077,
1273,
7495,
16,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
19,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_file_in_stdout() {
Command::cargo_bin("rrrocket")
.unwrap()
.args(&["-n", "assets/replays/1ec9.replay"])
.assert()
.success()
.stdout(predicate::str::contains(
r#"{"header_size":1944,"header_crc":3561912561"#,
));
} | rust_cleaned_test_functions.jsonl/88729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
1243,
67416,
368,
341,
286,
7348,
486,
66715,
21816,
445,
634,
46790,
1138,
310,
659,
15454,
741,
310,
659,
2116,
2099,
1183,
12,
77,
497,
330,
5160,
10758,
27797,
14,
16,
757,
24,
1327,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encrypt_decrypt_oaep() {
let priv_key = get_private_key();
do_test_encrypt_decrypt_oaep::<Sha1>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha224>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha256>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha384>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha512>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha3_256>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha3_384>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha3_512>(&priv_key);
do_test_oaep_with_different_hashes::<Sha1, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha224, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha256, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha384, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha512, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha3_256, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha3_384, Sha1>(&priv_key);
do_test_oaep_with_different_hashes::<Sha3_512, Sha1>(&priv_key);
} | rust_cleaned_test_functions.jsonl/120028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
80764,
14179,
64,
747,
368,
341,
286,
1077,
6095,
3097,
284,
633,
26249,
3097,
543,
286,
653,
4452,
66593,
80764,
14179,
64,
747,
27638,
62316,
16,
44784,
11887,
3097,
317,
286,
653,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_2_unlocked_during_is_valid() {
struct BlockingChecker {
first: AtomicBool,
s: Mutex<SyncSender<()>>,
r: Mutex<Receiver<()>>,
}
impl ManageConnection for BlockingChecker {
type Connection = FakeConnection;
type Error = Error;
fn connect(&self) -> Result<FakeConnection, Error> {
Ok(FakeConnection(true))
}
fn is_valid(&self, _: &mut FakeConnection) -> Result<(), Error> {
if self.first.compare_and_swap(true, false, Ordering::SeqCst) {
self.s.lock().send(()).unwrap();
self.r.lock().recv().unwrap();
}
Ok(())
}
fn has_broken(&self, _: &mut FakeConnection) -> bool {
false
}
}
let (s1, r1) = mpsc::sync_channel(0);
let (s2, r2) = mpsc::sync_channel(0);
let manager = BlockingChecker {
first: AtomicBool::new(true),
s: Mutex::new(s1),
r: Mutex::new(r2),
};
let pool = Pool::builder()
.test_on_check_out(true)
.max_size(2)
.build(manager)
.unwrap();
let p2 = pool.clone();
let t = thread::spawn(move || {
p2.get().ok().unwrap();
});
r1.recv().unwrap();
// get call by other task has triggered the health check
pool.get().ok().unwrap();
s2.send(()).ok().unwrap();
t.join().ok().unwrap();
} | rust_cleaned_test_functions.jsonl/6402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 706
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
62,
17,
19465,
291,
814,
1677,
6892,
8337,
368,
341,
262,
2036,
81945,
35188,
341,
286,
1156,
25,
30316,
11233,
345,
286,
274,
25,
66215,
27,
12154,
20381,
27,
368,
61340,
286,
435,
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_range_adjacent_to() {
assert!(!Range::new(1, 2).adjacent_to(Range::new(1, 1)));
assert!(!Range::new(1, 2).adjacent_to(Range::new(2, 2)));
assert!(Range::new(1, 2).adjacent_to(Range::new(0, 0)));
assert!(Range::new(1, 2).adjacent_to(Range::new(3, 10)));
assert!(!Range::new(1, 3).adjacent_to(Range::new(5, 5)));
} | rust_cleaned_test_functions.jsonl/75325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
42559,
18181,
2346,
368,
341,
286,
2060,
0,
3471,
6046,
486,
931,
7,
16,
11,
220,
17,
568,
24739,
18181,
2346,
2785,
844,
486,
931,
7,
16,
11,
220,
16,
4945,
286,
2060,
0,
3471,
6046,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_palindrome() {
assert_eq!(is_palindrome(90509), true);
assert_eq!(is_palindrome(9009), true);
assert_eq!(is_palindrome(9967), false);
} | rust_cleaned_test_functions.jsonl/68254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73310,
36058,
368,
341,
262,
2060,
10714,
10297,
285,
73310,
36058,
7,
24,
15,
20,
15,
24,
701,
830,
317,
262,
2060,
10714,
10297,
285,
73310,
36058,
7,
24,
15,
15,
24,
701,
830,
317,
262,
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 |
#[test]
fn test_timestamp_to_datetime_negative() {
// turns out that the chrono library itself didn't handle parsing
// negative timestamps:
// thread 'window::tests::test_timestamp_to_datetime' panicked at 'invalid or
// 19/src/naive/datetime.rs:117:18
assert_eq!(timestamp_to_datetime(-1568756160).to_rfc3339(), "foo");
} | rust_cleaned_test_functions.jsonl/10529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
2346,
28943,
53865,
368,
341,
1789,
286,
442,
10577,
700,
429,
279,
80372,
6733,
5086,
3207,
944,
3705,
22314,
198,
286,
442,
8225,
48781,
510,
1789,
286,
442,
4516,
364,
5507,
486,
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_monero_blocks() {
// Create temporary test folder
let seed1 = "9f02e032f9b15d2aded991e0f68cc3c3427270b568b782e55fbd269ead0bad97".to_string();
let seed2 = "9f02e032f9b15d2aded991e0f68cc3c3427270b568b782e55fbd269ead0bad98".to_string();
let factories = CryptoFactories::default();
let network = Network::Stibbons;
let mut algos = HashMap::new();
algos.insert(PowAlgorithm::Sha3, PowAlgorithmConstants {
max_target_time: 1800,
min_difficulty: 1.into(),
max_difficulty: 1.into(),
target_time: 300,
});
algos.insert(PowAlgorithm::Monero, PowAlgorithmConstants {
max_target_time: 1200,
min_difficulty: 1.into(),
max_difficulty: 1.into(),
target_time: 200,
});
let cc = ConsensusConstantsBuilder::new(network)
.with_max_randomx_seed_height(1)
.with_proof_of_work(algos)
.build();
let cm = ConsensusManagerBuilder::new(network)
.with_consensus_constants(cc)
.build();
let header_validator = HeaderValidator::new(cm.clone(), RandomXFactory::default());
let db = create_store_with_consensus_and_validators(
&cm,
Validators::new(MockValidator::new(true), header_validator, MockValidator::new(true)),
);
let block_0 = db.fetch_block(0).unwrap().try_into_chain_block().unwrap();
let (block_1_t, _) = chain_block_with_new_coinbase(&block_0, vec![], &cm, &factories);
let mut block_1 = db.prepare_block_merkle_roots(block_1_t).unwrap();
add_monero_data(&mut block_1, seed1.clone());
let cb_1 = db.add_block(Arc::new(block_1)).unwrap().assert_added();
// Now lets add a second faulty block using the same seed hash
let (block_2_t, _) = chain_block_with_new_coinbase(&cb_1, vec![], &cm, &factories);
let mut block_2 = db.prepare_block_merkle_roots(block_2_t).unwrap();
add_monero_data(&mut block_2, seed1.clone());
let cb_2 = db.add_block(Arc::new(block_2)).unwrap().assert_added();
let (block_3_t, _) = chain_block_with_new_coinbase(&cb_2, vec![], &cm, &factories);
let mut block_3 = db.prepare_block_merkle_roots(block_3_t).unwrap();
let mut block_3_broken = block_3.clone();
add_monero_data(&mut block_3_broken, seed1);
match db.add_block(Arc::new(block_3_broken)) {
Err(ChainStorageError::ValidationError {
source: ValidationError::BlockHeaderError(BlockHeaderValidationError::OldSeedHash),
}) => (),
Err(e) => {
panic!("Failed due to other error:{:?}", e);
},
Ok(res) => {
panic!("Block add unexpectedly succeeded with result: {:?}", res);
},
};
add_monero_data(&mut block_3, seed2);
db.add_block(Arc::new(block_3)).unwrap().assert_added();
} | rust_cleaned_test_functions.jsonl/27333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20737,
2328,
25201,
368,
341,
262,
442,
4230,
13340,
1273,
8527,
198,
262,
1077,
10320,
16,
284,
330,
24,
69,
15,
17,
68,
15,
18,
17,
69,
24,
65,
16,
20,
67,
17,
14255,
24,
24,
16,
68,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fuzz_log() {
Command::new("cargo")
.envs(vec![("TEST_FUZZ_LOG", "1")])
.args(&[
"test",
"--manifest-path",
&MANIFEST_PATH,
"--no-run",
"--features",
&("test-fuzz/".to_owned() + test_fuzz::serde_format().as_feature()),
])
.assert()
.success()
.stdout(predicate::str::is_match(r"(?m)^#\[cfg\(test\)\]\nmod parse_fuzz \{$").unwrap());
} | rust_cleaned_test_functions.jsonl/29930 | {
"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,
761,
8889,
5224,
368,
341,
262,
7348,
486,
931,
445,
66715,
1138,
286,
659,
3160,
82,
25592,
20703,
445,
10033,
1400,
52,
33536,
8419,
497,
330,
16,
899,
2546,
286,
659,
2116,
2099,
9640,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shift() {
run_test(|| {
let (mut value, result) = unsafe {
let mut alloc = BumpAlloc::from_raw_parts(Key([0x0; 32]));
let mut value: Value<i32> = Value::allocate_using(&mut alloc);
let mut result: Value<i32> = Value::allocate_using(&mut alloc);
value.initialize(10);
result.initialize(10 << 5);
(value, result)
};
// Check init values
assert_eq!(value.get(), &10);
assert_eq!(result.get(), &(10 << 5));
// Simple tests
assert_eq!(&value << 5, 10 << 5);
// Assign test
value <<= 5;
assert_eq!(&value, &result);
})
} | rust_cleaned_test_functions.jsonl/2204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22230,
368,
341,
286,
1598,
4452,
79453,
341,
310,
1077,
320,
6984,
897,
11,
1102,
8,
284,
19860,
341,
394,
1077,
5206,
5574,
284,
425,
1510,
25154,
486,
1499,
16067,
33217,
21358,
2561,
15,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_heap_wrapper_into_mut() {
// Test that CHeapWrapper::into_mut doesn't free the pointer. If it
// when it finds the refcount at 0.
let key = CHeapWrapper::<EC_KEY>::default();
unsafe { EC_KEY::free(key.into_mut()) };
} | rust_cleaned_test_functions.jsonl/62167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33059,
23561,
45514,
29523,
368,
341,
286,
442,
3393,
429,
356,
27909,
11542,
486,
18122,
29523,
3171,
944,
1910,
279,
7445,
13,
1416,
432,
8945,
286,
442,
979,
432,
13719,
279,
2053,
1830,
518,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_data_shreds_basic() {
// Create enough entries to ensure there are at least two shreds created
let num_entries = max_ticks_per_n_shreds(1, None) + 1;
assert!(num_entries > 1);
let (mut shreds, entries) = make_slot_entries(0, 0, num_entries);
let num_shreds = shreds.len() as u64;
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
assert!(shreds.len() > 1);
let last_shred = shreds.pop().unwrap();
blockstore
.insert_shreds(vec![last_shred], None, false)
.unwrap();
assert!(blockstore.get_slot_entries(0, 0).unwrap().is_empty());
let meta = blockstore
.meta(0)
.unwrap()
.expect("Expected new metadata object to be created");
assert!(meta.consumed == 0 && meta.received == num_shreds);
blockstore.insert_shreds(shreds, None, false).unwrap();
let result = blockstore.get_slot_entries(0, 0).unwrap();
assert_eq!(result, entries);
let meta = blockstore
.meta(0)
.unwrap()
.expect("Expected new metadata object to exist");
assert_eq!(meta.consumed, num_shreds);
assert_eq!(meta.received, num_shreds);
assert_eq!(meta.parent_slot, 0);
assert_eq!(meta.last_index, num_shreds - 1);
assert!(meta.next_slots.is_empty());
assert!(meta.is_connected);
} | rust_cleaned_test_functions.jsonl/9540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 750
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
1769,
3712,
53369,
34729,
368,
341,
286,
442,
4230,
3322,
10695,
311,
5978,
1052,
525,
518,
3245,
1378,
557,
53369,
3465,
198,
286,
1077,
1629,
26092,
284,
1932,
49961,
5678,
1089,
3712,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_signers() {
let program_id = Pubkey::new(&[0; 32]);
let memo = "🐆".as_bytes();
let pubkey0 = Pubkey::new_unique();
let pubkey1 = Pubkey::new_unique();
let pubkey2 = Pubkey::new_unique();
let mut account0 = Account::default();
let mut account1 = Account::default();
let mut account2 = Account::default();
let signed_account_infos = vec![
(&pubkey0, true, &mut account0).into_account_info(),
(&pubkey1, true, &mut account1).into_account_info(),
(&pubkey2, true, &mut account2).into_account_info(),
];
assert_eq!(
Ok(()),
process_instruction(&program_id, &signed_account_infos, memo)
);
assert_eq!(Ok(()), process_instruction(&program_id, &[], memo));
let unsigned_account_infos = vec![
(&pubkey0, false, &mut account0).into_account_info(),
(&pubkey1, false, &mut account1).into_account_info(),
(&pubkey2, false, &mut account2).into_account_info(),
];
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
process_instruction(&program_id, &unsigned_account_infos, memo)
);
let partially_signed_account_infos = vec![
(&pubkey0, true, &mut account0).into_account_info(),
(&pubkey1, false, &mut account1).into_account_info(),
(&pubkey2, true, &mut account2).into_account_info(),
];
assert_eq!(
Err(ProgramError::MissingRequiredSignature),
process_instruction(&program_id, &partially_signed_account_infos, memo)
);
} | rust_cleaned_test_functions.jsonl/133200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 786
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
388,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
931,
2099,
58,
15,
26,
220,
18,
17,
2558,
286,
1077,
21438,
284,
330,
148893,
3263,
300,
12524,
1428,
286,
1077,
95116,
15,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_when() {
let cases: Vec<(Vec<ScalarValue>, Option<Real>)> = vec![
(
vec![1.into(), (3.0).into(), 1.into(), (5.0).into()],
Real::new(3.0).ok(),
),
(
vec![0.into(), (3.0).into(), 1.into(), (5.0).into()],
Real::new(5.0).ok(),
),
(
vec![ScalarValue::Int(None), (2.0).into(), 1.into(), (6.0).into()],
Real::new(6.0).ok(),
),
(vec![(7.0).into()], Real::new(7.0).ok()),
(vec![0.into(), ScalarValue::Real(None)], None),
(vec![1.into(), ScalarValue::Real(None)], None),
(vec![1.into(), (3.5).into()], Real::new(3.5).ok()),
(vec![2.into(), (3.5).into()], Real::new(3.5).ok()),
(
vec![
0.into(),
ScalarValue::Real(None),
ScalarValue::Int(None),
ScalarValue::Real(None),
(5.5).into(),
],
Real::new(5.5).ok(),
),
];
for (args, expected) in cases {
let mut evaluator = RpnFnScalarEvaluator::new();
for arg in args {
evaluator = evaluator.push_param(arg);
}
let output = evaluator.evaluate(ScalarFuncSig::CaseWhenReal).unwrap();
assert_eq!(output, expected);
}
} | rust_cleaned_test_functions.jsonl/14917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 924
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
47636,
368,
341,
286,
1077,
5048,
25,
11312,
28706,
10050,
78505,
1130,
8066,
6959,
64829,
9231,
29,
284,
7486,
90515,
310,
2399,
394,
7486,
20703,
16,
39860,
1507,
320,
18,
13,
15,
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... | 3 |
#[test]
fn test_model_serializer_and_deserializer() {
let model = TrainingDataLanguageModel {
language: Language::English,
absolute_frequencies: None,
relative_frequencies: Some(expected_unigram_relative_frequencies()),
json_relative_frequencies: None,
};
let deserialized = TrainingDataLanguageModel::from_json(&model.to_json());
assert_eq!(deserialized.language, Language::English);
assert_eq!(deserialized.absolute_frequencies, None);
assert_eq!(deserialized.relative_frequencies, None);
assert_eq!(
deserialized.json_relative_frequencies,
Some(expected_unigram_json_relative_frequencies())
);
} | rust_cleaned_test_functions.jsonl/110758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5047,
67441,
8378,
15768,
41939,
368,
341,
310,
1077,
1614,
284,
16151,
1043,
13806,
1712,
341,
394,
4128,
25,
11434,
486,
22574,
345,
394,
10740,
761,
71731,
25,
2240,
345,
394,
8674,
761,
71731,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_indices_revator() {
let s = "ศไทย中华Việt Nam";
let p = [27, 26, 25, 24, 23, 20, 19, 18, 15, 12, 9, 6, 3, 0];
let v = ['m', 'a', 'N', ' ', 't', 'ệ','i','V','华','中','ย','ท','ไ','ศ'];
let mut pos = 0;
let mut it = s.char_indices().rev();
for c in it {
assert_eq!(c, (p[pos], v[pos]));
pos += 1;
}
assert_eq!(pos, v.len());
assert_eq!(pos, p.len());
} | rust_cleaned_test_functions.jsonl/2473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9232,
18333,
38082,
850,
368,
341,
286,
1077,
274,
284,
330,
123863,
125451,
100849,
35544,
124382,
29974,
876,
286,
1077,
281,
284,
508,
17,
22,
11,
220,
17,
21,
11,
220,
17,
20,
11,
220,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_poe_invalid_proof() {
let q = str::parse(
"115792089210356248762697446949407573529996955224135760342422259061068512044369",
)
.unwrap();
let hsmcl = HSMCL::keygen(&q, &1600);
let u = hsmcl.pk.gq;
let x = BigInt::sample(512);
let x_tag = &x + BigInt::from(1);
let w = u.exp(&x_tag);
let proof = PoEProof::prove(&x, &u, &w);
assert!(proof.verify().is_ok());
} | rust_cleaned_test_functions.jsonl/115365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4644,
31433,
86757,
368,
341,
286,
1077,
2804,
284,
607,
486,
6400,
1006,
310,
330,
16,
16,
20,
22,
24,
17,
15,
23,
24,
17,
16,
15,
18,
20,
21,
17,
19,
23,
22,
21,
17,
21,
24,
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_bpf_loader_upgradeable_set_upgrade_authority() {
let instruction = bincode::serialize(&UpgradeableLoaderInstruction::SetAuthority).unwrap();
let slot = 0;
let upgrade_authority_address = Pubkey::new_unique();
let upgrade_authority_account = Account::new_ref(1, 0, &Pubkey::new_unique());
let new_upgrade_authority_address = Pubkey::new_unique();
let new_upgrade_authority_account = Account::new_ref(1, 0, &Pubkey::new_unique());
let program_address = Pubkey::new_unique();
let (programdata_address, _) =
Pubkey::find_program_address(&[program_address.as_ref()], &id());
let programdata_account = Account::new_ref(
1,
UpgradeableLoaderState::programdata_len(0).unwrap(),
&bpf_loader_upgradeable::id(),
);
// Case: Set to new authority
programdata_account
.borrow_mut()
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(upgrade_authority_address),
})
.unwrap();
assert_eq!(
Ok(()),
process_instruction(
&bpf_loader_upgradeable::id(),
&[
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new_readonly(
&upgrade_authority_address,
true,
&upgrade_authority_account
),
KeyedAccount::new_readonly(
&new_upgrade_authority_address,
false,
&new_upgrade_authority_account
)
],
&instruction,
&mut MockInvokeContext::default()
)
);
let state: UpgradeableLoaderState = programdata_account.borrow().state().unwrap();
assert_eq!(
state,
UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(new_upgrade_authority_address),
}
);
// Case: Not upgradeable
programdata_account
.borrow_mut()
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(upgrade_authority_address),
})
.unwrap();
assert_eq!(
Ok(()),
process_instruction(
&bpf_loader_upgradeable::id(),
&[
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new_readonly(
&upgrade_authority_address,
true,
&upgrade_authority_account
)
],
&instruction,
&mut MockInvokeContext::default()
)
);
let state: UpgradeableLoaderState = programdata_account.borrow().state().unwrap();
assert_eq!(
state,
UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: None,
}
);
// Case: Authority did not sign
programdata_account
.borrow_mut()
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(upgrade_authority_address),
})
.unwrap();
assert_eq!(
Err(InstructionError::MissingRequiredSignature),
process_instruction(
&bpf_loader_upgradeable::id(),
&[
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new_readonly(
&upgrade_authority_address,
false,
&upgrade_authority_account
),
],
&instruction,
&mut MockInvokeContext::default()
)
);
// Case: wrong authority
programdata_account
.borrow_mut()
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(upgrade_authority_address),
})
.unwrap();
assert_eq!(
Err(InstructionError::MissingRequiredSignature),
process_instruction(
&bpf_loader_upgradeable::id(),
&[
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new_readonly(
&Pubkey::new_unique(),
true,
&upgrade_authority_account
),
KeyedAccount::new_readonly(
&new_upgrade_authority_address,
false,
&new_upgrade_authority_account
)
],
&instruction,
&mut MockInvokeContext::default()
)
);
// Case: No authority
programdata_account
.borrow_mut()
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: None,
})
.unwrap();
assert_eq!(
Err(InstructionError::InvalidArgument),
process_instruction(
&bpf_loader_upgradeable::id(),
&[
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new_readonly(
&Pubkey::new_unique(),
true,
&upgrade_authority_account
),
],
&bincode::serialize(&UpgradeableLoaderInstruction::SetAuthority).unwrap(),
&mut MockInvokeContext::default()
)
);
// Case: Not a ProgramData account
programdata_account
.borrow_mut()
.set_state(&UpgradeableLoaderState::Program {
programdata_address: Pubkey::new_unique(),
})
.unwrap();
assert_eq!(
Err(InstructionError::InvalidAccountData),
process_instruction(
&bpf_loader_upgradeable::id(),
&[
KeyedAccount::new(&programdata_address, false, &programdata_account),
KeyedAccount::new_readonly(
&Pubkey::new_unique(),
true,
&upgrade_authority_account
),
],
&bincode::serialize(&UpgradeableLoaderInstruction::SetAuthority).unwrap(),
&mut MockInvokeContext::default()
)
);
} | rust_cleaned_test_functions.jsonl/109955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4006
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
22139,
67794,
480,
2602,
67794,
22938,
487,
368,
341,
286,
1077,
7600,
284,
9544,
1851,
486,
24166,
2099,
43861,
480,
9181,
16664,
486,
1649,
45532,
568,
15454,
543,
286,
1077,
9446,
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_insert_at_position() {
let mut v = vec![1, 2, 3, 4];
_insert_at_position(&mut v, 2, &[5, 6]);
assert_eq!(&v, &[1, 2, 5, 6, 3, 4]);
} | rust_cleaned_test_functions.jsonl/129882 | {
"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,
17678,
3752,
9661,
368,
341,
286,
1077,
5206,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
716,
4208,
3752,
9661,
2099,
6984,
348,
11,
220,
17,
11,
44590,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prettyencoder_indent_level_param() {
use std::collections::BTreeMap;
let mut tree = BTreeMap::new();
tree.insert("hello".to_string(), String("guten tag".to_string()));
tree.insert("goodbye".to_string(), String("sayonara".to_string()));
let json = Array(
// The following layout below should look a lot like
vec!
( // 0x
String("greetings".to_string()), // 1x
Object(tree), // 1x + 2x + 2x + 1x
) // 0x
);
// Helper function for counting indents
fn indents(source: &str) -> usize {
let trimmed = source.trim_left_matches(' ');
source.len() - trimmed.len()
}
for i in 0..4 {
let printed = super::as_pretty_json(&json).indent(i as u32)
.to_string();
// Check for indents at each line
let lines: Vec<&str> = printed.lines().collect();
assert_eq!(lines.len(), 7); // JSON should be 7 lines
assert_eq!(indents(lines[0]), 0 * i);
assert_eq!(indents(lines[1]), 1 * i);
assert_eq!(indents(lines[2]), 1 * i);
assert_eq!(indents(lines[3]), 2 * i);
assert_eq!(indents(lines[4]), 2 * i); // "goodbye": "sayonara"
assert_eq!(indents(lines[5]), 1 * i);
assert_eq!(indents(lines[6]), 0 * i);
Json::from_str(&printed).ok()
.expect("Pretty-printed JSON is invalid!");
}
} | rust_cleaned_test_functions.jsonl/22759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 857
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
27008,
69045,
8274,
4090,
368,
341,
286,
990,
1460,
486,
51137,
486,
33,
6533,
2227,
401,
286,
1077,
5206,
4916,
284,
425,
6533,
2227,
486,
931,
1428,
286,
4916,
7030,
445,
14990,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_and_b() {
let compiled = bitwise::compile_and("B".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b00111000);
} | rust_cleaned_test_functions.jsonl/100579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
8378,
880,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
8378,
445,
33,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
10714,
10297,
5084... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_extreme_size() {
let arr = [false; 1024 * 128];
let mut bit_arr = Bit::from(arr);
bit!(mut bit_arr[69420]).insert(true);
assert_eq!(bit!(bit_arr[69420]).extract(), true);
} | rust_cleaned_test_functions.jsonl/44786 | {
"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,
9927,
9634,
2368,
368,
341,
286,
1077,
2890,
284,
508,
3849,
26,
220,
16,
15,
17,
19,
353,
220,
16,
17,
23,
935,
286,
1077,
5206,
2699,
11210,
284,
6495,
486,
1499,
10939,
626,
286,
2699,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_modify() {
let cases: Vec<(_, Vec<ScalarValue>, _)> = vec![
(
ScalarFuncSig::JsonSetSig,
vec![
None::<Json>.into(),
None::<Bytes>.into(),
None::<Json>.into(),
],
None::<Json>,
),
(
ScalarFuncSig::JsonSetSig,
vec![
Some(Json::from_i64(9).unwrap()).into(),
Some(b"$[1]".to_vec()).into(),
Some(Json::from_u64(3).unwrap()).into(),
],
Some(r#"[9,3]"#.parse().unwrap()),
),
(
ScalarFuncSig::JsonInsertSig,
vec![
Some(Json::from_i64(9).unwrap()).into(),
Some(b"$[1]".to_vec()).into(),
Some(Json::from_u64(3).unwrap()).into(),
],
Some(r#"[9,3]"#.parse().unwrap()),
),
(
ScalarFuncSig::JsonReplaceSig,
vec![
Some(Json::from_i64(9).unwrap()).into(),
Some(b"$[1]".to_vec()).into(),
Some(Json::from_u64(3).unwrap()).into(),
],
Some(r#"9"#.parse().unwrap()),
),
(
ScalarFuncSig::JsonSetSig,
vec![
Some(Json::from_str(r#"{"a":"x"}"#).unwrap()).into(),
Some(b"$.a".to_vec()).into(),
None::<Json>.into(),
],
Some(r#"{"a":null}"#.parse().unwrap()),
),
];
for (sig, args, expect_output) in cases {
let output: Option<Json> = RpnFnScalarEvaluator::new()
.push_params(args.clone())
.evaluate(sig)
.unwrap();
assert_eq!(output, expect_output, "{:?}", args);
}
} | rust_cleaned_test_functions.jsonl/60594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
57725,
368,
341,
286,
1077,
5048,
25,
11312,
27,
41117,
11312,
78505,
1130,
8066,
716,
16018,
284,
7486,
90515,
310,
2399,
394,
35176,
9626,
47246,
486,
5014,
1649,
47246,
345,
394,
7486,
90... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_schema_fingerprint() {
use crate::rabin::Rabin;
use md5::Md5;
use sha2::Sha256;
let raw_schema = r#"
{
"type": "record",
"name": "test",
"fields": [
{"name": "a", "type": "long", "default": 42},
{"name": "b", "type": "string"},
{"name": "c", "type": "long", "logicalType": "timestamp-micros"}
]
}
"#;
let schema = Schema::parse_str(raw_schema).unwrap();
assert_eq!(
"abf662f831715ff78f88545a05a9262af75d6406b54e1a8a174ff1d2b75affc4",
format!("{}", schema.fingerprint::<Sha256>())
);
assert_eq!(
"6e21c350f71b1a34e9efe90970f1bc69",
format!("{}", schema.fingerprint::<Md5>())
);
assert_eq!(
"28cf0a67d9937bb3",
format!("{}", schema.fingerprint::<Rabin>())
)
} | rust_cleaned_test_functions.jsonl/26538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
761,
47918,
368,
341,
286,
990,
17717,
486,
81,
8892,
486,
49,
8892,
280,
286,
990,
10688,
20,
486,
72529,
20,
280,
286,
990,
15870,
17,
486,
62316,
17,
20,
21,
401,
286,
1077,
7112,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_serialize_proc_macro_failed() {
assert_expand(
"serde_derive",
"Serialize",
"1.0.104",
r##"
struct {}
"##,
r##"
SUBTREE $
IDENT compile_error 4294967295
PUNCH ! [alone] 4294967295
SUBTREE {} 4294967295
LITERAL "expected identifier" 4294967295
"##,
);
} | rust_cleaned_test_functions.jsonl/18426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
88686,
24436,
58810,
35060,
368,
341,
262,
2060,
67875,
1006,
286,
330,
47024,
35345,
533,
756,
286,
330,
15680,
756,
286,
330,
16,
13,
15,
13,
16,
15,
19,
756,
286,
435,
565,
698,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aead_decrypt() {
const ct: [u8; AES_BLOCKSIZE] = [
0x42, 0xc9, 0x9b, 0x8f, 0x21, 0xf7, 0xe2, 0xd3, 0xb2, 0x69, 0x83, 0xf8, 0x30, 0xf3,
0xbf, 0x39,
];
const tag: [u8; taglen] = [
0x10, 0x8f, 0x8e, 0x8f, 0x78, 0xdd, 0x83, 0xd0, 0xf, 0xe2, 0xa2, 0x79, 0xc3, 0xce,
0xb2, 0x43,
];
const assocdata: [u8; 16] = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
];
const taglen: usize = 16;
const assoclen: usize = assocdata.len();
let mut pt = [0u8; ct.len()];
const pt_exp: [u8; 16] = [
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41,
];
let key = [0u8; AES128_KEYSIZE];
let iv = [0u8; AES_BLOCKSIZE];
let alg = CString::new("gcm(aes)").expect("Failed to init CString");
let mut outbuf = [0u8; ct.len() + taglen + assoclen];
let assocdata_offset: usize = 0;
let ct_offset = assocdata_offset + assoclen;
let tag_offset = ct_offset + taglen;
outbuf[assocdata_offset..ct_offset].clone_from_slice(&assocdata);
outbuf[ct_offset..tag_offset].clone_from_slice(&ct);
outbuf[tag_offset..].clone_from_slice(&tag);
let mut ret: i64;
unsafe {
let mut handle =
Box::into_raw(Box::new(kcapi_handle { _unused: [0u8; 0] })) as *mut kcapi_handle;
ret = (kcapi_aead_init(&mut handle as *mut _, alg.as_ptr(), 0))
.try_into()
.expect("Failed to convert i32 to i64");
assert_eq!(ret, 0);
ret = (kcapi_aead_settaglen(handle, taglen as u32))
.try_into()
.expect("Failed to convert i32 to i64");
assert_eq!(ret, 0);
kcapi_aead_setassoclen(handle, assoclen as u64);
let mut newiv = &mut [0u8; 48] as *mut u8;
let mut newivlen: u32 = 0;
ret = (kcapi_pad_iv(
handle,
iv.as_ptr(),
iv.len() as u32,
&mut newiv as *mut _,
&mut newivlen as *mut u32,
))
.try_into()
.expect("Failed to convert i32 to i64");
assert_eq!(ret, 0);
let inbuflen =
kcapi_aead_inbuflen_dec(handle, ct.len() as u64, assoclen as u64, taglen as u64);
let outbuflen =
kcapi_aead_outbuflen_dec(handle, ct.len() as u64, assoclen as u64, taglen as u64);
ret = (kcapi_aead_setkey(handle, key.as_ptr(), key.len() as u32))
.try_into()
.expect("Failed to convert i32 to i64");
assert_eq!(ret, 0);
ret = kcapi_aead_decrypt(
handle,
outbuf.as_ptr(),
inbuflen,
newiv,
outbuf.as_mut_ptr(),
outbuflen,
KCAPI_ACCESS_HEURISTIC as i32,
);
assert_eq!(ret, (outbuf.len() - assoclen) as i64);
pt.clone_from_slice(&outbuf[assocdata.len()..assocdata.len() + ct.len()]);
}
assert_eq!(pt, pt_exp);
} | rust_cleaned_test_functions.jsonl/9069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1995
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
3149,
80764,
368,
341,
286,
733,
20251,
25,
508,
84,
23,
26,
38841,
18756,
20494,
60,
284,
2278,
310,
220,
15,
87,
19,
17,
11,
220,
15,
8148,
24,
11,
220,
15,
87,
24,
65,
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_update_parameters() {
let council = vec![accounts(0), accounts(1)];
let mut policy = default_policy(council);
assert_eq!(U128(10u128.pow(24)), policy.proposal_bond);
assert_eq!(
U64::from(1_000_000_000 * 60 * 60 * 24 * 7),
policy.proposal_period
);
assert_eq!(U128(10u128.pow(24)), policy.bounty_bond);
assert_eq!(
U64::from(1_000_000_000 * 60 * 60 * 24),
policy.bounty_forgiveness_period
);
let new_parameters = PolicyParameters {
proposal_bond: Some(U128(10u128.pow(26))),
proposal_period: None,
bounty_bond: None,
bounty_forgiveness_period: Some(U64::from(1_000_000_000 * 60 * 60 * 24 * 5)),
min_voting_time: None,
};
policy.update_parameters(&new_parameters);
assert_eq!(U128(10u128.pow(26)), policy.proposal_bond);
assert_eq!(
U64::from(1_000_000_000 * 60 * 60 * 24 * 7),
policy.proposal_period
);
assert_eq!(U128(10u128.pow(24)), policy.bounty_bond);
assert_eq!(
U64::from(1_000_000_000 * 60 * 60 * 24 * 5),
policy.bounty_forgiveness_period
);
} | rust_cleaned_test_functions.jsonl/132768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 678
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
18263,
368,
341,
286,
1077,
14833,
284,
7486,
20703,
26206,
7,
15,
701,
9618,
7,
16,
12587,
286,
1077,
5206,
4842,
284,
1638,
22773,
1337,
6690,
626,
286,
2060,
10714,
10297,
52,
16,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derive_seed() {
assert_eq!(Cli::derive_seed(false, None).unwrap(), 0);
assert_eq!(Cli::derive_seed(false, Some(5)).unwrap(), 5);
assert!(Cli::derive_seed(true, Some(5)).is_err());
assert!(Cli::derive_seed(true, None).is_ok());
} | rust_cleaned_test_functions.jsonl/799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
33809,
368,
341,
286,
2060,
10714,
10297,
87014,
486,
27098,
33809,
3576,
11,
2240,
568,
15454,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
87014,
486,
27098,
33809,
3576,
11,
4329,
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_new_derived_stake_account() {
let (bank, funding_keypair, rent) = create_bank(10_000_000);
let funding_pubkey = funding_keypair.pubkey();
let bank_client = BankClient::new(bank);
let fee_payer_keypair = create_account(&bank_client, &funding_keypair, 1);
let fee_payer_pubkey = fee_payer_keypair.pubkey();
let base_keypair = Keypair::new();
let base_pubkey = base_keypair.pubkey();
let lamports = rent + 1;
let stake_authority_pubkey = solana_sdk::pubkey::new_rand();
let withdraw_authority_pubkey = solana_sdk::pubkey::new_rand();
let message = new_stake_account(
&fee_payer_pubkey,
&funding_pubkey,
&base_pubkey,
lamports,
&stake_authority_pubkey,
&withdraw_authority_pubkey,
&Pubkey::default(),
0,
);
let signers = [&funding_keypair, &fee_payer_keypair, &base_keypair];
bank_client
.send_and_confirm_message(&signers, message)
.unwrap();
let account = get_account_at(&bank_client, &base_pubkey, 0);
assert_eq!(account.lamports, lamports);
let authorized = StakeState::authorized_from(&account).unwrap();
assert_eq!(authorized.staker, stake_authority_pubkey);
assert_eq!(authorized.withdrawer, withdraw_authority_pubkey);
} | rust_cleaned_test_functions.jsonl/21746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
35345,
2221,
1261,
726,
13500,
368,
341,
286,
1077,
320,
17033,
11,
10773,
3097,
12670,
11,
8016,
8,
284,
1855,
35733,
7,
16,
15,
62,
15,
15,
15,
62,
15,
15,
15,
317,
286,
1077,
10773,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_potential_update() {
let np = IsingNode::new(1.0);
let update = vec![1.0, -1.0];
assert_eq!(np.update_potentials(&update).bias, 0.0)
} | rust_cleaned_test_functions.jsonl/118924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57952,
2283,
8882,
368,
341,
286,
1077,
2595,
284,
2160,
287,
1955,
486,
931,
7,
16,
13,
15,
317,
286,
1077,
2647,
284,
7486,
20703,
16,
13,
15,
11,
481,
16,
13,
15,
935,
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 |
#[test]
fn test_decrypt_oaep_invalid_hash() {
let seed = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();
let mut rng = StdRng::seed_from_u64(seed.as_secs());
let priv_key = get_private_key();
let pub_key: RSAPublicKey = (&priv_key).into();
let ciphertext = pub_key
.encrypt(
&mut rng,
PaddingScheme::new_oaep::<Sha1>(),
"a_plain_text".as_bytes(),
)
.unwrap();
assert!(
priv_key
.decrypt_blinded(
&mut rng,
PaddingScheme::new_oaep_with_label::<Sha1, _>("label"),
&ciphertext,
)
.is_err(),
"decrypt should have failed on hash verification"
);
} | rust_cleaned_test_functions.jsonl/29041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
14179,
64,
747,
31433,
8950,
368,
341,
286,
1077,
10320,
284,
739,
1462,
486,
3328,
1005,
17021,
56262,
10407,
1462,
486,
99089,
2089,
69945,
568,
15454,
543,
286,
1077,
5206,
28422,
284,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_gga() {
let input = "092725.00,4717.11399,N,00833.91590,E,1,08,1.01,499.6,M,48.0,M,,";
let expected = Ok((
"",
GGAMessage {
time: Some(NaiveTime::from_hms_milli(09, 27, 25, 00)),
lat: Some(Degree(47.1711399)),
ns: NorthSouth::North,
lon: Some(Degree(8.3391590)),
ew: EastWest::East,
quality: Fix::AutonomousGNSSFix,
num_sv: Some(8),
hdop: Some(1.01),
alt: Some(Meter(499.6)),
sep: Some(Meter(48.)),
diff_age: None,
diff_station: None,
},
));
assert_eq!(expected, parse_gga(input));
} | rust_cleaned_test_functions.jsonl/52313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1889,
6743,
368,
341,
286,
1077,
1946,
284,
330,
15,
24,
17,
22,
17,
20,
13,
15,
15,
11,
19,
22,
16,
22,
13,
16,
16,
18,
24,
24,
22037,
11,
15,
15,
23,
18,
18,
13,
24,
16,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_upgrade_to_different_binary() {
local_test_e(|runtime| async move {
let mut canister = set_up_universal_canister(&runtime).await;
push_message_to_stable(&canister).await;
// We can read it back
assert_eq!(
try_to_read_message_from_stable(&canister).await,
Ok(MSG.to_vec())
);
// Upgrade to different binary
Wasm::from_wat(STABLE_MEMORY_READER_WAT)
.install(&runtime)
.with_mode(CanisterInstallMode::Upgrade)
.install(&mut canister, Vec::new())
.await
.unwrap();
// Read
assert_eq!(
canister
.query_("read_10_bytes_from_stable", bytes, Vec::new())
.await
.unwrap(),
&MSG[..10],
);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/116090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67794,
2346,
82741,
31761,
368,
341,
262,
2205,
4452,
2204,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
5206,
646,
1571,
284,
738,
8237,
4907,
33952,
27421,
1571,
2099,
22255,
568,
11421,
280,
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_double() {
assert_eq!(
Variant::VDouble(1.1).plus(Variant::VDouble(2.4)).unwrap(),
Variant::VDouble(3.5)
);
} | rust_cleaned_test_functions.jsonl/84534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
7378,
7,
16,
13,
16,
568,
7138,
12410,
15341,
486,
53,
7378,
7,
17,
13,
19,
4579,
15454,
3148,
503,
39292,
486,
53,
7378,
7,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_message_type() {
let ie = InformationElement::new(
CauseCode::RequestAccepted,
CauseSource::LocalNode,
false,
false,
None,
0).unwrap();
assert_eq!(ie.information_element_type() as u8, InformationElementType::Cause as u8)
} | rust_cleaned_test_functions.jsonl/615 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
1819,
368,
341,
286,
1077,
29858,
284,
8085,
1691,
486,
931,
1006,
310,
44346,
2078,
486,
1900,
65906,
345,
310,
44346,
3608,
486,
7319,
1955,
345,
310,
895,
345,
310,
895,
345,
310,
2240,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_de_enum_map() {
let a = 1;
let b = 2;
let c = 3;
let d = 4;
assert_tokens(
&DeEnum::Map {
a: a,
b: b,
c: c,
d: d,
},
&[
Token::StructVariant {
name: "DeEnum",
variant: "Map",
len: 4,
},
Token::Str("a"),
Token::I8(1),
Token::Str("b"),
Token::I32(2),
Token::Str("c"),
Token::I32(3),
Token::Str("d"),
Token::I32(4),
Token::StructVariantEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56422 | {
"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,
2259,
31054,
5376,
368,
341,
262,
1077,
264,
284,
220,
16,
280,
262,
1077,
293,
284,
220,
17,
280,
262,
1077,
272,
284,
220,
18,
280,
262,
1077,
294,
284,
220,
19,
401,
262,
2060,
28838,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser() {
for entry in fs::read_dir("tests/services").unwrap() {
if let Ok(entry) = entry {
GraphQLParser::parse(
Rule::service_document,
&fs::read_to_string(entry.path()).unwrap(),
)
.unwrap();
}
}
} | rust_cleaned_test_functions.jsonl/110299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
368,
341,
286,
369,
4343,
304,
8619,
486,
878,
4334,
445,
23841,
22258,
1827,
15454,
368,
341,
310,
421,
1077,
7622,
18238,
8,
284,
4343,
341,
394,
35087,
6570,
486,
6400,
1006,
503,
1810... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uuid() {
let mut server = Server::new(&Conf);
let mut prev = 0;
for _ in 0..1000 {
let c = server.next_uuid(true);
println!("{}, {}", prev, c);
assert!(c > prev);
prev = c;
}
} | rust_cleaned_test_functions.jsonl/6022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
368,
341,
286,
1077,
5206,
3538,
284,
8422,
486,
931,
2099,
15578,
317,
286,
1077,
5206,
7872,
284,
220,
15,
280,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
1077,
272... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_quat_elements() {
let x = 1.0;
let y = 2.0;
let z = 3.0;
let w = 4.0;
let a = Quat::from_xyzw(x, y, z, w);
assert!(a.x() == x);
assert!(a.y() == y);
assert!(a.z() == z);
assert!(a.w() == w);
} | rust_cleaned_test_functions.jsonl/73797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
266,
22801,
368,
341,
262,
1077,
856,
284,
220,
16,
13,
15,
280,
262,
1077,
379,
284,
220,
17,
13,
15,
280,
262,
1077,
1147,
284,
220,
18,
13,
15,
280,
262,
1077,
289,
284,
220,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_250() {
assert_eq!(
Solution::count_unival_subtrees(to_tree(vec![
Some(5),
Some(1),
Some(5),
Some(5),
Some(5),
None,
Some(5)
])),
4
);
assert_eq!(Solution::count_unival_subtrees(to_tree(vec![])), 0);
assert_eq!(
Solution::count_unival_subtrees(to_tree(vec![
Some(5),
Some(5),
Some(5),
Some(5),
Some(5),
None,
Some(5)
])),
6
);
} | rust_cleaned_test_functions.jsonl/14378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
20,
15,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
1830,
4907,
3936,
5228,
90412,
12186,
11663,
25592,
90515,
394,
4329,
7,
20,
1326,
394,
4329,
7,
16,
1326,
394,
4329,
7,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lockup_is_expired() {
let custodian = Pubkey::new_rand();
let signers = [custodian].iter().cloned().collect::<HashSet<_>>();
let lockup = Lockup {
epoch: 1,
unix_timestamp: 1,
custodian,
};
// neither time
assert_eq!(
lockup.is_in_force(
&Clock {
epoch: 0,
unix_timestamp: 0,
..Clock::default()
},
&HashSet::new()
),
true
);
// not timestamp
assert_eq!(
lockup.is_in_force(
&Clock {
epoch: 2,
unix_timestamp: 0,
..Clock::default()
},
&HashSet::new()
),
true
);
// not epoch
assert_eq!(
lockup.is_in_force(
&Clock {
epoch: 0,
unix_timestamp: 2,
..Clock::default()
},
&HashSet::new()
),
true
);
assert_eq!(
lockup.is_in_force(
&Clock {
epoch: 1,
unix_timestamp: 1,
..Clock::default()
},
&HashSet::new()
),
false
);
assert_eq!(
lockup.is_in_force(
&Clock {
epoch: 0,
unix_timestamp: 0,
..Clock::default()
},
&signers,
),
false,
);
} | rust_cleaned_test_functions.jsonl/39457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9818,
454,
6892,
80221,
368,
341,
286,
1077,
16564,
63849,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
1841,
388,
284,
508,
44414,
63849,
936,
2015,
1005,
564,
19684,
1005,
17384,
27638,
446... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sql_of_ast_1() -> Result<()> {
let query: Query = parse(
r###"
from employees
filter country == "USA"
group [title, country] (
aggregate [average salary]
)
sort title
take 20
"###,
)?;
let sql = resolve_and_translate(query)?;
assert_display_snapshot!(sql,
@r###"
SELECT
title,
country,
AVG(salary)
FROM
employees
WHERE
country = 'USA'
GROUP BY
title,
country
ORDER BY
title
LIMIT
20
"###
);
Ok(())
} | rust_cleaned_test_functions.jsonl/62554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
3575,
48019,
62,
16,
368,
1464,
5714,
71698,
341,
286,
1077,
3239,
25,
11361,
284,
4715,
1006,
310,
435,
14374,
698,
286,
504,
8256,
198,
286,
4051,
3146,
621,
330,
24347,
698,
286,
1874,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_year_week_without_mode() {
let cases = vec![
("1987-01-01", Some(198652i64)),
("2000-01-01", Some(199952i64)),
("0000-01-01", Some(1i64)),
("0000-00-00", None),
];
let mut ctx = EvalContext::default();
for (datetime, exp) in cases {
let datetime = DateTime::parse_datetime(&mut ctx, datetime, MAX_FSP, true).unwrap();
let output = RpnFnScalarEvaluator::new()
.push_param(datetime)
.evaluate(ScalarFuncSig::YearWeekWithoutMode)
.unwrap();
assert_eq!(output, exp);
}
} | rust_cleaned_test_functions.jsonl/36236 | {
"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,
14645,
31277,
39904,
7302,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
16,
24,
23,
22,
12,
15,
16,
12,
15,
16,
497,
4329,
7,
16,
24,
23,
21,
20,
17,
72,
21,
19,
6965,
310,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_integer() {
assert_eq!(
Variant::VLong(42).divide(Variant::VInteger(2)).unwrap(),
Variant::VInteger(21)
);
} | rust_cleaned_test_functions.jsonl/84632 | {
"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,
31725,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
6583,
7,
19,
17,
568,
59394,
12410,
15341,
486,
53,
3486,
7,
17,
4579,
15454,
3148,
503,
39292,
486,
53,
3486,
7,
17,
16,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_token_account_with_extensions() {
let mint_pubkey = SplTokenPubkey::new(&[2; 32]);
let owner_pubkey = SplTokenPubkey::new(&[3; 32]);
let account_base = Account {
mint: mint_pubkey,
owner: owner_pubkey,
amount: 42,
state: AccountState::Initialized,
is_native: COption::None,
close_authority: COption::Some(owner_pubkey),
delegate: COption::None,
delegated_amount: 0,
};
let account_size = ExtensionType::get_account_len::<Account>(&[
ExtensionType::ImmutableOwner,
ExtensionType::MemoTransfer,
]);
let mut account_data = vec![0; account_size];
let mut account_state =
StateWithExtensionsMut::<Account>::unpack_uninitialized(&mut account_data).unwrap();
account_state.base = account_base;
account_state.pack_base();
account_state.init_account_type().unwrap();
assert!(parse_token(&account_data, None).is_err());
assert_eq!(
parse_token(&account_data, Some(2)).unwrap(),
TokenAccountType::Account(UiTokenAccount {
mint: mint_pubkey.to_string(),
owner: owner_pubkey.to_string(),
token_amount: UiTokenAmount {
ui_amount: Some(0.42),
decimals: 2,
amount: "42".to_string(),
ui_amount_string: "0.42".to_string()
},
delegate: None,
state: UiAccountState::Initialized,
is_native: false,
rent_exempt_reserve: None,
delegated_amount: None,
close_authority: Some(owner_pubkey.to_string()),
extensions: vec![],
}),
);
let mut account_data = vec![0; account_size];
let mut account_state =
StateWithExtensionsMut::<Account>::unpack_uninitialized(&mut account_data).unwrap();
account_state.base = account_base;
account_state.pack_base();
account_state.init_account_type().unwrap();
account_state.init_extension::<ImmutableOwner>().unwrap();
let mut memo_transfer = account_state.init_extension::<MemoTransfer>().unwrap();
memo_transfer.require_incoming_transfer_memos = true.into();
assert!(parse_token(&account_data, None).is_err());
assert_eq!(
parse_token(&account_data, Some(2)).unwrap(),
TokenAccountType::Account(UiTokenAccount {
mint: mint_pubkey.to_string(),
owner: owner_pubkey.to_string(),
token_amount: UiTokenAmount {
ui_amount: Some(0.42),
decimals: 2,
amount: "42".to_string(),
ui_amount_string: "0.42".to_string()
},
delegate: None,
state: UiAccountState::Initialized,
is_native: false,
rent_exempt_reserve: None,
delegated_amount: None,
close_authority: Some(owner_pubkey.to_string()),
extensions: vec![
UiExtension::ImmutableOwner,
UiExtension::MemoTransfer(UiMemoTransfer {
require_incoming_transfer_memos: true,
}),
],
}),
);
} | rust_cleaned_test_functions.jsonl/103631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1814
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6458,
13500,
6615,
60498,
368,
341,
286,
1077,
28337,
34014,
792,
284,
51198,
3323,
29162,
792,
486,
931,
2099,
58,
17,
26,
220,
18,
17,
2558,
286,
1077,
6372,
34014,
792,
284,
51198,
332... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bool() {
assert_eq!(
read_bool(&cbor_int!(123)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(read_bool(&cbor_bool!(true)), Ok(true));
assert_eq!(read_bool(&cbor_bool!(false)), Ok(false));
assert_eq!(
read_bool(&cbor_text!("foo")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_bool(&cbor_bytes_lit!(b"bar")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_bool(&cbor_array![]),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_bool(&cbor_map! {}),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
} | rust_cleaned_test_functions.jsonl/51441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
22159,
368,
341,
286,
2060,
10714,
33673,
310,
1349,
22159,
2099,
7221,
269,
4042,
10297,
16,
17,
18,
6965,
310,
15495,
7,
1162,
2537,
17,
9875,
48933,
868,
6735,
80002,
4189,
340,
286,
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,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_trait() {
use std::thread;
use std::sync::mpsc::channel;
let (tx, rx) = channel();
thread::spawn(move|| {
let session = Builder::new("Noise_NN_25519_ChaChaPoly_BLAKE2s".parse().unwrap())
.build_initiator().unwrap();
tx.send(session).unwrap();
});
let _session = rx.recv().expect("failed to receive noise session");
} | rust_cleaned_test_functions.jsonl/27116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
78491,
368,
341,
262,
990,
1460,
486,
4528,
280,
262,
990,
1460,
486,
12996,
486,
1307,
2388,
486,
10119,
5210,
262,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
543,
262,
4516,
486,
46087,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_path_type_match() {
assert_eq! {
rune! { bool =>
enum Custom { A, B(a) }
pub fn main() {
match Custom::A { Custom::A => true, _ => false }
}
},
true,
};
assert_eq! {
rune! { bool =>
enum Custom { A, B(a) }
pub fn main() {
match Custom::B(0) { Custom::A => true, _ => false }
}
},
false,
};
assert_eq! {
rune! { bool =>
enum Custom { A, B(a) }
pub fn main() {
match Custom::B(0) { Custom::B(0) => true, _ => false }
}
},
true,
};
assert_eq! {
rune! { bool =>
enum Custom { A, B { a } }
pub fn main() {
match (Custom::B { a: 0 }) { Custom::B { a: 0 } => true, _ => false }
}
},
true,
};
assert_eq! {
rune! { bool =>
enum Custom { A, B { a } }
fn test(a) { a == 0 }
pub fn main() {
match (Custom::B { a: 0 }) { Custom::B { a } if test(a) => true, _ => false }
}
},
true,
};
} | rust_cleaned_test_functions.jsonl/34513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 724
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
1819,
10708,
368,
341,
262,
2060,
10714,
0,
341,
286,
63499,
0,
314,
1807,
6274,
310,
7618,
8406,
314,
362,
11,
425,
2877,
8,
456,
310,
6675,
5168,
1887,
368,
341,
394,
2432,
8406,
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... | 2 |
#[test]
fn test_ban() {
let node1 = net_service_start("/test/1".to_string());
let node2 = net_service_start("/test/1".to_string());
node1.dial(
&node2,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
wait_connect_state(&node1, 1);
wait_connect_state(&node2, 1);
node1.ban_all();
wait_connect_state(&node1, 0);
wait_connect_state(&node2, 0);
node1.dial(
&node2,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
node1.dial(
&node2,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
node1.dial(
&node2,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
node1.dial(
&node2,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
wait_connect_state(&node1, 0);
wait_connect_state(&node2, 0);
} | rust_cleaned_test_functions.jsonl/71180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
276,
368,
341,
262,
1077,
2436,
16,
284,
4179,
12267,
4906,
4283,
1944,
14,
16,
3263,
983,
3904,
1423,
262,
1077,
2436,
17,
284,
4179,
12267,
4906,
4283,
1944,
14,
16,
3263,
983,
3904,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect() {
let empty = String::from_str("");
let s: String = empty.as_slice().chars().collect();
assert_eq!(empty, s);
let data = String::from_str("ประเทศไทย中");
let s: String = data.as_slice().chars().collect();
assert_eq!(data, s);
} | rust_cleaned_test_functions.jsonl/56794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
368,
341,
286,
1077,
4287,
284,
923,
486,
1499,
2895,
13056,
286,
1077,
274,
25,
923,
284,
4287,
5357,
26488,
1005,
19255,
1005,
17384,
543,
286,
2060,
10714,
10297,
3194,
11,
274,
317,
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_gossip_vote_doesnt_affect_fork_choice() {
let (
VoteSimulator {
bank_forks,
mut heaviest_subtree_fork_choice,
mut latest_validator_votes_for_frozen_banks,
vote_pubkeys,
..
},
_,
) = setup_default_forks(1, None::<GenerateVotes>);
let vote_pubkey = vote_pubkeys[0];
let mut unfrozen_gossip_verified_vote_hashes = UnfrozenGossipVerifiedVoteHashes::default();
let (gossip_verified_vote_hash_sender, gossip_verified_vote_hash_receiver) = unbounded();
// Best slot is 4
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 4);
// Cast a vote for slot 3 on one fork
let vote_slot = 3;
let vote_bank = bank_forks.read().unwrap().get(vote_slot).unwrap().clone();
gossip_verified_vote_hash_sender
.send((vote_pubkey, vote_slot, vote_bank.hash()))
.expect("Send should succeed");
ReplayStage::process_gossip_verified_vote_hashes(
&gossip_verified_vote_hash_receiver,
&mut unfrozen_gossip_verified_vote_hashes,
&heaviest_subtree_fork_choice,
&mut latest_validator_votes_for_frozen_banks,
);
// Pick the best fork. Gossip votes shouldn't affect fork choice
heaviest_subtree_fork_choice.compute_bank_stats(
&vote_bank,
&Tower::default(),
&mut latest_validator_votes_for_frozen_banks,
);
// Best slot is still 4
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 4);
} | rust_cleaned_test_functions.jsonl/25834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 813
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
41473,
54360,
96374,
406,
4306,
1705,
761,
669,
31936,
368,
341,
286,
1077,
2399,
310,
34034,
14027,
10511,
341,
394,
6073,
761,
73302,
345,
394,
5206,
566,
98362,
5228,
9344,
761,
669,
3193... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lcdc_status_with_mode() {
use crate::gpu::GpuMode::*;
let lcdc_status = 0b_0110_1011;
assert_eq!(
LcdControllerStatus::with_mode(lcdc_status, H_Blank),
0b_0110_1000
);
assert_eq!(
LcdControllerStatus::with_mode(lcdc_status, V_Blank),
0b_0110_1001
);
assert_eq!(
LcdControllerStatus::with_mode(lcdc_status, OAM_Read),
0b_0110_1010
);
assert_eq!(
LcdControllerStatus::with_mode(lcdc_status, VRAM_Read),
0b_0110_1011
);
} | rust_cleaned_test_functions.jsonl/59663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
72026,
4773,
6615,
7302,
368,
341,
286,
990,
17717,
486,
42594,
486,
38,
5584,
3636,
56162,
286,
1077,
38644,
66,
4773,
284,
220,
15,
65,
62,
15,
16,
16,
15,
62,
16,
15,
16,
16,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_connection() {
let _setup = SetupMocks::init();
let handle = create_connection("test_create_connection").unwrap();
assert_eq!(get_pw_did(handle).unwrap(), constants::DID);
assert_eq!(get_pw_verkey(handle).unwrap(), constants::VERKEY);
assert_eq!(get_state(handle), VcxStateType::VcxStateInitialized as u32);
connect(handle, Some("{}".to_string())).unwrap();
AgencyMock::set_next_response(GET_MESSAGES_INVITE_ACCEPTED_RESPONSE.to_vec());
update_state(handle, None).unwrap();
assert_eq!(get_state(handle), VcxStateType::VcxStateAccepted as u32);
AgencyMock::set_next_response(DELETE_CONNECTION_RESPONSE.to_vec());
assert_eq!(delete_connection(handle).unwrap(), 0);
// This errors b/c we release handle in delete connection
assert!(release(handle).is_err());
} | rust_cleaned_test_functions.jsonl/20872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
15866,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
1855,
15866,
445,
1944,
8657,
15866,
1827,
15454,
1428,
286,
2060,
10714,
10297,
455,
60181,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jle_imm() {
test_interpreter_and_jit_asm!(
"
mov32 r0, 0
mov32 r1, 5
jle r1, 4, +1
jle r1, 6, +1
exit
jle r1, 5, +1
exit
mov32 r0, 1
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1 } },
7
);
} | rust_cleaned_test_functions.jsonl/59012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
273,
71370,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
15,
11,
220,
15,
198,
286,
1974,
18,
17,
435,
16,
11,
220,
20,
198,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unify_roots() {
assert_eq!(unify_roots(vec![]).len(), 0);
assert_eq!(
unify_roots(vec!["Apps".into(), "Libraries".into()]),
&[PathBuf::from("Apps"), PathBuf::from("Libraries")]
);
assert_eq!(
unify_roots(vec!["Apps".into(), "Apps/Foo".into()]),
&[PathBuf::from("Apps")]
);
assert_eq!(
unify_roots(vec!["Apps/Foo".into(), "Apps".into()]),
&[PathBuf::from("Apps")]
);
assert_eq!(
unify_roots(vec!["Foo".into(), "Foo2".into()]),
&[PathBuf::from("Foo"), PathBuf::from("Foo2"),]
);
} | rust_cleaned_test_functions.jsonl/7371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1437,
26608,
2412,
368,
341,
286,
2060,
10714,
10297,
359,
1437,
26608,
2412,
25592,
0,
1294,
568,
2892,
1507,
220,
15,
317,
286,
2060,
10714,
33673,
310,
85340,
26608,
2412,
25592,
0,
1183,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_step_ignore_config() {
let l = default_logger();
// a raft that cannot make progress
let mut r = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
r.become_candidate();
r.become_leader();
assert!(!r.has_pending_conf());
let mut m = new_message(1, 1, MessageType::MsgPropose, 0);
let mut e = Entry::default();
e.set_entry_type(EntryType::EntryConfChange);
m.mut_entries().push(e);
assert!(!r.has_pending_conf());
r.step(m.clone()).expect("");
assert!(r.has_pending_conf());
let index = r.raft_log.last_index();
let pending_conf_index = r.pending_conf_index;
r.step(m).expect("");
let mut we = empty_entry(1, 3);
we.set_entry_type(EntryType::EntryNormal);
let wents = vec![we];
let entries = r.raft_log.entries(index + 1, None).expect("");
assert_eq!(entries, wents);
assert_eq!(r.pending_conf_index, pending_conf_index);
} | rust_cleaned_test_functions.jsonl/19146 | {
"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,
11946,
58493,
5332,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
442,
264,
52455,
429,
4157,
1281,
5098,
198,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spawn() {
let mut world = World::new(5);
world.set(1, 1, true);
assert_eq!(world.is_alive(1, 1), true);
} | rust_cleaned_test_functions.jsonl/23841 | {
"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,
76026,
368,
341,
286,
1077,
5206,
1879,
284,
4337,
486,
931,
7,
20,
317,
286,
1879,
980,
7,
16,
11,
220,
16,
11,
830,
317,
286,
2060,
10714,
10297,
14615,
2079,
58850,
7,
16,
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 |
#[test]
fn test_invalid_database_type() {
let buffer = std::fs::read("./testdata/GeoIP2-Anonymous-IP-Test.mmdb").unwrap();
let reader = Reader::<Country>::from_bytes(&buffer);
if let Err(Error::InvalidDatabaseType(msg)) = reader {
assert_eq!(msg, "GeoIP2-Anonymous-IP");
return;
}
assert!(false);
} | rust_cleaned_test_functions.jsonl/37379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
27341,
1819,
368,
341,
286,
1077,
4147,
284,
1460,
486,
3848,
486,
878,
13988,
92425,
14,
37344,
3298,
17,
12,
32684,
12,
3298,
12,
2271,
37008,
1999,
1827,
15454,
543,
286,
1077,
6604,
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_numeric_applicability() -> TestResult {
let mut p = Polar::new();
let eps = f64::EPSILON;
let nan1 = f64::NAN;
let nan2 = f64::from_bits(f64::NAN.to_bits() | 1);
assert!(eps.is_normal() && nan1.is_nan() && nan2.is_nan());
p.register_constant(sym!("eps"), term!(eps));
p.register_constant(sym!("nan1"), term!(nan1));
p.register_constant(sym!("nan2"), term!(nan2));
p.load_str(
r#"f(0);
f(1);
f(9007199254740991); # (1 << 53) - 1
f(9007199254740992); # (1 << 53)
f(9223372036854775807); # i64::MAX
f(-9223372036854775807); # i64::MIN + 1
f(9223372036854776000.0); # i64::MAX as f64
f(nan1); # NaN"#,
)?;
qeval(&mut p, "f(0)");
qeval(&mut p, "f(0.0)");
qnull(&mut p, "f(eps)");
qeval(&mut p, "f(1)");
qeval(&mut p, "f(1.0)");
qnull(&mut p, "f(1.0000000000000002)");
qnull(&mut p, "f(9007199254740990)");
qnull(&mut p, "f(9007199254740990.0)");
qeval(&mut p, "f(9007199254740991)");
qeval(&mut p, "f(9007199254740991.0)");
qeval(&mut p, "f(9007199254740992)");
qeval(&mut p, "f(9007199254740992.0)");
qeval(&mut p, "f(9223372036854775807)");
qeval(&mut p, "f(-9223372036854775807)");
qeval(&mut p, "f(9223372036854776000.0)");
qnull(&mut p, "f(nan1)");
qnull(&mut p, "f(nan2)");
Ok(())
} | rust_cleaned_test_functions.jsonl/97661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 769
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29418,
8191,
415,
2897,
368,
1464,
3393,
2077,
341,
262,
1077,
5206,
281,
284,
55896,
486,
931,
543,
262,
1077,
17986,
284,
282,
21,
19,
486,
45177,
55016,
280,
262,
1077,
20021,
16,
284,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_new() {
let mut context = get_context(accounts(0));
testing_env!(context.build());
let contract = Contract::new(accounts(0).into(), 10);
testing_env!(context.is_view(true).build());
assert_eq!(contract.hero_id, None);
assert_eq!(contract.loot_box_id, None);
} | rust_cleaned_test_functions.jsonl/118753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
15,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5116,
284,
19185,
486,
931,
91868,
7,
15,
568,
18122,
1507,
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_escape_a() {
test!(
MyE,
"0123456789",
"zeroonetwothreefourfivesixseveneightnine"
);
test_ptr!("0123456789", "zeroonetwothreefourfivesixseveneightnine");
} | rust_cleaned_test_functions.jsonl/22946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21832,
4306,
368,
341,
310,
1273,
33673,
394,
3017,
36,
345,
394,
330,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
756,
394,
330,
14154,
68686,
1126,
27856,
34024,
69,
1886,
941,
80185,
67532,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_equality() {
let json = r#"
{
"fields": [
{
"name": "c1",
"type": {"name": "int", "isSigned": true, "bitWidth": 32},
"nullable": true,
"children": []
},
{
"name": "c2",
"type": {"name": "floatingpoint", "precision": "DOUBLE"},
"nullable": true,
"children": []
},
{
"name": "c3",
"type": {"name": "utf8"},
"nullable": true,
"children": []
},
{
"name": "c4",
"type": {
"name": "list"
},
"nullable": true,
"children": [
{
"name": "custom_item",
"type": {
"name": "int",
"isSigned": true,
"bitWidth": 32
},
"nullable": false,
"children": []
}
]
}
]
}"#;
let json_schema: ArrowJsonSchema = serde_json::from_str(json).unwrap();
let schema = Schema::new(vec![
Field::new("c1", DataType::Int32, true),
Field::new("c2", DataType::Float64, true),
Field::new("c3", DataType::Utf8, true),
Field::new(
"c4",
DataType::List(Box::new(Field::new(
"custom_item",
DataType::Int32,
false,
))),
true,
),
]);
assert!(json_schema.equals_schema(&schema));
} | rust_cleaned_test_functions.jsonl/25668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
2204,
10473,
368,
341,
286,
1077,
2951,
284,
435,
2,
698,
286,
341,
310,
330,
9007,
788,
2278,
394,
341,
503,
330,
606,
788,
330,
66,
16,
756,
503,
330,
1313,
788,
5212,
606,
788,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_count_digits() {
assert_eq!(1, count_digits(0));
assert_eq!(1, count_digits(1));
assert_eq!(1, count_digits(9));
assert_eq!(2, count_digits(10));
assert_eq!(2, count_digits(11));
assert_eq!(2, count_digits(99));
assert_eq!(3, count_digits(100));
assert_eq!(3, count_digits(101));
assert_eq!(3, count_digits(999));
assert_eq!(4, count_digits(1000));
assert_eq!(4, count_digits(1001));
} | rust_cleaned_test_functions.jsonl/46342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
41432,
368,
341,
262,
2060,
10714,
10297,
16,
11,
1760,
41432,
7,
15,
1106,
262,
2060,
10714,
10297,
16,
11,
1760,
41432,
7,
16,
1106,
262,
2060,
10714,
10297,
16,
11,
1760,
41432,
7,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_common_handle_index_latin1_bin() {
use tidb_query_datatype::builder::FieldTypeBuilder;
let mut idx_exe = IndexScanExecutorImpl {
context: Default::default(),
schema: vec![
FieldTypeTp::Long.into(),
FieldTypeBuilder::new()
.tp(FieldTypeTp::String)
.collation(Collation::Latin1Bin)
.into(),
],
columns_id_without_handle: vec![2],
columns_id_for_common_handle: vec![1],
decode_handle_strategy: DecodeHandleStrategy::DecodeCommonHandle,
pid_column_cnt: 0,
index_version: -1,
};
let mut columns = idx_exe.build_column_vec(1);
idx_exe
.process_kv_pair(
&[
0x74, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x37, 0x5f, 0x69, 0x80, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x2, 0x3, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1,
0x6a, 0x6f, 0x76, 0x69, 0x61, 0x6c, 0x65, 0x64, 0xff, 0x69, 0x73, 0x6f, 0x6e,
0x0, 0x0, 0x0, 0x0, 0xfb,
],
&[
0x0, 0x7d, 0x1, 0x80, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x1, 0x0, 0x0,
],
&mut columns,
)
.unwrap();
assert_eq!(
columns[1].raw().last().unwrap().read_datum().unwrap(),
Datum::Bytes("jovialedison".as_bytes().to_vec())
);
} | rust_cleaned_test_functions.jsonl/12239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21107,
10630,
3560,
907,
14768,
16,
21816,
368,
341,
286,
990,
13112,
65,
5738,
15353,
20157,
486,
17850,
486,
63733,
3297,
401,
16885,
286,
1077,
5206,
7187,
76074,
284,
8008,
26570,
25255,
9673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_send_message_bad_response() {
init!("true");
let result = SendMessageBuilder::create().parse_response(::utils::constants::UPDATE_PROFILE_RESPONSE.to_vec());
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/75277 | {
"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,
21039,
13565,
6462,
34199,
9655,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
1102,
284,
62292,
3297,
486,
3182,
1005,
6400,
9655,
38732,
6031,
486,
15763,
486,
9239,
34533,
35901,
2389,
13251,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_top_level_events() {
let data = [
0x82, 0x2d, 0x01, 0x00, 0x4b, 0x28, 0x4d, 0x28, 0x01, 0x00, 0x4c, 0x28,
];
assert_eq!(
parse(&data[..]).unwrap().token_tape,
vec![
BinaryToken::Token(0x2d82),
BinaryToken::Token(0x284b),
BinaryToken::Token(0x284d),
BinaryToken::Token(0x284c),
]
);
} | rust_cleaned_test_functions.jsonl/109411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
10426,
8274,
19691,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
23,
17,
11,
220,
15,
87,
17,
67,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
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_contains() {
let data = vec![
Some(vec![Some(1), Some(2), None]),
Some(vec![Some(1), Some(2), None]),
Some(vec![Some(1), Some(2), None]),
None,
];
let values = Int32Array::from(&[Some(1), Some(3), None, Some(1)]);
let expected = BooleanArray::from(vec![
Some(true),
Some(false),
None,
None
]);
let mut a = MutableListArray::<i32, MutablePrimitiveArray<i32>>::new();
a.try_extend(data).unwrap();
let a: ListArray<i32> = a.into();
let result = contains(&a, &values).unwrap();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/96433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
4329,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
2240,
17036,
286,
4329,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
2240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_force_notify_ignored() {
let mut test = new_test();
test.handler.event = "push".into();
test.handler.data.ref_name = Some("refs/heads/some-branch".into());
test.handler.data.before = Some("abcdef0000".into());
test.handler.data.after = Some("1111abcdef".into());
test.handler.data.forced = Some(true);
// change the repo to an unconfigured one
test.handler.data.repository = Repo::parse(
&format!("http://{}/some-other-user/some-other-repo", test.github.github_host()),
).unwrap();
let mut pr = some_pr().unwrap();
pr.head.sha = "1111abcdef".into();
test.github.mock_get_pull_requests(
"some-other-user",
"some-other-repo",
Some("open"),
None,
Ok(vec![pr]),
);
test.github.mock_get_pull_request_commits(
"some-other-user",
"some-other-repo",
32,
Ok(some_commits()),
);
let msg = "joe.sender pushed 0 commit(s) to branch some-branch";
let attach = vec![
SlackAttachmentBuilder::new("")
.title("Pull Request #32: \"The PR\"")
.title_link("http://the-pr")
.build(),
];
test.slack.expect(vec![
slack::req("@the.pr.owner", msg, attach.clone()),
slack::req("@assign1", msg, attach.clone()),
slack::req("@bob.author", msg, attach.clone()),
slack::req("@joe.reviewer", msg, attach.clone()),
]);
// Note: no expectations here.
let resp = test.handler.handle_event().unwrap();
assert_eq!((StatusCode::OK, "push".into()), resp);
} | rust_cleaned_test_functions.jsonl/89658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 716
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
40739,
36654,
62,
58471,
368,
341,
262,
1077,
5206,
1273,
284,
501,
4452,
1428,
262,
1273,
31171,
5773,
284,
330,
9077,
3263,
18122,
543,
262,
1273,
31171,
2196,
11053,
1269,
284,
4329,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_first() {
let mut it = build_iterator_for_test();
it.seek(Seek::First).unwrap();
assert!(it.is_valid());
assert_eq!(&full_key(b"k01", 1)[..], it.key());
assert_eq!(b"v01", it.value());
} | rust_cleaned_test_functions.jsonl/5444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
12978,
368,
341,
286,
1077,
5206,
432,
284,
1936,
13491,
5478,
4452,
543,
286,
432,
38179,
7,
39350,
486,
5338,
568,
15454,
543,
286,
2060,
10297,
275,
2079,
8337,
1423,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_opts() {
fn has_one(_req: &mut Request, path: &mut PathState) -> bool {
path.url_path.contains("one")
}
fn has_two(_req: &mut Request, path: &mut PathState) -> bool {
path.url_path.contains("two")
}
let one_filter = FnFilter(has_one);
let two_filter = FnFilter(has_two);
let mut req = Request::default();
let mut path_state = PathState::new("http://localhost/one");
assert!(one_filter.filter(&mut req, &mut path_state));
assert!(!two_filter.filter(&mut req, &mut path_state));
assert!(one_filter.or_else(has_two).filter(&mut req, &mut path_state));
assert!(one_filter.or(two_filter).filter(&mut req, &mut path_state));
assert!(!one_filter.and_then(has_two).filter(&mut req, &mut path_state));
assert!(!one_filter.and(two_filter).filter(&mut req, &mut path_state));
let mut path_state = PathState::new("http://localhost/one/two");
assert!(one_filter.filter(&mut req, &mut path_state));
assert!(two_filter.filter(&mut req, &mut path_state));
assert!(one_filter.or_else(has_two).filter(&mut req, &mut path_state));
assert!(one_filter.or(two_filter).filter(&mut req, &mut path_state));
assert!(one_filter.and_then(has_two).filter(&mut req, &mut path_state));
assert!(one_filter.and(two_filter).filter(&mut req, &mut path_state));
let mut path_state = PathState::new("http://localhost/two");
assert!(!one_filter.filter(&mut req, &mut path_state));
assert!(two_filter.filter(&mut req, &mut path_state));
assert!(one_filter.or_else(has_two).filter(&mut req, &mut path_state));
assert!(one_filter.or(two_filter).filter(&mut req, &mut path_state));
assert!(!one_filter.and_then(has_two).filter(&mut req, &mut path_state));
assert!(!one_filter.and(two_filter).filter(&mut req, &mut path_state));
} | rust_cleaned_test_functions.jsonl/37064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32354,
368,
341,
286,
5168,
702,
11667,
2490,
2958,
25,
609,
6984,
6145,
11,
1815,
25,
609,
6984,
7933,
1397,
8,
1464,
1807,
341,
310,
1815,
7315,
2638,
8786,
445,
603,
1138,
286,
456,
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_into_vec() {
let h = hlist![1, 2, 3, 4, 5];
let as_vec: Vec<_> = h.into();
assert_eq!(as_vec, vec![1, 2, 3, 4, 5])
} | rust_cleaned_test_functions.jsonl/24769 | {
"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,
45514,
13251,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
438,
13251,
25,
11312,
32399,
29,
284,
305,
39860,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_everything() -> Result<(), String>
{
let parser = Parser::new_from_default()?;
let mut interpreter = Interpreter::new(parser);
interpreter.insert_default_bindings();
let mut program = String::new();
File::open("examples/general.txt").or_else(|_| Err("failed to open program".to_string()))?.read_to_string(&mut program).or_else(|_| Err("failed to read program into memory".to_string()))?;
interpreter.restart_into_string(&program)?;
File::create("bytecode_dump_main.bin").unwrap().write_all(&interpreter.dump_code()).unwrap();
interpreter.step_until_error_or_exit().ok();
if let Some(err) = &interpreter.last_error
{
panic!("{}", err);
}
// test clearing interpreter state and restarting
Ok(())
} | rust_cleaned_test_functions.jsonl/84668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64048,
1596,
368,
1464,
5714,
68843,
923,
397,
262,
341,
286,
1077,
6729,
284,
21102,
486,
931,
5673,
9993,
94136,
286,
1077,
5206,
39299,
284,
82493,
486,
931,
35335,
317,
286,
39299,
7030,
9993,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get() {
let dir = TempDir::new("test").unwrap();
let env = Environment::new().open(dir.path()).unwrap();
let db = env.open_db(None).unwrap();
let mut txn = env.begin_rw_txn().unwrap();
txn.put(db, b"key1", b"val1", WriteFlags::empty()).unwrap();
txn.put(db, b"key2", b"val2", WriteFlags::empty()).unwrap();
txn.put(db, b"key3", b"val3", WriteFlags::empty()).unwrap();
let cursor = txn.open_ro_cursor(db).unwrap();
assert_eq!((Some(&b"key1"[..]), &b"val1"[..]), cursor.get(None, None, MDB_FIRST).unwrap());
assert_eq!((Some(&b"key1"[..]), &b"val1"[..]), cursor.get(None, None, MDB_GET_CURRENT).unwrap());
assert_eq!((Some(&b"key2"[..]), &b"val2"[..]), cursor.get(None, None, MDB_NEXT).unwrap());
assert_eq!((Some(&b"key1"[..]), &b"val1"[..]), cursor.get(None, None, MDB_PREV).unwrap());
assert_eq!((Some(&b"key3"[..]), &b"val3"[..]), cursor.get(None, None, MDB_LAST).unwrap());
assert_eq!((None, &b"val2"[..]), cursor.get(Some(b"key2"), None, MDB_SET).unwrap());
assert_eq!((Some(&b"key3"[..]), &b"val3"[..]), cursor.get(Some(&b"key3"[..]), None, MDB_SET_KEY).unwrap());
assert_eq!((Some(&b"key3"[..]), &b"val3"[..]), cursor.get(Some(&b"key2\0"[..]), None, MDB_SET_RANGE).unwrap());
} | rust_cleaned_test_functions.jsonl/15132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 637
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
1944,
1827,
15454,
543,
286,
1077,
6105,
284,
11586,
486,
931,
1005,
2508,
14161,
3875,
6011,
15454,
543,
286,
1077,
2927,
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_submission_part1() {
let input = input_to_grid(SUBMISSION_PATH);
let res = part1(input);
assert_eq!(res, 475);
} | rust_cleaned_test_functions.jsonl/84159 | {
"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,
75866,
10495,
16,
368,
341,
286,
1077,
1946,
284,
1946,
2346,
15604,
3759,
4493,
25245,
7944,
317,
286,
1077,
592,
284,
949,
16,
5384,
317,
286,
2060,
10714,
10297,
416,
11,
220,
19,
22,
20,
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 |
#[test]
fn test_matches() {
assert!(matches(0b1100_1010, 4, 0b0110u32, 0b0100u32));
} | rust_cleaned_test_functions.jsonl/50745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 59
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38344,
368,
341,
286,
2060,
10297,
19914,
7,
15,
65,
16,
16,
15,
15,
62,
16,
15,
16,
15,
11,
220,
19,
11,
220,
15,
65,
15,
16,
16,
15,
84,
18,
17,
11,
220,
15,
65,
15,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_reorder_symbols() {
let mut cfg: Cfg = Cfg::new();
let (start, a, x, b, c, y) = cfg.sym();
cfg.rule(start).rhs([a, x, b, c, y]).rhs([c])
.rule(b).rhs([a, a]).rhs([a, c])
.rule(c).rhs([x]).rhs([y])
.rule(a).rhs([]);
let ordering = &[
/* start => */ 1,
/* a => */ 2,
/* x => */ 5,
/* b => */ 3,
/* c => */ 4,
/* y => */ 6,
];
Remap::new(&mut cfg).reorder_symbols(|left, right| {
ordering[left.usize()].cmp(&ordering[right.usize()])
});
{
let mut equivalent: Cfg = Cfg::new();
let (start, a, b, c, x, y) = equivalent.sym();
equivalent
.rule(a).rhs([])
.rule(start).rhs([a, x, b, c, y]).rhs([c])
.rule(b).rhs([a, a]).rhs([a, c])
.rule(c).rhs([x]).rhs([y]);
support::assert_eq_rules(equivalent.rules(), cfg.rules());
};
assert!(Usefulness::new(&mut cfg).reachable([start]).all_useful());
} | rust_cleaned_test_functions.jsonl/52972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1358,
55752,
368,
341,
262,
1077,
5206,
13286,
25,
356,
4817,
284,
356,
4817,
486,
931,
543,
1066,
262,
1077,
320,
2468,
11,
264,
11,
856,
11,
293,
11,
272,
11,
379,
8,
284,
13286,
509... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_has_decrease() {
let input = "11".chars().collect();
assert_eq!(has_decrease(&input), false);
let input = "12".chars().collect();
assert_eq!(has_decrease(&input), false);
let input = "21".chars().collect();
assert_eq!(has_decrease(&input), true);
} | rust_cleaned_test_functions.jsonl/132779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
2259,
19947,
368,
341,
262,
1077,
1946,
284,
330,
16,
16,
3263,
19255,
1005,
17384,
543,
262,
2060,
10714,
10297,
4648,
2259,
19947,
2099,
1355,
701,
895,
317,
262,
1077,
1946,
284,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_file_with_dependencies() {
let input = r#"file "keyboard.xml" [exists -> dep1 , contains "plug" -> dep2 ]"#
.chars()
.collect::<Vec<_>>();
let r = command_file().parse(&input);
assert_eq!(
r,
Ok(Action::File(
"keyboard.xml".into(),
Some(vec![
DependencyCheck::Exists("dep1".into()),
DependencyCheck::Contains("plug".into(), "dep2".into())
]),
))
)
} | rust_cleaned_test_functions.jsonl/50003 | {
"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,
21039,
2458,
6615,
71841,
368,
341,
286,
1077,
1946,
284,
435,
55543,
1192,
330,
41713,
9028,
1,
508,
16304,
1464,
2170,
16,
1154,
5610,
330,
47474,
1,
1464,
2170,
17,
2279,
1,
4956,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_out_of_bounds() {
assert_eq!("foobar".substring(0, 10), "foobar");
assert_eq!("foobar".substring(6, 10), "");
} | rust_cleaned_test_functions.jsonl/83635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
3575,
36878,
368,
341,
286,
2060,
10714,
17223,
50267,
3263,
33874,
7,
15,
11,
220,
16,
15,
701,
330,
50267,
797,
286,
2060,
10714,
17223,
50267,
3263,
33874,
7,
21,
11,
220,
16,
15,
701... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_scanutil() {
assert_eq!(Some((-5, 2)), "-5zxc".scan_num::<i32>());
assert_eq!(Some((51, 2)), "51zxc".scan_num::<u32>());
assert_eq!(Some((192, 4)), "+192zxc".scan_num::<i32>());
assert_eq!(None, "z192zxc".scan_num::<i32>());
assert_eq!(Some(('a', 3)), "141zxc".scan_char(8));
assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8));
assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16));
assert_eq!(None, "z2qzxc".scan_char(8));
} | rust_cleaned_test_functions.jsonl/36714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
1314,
368,
341,
262,
2060,
10714,
10297,
8373,
54934,
20,
11,
220,
17,
5731,
6523,
20,
89,
8148,
3263,
16405,
4273,
27638,
72,
18,
17,
32872,
262,
2060,
10714,
10297,
8373,
1188,
20,
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_issue10_2() {
let text = b"TGTGTGTG$";
let pos = suffix_array(text);
assert_eq!(pos, [8, 7, 5, 3, 1, 6, 4, 2, 0]);
} | rust_cleaned_test_functions.jsonl/71444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
16,
15,
62,
17,
368,
341,
286,
1077,
1467,
284,
293,
95029,
25388,
25388,
25388,
38,
3,
876,
286,
1077,
1133,
284,
20525,
3858,
7235,
317,
286,
2060,
10714,
10297,
966,
11,
508,
23,
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_eval_complex() {
let expr =
Expr::Times(Expr::Plus(integer_expr(1).boxed(), integer_expr(2).boxed()).boxed(),
Expr::Minus(integer_expr(5).boxed(), float_expr(3.0).boxed()).boxed());
let res = eval_expr(&expr, &mut *ctx()).unwrap();
assert_eq!(res, Value::Float(6.0));
} | rust_cleaned_test_functions.jsonl/108366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
41522,
368,
972,
1789,
286,
1077,
15169,
32203,
310,
28819,
486,
18889,
7,
16041,
486,
21807,
87414,
21915,
7,
16,
568,
79075,
1507,
7546,
21915,
7,
17,
568,
79075,
6011,
79075,
24853,
664,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dns_rr_a_address() {
let input = vec![0xc9, 0xba, 0x81, 0xa0, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00,
0x00, 0x01, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x18, 0x5c,
0x00, 0x04, 0x5d, 0xb8, 0xd8, 0x22, 0x00, 0x00, 0x29, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00];
let output = msg::parse_dns_message(&input[..]).unwrap().1;
assert_eq!(output.answer[0].rdata, Rdata::A(Ipv4Addr::from_str("93.184.216.34").unwrap()));
} | rust_cleaned_test_functions.jsonl/83425 | {
"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,
21039,
71125,
56285,
4306,
6744,
368,
341,
262,
1077,
1946,
284,
7486,
20703,
15,
8148,
24,
11,
220,
15,
55368,
11,
220,
15,
87,
23,
16,
11,
220,
15,
9591,
15,
11,
220,
15,
87,
15,
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_lib_payload_and_values() {
Payload::One(Value::Usize(2));
Payload::Tup2((Value::Bool(true), Value::Usize(128)));
Payload::Tup3((
Value::Bool(true),
Value::Usize(128),
Value::Str(String::from("omar")),
));
Payload::Tup4((
Value::Bool(true),
Value::U8(128),
Value::Str(String::from("pippo")),
Value::Isize(-2),
));
Payload::Vec(vec![
Value::U16(1),
Value::U32(2),
Value::U64(3),
Value::U128(4),
]);
let mut map: HashMap<String, Value> = HashMap::new();
map.insert(String::from("a"), Value::I8(4));
map.insert(String::from("b"), Value::I16(-8));
map.insert(String::from("c"), Value::I32(16));
map.insert(String::from("d"), Value::I64(-32));
map.insert(String::from("e"), Value::I128(64));
Payload::Map(map);
let mut link: LinkedList<Payload> = LinkedList::new();
link.push_back(Payload::One(Value::Usize(1)));
link.push_back(Payload::Tup2((Value::Usize(2), Value::Usize(4))));
Payload::Linked(link);
drop(Payload::None);
} | rust_cleaned_test_functions.jsonl/19710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16142,
32813,
8378,
9146,
368,
341,
286,
52916,
486,
3966,
25346,
486,
52,
2141,
7,
17,
1106,
286,
52916,
486,
51,
454,
17,
1188,
1130,
486,
11233,
3715,
701,
5162,
486,
52,
2141,
7,
16,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seconds() -> Result<(), tarde::Error> {
let x = 1;
let now = time::Instant::now();
thread::sleep(x.sec()?);
Ok(assert!(now.elapsed() >= x.sec()?))
} | rust_cleaned_test_functions.jsonl/40378 | {
"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,
34825,
368,
1464,
5714,
68843,
60645,
486,
1454,
29,
341,
262,
1077,
856,
284,
220,
16,
26,
715,
262,
1077,
1431,
284,
882,
486,
30340,
486,
3328,
543,
262,
4516,
486,
25809,
2075,
54694,
93333,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 3 |
#[test]
fn test_parse_attribute_indirect_implicit_const() {
let encoding = Encoding {
format: Format::Dwarf32,
version: 4,
address_size: 4,
};
let mut buf = [0; 100];
let mut writable = &mut buf[..];
leb128::write::unsigned(&mut writable, constants::DW_FORM_implicit_const.0.into())
.expect("should write implicit_const");
let input = &mut EndianSlice::new(&buf, LittleEndian);
let spec =
AttributeSpecification::new(constants::DW_AT_low_pc, constants::DW_FORM_indirect, None);
assert_eq!(
parse_attribute(input, encoding, spec),
Err(Error::InvalidImplicitConst)
);
} | rust_cleaned_test_functions.jsonl/102062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16791,
9122,
1226,
62,
30940,
13610,
368,
341,
286,
1077,
11170,
284,
29330,
341,
310,
3561,
25,
15042,
486,
35,
32634,
18,
17,
345,
310,
2319,
25,
220,
19,
345,
310,
2621,
2368,
25,
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_zero_key_replay_counter_lower_msg3_counter() {
let mut supplicant = test_util::get_wpa2_supplicant();
supplicant.start().expect("Failed starting Supplicant");
assert_eq!(0, supplicant.esssa.key_replay_counter);
let (result, updates) = send_fourway_msg1(&mut supplicant, |msg1| {
msg1.key_frame_fields.key_replay_counter.set_from_native(1);
});
assert!(result.is_ok());
assert_eq!(0, supplicant.esssa.key_replay_counter);
let msg2 = expect_eapol_resp(&updates[..]);
let snonce = msg2.keyframe().key_frame_fields.key_nonce;
let ptk = test_util::get_ptk(&ANONCE[..], &snonce[..]);
// counter in message 3 is lower than in message 1. It is a
// message 1 is in fact meaningless because replay counters
// are only updated when there is a MIC to verify. There is no
// doesn't matter.
let (result, updates) = send_fourway_msg3(&mut supplicant, &ptk, |msg3| {
msg3.key_frame_fields.key_replay_counter.set_from_native(0);
});
assert!(result.is_ok());
assert_eq!(0, supplicant.esssa.key_replay_counter);
test_util::expect_reported_ptk(&updates[..]);
} | rust_cleaned_test_functions.jsonl/21798 | {
"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,
19359,
3097,
1288,
1363,
15730,
30425,
6483,
18,
15730,
368,
341,
286,
1077,
5206,
90035,
35237,
284,
1273,
18974,
486,
455,
1670,
6595,
17,
91480,
35237,
543,
286,
90035,
35237,
4962,
1005,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.