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_color_from_str_rgba() {
assert_eq!(
Color::try_from("#000000FF").unwrap(),
Color::from((0.0, 0.0, 0.0, 1.0))
);
assert_eq!(
Color::try_from("#FF00FF00").unwrap(),
Color::from((1.0, 0.0, 1.0, 0.0))
);
} | rust_cleaned_test_functions.jsonl/57746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
5673,
2895,
95229,
368,
341,
286,
2060,
10714,
33673,
310,
3478,
486,
1539,
5673,
3584,
15,
15,
15,
15,
15,
15,
1748,
1827,
15454,
3148,
310,
3478,
486,
1499,
1188,
15,
13,
15,
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_output_success() {
let mut cmd = process::Command::new("printf");
cmd.arg("hello");
match output(cmd) {
Ok(ref string) if string == "hello" => {}
result => panic!("expected output success but got: {:?}", result),
}
} | rust_cleaned_test_functions.jsonl/74396 | {
"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,
7645,
18632,
368,
341,
220,
1077,
5206,
5439,
284,
1882,
486,
4062,
486,
931,
445,
2517,
797,
220,
5439,
21186,
445,
14990,
797,
220,
2432,
2550,
14160,
8,
341,
262,
7622,
13321,
914,
8,
421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_jpdatabase_new() {
use std::path::Path;
let json_f = Path::new("./test.json");
let jp_database = JPDataBase::new(json_f);
assert_eq!(jp_database.jp_dict.len(), 3);
assert_eq!(jp_database.jp_dict[0].kangji, "勉強");
assert_eq!(jp_database.jp_dict[0].kana, "べんきょう");
assert_eq!(jp_database.jp_dict[0].chinese, "学习");
assert!(jp_database.jp_dict[0].sentence.is_empty());
assert_eq!(jp_database.jp_dict[1].sentence.len(), 1);
assert_eq!(jp_database.jp_dict[2].sentence.len(), 2);
assert_eq!(jp_database.jp_dict[2].sentence[0], "もう結婚を真剣に考えてもよい年ごろだ");
assert_eq!(jp_database.jp_dict[2].sentence[1], "真剣になればあんなやつを負かすのはなんでもない");
} | rust_cleaned_test_functions.jsonl/8002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
79,
12216,
5921,
368,
341,
262,
990,
1460,
486,
2343,
486,
1820,
280,
262,
1077,
2951,
761,
284,
7933,
486,
931,
13988,
1944,
4323,
797,
262,
1077,
43571,
27341,
284,
48780,
82787,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash() {
use std::str::FromStr;
let name = Name::from_str("www.example.com").unwrap();
let salt: Vec<u8> = vec![1, 2, 3, 4];
assert_eq!(
Nsec3HashAlgorithm::SHA1
.hash(&salt, &name, 0)
.unwrap()
.as_ref()
.len(),
20
);
assert_eq!(
Nsec3HashAlgorithm::SHA1
.hash(&salt, &name, 1)
.unwrap()
.as_ref()
.len(),
20
);
assert_eq!(
Nsec3HashAlgorithm::SHA1
.hash(&salt, &name, 3)
.unwrap()
.as_ref()
.len(),
20
);
} | rust_cleaned_test_functions.jsonl/100495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
262,
990,
1460,
486,
495,
486,
3830,
2580,
401,
262,
1077,
829,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
1827,
15454,
543,
262,
1077,
12021,
25,
11312,
34837,
23,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if_none_match_hit() {
let etag = etag::EntityTag::new(true, "12345".to_owned());
let headers = get_header("\"1234\", W/\"12345\"");
assert!(if_none_match(&etag, &headers));
} | rust_cleaned_test_functions.jsonl/27272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
31488,
10708,
37697,
368,
341,
286,
1077,
1842,
351,
284,
1842,
351,
486,
3030,
5668,
486,
931,
3715,
11,
330,
16,
17,
18,
19,
20,
3263,
983,
51973,
5231,
286,
1077,
7102,
284,
633,
875... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rows() {
let mut component = TableComponent::new(KeyConfig::default());
component.rows = vec![
vec!["a", "b", "c"].iter().map(|h| h.to_string()).collect(),
vec!["d", "e", "f"].iter().map(|h| h.to_string()).collect(),
];
assert_eq!(component.rows(1, 2), vec![vec!["1", "b"], vec!["2", "e"]],)
} | rust_cleaned_test_functions.jsonl/120815 | {
"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,
10949,
368,
341,
286,
1077,
5206,
3692,
284,
6633,
2189,
486,
931,
21358,
2648,
486,
2258,
1423,
286,
3692,
19336,
284,
7486,
90515,
310,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
5521,
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_notrunc_does_not_truncate() {
let fname = "this-file-exists-notrunc.txt";
let fpath = fixture_path!(fname);
match fpath.metadata() {
Ok(m) if m.len() == 256 => {}
_ => build_test_file!(&fpath, &build_ascii_block(256)),
}
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&["status=none", "conv=notrunc", of!(&fname), "if=null.txt"])
.run()
.no_stdout()
.no_stderr()
.success();
assert_eq!(256, fix.metadata(fname).len());
} | rust_cleaned_test_functions.jsonl/59389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
81,
1347,
96374,
7913,
3547,
26900,
368,
341,
1066,
262,
1077,
22548,
284,
330,
574,
14203,
10187,
1671,
29169,
81,
1347,
3909,
876,
262,
1077,
282,
2343,
284,
12507,
2638,
10297,
23993,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_ser_enum_map() {
let a = 1;
let b = 2;
let c = 3;
let mut d = 4;
assert_ser_tokens(
&SerEnum::Map {
a: a,
b: b,
c: &c,
d: &mut d,
},
&[
Token::StructVariant {
name: "SerEnum",
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/56419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
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,
5206,
294,
284,
220,
19,
401,
262,
2060,
758... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialization() {
let data = [
("http://example.com/", "http://example.com/"),
("http://addslash.com", "http://addslash.com/"),
("http://@emptyuser.com/", "http://emptyuser.com/"),
("http://:@emptypass.com/", "http://emptypass.com/"),
("http://user@user.com/", "http://user@user.com/"),
("http://user:pass@userpass.com/", "http://user:pass@userpass.com/"),
("http://slashquery.com/path/?q=something", "http://slashquery.com/path/?q=something"),
("http://noslashquery.com/path?q=something", "http://noslashquery.com/path?q=something"),
];
for &(input, result) in &data {
let url = Url::parse(input).unwrap();
assert_eq!(url.as_str(), result);
}
} | rust_cleaned_test_functions.jsonl/52241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
2022,
368,
341,
262,
1077,
821,
284,
2278,
286,
3489,
1254,
1110,
8687,
905,
28105,
330,
1254,
1110,
8687,
905,
14,
4461,
286,
3489,
1254,
1110,
718,
50256,
905,
497,
330,
1254,
1110,
718... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_tree_hash() {
let db: MerkleTree<u32> = MerkleTree::new();
assert_eq!(&"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9".to_string(),
db.root_hash().unwrap_or(&"None".to_string()));
} | rust_cleaned_test_functions.jsonl/98830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
11663,
8950,
368,
341,
262,
1077,
2927,
25,
8755,
23089,
6533,
34837,
18,
17,
29,
284,
8755,
23089,
6533,
486,
931,
543,
262,
2060,
10714,
0,
2099,
1,
20,
1859,
84797,
21,
21,
77887,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detach_rc() {
let str_pool : Pool<String> = Pool::with_size(1);
{
assert_eq!(1, str_pool.size());
let _string : String = str_pool.new_rc().detach();
assert_eq!(0, str_pool.size());
}
assert_eq!(0, str_pool.size());
} | rust_cleaned_test_functions.jsonl/121197 | {
"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,
93067,
30299,
368,
341,
414,
1077,
607,
15709,
549,
22728,
3464,
29,
284,
22728,
486,
4197,
2368,
7,
16,
317,
414,
341,
286,
2060,
10714,
10297,
16,
11,
607,
15709,
2486,
1423,
286,
1077,
716,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_playback() {
let mut oauth = SpotifyOAuth::default()
.scope("user-modify-playback-state")
.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 device_id = "74ASZWbe4lXaubB36ztrGX";
let result = spotify.transfer_playback(device_id, true);
assert!(result.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
22144,
1419,
368,
341,
262,
1077,
5206,
46415,
284,
40537,
57850,
486,
2258,
741,
286,
659,
4186,
445,
872,
17078,
1437,
26544,
1419,
20733,
1138,
286,
659,
5834,
543,
262,
2432,
633,
6458,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_exec() -> Result<()> {
use escargot::CargoBuild;
fn get_exec() -> Result<String> {
let runner = CargoBuild::new()
.current_release()
.run()
.context(format!("Error running CargoBuild"))?;
Ok(runner.path().to_owned().to_string_lossy().to_string())
}
crate::run_client(Connection::with_activate(&format!(
"{} --varlink=$VARLINK_ADDRESS --timeout 4",
get_exec()?
))?)
} | rust_cleaned_test_functions.jsonl/31462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
368,
1464,
5714,
71698,
341,
262,
990,
3835,
858,
354,
486,
98228,
11066,
280,
262,
5168,
633,
18430,
368,
1464,
5714,
3464,
29,
341,
286,
1077,
22259,
284,
61288,
11066,
486,
931,
741,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_check_redundancy() {
// Gaps
assert_eq!(
check_redundancy(vec![DhtArc::from_start_and_half_len(0u32, 1)]),
0
);
assert_eq!(
check_redundancy(vec![DhtArc::from_start_and_half_len(0u32, 0)]),
0
);
assert_eq!(
check_redundancy(vec![DhtArc::from_start_and_half_len(
0u32,
MAX_HALF_LENGTH - 2
)]),
0
);
assert_eq!(
check_redundancy(vec![
DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH / 2),
DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH / 2)
]),
0
);
assert_eq!(
check_redundancy(vec![
DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH / 3 + 1),
DhtArc::from_start_and_half_len(MAX_HALF_LENGTH / 3, MAX_HALF_LENGTH / 3 + 1),
DhtArc::from_start_and_half_len(
(MAX_HALF_LENGTH / 3) * 2 + 100,
MAX_HALF_LENGTH / 3 + 1
)
]),
0
);
assert_eq!(
check_redundancy(vec![
DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH / 3 + 1),
DhtArc::from_start_and_half_len(MAX_HALF_LENGTH / 3 - 1, MAX_HALF_LENGTH / 3 + 1),
DhtArc::from_start_and_half_len(
MAX_HALF_LENGTH + (MAX_HALF_LENGTH / 3),
MAX_HALF_LENGTH / 2 + MAX_HALF_LENGTH / 8,
),
]),
0
);
// No Gaps
assert_eq!(
check_redundancy(vec![DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH)]),
1
);
assert_eq!(
check_redundancy(vec![
DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH);
3
]),
3
);
assert_eq!(
check_redundancy(vec![DhtArc::from_start_and_half_len(
0u32,
MAX_HALF_LENGTH - 1
)]),
1
);
assert_eq!(
check_redundancy(vec![
DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH / 2 + 1),
DhtArc::from_start_and_half_len(MAX_HALF_LENGTH, MAX_HALF_LENGTH / 2 + 1)
]),
1
);
let one = DhtArc::from_start_and_half_len(0u32, MAX_HALF_LENGTH / 3 + 1);
let two = DhtArc::from_start_and_half_len(MAX_HALF_LENGTH / 3 - 1, MAX_HALF_LENGTH / 3 + 1);
let three = DhtArc::from_start_and_half_len(MAX_HALF_LENGTH - 100, MAX_HALF_LENGTH / 2 + 100);
assert_eq!(check_redundancy(vec![one, two, three]), 1);
let arm = Wrapping(MAX_HALF_LENGTH / 3);
let mut peers = Vec::new();
for i in 0..12 {
peers.push(DhtArc::from_start_and_half_len(
(arm * Wrapping(i)).0,
arm.0 + 10,
));
}
assert_eq!(check_redundancy(peers), 4);
} | rust_cleaned_test_functions.jsonl/75433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
1288,
1054,
303,
6572,
368,
341,
262,
442,
479,
2625,
198,
262,
2060,
10714,
33673,
286,
1779,
1288,
1054,
303,
6572,
25592,
20703,
35,
426,
36809,
486,
1499,
4906,
8378,
40626,
6043,
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... | 2 |
#[test]
fn test_decrement() {
let mut test_machine = Machine::new(false);
test_machine.tape[test_machine.index] = 1;
test_machine.increment(-1);
assert_eq!(test_machine.tape[test_machine.index], 0);
} | rust_cleaned_test_functions.jsonl/88370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
13477,
368,
341,
262,
1077,
5206,
1273,
38695,
284,
12960,
486,
931,
3576,
317,
262,
1273,
38695,
734,
2027,
72626,
38695,
5154,
60,
284,
220,
16,
280,
262,
1273,
38695,
56936,
4080,
16,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tracers() {
let mut tracer = Tracer::new(TracerConfig::default());
test_variant(
&mut tracer,
E::Unit,
Value::Variant(0, Box::new(Value::Unit)),
);
test_variant(
&mut tracer,
E::Newtype(1),
Value::Variant(1, Box::new(Value::U16(1))),
);
test_variant(
&mut tracer,
E::Tuple(1, Some(true)),
Value::Variant(
2,
Box::new(Value::Seq(vec![
Value::U16(1),
Value::Option(Some(Box::new(Value::Bool(true)))),
])),
),
);
test_variant(
&mut tracer,
E::Struct { a: 1 },
Value::Variant(3, Box::new(Value::Seq(vec![Value::U32(1)]))),
);
test_variant(
&mut tracer,
E::NewTupleArray((1, 2, 3)),
Value::Variant(
4,
Box::new(Value::Seq(vec![
Value::U16(1),
Value::U16(2),
Value::U16(3),
])),
),
);
let registry = tracer.registry().unwrap();
let format = registry.get("E").unwrap();
let variants = match format {
ContainerFormat::Enum(variants) => variants,
_ => {
unreachable!();
}
};
// User provided identifier were scraped.
assert_eq!(variants.len(), 5);
assert_eq!(variants.get(&0).unwrap().name, "Unit");
assert_eq!(variants.get(&1).unwrap().name, "Newtype");
assert_eq!(variants.get(&2).unwrap().name, "Tuple");
assert_eq!(variants.get(&3).unwrap().name, "Struct");
assert_eq!(variants.get(&4).unwrap().name, "NewTupleArray");
// Variant definitions were scraped.
assert_eq!(variants.get(&0).unwrap().value, VariantFormat::Unit);
assert_eq!(
variants.get(&1).unwrap().value,
VariantFormat::NewType(Box::new(Format::U16))
);
assert_eq!(
variants.get(&2).unwrap().value,
VariantFormat::Tuple(vec![Format::U16, Format::Option(Box::new(Format::Bool))])
);
assert_eq!(
variants.get(&3).unwrap().value,
VariantFormat::Struct(vec![Named {
name: "a".into(),
value: Format::U32
}])
);
assert_eq!(
variants.get(&4).unwrap().value,
VariantFormat::NewType(Box::new(Format::TupleArray {
content: Box::new(Format::U16),
size: 3
})),
);
// Format values can serialize and deserialize in text and binary encodings.
let data = serde_json::to_string_pretty(format).unwrap();
let format2 = serde_json::from_str::<ContainerFormat>(&data).unwrap();
assert_eq!(*format, format2);
let data = serde_yaml::to_string(format).unwrap();
let format3 = serde_yaml::from_str::<ContainerFormat>(&data).unwrap();
assert_eq!(*format, format3);
let data = bincode::serialize(format).unwrap();
let format4 = bincode::deserialize(&data).unwrap();
assert_eq!(*format, format4);
// Tracing deserialization
let samples = Samples::new();
let mut tracer = Tracer::new(TracerConfig::default());
let (mut ident, samples) = tracer.trace_type::<E>(&samples).unwrap();
ident.normalize().unwrap();
assert_eq!(ident, Format::TypeName("E".into()));
assert_eq!(tracer.registry().unwrap().get("E").unwrap(), format);
assert_eq!(
samples,
vec![
E::Unit,
E::Newtype(0),
E::Tuple(0, Some(false)),
E::Struct { a: 0 },
E::NewTupleArray((0, 0, 0))
]
);
} | rust_cleaned_test_functions.jsonl/23925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1722
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
72697,
368,
341,
262,
1077,
5206,
64306,
284,
1163,
9584,
486,
931,
7,
1282,
9584,
2648,
486,
2258,
5231,
262,
1273,
46112,
1006,
286,
609,
6984,
64306,
345,
286,
468,
486,
4562,
345,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multiply() {
let mut program = Program{
code: vec![4, 2, 0],
ip: 0,
move_ip: true,
rel_base: 0,
param_indices: vec![0, 1, 2],
finish: false
};
// Positive multiply
multiply(&mut program);
assert_eq!(program.code, vec![4, 2, 8]);
// Negative multiply
program.code = vec![-3, 2, 0];
multiply(&mut program);
assert_eq!(program.code, vec![-3, 2, -6]);
// Negative * Negative = Positive
program.code = vec![-3, -2, 0];
multiply(&mut program);
assert_eq!(program.code, vec![-3, -2, 6]);
} | rust_cleaned_test_functions.jsonl/52445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93054,
368,
341,
286,
1077,
5206,
2025,
284,
6687,
515,
310,
2038,
25,
7486,
20703,
19,
11,
220,
17,
11,
220,
15,
1259,
310,
5997,
25,
220,
15,
345,
310,
3271,
10385,
25,
830,
345,
310,
1351... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_statistics_nan_middle() {
let stats = statistics_roundtrip::<DoubleType>(&[1.0, f64::NAN, 2.0]);
assert!(stats.has_min_max_set());
if let Statistics::Double(stats) = stats {
assert_eq!(stats.min(), &1.0);
assert_eq!(stats.max(), &2.0);
} else {
panic!("expecting Statistics::Float");
}
} | rust_cleaned_test_functions.jsonl/54372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
49569,
73936,
62580,
368,
341,
286,
1077,
10472,
284,
13142,
29896,
32981,
27638,
7378,
929,
44784,
58,
16,
13,
15,
11,
282,
21,
19,
486,
45,
1093,
11,
220,
17,
13,
15,
2558,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_datetime_from_int() {
assert_eq!(Value::DateTime(DateTime::new(Date::new_str("2012", "01", "03"), Some(Time::new_str(
"03", "30", "30", None, None
)))), Value::datetime_from_int(2012, 1, 3, 3, 30, 30).unwrap());
} | rust_cleaned_test_functions.jsonl/86209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
28943,
5673,
4042,
368,
341,
262,
2060,
10714,
10297,
1130,
486,
7689,
32083,
486,
931,
19987,
486,
931,
2895,
445,
17,
15,
16,
17,
497,
330,
15,
16,
497,
330,
15,
18,
3975,
4329,
36968,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_avg2_specific() {
assert_eq!(
255,
avg2(255, 255),
"avg2(255, 255), expected 255, got {}.",
avg2(255, 255)
);
assert_eq!(1, avg2(1, 1), "avg2(1, 1), expected 1, got {}.", avg2(1, 1));
assert_eq!(2, avg2(2, 1), "avg2(2, 1), expected 2, got {}.", avg2(2, 1));
} | rust_cleaned_test_functions.jsonl/44864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26631,
17,
56592,
368,
341,
286,
2060,
10714,
33673,
310,
220,
17,
20,
20,
345,
310,
19712,
17,
7,
17,
20,
20,
11,
220,
17,
20,
20,
1326,
310,
330,
13961,
17,
7,
17,
20,
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... | 1 |
#[test]
fn test_get_out_of_bound() {
let engine = TestEngineBuilder::new().build().unwrap();
// Generate 1 put for [a].
must_prewrite_put(&engine, b"a", b"value", b"a", 7);
must_commit(&engine, b"a", 7, 7);
// Generate 5 rollback for [b].
for ts in 0..5 {
must_rollback(&engine, b"b", ts);
}
let snapshot = engine.snapshot(&Context::new()).unwrap();
let mut scanner = ScannerBuilder::new(snapshot, 10, false)
.range(None, None)
.build()
.unwrap();
// Initial position: 1 seek_to_first:
// a_7 b_4 b_3 b_2 b_1 b_0
// ^cursor
// a_7 b_4 b_3 b_2 b_1 b_0
// ^cursor
assert_eq!(
scanner.next().unwrap(),
Some((Key::from_raw(b"a"), b"value".to_vec())),
);
let statistics = scanner.take_statistics();
assert_eq!(statistics.write.seek, 1);
assert_eq!(statistics.write.next, 1);
// Use 5 next and reach out of bound:
// a_7 b_4 b_3 b_2 b_1 b_0
// ^cursor
assert_eq!(scanner.next().unwrap(), None);
let statistics = scanner.take_statistics();
assert_eq!(statistics.write.seek, 0);
assert_eq!(statistics.write.next, 5);
assert_eq!(scanner.next().unwrap(), None);
let statistics = scanner.take_statistics();
assert_eq!(statistics.write.seek, 0);
assert_eq!(statistics.write.next, 0);
} | rust_cleaned_test_functions.jsonl/2281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
6068,
3575,
19447,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
286,
442,
19813,
220,
16,
2182,
369,
508,
64,
26126,
286,
1969,
620,
52473,
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_three_directories_and_file_and_stdin() {
let s = TestScenario::new(util_name!());
s.fixtures.mkdir("test_directory3");
s.fixtures.mkdir("test_directory3/test_directory4");
s.fixtures.mkdir("test_directory3/test_directory5");
s.ucmd()
.args(&[
"test_directory3/test_directory4",
"alpha.txt",
"-",
"filewhichdoesnotexist.txt",
"nonewline.txt",
"test_directory3/test_directory5",
"test_directory3/../test_directory3/test_directory5",
"test_directory3",
])
.pipe_in("stdout bytes")
.fails()
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
.stdout_is(
"abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline",
);
} | rust_cleaned_test_functions.jsonl/90929 | {
"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,
50016,
32871,
2433,
8378,
2458,
8378,
15656,
258,
368,
341,
262,
1077,
274,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
274,
67785,
18513,
30163,
445,
1944,
14846,
18,
797,
262,
274,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_blocks_by_parent_and_get_block_should_not_deadlock() {
let consensus = ConsensusBuilder::default().build();
let pool = OrphanBlockPool::with_capacity(1024);
let mut header = consensus.genesis_block().header();
let mut hashes = Vec::new();
for _ in 1..1024 {
let new_block = gen_block(&header);
pool.insert(new_block.clone());
header = new_block.header();
hashes.push(header.hash());
}
let pool_arc1 = Arc::new(pool);
let pool_arc2 = Arc::clone(&pool_arc1);
let thread1 = thread::spawn(move || {
pool_arc1.remove_blocks_by_parent(&consensus.genesis_block().hash());
});
for hash in hashes.iter().rev() {
pool_arc2.get_block(hash);
}
thread1.join().unwrap();
} | rust_cleaned_test_functions.jsonl/79768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
25201,
3710,
15960,
8378,
3062,
7113,
43378,
7913,
53427,
1023,
368,
341,
286,
1077,
23869,
284,
7292,
13626,
3297,
486,
2258,
1005,
5834,
543,
286,
1077,
7314,
284,
2521,
9943,
4713,
10551,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_voice_states_with_no_cached_guilds() {
let cache = InMemoryCache::builder()
.event_types(EventType::VOICE_STATE_UPDATE)
.build();
cache.update(&VoiceStateUpdate(VoiceState {
channel_id: None,
deaf: false,
guild_id: Some(GuildId(1)),
member: None,
mute: false,
self_deaf: false,
self_mute: false,
self_stream: false,
session_id: "38fj3jfkh3pfho3prh2".to_string(),
suppress: false,
token: None,
user_id: UserId(1),
}));
} | rust_cleaned_test_functions.jsonl/88896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76765,
22972,
6615,
6536,
64369,
1889,
1498,
82,
368,
341,
286,
1077,
6500,
284,
758,
10642,
8233,
486,
17850,
741,
310,
659,
3087,
9763,
30469,
929,
486,
77915,
10832,
22408,
340,
310,
659,
5834,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_open_tag() {
{
assert_eq!(
open_tag().parse("<p>aaaa"),
Ok((("p".to_string(), AttrMap::new()), "aaaa"))
);
}
{
let mut attributes = AttrMap::new();
attributes.insert("id".to_string(), "test".to_string());
assert_eq!(
open_tag().parse("<p id=\"test\">"),
Ok((("p".to_string(), attributes), ""))
)
}
{
let result = open_tag().parse("<p id=\"test\" class=\"sample\">");
let mut attributes = AttrMap::new();
attributes.insert("id".to_string(), "test".to_string());
attributes.insert("class".to_string(), "sample".to_string());
assert_eq!(result, Ok((("p".to_string(), attributes), "")));
}
{
assert!(open_tag().parse("<p id>").is_err());
}
} | rust_cleaned_test_functions.jsonl/134145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11311,
9372,
368,
341,
286,
341,
310,
2060,
10714,
33673,
394,
1787,
9372,
1005,
6400,
9639,
79,
29,
28458,
4461,
394,
7622,
1188,
445,
79,
3263,
983,
3904,
1507,
50943,
2227,
486,
931,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_last_cycle_increments() {
// last cycle increments
let mut long_name = "aaaa bbbb cccc dddd eeee fff #14".to_string();
assert_eq!(long_name.len(), MAX_NAME_LENGTH);
increment_name(&mut long_name, true).unwrap();
assert_eq!(long_name, "aaaa bbbb cccc dddd eeee fff #0".to_string());
let mut long_uri = String::new();
for _ in 0..19 {
// 10 long slice
long_uri.push_str("asdf.qwer/");
}
let mut long_uri_expected = long_uri.clone();
long_uri.push_str("123456.jpg");
assert_eq!(long_uri.len(), MAX_URI_LENGTH);
increment_uri(&mut long_uri, true).unwrap();
long_uri_expected.push_str("0.jpg");
assert_eq!(long_uri, long_uri_expected);
} | rust_cleaned_test_functions.jsonl/3938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
39079,
1243,
837,
1368,
368,
341,
286,
442,
1537,
10775,
61600,
198,
286,
1077,
5206,
1293,
1269,
284,
330,
28458,
293,
53151,
272,
37054,
294,
40360,
384,
34063,
282,
542,
671,
16,
19,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_empty_cache() {
let cache = DnsLru::new(1, dns_lru::TtlConfig::default());
let client = mock(vec![empty()]);
let client = CachingClient::with_cache(cache, client, false);
if let ResolveErrorKind::NoRecordsFound {
query,
negative_ttl,
..
} = block_on(CachingClient::inner_lookup(
Query::new(),
DnsRequestOptions::default(),
client,
vec![],
))
.unwrap_err()
.kind()
{
assert_eq!(**query, Query::new());
assert_eq!(*negative_ttl, None);
} else {
panic!("wrong error received")
}
} | rust_cleaned_test_functions.jsonl/39906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
11529,
368,
341,
286,
1077,
6500,
284,
422,
4412,
43,
2672,
486,
931,
7,
16,
11,
44077,
907,
2672,
486,
51,
11544,
2648,
486,
2258,
1423,
286,
1077,
2943,
284,
7860,
25592,
20703,
3194,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lda_imm() {
let mut r = Register::new();
lda_imm(0xA9, &mut r);
assert_eq!(r.get_A(), 0xA9);
} | rust_cleaned_test_functions.jsonl/14179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
64,
71370,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
68131,
71370,
7,
15,
14673,
24,
11,
609,
6984,
435,
317,
262,
2060,
10714,
10297,
81,
670,
1566,
1507,
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 |
#[test]
fn test_extract_address_hash_scriptsig_p2sh() {
let raw_tx = "0100000001c8cc2b56525e734ff63a13bc6ad06a9e5664df8c67632253a8e36017aee3ee40000000009000483045022100ad0851c69dd756b45190b5a8e97cb4ac3c2b0fa2f2aae23aed6ca97ab33bf88302200b248593abc1259512793e7dea61036c601775ebb23640a0120b0dba2c34b79001455141042f90074d7a5bf30c72cf3a8dfd1381bdbd30407010e878f3a11269d5f74a58788505cdca22ea6eab7cfb40dc0e07aba200424ab0d79122a653ad0c7ec9896bdf51aefeffffff0120f40e00000000001976a9141d30342095961d951d306845ef98ac08474b36a088aca7270400";
let tx_bytes = hex::decode(&raw_tx).unwrap();
let transaction = parse_transaction(&tx_bytes).unwrap();
let address = Address::P2SH(H160([
233, 195, 221, 12, 7, 170, 199, 97, 121, 235, 199, 106, 108, 120, 212, 214, 124, 108, 22, 10,
]));
let extr_address = extract_address_hash_scriptsig(&transaction.inputs[0].script).unwrap();
assert_eq!(&extr_address, &address);
} | rust_cleaned_test_functions.jsonl/132200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
6744,
8950,
14660,
21339,
620,
17,
927,
368,
341,
286,
1077,
7112,
17805,
284,
330,
15,
16,
15,
15,
15,
15,
15,
15,
15,
16,
66,
23,
638,
17,
65,
20,
21,
20,
17,
20,
68,
22,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_pruned_f64() {
test_helpers::maybe_start_logging();
// column1 < 100.0 where
let observer = TestObserver::new();
let c1 = Arc::new(TestChunk::new("chunk1").with_f64_field_column_with_stats(
"column1",
Some(0.0),
Some(10.0),
));
let predicate = PredicateBuilder::new()
.add_expr(col("column1").lt(lit(100.0)))
.build();
let pruned = prune_chunks(&observer, vec![c1], &predicate);
assert!(observer.events().is_empty());
assert_eq!(names(&pruned), vec!["chunk1"]);
} | rust_cleaned_test_functions.jsonl/47392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
5294,
48883,
761,
21,
19,
368,
341,
286,
1273,
54473,
486,
36760,
4906,
59982,
543,
286,
442,
3250,
16,
366,
220,
16,
15,
15,
13,
15,
1380,
8945,
286,
1077,
22067,
284,
3393,
17151,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1323() {
assert_eq!(Solution::maximum69_number(9669), 9969);
assert_eq!(Solution::maximum69_number(9996), 9999);
assert_eq!(Solution::maximum69_number(9999), 9999);
} | rust_cleaned_test_functions.jsonl/134258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
18,
17,
18,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
39187,
21,
24,
5500,
7,
24,
21,
21,
24,
701,
220,
24,
24,
21,
24,
317,
286,
2060,
10714,
10297,
36842,
486,
39187,
21,
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_serialize_revoke() {
let req = LeaseProtocolRequest::revoke("456");
let json = serde_json::to_string(&req).unwrap();
let after: LeaseProtocolRequest = serde_json::from_str(json.as_str()).unwrap();
assert_eq!(after, req)
} | rust_cleaned_test_functions.jsonl/21172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
1288,
7621,
368,
341,
286,
1077,
4232,
284,
80651,
20689,
1900,
486,
265,
7621,
445,
19,
20,
21,
797,
286,
1077,
2951,
284,
61570,
9455,
486,
983,
3904,
2099,
2958,
568,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_linkat_no_follow_symlink() {
let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test");
let tempdir = tempfile::tempdir().unwrap();
let oldfilename = "foo.txt";
let oldfilepath = tempdir.path().join(oldfilename);
let symoldfilename = "symfoo.txt";
let symoldfilepath = tempdir.path().join(symoldfilename);
let newfilename = "nofollowsymbar.txt";
let newfilepath = tempdir.path().join(newfilename);
// Create file
File::create(&oldfilepath).unwrap();
// Create symlink to file
symlinkat(&oldfilepath, None, &symoldfilepath).unwrap();
// Get file descriptor for base directory
let dirfd = fcntl::open(tempdir.path(), fcntl::OFlag::empty(), stat::Mode::empty()).unwrap();
// Attempt link symlink of file at relative path
linkat(Some(dirfd), symoldfilename, Some(dirfd), newfilename, LinkatFlags::NoSymlinkFollow).unwrap();
// Assert newfile is actually a symlink to oldfile.
assert_eq!(
readlink(&newfilepath)
.unwrap()
.to_str()
.unwrap(),
oldfilepath.to_str().unwrap()
);
} | rust_cleaned_test_functions.jsonl/30617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
266,
6536,
43490,
58530,
44243,
368,
341,
262,
1077,
716,
76,
284,
3504,
34,
17563,
27661,
4125,
1005,
17119,
445,
38099,
2684,
70498,
553,
2441,
1273,
3071,
262,
1077,
2730,
3741,
284,
5481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_dialogue_tree_conversion() {
let node = common_node();
assert_eq!(node.to_struct(), serde_json::from_str("{\"story\":[{\"what\":\"Mama milk?\",\"who\": \"dad\"},{\"what\":\"Really dad?\",\"who\": \"sister\"}],\"choices\": null,\"visited\":false}").unwrap());
} | rust_cleaned_test_functions.jsonl/107723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
24331,
361,
11663,
64132,
368,
341,
286,
1077,
2436,
284,
4185,
5084,
1428,
286,
2060,
10714,
10297,
3509,
2389,
15126,
1507,
61570,
9455,
486,
1499,
2895,
99141,
26485,
59,
8899,
64238,
12555... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_accounts_multiple_loaders() {
let mut accounts: Vec<TransactionAccount> = Vec::new();
let mut error_counters = ErrorCounters::default();
let keypair = Keypair::new();
let key0 = keypair.pubkey();
let key1 = Pubkey::new(&[5u8; 32]);
let key2 = Pubkey::new(&[6u8; 32]);
let mut account = AccountSharedData::new(1, 0, &Pubkey::default());
account.set_rent_epoch(1);
accounts.push((key0, account));
let mut account = AccountSharedData::new(40, 1, &Pubkey::default());
account.set_executable(true);
account.set_rent_epoch(1);
account.set_owner(native_loader::id());
accounts.push((key1, account));
let mut account = AccountSharedData::new(41, 1, &Pubkey::default());
account.set_executable(true);
account.set_rent_epoch(1);
account.set_owner(key1);
accounts.push((key2, account));
let instructions = vec![
CompiledInstruction::new(1, &(), vec![0]),
CompiledInstruction::new(2, &(), vec![0]),
];
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
vec![key1, key2],
instructions,
);
let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters);
assert_eq!(error_counters.account_not_found, 0);
assert_eq!(loaded_accounts.len(), 1);
match &loaded_accounts[0] {
(Ok(loaded_transaction), _nonce) => {
assert_eq!(loaded_transaction.accounts.len(), 6);
assert_eq!(loaded_transaction.accounts[0].1, accounts[0].1);
assert_eq!(loaded_transaction.program_indices.len(), 2);
assert_eq!(loaded_transaction.program_indices[0].len(), 1);
assert_eq!(loaded_transaction.program_indices[1].len(), 2);
for program_indices in loaded_transaction.program_indices.iter() {
for (i, program_index) in program_indices.iter().enumerate() {
// +1 to skip first not loader account
assert_eq!(
loaded_transaction.accounts[*program_index].0,
accounts[i + 1].0
);
assert_eq!(
loaded_transaction.accounts[*program_index].1,
accounts[i + 1].1
);
}
}
}
(Err(e), _nonce) => Err(e).unwrap(),
}
} | rust_cleaned_test_functions.jsonl/13206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
55665,
45233,
12411,
388,
368,
341,
286,
1077,
5206,
9618,
25,
11312,
86314,
7365,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
1465,
85632,
284,
4600,
2507,
388,
486,
2258,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_generic_newtype_struct() {
assert_tokens(
&GenericNewTypeStruct(5u32),
&[
Token::NewtypeStruct {
name: "GenericNewTypeStruct",
},
Token::U32(5),
],
);
} | rust_cleaned_test_functions.jsonl/56425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
5921,
1313,
15126,
368,
341,
262,
2060,
28838,
1006,
286,
609,
19964,
3564,
929,
9422,
7,
20,
84,
18,
17,
1326,
286,
609,
9640,
310,
9660,
486,
3564,
1313,
9422,
341,
394,
829,
25,
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_double_optimization() -> Result<()> {
let table_scan = test_table_scan()?;
let plan = LogicalPlanBuilder::from(table_scan)
.project(vec![col("b")])?
.project(vec![lit(1).alias("a")])?
.build()?;
let optimized_plan1 = optimize(&plan).expect("failed to optimize plan");
let optimized_plan2 =
optimize(&optimized_plan1).expect("failed to optimize plan");
let formatted_plan1 = format!("{:?}", optimized_plan1);
let formatted_plan2 = format!("{:?}", optimized_plan2);
assert_eq!(formatted_plan1, formatted_plan2);
Ok(())
} | rust_cleaned_test_functions.jsonl/28450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
15032,
65964,
368,
1464,
5714,
71698,
341,
286,
1077,
1965,
28857,
284,
1273,
5237,
28857,
368,
69493,
286,
1077,
3119,
284,
62069,
20485,
3297,
486,
1499,
15761,
28857,
340,
310,
659,
4987,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_binary_literal_from_hex_str() {
let cs: Vec<(&str, Vec<u8>, bool)> = vec![
("x'1'", vec![], true),
("x'01'", vec![0x1], false),
("X'01'", vec![0x1], false),
("0x1", vec![0x1], false),
("0x-1", vec![], true),
("0X11", vec![], true),
("x'01+'", vec![], true),
("0x123", vec![0x01, 0x23], false),
("0x10", vec![0x10], false),
("0x4D7953514C", b"MySQL".to_vec(), false),
(
"0x4920616D2061206C6F6E672068657820737472696E67",
b"I am a long hex string".to_vec(),
false,
),
(
"x'4920616D2061206C6F6E672068657820737472696E67'",
b"I am a long hex string".to_vec(),
false,
),
(
"X'4920616D2061206C6F6E672068657820737472696E67'",
b"I am a long hex string".to_vec(),
false,
),
("x''", vec![], false),
];
for (input, exptected, err) in cs {
if err {
assert!(
BinaryLiteral::from_hex_str(input).is_err(),
"input: {}",
input
);
} else {
let lit = BinaryLiteral::from_hex_str(input).unwrap();
assert_eq!(lit.0, exptected);
}
}
} | rust_cleaned_test_functions.jsonl/12347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 964
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
34100,
5673,
32655,
2895,
368,
341,
286,
1077,
10532,
25,
11312,
27,
2099,
495,
11,
11312,
34837,
23,
8066,
1807,
16018,
284,
7486,
90515,
310,
3489,
87,
6,
16,
22772,
7486,
0,
12995,
830... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_find_lifetimes_type_alias() {
check(
r#"
type Foo<'a, T> where T: 'a<|> = &'a T;
"#,
expect![[r#"
'a LifetimeParam FileId(0) 9..11 9..11 Lifetime
FileId(0) 25..27 Lifetime
FileId(0) 31..33 Lifetime
"#]],
);
} | rust_cleaned_test_functions.jsonl/47791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
907,
333,
6889,
1819,
35947,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1313,
33428,
18291,
64,
11,
350,
29,
1380,
350,
25,
364,
64,
27,
91,
29,
284,
30136,
64,
350,
280,
57676,
345... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stake_state_calculate_rewards() {
let mut vote_state = VoteState::default();
let mut vote_i = 0;
// put a credit in the vote_state
while vote_state.credits() == 0 {
vote_state.process_vote(&Vote::new(vote_i));
vote_i += 1;
}
assert_eq!(None, StakeState::calculate_rewards(0, 100, &vote_state));
// this guy can
assert_eq!(
Some((0, 1)),
StakeState::calculate_rewards(0, STAKE_GETS_PAID_EVERY_VOTE, &vote_state)
);
vote_state.commission = std::u32::MAX / 2;
assert_eq!(
None,
StakeState::calculate_rewards(0, STAKE_GETS_PAID_EVERY_VOTE, &vote_state)
);
// put more credit in the vote_state
while vote_state.credits() < 10 {
vote_state.process_vote(&Vote::new(vote_i));
vote_i += 1;
}
vote_state.commission = 0;
assert_eq!(
Some((0, 10)),
StakeState::calculate_rewards(0, STAKE_GETS_PAID_EVERY_VOTE, &vote_state)
);
vote_state.commission = std::u32::MAX;
assert_eq!(
Some((10, 0)),
StakeState::calculate_rewards(0, STAKE_GETS_PAID_EVERY_VOTE, &vote_state)
);
vote_state.commission = std::u32::MAX / 2;
assert_eq!(
Some((5, 5)),
StakeState::calculate_rewards(0, STAKE_GETS_PAID_EVERY_VOTE, &vote_state)
);
assert_eq!(None, StakeState::calculate_rewards(0, 100, &vote_state));
} | rust_cleaned_test_functions.jsonl/43335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 871
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
4387,
24005,
11207,
77997,
368,
341,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
486,
2258,
543,
286,
1077,
5206,
6910,
5318,
284,
220,
15,
401,
286,
442,
2182,
264,
6668,
304,
279... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_slice() {
let mut bit_v: [u8; 2] = [0; 2];
bit_util::set_bit(&mut bit_v, 0);
bit_util::set_bit(&mut bit_v, 3);
bit_util::set_bit(&mut bit_v, 10);
let data = ArrayData::builder(DataType::Int32)
.len(16)
.null_bit_buffer(Buffer::from(bit_v))
.build();
let new_data = data.slice(1, 15);
assert_eq!(data.len() - 1, new_data.len());
assert_eq!(1, new_data.offset());
assert_eq!(data.null_count(), new_data.null_count());
let new_data = new_data.slice(1, 14);
assert_eq!(data.len() - 2, new_data.len());
assert_eq!(2, new_data.offset());
assert_eq!(data.null_count() - 1, new_data.null_count());
} | rust_cleaned_test_functions.jsonl/133941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
368,
341,
286,
1077,
5206,
2699,
2273,
25,
508,
84,
23,
26,
220,
17,
60,
284,
508,
15,
26,
220,
17,
935,
286,
2699,
18974,
486,
746,
13996,
2099,
6984,
2699,
2273,
11,
220,
15,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_evaluate_configs() {
let comp_res = Component::from_str(
r#"{
"parameters": [
{
"name": "one",
"type": "string",
"default": "test one"
}
],
"containers": [
{
"name": "container1",
"image": "nginx:latest"
},
{
"name": "container2",
"image": "nginx:latest",
"config": [
{
"path": "/etc/access/default_user.txt",
"value": "admin"
},
{
"path": "/var/run/db-data",
"fromParam": "one"
}
]
},
{
"name": "container3",
"image": "nginx:latest",
"config": [
{
"path": "/etc/access/default_user.txt",
"value": "admin",
"fromParam": "two"
}
]
}
]
}"#,
);
let comp = comp_res.as_ref().expect("component should exist");
let resloved_val =
resolve_parameters(comp.parameters.clone(), BTreeMap::new()).expect("resolved parameter");
let configs = comp.evaluate_configs(resloved_val);
assert_eq!(3, configs.len());
let mut exp: BTreeMap<String, BTreeMap<String, String>> = BTreeMap::new();
let mut c20 = BTreeMap::new();
c20.insert("default_user.txt".to_string(), "admin".to_string());
let mut c21 = BTreeMap::new();
c21.insert("db-data".to_string(), "test one".to_string());
exp.insert("container20".to_string(), c20);
exp.insert("container21".to_string(), c21);
let mut c30 = BTreeMap::new();
c30.insert("default_user.txt".to_string(), "admin".to_string());
exp.insert("container30".to_string(), c30);
assert_eq!(exp, configs);
} | rust_cleaned_test_functions.jsonl/98691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
19642,
59150,
368,
341,
262,
1077,
1367,
4918,
284,
5578,
486,
1499,
2895,
1006,
286,
435,
55543,
515,
310,
330,
13786,
788,
2278,
394,
341,
503,
330,
606,
788,
330,
603,
756,
503,
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_eth_address_pool_overflow() {
new_test_ext().execute_with(|| {
let account: AccountId32 = AccountId32::from([113u8; 32]);
let block_number: u32 = 99999;
let mut gen = Random{};
let mut expected_vec = Vec::new();
for index in 0..(MAX_ETH_LINKS*2) {
let key_pair = gen.generate();
let msg = generate_msg(&account, block_number);
let sig = generate_sig(&key_pair, &msg);
let (r, s, v) = generate_rsv(&sig);
assert_ok!(AccountLinker::link_eth(
Origin::signed(account.clone()),
account.clone(),
index as u32,
key_pair.address().to_fixed_bytes(),
block_number,
r,
s,
v
));
if index < MAX_ETH_LINKS {
expected_vec.push(key_pair.address().to_fixed_bytes());
} else {
expected_vec[MAX_ETH_LINKS-1] = key_pair.address().to_fixed_bytes();
}
}
assert_eq!(AccountLinker::eth_addresses(&account).len(), MAX_ETH_LINKS);
assert_eq!(AccountLinker::eth_addresses(&account), expected_vec);
});
} | rust_cleaned_test_functions.jsonl/133799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
6744,
15709,
79073,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
1476,
197,
10217,
2692,
25,
8615,
764,
18,
17,
284,
8615,
764,
18,
17,
486,
1499,
2561,
16,
16,
18,
84,
23,
26,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_crypto_stream_xchacha20_keybytes() {
assert!(
unsafe { crypto_stream_xchacha20_keybytes() } == crypto_stream_xchacha20_KEYBYTES as usize
)
} | rust_cleaned_test_functions.jsonl/68183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78298,
12673,
3212,
331,
51576,
17,
15,
3097,
9651,
368,
341,
262,
2060,
33673,
286,
19860,
314,
19028,
12673,
3212,
331,
51576,
17,
15,
3097,
9651,
368,
335,
621,
19028,
12673,
3212,
331,
51576,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vcx_disclosed_proof_serialize_and_deserialize() {
let _setup = SetupMocks::init();
let handle = _vcx_disclosed_proof_create_with_request_c_closure(::utils::constants::PROOF_REQUEST_JSON).unwrap();
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_disclosed_proof_serialize(cb.command_handle,
handle,
Some(cb.get_callback())), error::SUCCESS.code_num);
let s = cb.receive(TimeoutUtils::some_short()).unwrap().unwrap();
let j: Value = serde_json::from_str(&s).unwrap();
assert_eq!(j["version"], PENDING_OBJECT_SERIALIZE_VERSION);
let cb = return_types_u32::Return_U32_U32::new().unwrap();
assert_eq!(vcx_disclosed_proof_deserialize(cb.command_handle,
CString::new(s).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
let handle = cb.receive(TimeoutUtils::some_short()).unwrap();
assert!(handle > 0);
} | rust_cleaned_test_functions.jsonl/104426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
37745,
9259,
86757,
88686,
8378,
15768,
9050,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
716,
7362,
87,
37745,
9259,
86757,
8657,
6615,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union_field_completion() {
check(
r#"
union U { field: u8, other: u16 }
fn foo(u: U) { u.$0 }
"#,
expect![[r#"
fd field u8
fd other u16
"#]],
);
} | rust_cleaned_test_functions.jsonl/26250 | {
"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,
51621,
5013,
60164,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
16192,
547,
314,
2070,
25,
575,
23,
11,
1008,
25,
575,
16,
21,
456,
8822,
15229,
8154,
25,
547,
8,
314,
575,
2418,
15,
456,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_agent_none() {
let mut transaction_context = MockTransactionContext::default();
let state = ProductState::new(&mut transaction_context);
let result = state.get_agent("agent_public_key").unwrap();
assert!(result.is_none())
} | rust_cleaned_test_functions.jsonl/20314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
25730,
31488,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
1584,
284,
5643,
1397,
486,
931,
2099,
6984,
7745,
8467,
626,
286,
1077,
1102,
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 |
#[test]
fn test_node_merge_crash_when_snapshot() {
let mut cluster = new_node_cluster(0, 3);
cluster.cfg.raft_store.merge_max_log_gap = 10;
cluster.cfg.raft_store.raft_log_gc_count_limit = 11;
cluster.cfg.raft_store.raft_log_gc_tick_interval = ReadableDuration::millis(50);
// Make merge check resume quickly.
cluster.cfg.raft_store.raft_base_tick_interval = ReadableDuration::millis(10);
cluster.cfg.raft_store.raft_election_timeout_ticks = 10;
// election timeout must be greater than lease
cluster.cfg.raft_store.raft_store_max_leader_lease = ReadableDuration::millis(90);
cluster.cfg.raft_store.merge_check_tick_interval = ReadableDuration::millis(100);
cluster.cfg.raft_store.peer_stale_state_check_interval = ReadableDuration::millis(500);
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
let on_raft_gc_log_tick_fp = "on_raft_gc_log_tick";
fail::cfg(on_raft_gc_log_tick_fp, "return()").unwrap();
cluster.run();
let mut region = pd_client.get_region(b"k1").unwrap();
cluster.must_split(®ion, b"k2");
region = pd_client.get_region(b"k2").unwrap();
cluster.must_split(®ion, b"k3");
region = pd_client.get_region(b"k3").unwrap();
cluster.must_split(®ion, b"k4");
region = pd_client.get_region(b"k4").unwrap();
cluster.must_split(®ion, b"k5");
let r1 = pd_client.get_region(b"k1").unwrap();
let r1_on_store1 = find_peer(&r1, 1).unwrap().to_owned();
cluster.must_transfer_leader(r1.get_id(), r1_on_store1);
let r2 = pd_client.get_region(b"k2").unwrap();
let r2_on_store1 = find_peer(&r2, 1).unwrap().to_owned();
cluster.must_transfer_leader(r2.get_id(), r2_on_store1);
let r3 = pd_client.get_region(b"k3").unwrap();
let r3_on_store1 = find_peer(&r3, 1).unwrap().to_owned();
cluster.must_transfer_leader(r3.get_id(), r3_on_store1);
let r4 = pd_client.get_region(b"k4").unwrap();
let r4_on_store1 = find_peer(&r4, 1).unwrap().to_owned();
cluster.must_transfer_leader(r4.get_id(), r4_on_store1);
let r5 = pd_client.get_region(b"k5").unwrap();
let r5_on_store1 = find_peer(&r5, 1).unwrap().to_owned();
cluster.must_transfer_leader(r5.get_id(), r5_on_store1);
for i in 1..5 {
cluster.must_put(format!("k{}", i).as_bytes(), b"v");
must_get_equal(&cluster.get_engine(3), format!("k{}", i).as_bytes(), b"v");
}
cluster.add_send_filter(IsolationFilterFactory::new(3));
pd_client.must_merge(r2.get_id(), r3.get_id());
pd_client.must_merge(r4.get_id(), r3.get_id());
pd_client.must_merge(r1.get_id(), r3.get_id());
pd_client.must_merge(r5.get_id(), r3.get_id());
for i in 1..5 {
for j in 1..20 {
cluster.must_put(format!("k{}{}", i, j).as_bytes(), b"vvv");
}
}
region = pd_client.get_region(b"k1").unwrap();
let state1 = cluster.truncated_state(region.get_id(), 1);
// Remove log compaction failpoint
fail::remove(on_raft_gc_log_tick_fp);
// Wait to trigger compact raft log
cluster.wait_log_truncated(region.get_id(), 1, state1.get_index() + 1);
let on_region_worker_apply_fp = "on_region_worker_apply";
fail::cfg(on_region_worker_apply_fp, "return()").unwrap();
let on_region_worker_destroy_fp = "on_region_worker_destroy";
fail::cfg(on_region_worker_destroy_fp, "return()").unwrap();
cluster.clear_send_filters();
let timer = Instant::now();
loop {
let local_state = cluster.region_local_state(region.get_id(), 3);
if local_state.get_state() == PeerState::Applying {
break;
}
if timer.saturating_elapsed() > Duration::from_secs(1) {
panic!("not become applying state after 1 seconds.");
}
sleep_ms(10);
}
cluster.stop_node(3);
fail::remove(on_region_worker_apply_fp);
fail::remove(on_region_worker_destroy_fp);
cluster.run_node(3).unwrap();
for i in 1..5 {
for j in 1..20 {
must_get_equal(
&cluster.get_engine(3),
format!("k{}{}", i, j).as_bytes(),
b"vvv",
);
}
}
} | rust_cleaned_test_functions.jsonl/56291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1883
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
20888,
32331,
988,
47636,
53265,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
10652,
30481,
13,
2944,
14809,
25002,
6345,
5224,
51790,
284,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_call_hierarchy_incoming_outgoing() {
check_hierarchy(
r#"
//- /lib.rs
fn caller1() {
call$0er2();
}
fn caller2() {
caller3();
}
fn caller3() {
}
"#,
expect![["caller2 Function FileId(0) 33..64 36..43"]],
expect![["caller1 Function FileId(0) 0..31 3..10 : [19..26]"]],
expect![["caller3 Function FileId(0) 66..83 69..76 : [52..59]"]],
);
} | rust_cleaned_test_functions.jsonl/38292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
95043,
1243,
4959,
6068,
9546,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
8822,
19865,
16,
368,
341,
262,
1618,
3,
15,
261,
17,
543,
630,
8822,
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_into_values() {
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
let map: HashMap<_, _> = vec.into_iter().collect();
let values: Vec<_> = map.into_values().collect();
assert_eq!(values.len(), 3);
assert!(values.contains(&'a'));
assert!(values.contains(&'b'));
assert!(values.contains(&'c'));
} | rust_cleaned_test_functions.jsonl/26955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
9146,
368,
341,
286,
1077,
7486,
284,
7486,
0,
9697,
16,
11,
364,
64,
4567,
320,
17,
11,
364,
65,
4567,
320,
18,
11,
364,
66,
863,
935,
286,
1077,
2415,
25,
10528,
27,
6878,
716,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_ps_mode_fails() {
// Setup environment
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
let test_values = test_setup();
let (phy, mut phy_stream) = fake_phy();
let phy_id = 10u16;
test_values.phys.insert(phy_id, phy);
// Initiate a QueryPhy request. The returned future should not be able
// to produce a result immediately
let req_msg = fidl_svc::SetPsModeRequest {
phy_id,
ps_mode: fidl_wlan_common::PowerSaveType::PsPollMode,
};
let req_fut = super::set_ps_mode(&test_values.phys, req_msg);
pin_mut!(req_fut);
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
let (req, responder) = assert_variant!(exec.run_until_stalled(&mut phy_stream.next()),
Poll::Ready(Some(Ok(fidl_dev::PhyRequest::SetPsMode { req, responder }))) => (req, responder)
);
assert_eq!(req, fidl_wlan_common::PowerSaveType::PsPollMode);
// Failure case #1: WLAN PHY not responding
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
// Failure case #2: WLAN PHY has not implemented the feature.
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
let resp = zx::Status::NOT_SUPPORTED.into_raw();
responder.send(resp).expect("failed to send the response to SetPsMode");
assert_eq!(Poll::Ready(zx::Status::NOT_SUPPORTED), exec.run_until_stalled(&mut req_fut));
} | rust_cleaned_test_functions.jsonl/20601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 699
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
26047,
7302,
761,
6209,
368,
341,
286,
442,
18626,
4573,
198,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
797,
286,
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_exec_invalid_utf8() {
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
let dirs = &["test1"];
let files = &[];
let te = TestEnv::new(dirs, files);
fs::File::create(
te.test_root()
.join(OsStr::from_bytes(b"test1/test_\xFEinvalid.txt")),
)
.unwrap();
te.assert_output_raw(
&["", "test1/", "--exec", "echo", "{}"],
b"test1/test_\xFEinvalid.txt\n",
);
te.assert_output_raw(
&["", "test1/", "--exec", "echo", "{/}"],
b"test_\xFEinvalid.txt\n",
);
te.assert_output_raw(&["", "test1/", "--exec", "echo", "{//}"], b"test1\n");
te.assert_output_raw(
&["", "test1/", "--exec", "echo", "{.}"],
b"test1/test_\xFEinvalid\n",
);
te.assert_output_raw(
&["", "test1/", "--exec", "echo", "{/.}"],
b"test_\xFEinvalid\n",
);
} | rust_cleaned_test_functions.jsonl/10900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
31433,
39453,
23,
368,
341,
262,
990,
1460,
486,
53799,
486,
28867,
2580,
280,
262,
990,
1460,
486,
436,
486,
56646,
486,
53799,
486,
28867,
2580,
6756,
401,
262,
1077,
42248,
284,
609,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double() {
let a = Scalar::from_raw([
0x1fff3231233ffffd,
0x4884b7fa00034802,
0x998c4fefecbc4ff3,
0x1824b159acc50562,
]);
assert_eq!(a.double(), a + a);
} | rust_cleaned_test_functions.jsonl/42759 | {
"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,
24598,
368,
341,
262,
1077,
264,
284,
35176,
486,
1499,
16067,
8956,
414,
220,
15,
87,
16,
14092,
18,
17,
18,
16,
17,
18,
18,
7238,
67,
345,
414,
220,
15,
87,
19,
23,
23,
19,
65,
22,
363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_flatten_hash_intermediate() {
solana_logger::setup();
let test = vec![vec![vec![CalculateHashIntermediate::new(
1,
Hash::new_unique(),
2,
3,
Pubkey::new_unique(),
)]]];
let mut stats = HashStats::default();
let result = AccountsHash::flatten_hash_intermediate(test.clone(), &mut stats);
assert_eq!(result, test[0]);
assert_eq!(stats.unreduced_entries, 1);
let mut stats = HashStats::default();
let result = AccountsHash::flatten_hash_intermediate(
vec![vec![vec![CalculateHashIntermediate::default(); 0]]],
&mut stats,
);
assert_eq!(result.iter().flatten().count(), 0);
assert_eq!(stats.unreduced_entries, 0);
let test = vec![
vec![vec![
CalculateHashIntermediate::new(1, Hash::new_unique(), 2, 3, Pubkey::new_unique()),
CalculateHashIntermediate::new(8, Hash::new_unique(), 9, 10, Pubkey::new_unique()),
]],
vec![vec![CalculateHashIntermediate::new(
4,
Hash::new_unique(),
5,
6,
Pubkey::new_unique(),
)]],
];
let mut stats = HashStats::default();
let result = AccountsHash::flatten_hash_intermediate(test.clone(), &mut stats);
let expected = test
.into_iter()
.flatten()
.into_iter()
.flatten()
.collect::<Vec<_>>();
assert_eq!(result.into_iter().flatten().collect::<Vec<_>>(), expected);
assert_eq!(stats.unreduced_entries, expected.len());
} | rust_cleaned_test_functions.jsonl/17808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 891
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
5081,
14456,
8950,
15318,
14636,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
1273,
284,
7486,
20703,
4083,
20703,
4083,
20703,
47866,
6370,
98961,
486,
931,
1006,
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_record_to_string_for_data_record() {
let empty_data_record = Record::Data {
offset: 0x0000,
value: vec![],
};
assert_eq!(
empty_data_record.to_record_string(),
Ok(String::from(":0000000000"))
);
let data = vec![
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x67, 0x61, 0x70,
];
let populated_data_record = Record::Data {
offset: 0x0010,
value: data,
};
assert_eq!(
populated_data_record.to_record_string(),
Ok(String::from(":0B0010006164647265737320676170A7"))
);
// Validating that the maximum length data record will not panic on serialization.
let max_length_data = (0..255).map(|_| 0u8).collect::<Vec<u8>>();
let max_length_data_record = Record::Data {
offset: 0x0000,
value: max_length_data,
};
assert_eq!(max_length_data_record.to_record_string().is_ok(), true);
} | rust_cleaned_test_functions.jsonl/105905 | {
"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,
14192,
2346,
3904,
5478,
1769,
14192,
368,
341,
262,
1077,
4287,
1769,
14192,
284,
13583,
486,
1043,
341,
286,
4347,
25,
220,
15,
87,
15,
15,
15,
15,
345,
286,
897,
25,
7486,
20703,
1259,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix_with_zero_determinant_is_not_invertible() {
// This matrix should not be invertible since it has two identical columns.
let matrix: Matrix4x4<f64> = Matrix4x4::new(
1_f64, 2_f64, 3_f64, 4_f64,
5_f64, 6_f64, 7_f64, 8_f64,
5_f64, 6_f64, 7_f64, 8_f64,
9_f64, 10_f64, 11_f64, 12_f64
);
assert!(!matrix.is_invertible());
} | rust_cleaned_test_functions.jsonl/129096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
6615,
19359,
814,
16483,
517,
6892,
7913,
1243,
1621,
1238,
368,
341,
286,
442,
1096,
6172,
1265,
537,
387,
42199,
1238,
2474,
432,
702,
1378,
19516,
8147,
624,
286,
1077,
6172,
25,
11631,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inlinee_lines() {
let data = &[
0, 0, 0, 0, 254, 18, 0, 0, 104, 1, 0, 0, 24, 0, 0, 0, 253, 18, 0, 0, 104, 1, 0, 0, 28,
0, 0, 0,
];
let inlinee_lines = DebugInlineeLinesSubsection::parse(data).expect("parse inlinee lines");
assert!(!inlinee_lines.header.has_extra_files());
let lines: Vec<_> = inlinee_lines
.lines()
.collect()
.expect("collect inlinee lines");
let expected = [
InlineeSourceLine {
inlinee: IdIndex(0x12FE),
file_id: FileIndex(0x168),
line: 24,
extra_files: &[],
},
InlineeSourceLine {
inlinee: IdIndex(0x12FD),
file_id: FileIndex(0x168),
line: 28,
extra_files: &[],
},
];
assert_eq!(lines, expected);
} | rust_cleaned_test_functions.jsonl/28451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
41871,
68,
18323,
368,
341,
286,
1077,
821,
284,
609,
9640,
310,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
17,
20,
19,
11,
220,
16,
23,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_system_instruction_nonce() {
let mut keys: Vec<Pubkey> = vec![];
for _ in 0..5 {
keys.push(solana_sdk::pubkey::new_rand());
}
let instruction = system_instruction::advance_nonce_account(&keys[1], &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_system(&message.instructions[0], &keys[0..3]).unwrap(),
ParsedInstructionEnum {
instruction_type: "advanceNonce".to_string(),
info: json!({
"nonceAccount": keys[1].to_string(),
"recentBlockhashesSysvar": keys[2].to_string(),
"nonceAuthority": keys[0].to_string(),
}),
}
);
assert!(parse_system(&message.instructions[0], &keys[0..2]).is_err());
let lamports = 55;
let instruction =
system_instruction::withdraw_nonce_account(&keys[1], &keys[0], &keys[2], lamports);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_system(&message.instructions[0], &keys[0..5]).unwrap(),
ParsedInstructionEnum {
instruction_type: "withdrawFromNonce".to_string(),
info: json!({
"nonceAccount": keys[1].to_string(),
"destination": keys[2].to_string(),
"recentBlockhashesSysvar": keys[3].to_string(),
"rentSysvar": keys[4].to_string(),
"nonceAuthority": keys[0].to_string(),
"lamports": lamports
}),
}
);
assert!(parse_system(&message.instructions[0], &keys[0..4]).is_err());
let instructions =
system_instruction::create_nonce_account(&keys[0], &keys[1], &keys[4], lamports);
let message = Message::new(&instructions, None);
assert_eq!(
parse_system(&message.instructions[1], &keys[0..4]).unwrap(),
ParsedInstructionEnum {
instruction_type: "initializeNonce".to_string(),
info: json!({
"nonceAccount": keys[1].to_string(),
"recentBlockhashesSysvar": keys[2].to_string(),
"rentSysvar": keys[3].to_string(),
"nonceAuthority": keys[4].to_string(),
}),
}
);
assert!(parse_system(&message.instructions[1], &keys[0..3]).is_err());
let instruction = system_instruction::authorize_nonce_account(&keys[1], &keys[0], &keys[2]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_system(&message.instructions[0], &keys[0..2]).unwrap(),
ParsedInstructionEnum {
instruction_type: "authorizeNonce".to_string(),
info: json!({
"nonceAccount": keys[1].to_string(),
"newAuthorized": keys[2].to_string(),
"nonceAuthority": keys[0].to_string(),
}),
}
);
assert!(parse_system(&message.instructions[0], &keys[0..1]).is_err());
} | rust_cleaned_test_functions.jsonl/130628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17687,
54923,
48508,
368,
341,
286,
1077,
5206,
6894,
25,
11312,
21604,
392,
792,
29,
284,
7486,
0,
15078,
286,
369,
716,
304,
220,
15,
496,
20,
341,
310,
6894,
2552,
80608,
3362,
61783,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_commands_here() {
let cmd1 = r##"89563 @@@ 1603443779 @@@ "/my/path/1" @@@ echo path1"##;
let cmd2 = r##"89563 @@@ 1603443779 @@@ "/my/path/2" @@@ echo path2"##;
let commands = vec![Ok(String::from(cmd1)), Ok(String::from(cmd2))];
let options = Options {
here: true,
today: false,
yesterday: false,
begin: None,
end: None,
socket_addr: None,
};
let here_directory = PathBuf::from("/my/path/1");
let cmds = get_commands(commands.into_iter(), &options, here_directory);
assert_eq!(cmds, vec![String::from("echo path1")])
} | rust_cleaned_test_functions.jsonl/67808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
44151,
73271,
368,
341,
286,
1077,
5439,
16,
284,
435,
565,
1,
23,
24,
20,
21,
18,
569,
19191,
220,
16,
21,
15,
18,
19,
19,
18,
22,
22,
24,
569,
19191,
3521,
2408,
50976,
14,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_6XNN() {
// 0x6XNN - Store number NN in register VX
let opcode = 0x6789;
let mut vm = get_vm();
vm.v[0x7] = 0x0;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x7], 0x89);
} | rust_cleaned_test_functions.jsonl/246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
21,
55,
9745,
368,
341,
262,
442,
220,
15,
87,
21,
55,
9745,
481,
9129,
1372,
44678,
304,
4161,
78177,
271,
262,
1077,
30028,
284,
220,
15,
87,
21,
22,
23,
24,
280,
262,
1077,
5206,
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_node_key_env() {
let mut cmd1 = Command::cargo_bin("factomd").unwrap();
cmd1.arg("--node-key-env")
.arg("FACTOMD_NODE_KEY")
.assert()
.success();
} | rust_cleaned_test_functions.jsonl/86583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
3097,
15879,
368,
341,
262,
1077,
5206,
5439,
16,
284,
7348,
486,
66715,
21816,
445,
33110,
316,
67,
1827,
15454,
1428,
262,
5439,
16,
21186,
21549,
3509,
16173,
67462,
1138,
286,
659,
858,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_split_path() {
assert_eq!(split_path("C:\\a\\b"), (Some("C:\\a"), "b"));
assert_eq!(split_path("C:/a\\b"), (Some("C:/a"), "b"));
assert_eq!(split_path("C:\\a\\b\\c"), (Some("C:\\a\\b"), "c"));
assert_eq!(split_path("a\\b\\c\\d\\e"), (Some("a\\b\\c\\d"), "e"));
assert_eq!(split_path("\\\\UNC\\a"), (Some("\\\\UNC"), "a"));
assert_eq!(split_path("/a/b/c"), (Some("/a/b"), "c"));
assert_eq!(split_path("/a/b/c/d"), (Some("/a/b/c"), "d"));
assert_eq!(split_path("a/b/c"), (Some("a/b"), "c"));
assert_eq!(split_path("a"), (None, "a"));
assert_eq!(split_path("a/"), (None, "a"));
assert_eq!(split_path("/a"), (Some("/"), "a"));
assert_eq!(split_path(""), (None, ""));
assert_eq!(
split_path("foo/아이쿱 조합원 앱카드"),
(Some("foo"), "아이쿱 조합원 앱카드")
);
} | rust_cleaned_test_functions.jsonl/46973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
2638,
368,
341,
286,
2060,
10714,
10297,
6960,
2638,
445,
34,
23817,
64,
3422,
65,
3975,
320,
8373,
445,
34,
23817,
64,
3975,
330,
65,
4010,
286,
2060,
10714,
10297,
6960,
2638,
445,
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... | 1 |
#[test]
fn test_environment_with_runner_from_parent() -> Result<(), Error> {
let decl = ComponentDecl {
environments: vec![EnvironmentDeclBuilder::new()
.name("env")
.add_runner(cm_rust::RunnerRegistration {
source: RegistrationSource::Parent,
source_name: "foo".into(),
target_name: "foo".into(),
})
.build()],
children: vec![
ChildDeclBuilder::new_lazy_child("childA").build(),
ChildDeclBuilder::new_lazy_child("childB").environment("env").build(),
],
..default_component_decl()
};
let mut expected: Vec<(DependencyNode, Vec<DependencyNode>)> = Vec::new();
expected.push((DependencyNode::Child("childA".to_string()), vec![]));
expected.push((DependencyNode::Child("childB".to_string()), vec![]));
validate_results(expected, process_component_dependencies(&decl));
Ok(())
} | rust_cleaned_test_functions.jsonl/63292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 501
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51774,
6615,
54828,
5673,
15960,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
3963,
284,
5578,
21629,
341,
310,
21737,
25,
7486,
20703,
12723,
21629,
3297,
486,
931,
741,
394,
659,
606,
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_works_on_happy_json() {
let route = sphinx_route_to(
topology_fixture(),
&NodeAddressBytes::try_from_base58_string(
"FE7zC2sJZrhXgQWvzXXVH8GHi2xXRynX8UWK8rD8ikf3",
)
.unwrap(),
)
.unwrap();
assert_eq!(4, route.len());
} | rust_cleaned_test_functions.jsonl/45053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11498,
82,
4470,
1523,
11144,
9455,
368,
341,
286,
1077,
6021,
284,
41722,
20014,
28109,
2346,
1006,
310,
44882,
74409,
3148,
310,
609,
1955,
4286,
7078,
486,
1539,
5673,
7651,
20,
23,
3904,
1006,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_in_array_2() {
let result = linear_search(&vec![10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 11);
assert_eq!(result, None);
} | rust_cleaned_test_functions.jsonl/50280 | {
"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,
7913,
1243,
3858,
62,
17,
368,
341,
286,
1077,
1102,
284,
13482,
10716,
2099,
4083,
20703,
16,
15,
11,
220,
24,
11,
220,
23,
11,
220,
22,
11,
220,
21,
11,
220,
20,
11,
220,
19,
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_parse_contents() {
let result: Vec<Lint> = parse_contents(
r#"
declare_clippy_lint! {
pub PTR_ARG,
style,
"really long \
text"
}
declare_clippy_lint!{
pub DOC_MARKDOWN,
pedantic,
"single line"
}
/// some doc comment
declare_deprecated_lint! {
pub SHOULD_ASSERT_EQ,
"`assert!()` will be more flexible with RFC 2011"
}
"#,
"module_name",
)
.collect();
let expected = vec![
Lint::new("ptr_arg", "style", "really long text", None, "module_name"),
Lint::new("doc_markdown", "pedantic", "single line", None, "module_name"),
Lint::new(
"should_assert_eq",
"Deprecated",
"`assert!()` will be more flexible with RFC 2011",
Some("`assert!()` will be more flexible with RFC 2011"),
"module_name",
),
];
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/1254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16682,
368,
341,
262,
1077,
1102,
25,
11312,
27,
47556,
29,
284,
4715,
16682,
1006,
286,
435,
2,
698,
18471,
6794,
45749,
907,
396,
0,
341,
262,
6675,
55196,
13905,
345,
262,
1707,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chain_feedback() {
#[rustfmt::skip]
let tests = vec![
(
vec![3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,
27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5],
&[9,8,7,6,5],
139629729,
),
(
vec![3,52,1001,52,-5,52,3,53,1,52,56,54,1007,54,5,
55,1005,55,26,1001,54,-5,54,1105,1,12,1,53,54,
53,1008,54,0,55,1001,55,1,55,2,53,55,53,4,
53,1001,56,-1,56,1005,56,6,99,0,0,0,0,10],
&[9,7,8,5,6],
18216,
),
];
for (prog, settings, output) in tests {
let prog = Intcode::new(prog);
assert_eq!(output, chain_output_feedback(&prog, settings));
assert_eq!(output, max_output(&prog, chain_output_feedback, 5..=9));
}
} | rust_cleaned_test_functions.jsonl/75779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
58138,
368,
341,
262,
11506,
35788,
12501,
486,
20599,
921,
262,
1077,
7032,
284,
7486,
90515,
286,
2399,
310,
7486,
20703,
18,
11,
17,
21,
11,
16,
15,
15,
16,
11,
17,
21,
4999,
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... | 2 |
#[test]
fn test_anchoring_transaction_builder_funds() {
let funding_tx0: Transaction = Transaction::from_hex(
"02000000000101b651818fe3855d0d5d74de1cf72b56503c16f808519440e842b6\
dc2dd570c4930100000000feffffff02deaa7b0000000000160014923904449829\
cd865cdfb72abdba0806ce9e48911027000000000000220020e9bb049fdff8f8d3\
b33b7335978b1dbb268833a32a69906f9e500e4103151bef02483045022100ddc7\
eb1193529a8d0e48cf24f536d5fbb5de3b67d2f56c98190ea8585d58a156022075\
e33981f1a7d78ce2915402d4b9b38b8d5311e0aef2e3ccf9284d2ce602968d0121\
021d0478acd223fb9b2ad7485f06f12914a1b7effc78390a08c50bfe53b3b24815\
062c1400",
)
.unwrap();
let funding_tx1: Transaction = Transaction::from_hex(
"020000000001018aa4065d472efc80d2a9f26bf0f77aabd5b8fcb45661de8a0161\
cbcc6b5fef9e0000000000feffffff0235837b00000000001600143e9fd2829e66\
868739ddbb8c397a3e35ae02a5151027000000000000220020e9bb049fdff8f8d3\
b33b7335978b1dbb268833a32a69906f9e500e4103151bef0247304402201d2f3c\
a3ec4c82071b825a44c5b8a7455e4e50caef07e988bbe46554846e445702205f1b\
066bf6d747c06b3721ac878104e434e977e0e321191a0c860f05fb3bb319012103\
b475c0164be599df74ea5d4b669fe1c439953e40eea2d4958d66698f26eeaa5f2a\
2c1400",
)
.unwrap();
let funding_tx2: Transaction = Transaction::from_hex(
"0200000000010115c9acef986ba57a7fcf43c6cb60221b70af1da6d3ad6d1e2480\
e55bc80c559c00000000171600147881a57eadd9361c497e2b1671da4ed1c0ac1e\
44feffffff02a086010000000000220020e9bb049fdff8f8d3b33b7335978b1dbb\
268833a32a69906f9e500e4103151bef406df6000000000016001424ff8bab4afa\
feca816e4a8300e135045ce15f6b02483045022100f6b55f77ec53e339d150637a\
76de5436165c27ea415a8175f5fdff634bf91cd402204252dbd3af0ba8a7490912\
68491169dca4477515e2b3155de04ffacfa39f00d4012102ad0617b920ce3a7a48\
1a10222344a7b338e7a13e8e725eb44a3a53354a90f9e32a2c1400",
)
.unwrap();
let keys = vec![
"038b782f94d19f34536a96e12e0bad99e6f82c838fa16a4234572f5f132d95ba29",
"020ae2216f42575c4196864eda0252c75c61273065f691b32be9a99cb2a3c9b4d1",
"02536d5e1464b961562da57207e4a46edb7dade9b92aa29712ca8309c8aba5be5b",
]
.iter()
.map(|h| PublicKey::from_hex(h).unwrap().0)
.collect::<Vec<_>>();
let redeem_script = RedeemScriptBuilder::with_public_keys(keys)
.to_script()
.unwrap();
let mut builder = BtcAnchoringTransactionBuilder::new(&redeem_script);
builder.additional_funds(funding_tx0.clone()).unwrap();
builder.additional_funds(funding_tx1).unwrap();
builder.additional_funds(funding_tx2).unwrap();
builder.fee(1);
builder.payload(Height::zero(), funding_tx0.object_hash());
let (tx, inputs) = builder.create().unwrap();
assert_eq!(inputs.len(), 3);
let inputs = tx.0.input;
assert_eq!(inputs.len(), 3);
let outputs = tx.0.output;
assert_eq!(outputs.len(), 2);
let out_0 = &outputs[0];
let out_1 = &outputs[1];
assert_ne!(out_0.value, 0);
assert_eq!(out_1.value, 0);
} | rust_cleaned_test_functions.jsonl/61862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1943
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3497,
5503,
28884,
28532,
761,
42950,
368,
341,
286,
1077,
10773,
17805,
15,
25,
17869,
284,
17869,
486,
1499,
32655,
1006,
310,
330,
15,
17,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonblock_select_race() {
const N: usize = 1000;
let done = make::<bool>(1);
for _ in 0..N {
let c1 = make::<i32>(1);
let c2 = make::<i32>(1);
c1.send(1);
go!(c1, c2, done, {
select! {
recv(c1.rx()) -> _ => {}
recv(c2.rx()) -> _ => {}
default => {
done.send(false);
return;
}
}
done.send(true);
});
c2.send(1);
select! {
recv(c1.rx()) -> _ => {}
default => {}
}
if !done.recv().unwrap() {
panic!("no chan is ready");
}
}
} | rust_cleaned_test_functions.jsonl/2876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
4574,
13051,
91317,
368,
341,
286,
733,
451,
25,
22301,
284,
220,
16,
15,
15,
15,
401,
286,
1077,
2814,
284,
1281,
27638,
2641,
2235,
16,
317,
286,
369,
716,
304,
220,
15,
496,
45,
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... | 3 |
#[test]
fn test_cross_cmp() {
assert!(Level::Debug > LevelFilter::Error);
assert!(LevelFilter::Warn < Level::Trace);
assert!(LevelFilter::Off < Level::Error);
} | rust_cleaned_test_functions.jsonl/71731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35284,
35193,
368,
341,
286,
2060,
10297,
4449,
486,
7939,
861,
9395,
5632,
486,
1454,
317,
286,
2060,
10297,
4449,
5632,
486,
38244,
366,
9395,
486,
6550,
317,
286,
2060,
10297,
4449,
5632,
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 |
#[test]
fn test_empty_repeat_vars_in_empty_repeat_vars() {
parse_macro(
r#"
macro_rules! delegate_impl {
([$self_type:ident, $self_wrap:ty, $self_map:ident]
pub trait $name:ident $(: $sup:ident)* $(+ $more_sup:ident)* {
// "Escaped" associated types. Stripped before making the `trait`
// itself, but forwarded when delegating impls.
$(
@escape [type $assoc_name_ext:ident]
// Associated types. Forwarded.
)*
$(
@section type
$(
$(#[$_assoc_attr:meta])*
type $assoc_name:ident $(: $assoc_bound:ty)*;
)+
)*
// Methods. Forwarded. Using $self_map!(self) around the self argument.
// Methods must use receiver `self` or explicit type like `self: &Self`
// &self and &mut self are _not_ supported.
$(
@section self
$(
$(#[$_method_attr:meta])*
fn $method_name:ident(self $(: $self_selftype:ty)* $(,$marg:ident : $marg_ty:ty)*) -> $mret:ty;
)+
)*
// Arbitrary tail that is ignored when forwarding.
$(
@section nodelegate
$($tail:tt)*
)*
}) => {
impl<> $name for $self_wrap where $self_type: $name {
$(
$(
fn $method_name(self $(: $self_selftype)* $(,$marg: $marg_ty)*) -> $mret {
$self_map!(self).$method_name($($marg),*)
}
)*
)*
}
}
}
"#,
).assert_expand_items(
r#"delegate_impl ! {[G , & 'a mut G , deref] pub trait Data : GraphBase {@ section type type NodeWeight ;}}"#,
"impl <> Data for & \'a mut G where G : Data {}",
);
} | rust_cleaned_test_functions.jsonl/28772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 886
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
41975,
11168,
1243,
15124,
41975,
11168,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
32606,
21407,
0,
13380,
21007,
341,
262,
320,
3442,
721,
1819,
25,
1713,
11,
400,
721,
38550,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_label() {
test_lexer! {
"'asdf 'a' \"foo bar\"",
ast::Token {
span: Span::new(0, 5),
kind: ast::Kind::Label,
},
ast::Token {
span: Span::new(6, 9),
kind: ast::Kind::LitChar,
},
ast::Token {
span: Span::new(10, 19),
kind: ast::Kind::LitStr {
escaped: false,
},
}
};
} | rust_cleaned_test_functions.jsonl/57216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6106,
368,
341,
286,
1273,
62,
38815,
0,
341,
310,
7178,
76615,
364,
64,
6,
7245,
7975,
3619,
95901,
310,
11763,
486,
3323,
341,
394,
9390,
25,
11903,
486,
931,
7,
15,
11,
220,
20,
1326,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_month_day_special_case() {
let context = build_context(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)));
let month = MonthDay::new_unchecked(2, 31);
let walker = month.to_walker(&context.reference, &context);
assert_eq!(None, walker.forward.clone().next());
assert_eq!(None, walker.backward.clone().next());
} | rust_cleaned_test_functions.jsonl/114685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18933,
16763,
41629,
19096,
368,
341,
286,
1077,
2266,
284,
1936,
8467,
3189,
12913,
7,
59604,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
1523,
1011,
7,
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_single() {
struct Foo;
impl fmt::Debug for Foo {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&true)
.finish()
}
}
assert_eq!("Foo(true)", format!("{:?}", Foo));
assert_eq!(
"Foo(
true,
)",
format!("{:#?}", Foo));
} | rust_cleaned_test_functions.jsonl/69312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
368,
341,
286,
2036,
33428,
401,
286,
11605,
8879,
486,
7939,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
8879,
486,
14183,
18291,
62,
9231,
1464,
8879,
486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_auth_tokens_multiple() {
let auth_tokens =
AuthTokens::new(Some("abc123@deno.land;def456@example.com".to_string()));
let fixture = resolve_url("https://deno.land/x/mod.ts").unwrap();
assert_eq!(
auth_tokens.get(&fixture).unwrap().to_string(),
"Bearer abc123".to_string()
);
let fixture = resolve_url("http://example.com/a/file.ts").unwrap();
assert_eq!(
auth_tokens.get(&fixture).unwrap().to_string(),
"Bearer def456".to_string()
);
} | rust_cleaned_test_functions.jsonl/105822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14014,
28838,
45233,
368,
341,
262,
1077,
4166,
28838,
4035,
414,
7366,
29300,
486,
931,
65405,
445,
13683,
16,
17,
18,
31,
5183,
78,
87627,
26,
750,
19,
20,
21,
35487,
905,
3263,
983,
3904,
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_no_panic() {
assert!(eval(&format!(
"{} + {}",
IntType::max_value(),
IntType::max_value()
))
.is_err());
assert!(eval(&format!(
"-{} - {}",
IntType::max_value(),
IntType::max_value()
))
.is_err());
assert!(eval(&format!("-(-{} - 1)", IntType::max_value())).is_err());
assert!(eval(&format!(
"{} * {}",
IntType::max_value(),
IntType::max_value()
))
.is_err());
assert!(eval(&format!("{} / {}", IntType::max_value(), 0)).is_err());
assert!(eval(&format!("{} % {}", IntType::max_value(), 0)).is_err());
assert!(eval(&format!(
"{} ^ {}",
IntType::max_value(),
IntType::max_value()
))
.is_ok());
} | rust_cleaned_test_functions.jsonl/105350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
620,
31270,
368,
341,
262,
2060,
10297,
14170,
2099,
2243,
33673,
286,
35503,
488,
4687,
756,
286,
1333,
929,
486,
2810,
3142,
3148,
286,
1333,
929,
486,
2810,
3142,
741,
262,
19245,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonce_valid() {
let lst = [
"XFHw3qcgFNZAdw",
"XFHw3qcg-NZAdw",
"XFHw3qcg_NZAdw",
"XFHw3qcg-_ZAdw",
"a",
"1",
"-",
"_",
];
for n in lst.iter() {
assert!(is_nonce(n));
}
} | rust_cleaned_test_functions.jsonl/19261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
8337,
368,
341,
286,
1077,
18845,
284,
2278,
310,
330,
66138,
39,
86,
18,
80,
27446,
41604,
57,
2589,
86,
756,
310,
330,
66138,
39,
86,
18,
80,
27446,
11250,
57,
2589,
86,
756,
310,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_validate_isbn() {
let a = "ISBN13 978-1-4920-6766-5";
let b = "ISBN-13 9781492067665";
let c = "978-1-4920-6766-5";
let d = "9781492067665";
let e = "978-1-4920-6766-6";
assert_eq!(validate_isbn(a), true);
assert_eq!(validate_isbn(b), true);
assert_eq!(validate_isbn(c), true);
assert_eq!(validate_isbn(d), true);
assert_eq!(validate_isbn(e), false);
} | rust_cleaned_test_functions.jsonl/92004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
6892,
11081,
368,
341,
286,
1077,
264,
284,
330,
45185,
16,
18,
220,
24,
22,
23,
12,
16,
12,
19,
24,
17,
15,
12,
21,
22,
21,
21,
12,
20,
876,
286,
1077,
293,
284,
330,
45185,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_group_pattern_with_multiple_defs() {
parse_macro(
r#"
macro_rules! foo {
($ ($ i:ident),*) => ( struct Bar { $ (
fn $ i {}
)*} );
}
"#,
)
.assert_expand_items("foo! { foo, bar }", "struct Bar {fn foo {} fn bar {}}");
} | rust_cleaned_test_functions.jsonl/28711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
6288,
21260,
6615,
45233,
56535,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
1711,
600,
25,
1713,
701,
3764,
589,
320,
2036,
4716,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_btf_type_fwd() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x0b, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Fwd(_)) => {}
Ok(t) => panic!("expected fwd type, got {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
81083,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
65,
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... | 2 |
#[test]
fn test_from_reference_files() {
let before_file = std::str::from_utf8(include_bytes!("resources/small-lib-before.rs")).unwrap();
let expected_lib = include_bytes!("resources/after/lib.rs");
let expected_interrupt = include_bytes!("resources/after/interrupt.rs");
let expected_ac = include_bytes!("resources/after/ac.rs");
let expected_ac2 = include_bytes!("resources/after/ac/ac2.rs");
let expected_ac3 = include_bytes!("resources/after/ac/ac2/ac3.rs");
let lib_dir = tempdir().unwrap();
create_directory_structure(lib_dir.path(), before_file.to_string()).unwrap();
compare_to_expected(expected_lib, lib_dir.path().join("lib.rs"));
compare_to_expected(expected_interrupt, lib_dir.path().join("interrupt.rs"));
compare_to_expected(expected_ac, lib_dir.path().join("ac.rs"));
compare_to_expected(expected_ac2, lib_dir.path().join("ac/ac2.rs"));
compare_to_expected(expected_ac3, lib_dir.path().join("ac/ac2/ac3.rs"));
} | rust_cleaned_test_functions.jsonl/121496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
25433,
10931,
368,
1476,
262,
1077,
1573,
2458,
284,
1460,
486,
495,
486,
1499,
39453,
23,
77863,
12524,
17223,
12745,
96816,
38641,
69447,
25638,
15197,
15454,
1428,
262,
1077,
3601,
16142,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt_series() {
let s = Series::new("foo", &["Somelongstringto eeat wit me oundaf"]);
dbg!(&s);
assert_eq!(
r#"shape: (1,)
Series: 'foo' [str]
[
"Somelongstring...
]"#,
format!("{:?}", s)
);
let s = Series::new("foo", &["😀😁😂😃😄😅😆😇😈😉😊😋😌😎😏😐😑😒😓"]);
dbg!(&s);
assert_eq!(
r#"shape: (1,)
Series: 'foo' [str]
[
"😀😁😂😃😄😅😆😇😈😉😊😋😌😎...
]"#,
format!("{:?}", s)
);
let s = Series::new("foo", &["yzäöüäöüäöüäö"]);
dbg!(&s);
assert_eq!(
r#"shape: (1,)
Series: 'foo' [str]
[
"yzäöüäöüäöüäö"
]"#,
format!("{:?}", s)
);
let s = Series::new("foo", (0..100).collect::<Vec<_>>());
dbg!(&s);
assert_eq!(
r#"shape: (100,)
Series: 'foo' [i32]
[
0
1
2
3
4
5
6
7
8
9
10
11
...
88
89
90
91
92
93
94
95
96
97
98
99
]"#,
format!("{:?}", s)
);
} | rust_cleaned_test_functions.jsonl/4394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 685
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
35015,
368,
341,
286,
1077,
274,
284,
11131,
486,
931,
445,
7975,
497,
609,
1183,
49882,
38022,
917,
983,
384,
32066,
37367,
752,
220,
795,
2577,
15049,
286,
47904,
0,
2099,
82,
317,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cargo_env_vars() {
assert_eq!(
std::env::var("NEXTEST").as_deref(),
Ok("1"),
"NEXTEST environment variable set to 1"
);
assert_env!("CARGO");
assert_env!("CARGO_MANIFEST_DIR");
assert_env!("CARGO_PKG_VERSION");
assert_env!("CARGO_PKG_VERSION_MAJOR");
assert_env!("CARGO_PKG_VERSION_MINOR");
assert_env!("CARGO_PKG_VERSION_PATCH");
assert_env!("CARGO_PKG_VERSION_PRE");
assert_env!("CARGO_PKG_AUTHORS");
assert_env!("CARGO_PKG_NAME");
assert_env!("CARGO_PKG_DESCRIPTION");
assert_env!("CARGO_PKG_HOMEPAGE");
assert_env!("CARGO_PKG_REPOSITORY");
assert_env!("CARGO_PKG_LICENSE");
assert_env!("CARGO_PKG_LICENSE_FILE");
// CARGO_CRATE_NAME is missing at runtime
// CARGO_BIN_EXE is missing at runtime
// CARGO_PRIMARY_PACKAGE is missing at runtime
// CARGO_TARGET_TMPDIR is missing at runtime
// TODO: dynamic library paths?
} | rust_cleaned_test_functions.jsonl/77296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
12088,
15879,
11168,
368,
341,
262,
2060,
10714,
33673,
286,
1460,
486,
3160,
486,
947,
445,
45,
3257,
10033,
1827,
300,
814,
43970,
3148,
286,
7622,
445,
16,
4461,
286,
330,
45,
3257,
1003... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aesni_128() {
if util::supports_aesni() {
let tests = tests128();
for t in tests.iter() {
let mut enc = aesni::AesNiEncryptor::new(KeySize128, &t.key[..]);
let mut dec = aesni::AesNiDecryptor::new(KeySize128, &t.key[..]);
run_test(&mut enc, &mut dec, t);
}
}
} | rust_cleaned_test_functions.jsonl/60750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
7751,
62,
16,
17,
23,
368,
341,
286,
421,
4094,
486,
77709,
90958,
7751,
368,
341,
310,
1077,
7032,
284,
7032,
16,
17,
23,
543,
310,
369,
259,
304,
7032,
19471,
368,
341,
394,
1077,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_json_as_int() {
test_none_with_ctx(cast_any_as_any::<Json, Int>);
// no overflow
let cs = vec![
(Json::Object(BTreeMap::default()), 0, false),
(Json::Array(vec![]), 0, false),
(Json::I64(10), 10i64, false),
(Json::I64(i64::MAX), i64::MAX, false),
(Json::I64(i64::MIN), i64::MIN, false),
(Json::U64(0), 0, false),
(Json::U64(u64::MAX), u64::MAX as i64, false),
(Json::Double(i64::MIN as u64 as f64), i64::MAX, false),
(Json::Double(i64::MAX as u64 as f64), i64::MAX, false),
(Json::Double(i64::MIN as u64 as f64), i64::MAX, false),
(Json::Double(i64::MIN as f64), i64::MIN, false),
(Json::Double(10.5), 11, false),
(Json::Double(10.4), 10, false),
(Json::Double(-10.4), -10, false),
(Json::Double(-10.5), -11, false),
(Json::String(String::from("10.0")), 10, false),
(Json::Boolean(true), 1, false),
(Json::Boolean(false), 0, false),
(Json::None, 0, false),
(
Json::Double(((1u64 << 63) + (1u64 << 62)) as u64 as f64),
i64::MAX,
true,
),
(
Json::Double(-((1u64 << 63) as f64 + (1u64 << 62) as f64)),
i64::MIN,
true,
),
];
for (input, expect, overflow) in cs {
let mut ctx = make_ctx_about_overflow_truncate_should_clip_to_zero(true, false, false);
let r = cast_any_as_any::<Json, Int>(&mut ctx, &Some(input.clone()));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_overflow(&ctx, overflow, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1072
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
4042,
368,
341,
286,
1273,
31488,
6615,
15147,
1337,
559,
37248,
11898,
37248,
27638,
5014,
11,
1333,
29,
626,
286,
442,
902,
16484,
198,
286,
1077,
10532,
284,
7486,
90515,
3374,
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... | 2 |
#[test]
fn test_fq_num_bits() {
assert_eq!(FqParameters::MODULUS_BITS, 254);
assert_eq!(FqParameters::CAPACITY, 253);
} | rust_cleaned_test_functions.jsonl/3551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
4273,
20034,
368,
341,
262,
2060,
10714,
10297,
37,
80,
9706,
486,
26459,
1094,
2034,
32695,
11,
220,
17,
20,
19,
317,
262,
2060,
10714,
10297,
37,
80,
9706,
486,
31400,
62985,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dense_update_eval() {
let projector = Fourier::new(3, vec![(0.0, 10.0)]).normalise_l2();
let mut evaluator = VectorFunction::zeros(projector.dim(), 2);
assert_eq!(evaluator.n_outputs(), 2);
assert_eq!(evaluator.weights.len(), 6);
let features = projector.project(&vec![5.0]);
let _ = evaluator.update(&features, Vector::from_vec(vec![20.0, 50.0]));
let out = evaluator.evaluate(&features).unwrap();
assert!((out[0] - 20.0).abs() < 1e-6);
assert!((out[1] - 50.0).abs() < 1e-6);
} | rust_cleaned_test_functions.jsonl/26873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72619,
8882,
21296,
368,
341,
286,
1077,
67985,
284,
88954,
486,
931,
7,
18,
11,
7486,
0,
9697,
15,
13,
15,
11,
220,
16,
15,
13,
15,
7252,
568,
8252,
1064,
907,
17,
543,
286,
1077,
5206,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort() {
let m = indexmap! {
1 => 2,
7 => 1,
2 => 2,
3 => 3,
};
itertools::assert_equal(m.sorted_by(|_k1, v1, _k2, v2| v1.cmp(v2)),
vec![(7, 1), (1, 2), (2, 2), (3, 3)]);
} | rust_cleaned_test_functions.jsonl/103154 | {
"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,
18435,
368,
341,
262,
1077,
296,
284,
1922,
2186,
0,
341,
286,
220,
16,
589,
220,
17,
345,
286,
220,
22,
589,
220,
16,
345,
286,
220,
17,
589,
220,
17,
345,
286,
220,
18,
589,
220,
18,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tabs_fail() {
let mut a = Assert::new();
a.dialect_set(|d| d.enable_tabs = false);
a.fail("def f():\n\tpass", "Parse error");
a.fail("def f():\n x\t=3", "Parse error");
} | rust_cleaned_test_functions.jsonl/92426 | {
"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,
57953,
22121,
368,
341,
262,
1077,
5206,
264,
284,
5319,
486,
931,
543,
262,
264,
950,
55056,
2602,
22428,
67,
91,
294,
28697,
57953,
284,
895,
317,
262,
264,
26738,
445,
750,
282,
4555,
59,
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() {
let g = MatrixGraph::<i32, i32>::new();
assert_eq!(g.node_count(), 0);
assert_eq!(g.edge_count(), 0);
} | rust_cleaned_test_functions.jsonl/81953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
342,
284,
11631,
11212,
27638,
72,
18,
17,
11,
600,
18,
17,
6831,
931,
543,
286,
2060,
10714,
10297,
70,
12097,
3180,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_if() {
for &(val, expectation) in [(true, "true"), (false, "false")].iter() {
let mut ctx = std::collections::BTreeMap::new();
ctx.insert("cond", Value::from(val));
let mut c = Compiler::new();
c.add(Instruction::Lookup("cond"));
c.start_if();
c.add(Instruction::EmitRaw("true"));
c.start_else();
c.add(Instruction::EmitRaw("false"));
c.end_if();
let mut output = String::new();
simple_eval(&c.finish().0, ctx, &mut output).unwrap();
assert_eq!(output, expectation);
}
} | rust_cleaned_test_functions.jsonl/72122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
368,
341,
262,
369,
22796,
831,
11,
30193,
8,
304,
17826,
1866,
11,
330,
1866,
3975,
320,
3849,
11,
330,
3849,
899,
936,
2015,
368,
341,
286,
1077,
5206,
5635,
284,
1460,
486,
51137,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boolean_is_ident() {
check(
r#"
macro_rules! m {
($lit0:literal, $lit1:literal) => { const VALUE: (bool, bool) = ($lit0, $lit1); };
}
m!(true, false);
"#,
expect![[r#"
macro_rules! m {
($lit0:literal, $lit1:literal) => { const VALUE: (bool, bool) = ($lit0, $lit1); };
}
const VALUE: (bool, bool) = (true , false );
"#]],
);
} | rust_cleaned_test_functions.jsonl/85251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
6892,
38399,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
296,
341,
262,
1711,
31635,
15,
25,
35785,
11,
400,
31635,
16,
25,
35785,
8,
589,
314,
733,
26827,
25,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_left_associativity() {
let grm = YaccGrammar::new(YaccKind::Original(YaccOriginalActionKind::GenericParseTree), &"
%start Expr
%left '+'
%left '*'
%%
Expr : Expr '+' Expr
| Expr '*' Expr
| 'id' ;
").unwrap();
let sg = pager_stategraph(&grm);
let st = StateTable::new(&grm, &sg).unwrap();
let len = usize::from(grm.tokens_len()) * usize::from(sg.all_states_len());
assert_eq!(st.actions.len(), len);
let s0 = StIdx(0);
let s1 = sg.edge(s0, Symbol::Rule(grm.rule_idx("Expr").unwrap())).unwrap();
let s3 = sg.edge(s1, Symbol::Token(grm.token_idx("+").unwrap())).unwrap();
let s4 = sg.edge(s1, Symbol::Token(grm.token_idx("*").unwrap())).unwrap();
let s5 = sg.edge(s4, Symbol::Rule(grm.rule_idx("Expr").unwrap())).unwrap();
let s6 = sg.edge(s3, Symbol::Rule(grm.rule_idx("Expr").unwrap())).unwrap();
assert_eq!(st.action(s5, grm.token_idx("+").unwrap()),
Action::Reduce(grm.rule_to_prods(grm.rule_idx("Expr").unwrap())[1]));
assert_eq!(st.action(s5, grm.token_idx("*").unwrap()),
Action::Reduce(grm.rule_to_prods(grm.rule_idx("Expr").unwrap())[1]));
assert_eq!(st.action(s5, grm.eof_token_idx()),
Action::Reduce(grm.rule_to_prods(grm.rule_idx("Expr").unwrap())[1]));
assert_eq!(st.action(s6, grm.token_idx("+").unwrap()),
Action::Reduce(grm.rule_to_prods(grm.rule_idx("Expr").unwrap())[0]));
assert_eq!(st.action(s6, grm.token_idx("*").unwrap()),
Action::Shift(s4));
assert_eq!(st.action(s6, grm.eof_token_idx()),
Action::Reduce(grm.rule_to_prods(grm.rule_idx("Expr").unwrap())[0]));
} | rust_cleaned_test_functions.jsonl/38023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1031
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9579,
58665,
43415,
368,
341,
286,
1077,
1081,
76,
284,
809,
4475,
97178,
486,
931,
20206,
4475,
10629,
486,
18395,
20206,
4475,
18395,
2512,
10629,
486,
19964,
14463,
6533,
701,
609,
698,
310,
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_invalid_node_type() {
let mut bytecode: Vec<u8> = BIND_HEADER.to_vec();
append_section_header(&mut bytecode, SYMB_MAGIC_NUM, 18);
let device_name: [u8; 5] = [0x49, 0x42, 0x49, 0x53, 0]; // "IBIS"
bytecode.extend_from_slice(&[1, 0, 0, 0]);
bytecode.extend_from_slice(&device_name);
let primary_node_name: [u8; 5] = [0x52, 0x41, 0x49, 0x4C, 0]; // "RAIL"
bytecode.extend_from_slice(&[2, 0, 0, 0]);
bytecode.extend_from_slice(&primary_node_name);
let primary_node_inst = [0x30];
let composite_insts_sz =
COMPOSITE_NAME_ID_BYTES + (NODE_TYPE_HEADER_SZ + primary_node_inst.len()) as u32;
append_section_header(&mut bytecode, COMPOSITE_MAGIC_NUM, composite_insts_sz);
// Add device name ID.
bytecode.extend_from_slice(&[1, 0, 0, 0]);
// Add the node instructions with an invalid node type.
bytecode.push(0x52);
bytecode.extend_from_slice(&[2, 0, 0, 0]);
bytecode.extend_from_slice(&(primary_node_inst.len() as u32).to_le_bytes());
bytecode.extend_from_slice(&primary_node_inst);
assert_eq!(Err(BytecodeError::InvalidNodeType(0x52)), DecodedRules::new(bytecode));
} | rust_cleaned_test_functions.jsonl/24048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5084,
1819,
368,
341,
286,
1077,
5206,
75129,
25,
11312,
34837,
23,
29,
284,
91370,
20330,
2389,
13251,
543,
286,
8737,
16221,
8757,
2099,
6984,
75129,
11,
16079,
8412,
49194,
9631,
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_parse_expr_key_and_numbers() {
assert_parse_length_expr("key + 4", &["key"], "_self.get_key() as usize + 4");
assert_parse_length_expr(
"another_key - 7 + 8 * 2 / 1 % 2",
&["another_key"],
"_self.get_another_key() as usize - 7 + 8 * 2 / 1 % 2",
);
assert_parse_length_expr("2 * key - 4", &["key"], "2 * _self.get_key() as usize - 4");
} | rust_cleaned_test_functions.jsonl/114323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
21915,
3097,
8378,
32964,
368,
341,
286,
2060,
21039,
5118,
21915,
445,
792,
488,
220,
19,
497,
609,
1183,
792,
7914,
9000,
721,
670,
3097,
368,
438,
22301,
488,
220,
19,
797,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quality_item_fmt_q_0001() {
let x = QualityItem::new(Chunked, Quality(1));
assert_eq!(format!("{}", x), "chunked; q=0.001");
} | rust_cleaned_test_functions.jsonl/65729 | {
"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,
55074,
5634,
38128,
8976,
62,
15,
15,
15,
16,
368,
341,
286,
1077,
856,
284,
17927,
1234,
486,
931,
7,
28304,
291,
11,
17927,
7,
16,
1106,
286,
2060,
10714,
10297,
2243,
79878,
856,
701,
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 |
#[test]
fn test_error_on_duplicate_requests() {
let actor: ActorID = "37704788917a499cb0206fa8519ac4d9".try_into().unwrap();
let change_request1 = UncompressedChange {
actor_id: actor.clone(),
seq: 1,
message: None,
hash: None,
time: 0,
deps: Vec::new(),
start_op: 1,
operations: vec![Op {
action: protocol::OpType::Set("magpie".into()),
obj: ObjectID::Root,
key: "bird".into(),
insert: false,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let change_request2 = UncompressedChange {
actor_id: actor,
seq: 2,
message: None,
hash: None,
time: 0,
deps: Vec::new(),
start_op: 2,
operations: vec![Op {
action: protocol::OpType::Set("jay".into()),
obj: ObjectID::Root,
key: "bird".into(),
insert: false,
pred: Vec::new(),
}],
extra_bytes: Vec::new(),
};
let mut backend = Backend::init();
backend.apply_local_change(change_request1.clone()).unwrap();
backend.apply_local_change(change_request2.clone()).unwrap();
assert!(backend.apply_local_change(change_request1).is_err());
assert!(backend.apply_local_change(change_request2).is_err());
} | rust_cleaned_test_functions.jsonl/22976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 676
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
4470,
70434,
37216,
368,
341,
262,
1077,
12089,
25,
24718,
915,
284,
330,
18,
22,
22,
15,
19,
22,
23,
23,
24,
16,
22,
64,
19,
24,
24,
7221,
15,
17,
15,
21,
3632,
23,
20,
16,
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_collatz_sequence() {
let mut c = collatz(13);
assert_eq!(c.next(), Some(40));
assert_eq!(c.next(), Some(20));
assert_eq!(c.next(), Some(10));
assert_eq!(c.next(), Some(5));
assert_eq!(c.next(), Some(16));
assert_eq!(c.next(), Some(8));
assert_eq!(c.next(), Some(4));
assert_eq!(c.next(), Some(2));
assert_eq!(c.next(), Some(1));
assert_eq!(c.next(), None);
} | rust_cleaned_test_functions.jsonl/45542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43597,
20175,
23735,
368,
341,
286,
1077,
5206,
272,
284,
4530,
20175,
7,
16,
18,
626,
286,
2060,
10714,
10297,
66,
4529,
1507,
4329,
7,
19,
15,
1106,
286,
2060,
10714,
10297,
66,
4529,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_established_send_wrap() {
let mut s = socket_established();
let local_seq_start = TcpSeqNumber(i32::MAX - 1);
s.local_seq_no = local_seq_start + 1;
s.remote_last_seq = local_seq_start + 1;
s.send_slice(b"abc").unwrap();
recv!(s, time 1000, Ok(TcpRepr {
seq_number: local_seq_start + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abc"[..],
..RECV_TEMPL
}));
} | rust_cleaned_test_functions.jsonl/1724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18583,
5102,
291,
13565,
38550,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
1077,
2205,
14486,
4906,
284,
64876,
20183,
2833,
1956,
18,
17,
486,
10586,
481,
220,
16,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string() {
let cfg = PayloadConfig::default();
let mut req = TestRequest::with_header(header::CONTENT_LENGTH, "11").finish();
req.payload_mut()
.unread_data(Bytes::from_static(b"hello=world"));
match String::from_request(&req, &cfg).poll().unwrap() {
Async::Ready(s) => {
assert_eq!(s, "hello=world");
}
_ => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/75108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
286,
1077,
13286,
284,
52916,
2648,
486,
2258,
543,
286,
1077,
5206,
4232,
284,
3393,
1900,
486,
4197,
8757,
25534,
486,
67872,
15023,
11,
330,
16,
16,
1827,
30150,
543,
286,
423... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.