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_try_from_record_for_contig_with_an_invalid_length() {
let record = Record::new(
record::Key::Contig,
record::Value::Struct(vec![
(String::from("ID"), String::from("sq0")),
(String::from("length"), String::from("NA")),
]),
);
assert!(matches!(
Contig::try_from(record),
Err(TryFromRecordError::InvalidLength(_))
));
} | rust_cleaned_test_functions.jsonl/81754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
14192,
5478,
10260,
343,
6615,
12008,
31433,
5118,
368,
341,
286,
1077,
3255,
284,
13583,
486,
931,
1006,
310,
3255,
486,
1592,
486,
818,
343,
345,
310,
3255,
486,
1130,
486,
9422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hex_color_3_char_hex() {
let ok = HexColor::try_from("#d18").unwrap();
assert_eq!(ok.to_string(), "#d18");
} | rust_cleaned_test_functions.jsonl/121606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
6714,
62,
18,
9232,
32655,
368,
341,
286,
1077,
5394,
284,
27228,
1636,
486,
1539,
5673,
3584,
67,
16,
23,
1827,
15454,
543,
286,
2060,
10714,
10297,
562,
2389,
3904,
1507,
5869,
67,
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 |
#[test]
fn test_version_parse() {
assert_eq!(Version::parse("1"), Err("1"));
assert_eq!(Version::parse("1."), Err("1."));
assert_eq!(Version::parse("1 h3l1o. W0rld"), Err("1 h3l1o. W0rld"));
assert_eq!(Version::parse("1. h3l1o. W0rld"), Err("1. h3l1o. W0rld"));
assert_eq!(Version::parse("1.2.3"), Ok(Version::new(1, 2, Some(3), "")));
assert_eq!(Version::parse("1.2"), Ok(Version::new(1, 2, None, "")));
assert_eq!(Version::parse("1.2 h3l1o. W0rld"), Ok(Version::new(1, 2, None, "h3l1o. W0rld")));
assert_eq!(Version::parse("1.2.h3l1o. W0rld"), Ok(Version::new(1, 2, None, "W0rld")));
assert_eq!(Version::parse("1.2. h3l1o. W0rld"), Ok(Version::new(1, 2, None, "h3l1o. W0rld")));
assert_eq!(Version::parse("1.2.3.h3l1o. W0rld"), Ok(Version::new(1, 2, Some(3), "W0rld")));
assert_eq!(Version::parse("1.2.3 h3l1o. W0rld"), Ok(Version::new(1, 2, Some(3), "h3l1o. W0rld")));
assert_eq!(Version::parse("OpenGL ES 3.1"), Ok(Version::new_embedded(3, 1, "")));
assert_eq!(Version::parse("OpenGL ES 2.0 Google Nexus"), Ok(Version::new_embedded(2, 0, "Google Nexus")));
assert_eq!(Version::parse("GLSL ES 1.1"), Ok(Version::new_embedded(1, 1, "")));
} | rust_cleaned_test_functions.jsonl/61346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
21039,
368,
341,
286,
2060,
10714,
10297,
5637,
486,
6400,
445,
16,
3975,
15495,
445,
16,
4010,
286,
2060,
10714,
10297,
5637,
486,
6400,
445,
16,
82815,
15495,
445,
16,
54136,
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_sample() {
let df = df![
"foo" => &[1, 2, 3, 4, 5]
]
.unwrap();
// default samples are random and don't require seeds
assert!(df.sample_n(3, false, false, None).is_ok());
assert!(df.sample_frac(0.4, false, false, None).is_ok());
// with seeding
assert!(df.sample_n(3, false, false, Some(0)).is_ok());
assert!(df.sample_frac(0.4, false, false, Some(0)).is_ok());
assert!(df.sample_frac(2.0, false, false, Some(0)).is_err());
assert!(df.sample_n(3, true, false, Some(0)).is_ok());
assert!(df.sample_frac(0.4, true, false, Some(0)).is_ok());
assert!(df.sample_frac(2.0, true, false, Some(0)).is_ok());
} | rust_cleaned_test_functions.jsonl/46599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
368,
341,
262,
1077,
6764,
284,
6764,
90515,
310,
330,
7975,
1,
589,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
921,
286,
5133,
286,
659,
15454,
1428,
262,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_user_permissions() {
let desmos_cli = DesmosCli::default();
let contract_address = desmos_cli.get_contract_by_code(1);
let query = DesmosChain {
request: SubspacesQuery::UserPermissions {
subspace_id: TEST_SUBSPACE,
user: Addr::unchecked(USER1_ADDRESS),
}
.into(),
};
let response: QueryUserPermissionsResponse =
desmos_cli.wasm_query(&contract_address, &query).to_object();
// Should be only the user1
assert_eq!(31, response.permissions);
} | rust_cleaned_test_functions.jsonl/93738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
3317,
44767,
368,
341,
286,
1077,
939,
8631,
47147,
284,
3874,
8631,
87014,
486,
2258,
543,
286,
1077,
5116,
6744,
284,
939,
8631,
47147,
670,
51499,
3710,
4136,
7,
16,
626,
286,
1077,
323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_debug_data() {
let frame = GoawayFrame::new(0, ErrorCode::ProtocolError);
let expected: Vec<u8> = raw_frame_from_parts((8, 0x7, 0, 0), vec![0, 0, 0, 0, 0, 0, 0, 1])
.into();
let raw = serialize_frame(&frame);
assert_eq!(expected, raw);
} | rust_cleaned_test_functions.jsonl/38129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
6536,
15446,
1769,
368,
341,
286,
1077,
4034,
284,
5994,
13757,
4369,
486,
931,
7,
15,
11,
60084,
486,
20689,
1454,
317,
286,
1077,
3601,
25,
11312,
34837,
23,
29,
284,
7112,
8929,
5673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bulk_load_crash() {
let bulk_nodes = vec![
[570.0, 1080.0, 89.0],
[30.0, 1080.0, 627.0],
[1916.0, 1080.0, 68.0],
[274.0, 1080.0, 790.0],
[476.0, 1080.0, 895.0],
[1557.0, 1080.0, 250.0],
[1546.0, 1080.0, 883.0],
[1512.0, 1080.0, 610.0],
[1729.0, 1080.0, 358.0],
[1841.0, 1080.0, 434.0],
[1752.0, 1080.0, 696.0],
[1674.0, 1080.0, 705.0],
[136.0, 1080.0, 22.0],
[1593.0, 1080.0, 71.0],
[586.0, 1080.0, 272.0],
[348.0, 1080.0, 373.0],
[502.0, 1080.0, 2.0],
[1488.0, 1080.0, 1072.0],
[31.0, 1080.0, 526.0],
[1695.0, 1080.0, 559.0],
[1663.0, 1080.0, 298.0],
[316.0, 1080.0, 417.0],
[1348.0, 1080.0, 731.0],
[784.0, 1080.0, 126.0],
[225.0, 1080.0, 847.0],
[79.0, 1080.0, 819.0],
[320.0, 1080.0, 504.0],
[1714.0, 1080.0, 1026.0],
[264.0, 1080.0, 229.0],
[108.0, 1080.0, 158.0],
[1665.0, 1080.0, 604.0],
[496.0, 1080.0, 231.0],
[1813.0, 1080.0, 865.0],
[1200.0, 1080.0, 326.0],
[1661.0, 1080.0, 818.0],
[135.0, 1080.0, 229.0],
[424.0, 1080.0, 1016.0],
[1708.0, 1080.0, 791.0],
[1626.0, 1080.0, 682.0],
[442.0, 1080.0, 895.0],
];
let nodes = vec![
[1916.0, 1060.0, 68.0],
[1664.0, 1060.0, 298.0],
[1594.0, 1060.0, 71.0],
[225.0, 1060.0, 846.0],
[1841.0, 1060.0, 434.0],
[502.0, 1060.0, 2.0],
[1625.5852, 1060.0122, 682.0],
[1348.5273, 1060.0029, 731.08124],
[316.36127, 1060.0298, 418.24515],
[1729.3253, 1060.0023, 358.50134],
];
let mut tree = RTree::bulk_load(bulk_nodes);
for node in nodes {
// which is intentional and not harmful.
tree.insert(node);
tree.root().sanity_check::<DefaultParams>(false);
}
} | rust_cleaned_test_functions.jsonl/125867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71392,
12411,
32331,
988,
368,
341,
286,
1077,
19583,
14896,
284,
7486,
90515,
310,
508,
20,
22,
15,
13,
15,
11,
220,
16,
15,
23,
15,
13,
15,
11,
220,
23,
24,
13,
15,
1259,
310,
508,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_symlink_custom_backup_suffix() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_symlink_custom_backup_suffix";
let link = "test_symlink_custom_backup_suffix_link";
let suffix = "super-suffix-of-the-century";
at.touch(file);
at.symlink_file(file, link);
assert!(at.file_exists(file));
assert!(at.is_symlink(link));
assert_eq!(at.resolve_link(link), file);
let arg = &format!("--suffix={}", suffix);
ucmd.args(&["-b", arg, "-s", file, link])
.succeeds()
.no_stderr();
assert!(at.file_exists(file));
assert!(at.is_symlink(link));
assert_eq!(at.resolve_link(link), file);
let backup = &format!("{}{}", link, suffix);
assert!(at.is_symlink(backup));
assert_eq!(at.resolve_link(backup), file);
} | rust_cleaned_test_functions.jsonl/4886 | {
"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,
58530,
44243,
15875,
44710,
37151,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
330,
1944,
58530,
44243,
15875,
44710,
37151,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_string() {
let expected: Cow<'static, str> = "Nullable(UInt8)".into();
let actual = SqlType::Nullable(&SqlType::UInt8).to_string();
assert_eq!(expected, actual)
} | rust_cleaned_test_functions.jsonl/81437 | {
"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,
2346,
3904,
368,
341,
262,
1077,
3601,
25,
21851,
18291,
1978,
11,
607,
29,
284,
330,
15703,
69210,
23,
94010,
18122,
543,
262,
1077,
5042,
284,
7224,
929,
486,
15703,
2099,
8269,
929,
486,
1877... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bit() {
use consts::*;
use Same;
type T1 = <GetBitOut<U2, U0> as Same<B0>>::Output;
type T2 = <GetBitOut<U2, U1> as Same<B1>>::Output;
type T3 = <GetBitOut<U2, U2> as Same<B0>>::Output;
<T1 as Bit>::to_bool();
<T2 as Bit>::to_bool();
<T3 as Bit>::to_bool();
} | rust_cleaned_test_functions.jsonl/37834 | {
"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,
3062,
13996,
368,
341,
262,
990,
95432,
56162,
262,
990,
25739,
280,
262,
943,
350,
16,
284,
366,
1949,
8344,
2662,
36397,
17,
11,
547,
15,
29,
438,
25739,
32519,
15,
77595,
5097,
280,
262,
94... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_used_in_while_expr() {
check_assist(
inline_local_variable,
r"
fn foo() {
let a$0 = 1 > 0;
while a {}
}",
r"
fn foo() {
while 1 > 0 {}
}",
);
} | rust_cleaned_test_functions.jsonl/3242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
1243,
86069,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
435,
698,
8822,
15229,
368,
341,
262,
1077,
264,
3,
15,
284,
220,
16,
861,
220,
15,
280,
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... | 1 |
#[test]
fn test_hash_height_1() {
// more precisely `curl`ed from locally build docker image of:
// 606d0a89ccabbd3e59cff521f9f4d875cc366ac9
// via
let json_data = r#"
{
"version": {
"block": "10",
"app": "1"
},
"chain_id": "dockerchain",
"height": "1",
"time": "2020-07-09T14:24:44.7157258Z",
"last_block_id": {
"hash": "",
"parts": {
"total": "0",
"hash": ""
}
},
"last_commit_hash": "",
"data_hash": "",
"validators_hash": "74F2AC2B6622504D08DD2509E28CE731985CFE4D133C9DB0CB85763EDCA95AA3",
"next_validators_hash": "74F2AC2B6622504D08DD2509E28CE731985CFE4D133C9DB0CB85763EDCA95AA3",
"consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
"app_hash": "",
"last_results_hash": "",
"evidence_hash": "",
"proposer_address": "AD358F20C8CE80889E0F0248FDDC454595D632AE"
}"#;
// extracted expected hash from a commit via
let header: Header = serde_json::from_str(json_data).unwrap();
let got_hash = header.hash();
let want_hash =
Hash::from_str("F008EACA817CF6A3918CF7A6FD44F1F2464BB24D25A7EDB45A03E8783E9AB438")
.unwrap();
assert_eq!(got_hash, want_hash);
} | rust_cleaned_test_functions.jsonl/14124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 730
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
9561,
62,
16,
368,
341,
1789,
286,
442,
803,
23638,
1565,
19925,
63,
291,
504,
23490,
1936,
26588,
2168,
315,
510,
1789,
286,
442,
220,
21,
15,
21,
67,
15,
64,
23,
24,
638,
370,
8940,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_volatile() {
let mut p = Path::default();
assert!(!p.is_volatile());
p.set_is_volatile(true);
assert!(p.is_volatile());
} | rust_cleaned_test_functions.jsonl/55876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
2273,
25517,
368,
972,
262,
1077,
5206,
281,
284,
7933,
486,
2258,
1647,
262,
2060,
0,
3471,
79,
2079,
2273,
25517,
6201,
262,
281,
980,
6892,
2273,
25517,
3715,
736,
262,
2060,
10297,
79,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_summaries() {
let late_arrival_period = Duration::from_secs(100);
let mut w = make_windows(late_arrival_period);
let instant = w.created_at;
let created_at_time = to_approximate_datetime(w.created_at);
// Window 1
w.add_range(
Some(&Sequence { id: 1, number: 1 }),
NonZeroUsize::new(11).unwrap(),
Utc.timestamp_nanos(10),
Utc.timestamp_nanos(11),
instant + Duration::from_millis(1),
);
w.add_range(
Some(&Sequence { id: 1, number: 2 }),
NonZeroUsize::new(4).unwrap(),
Utc.timestamp_nanos(10),
Utc.timestamp_nanos(340),
instant + Duration::from_millis(30),
);
w.add_range(
Some(&Sequence { id: 1, number: 3 }),
NonZeroUsize::new(6).unwrap(),
Utc.timestamp_nanos(1),
Utc.timestamp_nanos(5),
instant + Duration::from_millis(50),
);
// More than DEFAULT_CLOSED_WINDOW_PERIOD after start of Window 1 => Window 2
w.add_range(
Some(&Sequence { id: 1, number: 4 }),
NonZeroUsize::new(3).unwrap(),
Utc.timestamp_nanos(89),
Utc.timestamp_nanos(90),
instant + DEFAULT_CLOSED_WINDOW_PERIOD + Duration::from_millis(1),
);
// More than DEFAULT_CLOSED_WINDOW_PERIOD after start of Window 2 => Window 3
w.add_range(
Some(&Sequence { id: 1, number: 5 }),
NonZeroUsize::new(8).unwrap(),
Utc.timestamp_nanos(3),
Utc.timestamp_nanos(4),
instant + DEFAULT_CLOSED_WINDOW_PERIOD * 3,
);
let closed_duration = chrono::Duration::from_std(DEFAULT_CLOSED_WINDOW_PERIOD).unwrap();
let summaries: Vec<_> = w.summaries().collect();
assert_eq!(summaries.len(), 3);
assert_eq!(
summaries,
vec![
WriteSummary {
time_of_first_write: created_at_time + chrono::Duration::milliseconds(1),
time_of_last_write: created_at_time + chrono::Duration::milliseconds(50),
min_timestamp: Utc.timestamp_nanos(1),
max_timestamp: Utc.timestamp_nanos(340),
row_count: 21
},
WriteSummary {
time_of_first_write: created_at_time
+ closed_duration
+ chrono::Duration::milliseconds(1),
time_of_last_write: created_at_time
+ closed_duration
+ chrono::Duration::milliseconds(1),
min_timestamp: Utc.timestamp_nanos(89),
max_timestamp: Utc.timestamp_nanos(90),
row_count: 3
},
WriteSummary {
time_of_first_write: created_at_time + closed_duration * 3,
time_of_last_write: created_at_time + closed_duration * 3,
min_timestamp: Utc.timestamp_nanos(3),
max_timestamp: Utc.timestamp_nanos(4),
row_count: 8
},
]
);
// Rotate first and second windows into persistable
w.rotate(instant + late_arrival_period + DEFAULT_CLOSED_WINDOW_PERIOD * 2);
let summaries: Vec<_> = w.summaries().collect();
assert_eq!(summaries.len(), 2);
assert_eq!(
summaries,
vec![
WriteSummary {
time_of_first_write: created_at_time + chrono::Duration::milliseconds(1),
time_of_last_write: created_at_time
+ closed_duration
+ chrono::Duration::milliseconds(1),
min_timestamp: Utc.timestamp_nanos(1),
max_timestamp: Utc.timestamp_nanos(340),
row_count: 24
},
WriteSummary {
time_of_first_write: created_at_time + closed_duration * 3,
time_of_last_write: created_at_time + closed_duration * 3,
min_timestamp: Utc.timestamp_nanos(3),
max_timestamp: Utc.timestamp_nanos(4),
row_count: 8
},
]
);
} | rust_cleaned_test_functions.jsonl/133353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
89333,
368,
341,
286,
1077,
3309,
11210,
3936,
20818,
284,
21045,
486,
1499,
68718,
7,
16,
15,
15,
317,
286,
1077,
5206,
289,
284,
1281,
58220,
2333,
349,
11210,
3936,
20818,
317,
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_that_java_code_compiles_and_demo_runs() {
let registry = get_aptos_registry();
let abis = get_stdlib_script_abis();
let dir = tempdir().unwrap();
let paths = std::fs::read_dir("examples/java/custom_aptos_code")
.unwrap()
.map(|e| e.unwrap().path());
let config = serdegen::CodeGeneratorConfig::new("com.aptos.types".to_string())
.with_encodings(vec![serdegen::Encoding::Bcs])
.with_custom_code(buildgen::read_custom_code_from_paths(
&["com", "aptos", "types"],
paths,
));
let bcs_installer = serdegen::java::Installer::new(dir.path().to_path_buf());
bcs_installer.install_module(&config, ®istry).unwrap();
bcs_installer.install_serde_runtime().unwrap();
bcs_installer.install_bcs_runtime().unwrap();
let abi_installer = buildgen::java::Installer::new(dir.path().to_path_buf());
abi_installer
.install_transaction_builders("com.aptos.stdlib", &abis)
.unwrap();
std::fs::copy(
"examples/java/StdlibDemo.java",
dir.path().join("StdlibDemo.java"),
)
.unwrap();
let paths = || {
std::iter::empty()
.chain(std::fs::read_dir(dir.path().join("com/novi/serde")).unwrap())
.chain(std::fs::read_dir(dir.path().join("com/novi/bcs")).unwrap())
.chain(std::fs::read_dir(dir.path().join("com/aptos/types")).unwrap())
.chain(std::fs::read_dir(dir.path().join("com/aptos/stdlib")).unwrap())
.map(|e| e.unwrap().path())
.chain(std::iter::once(dir.path().join("StdlibDemo.java")))
};
let status = Command::new("javadoc")
.arg("-sourcepath")
.arg(dir.path())
.arg("-d")
.arg(dir.path().join("html"))
.args(paths())
.status()
.unwrap();
assert!(status.success());
let status = Command::new("javac")
.arg("-cp")
.arg(dir.path())
.arg("-d")
.arg(dir.path())
.args(paths())
.status()
.unwrap();
assert!(status.success());
let output = Command::new("java")
.arg("-enableassertions")
.arg("-cp")
.arg(dir.path())
.arg("StdlibDemo")
.output()
.unwrap();
assert_eq!(std::str::from_utf8(&output.stderr).unwrap(), String::new());
assert_eq!(
std::str::from_utf8(&output.stdout).unwrap(),
EXPECTED_OUTPUT
);
assert!(output.status.success());
} | rust_cleaned_test_functions.jsonl/15229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70197,
77323,
4136,
18177,
3658,
8378,
47830,
67352,
368,
341,
262,
1077,
19424,
284,
633,
62,
2689,
436,
50650,
543,
262,
1077,
668,
285,
284,
633,
15656,
2740,
14660,
62,
15367,
543,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decoder_invalid_one_byte_before_finish() {
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [], [0x12], "");
assert_finish_err!(d, "");
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [0x12, 0x34], [0x56], "\u1234");
assert_finish_err!(d, "");
} | rust_cleaned_test_functions.jsonl/15684 | {
"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,
49843,
31433,
11667,
19737,
23708,
42980,
368,
341,
286,
1077,
5206,
294,
284,
20076,
62,
16,
21,
11594,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
10071,
508,
15,
87,
16,
17,
1125,
144... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_rle_i32() {
// Test primitive rle block iterator for i32
let builder = PlainPrimitiveBlockBuilder::new(20);
let mut rle_builder =
RleBlockBuilder::<I32Array, PlainPrimitiveBlockBuilder<i32>>::new(builder);
for item in [Some(&1)].iter().cycle().cloned().take(3) {
rle_builder.append(item);
}
for item in [Some(&2)].iter().cycle().cloned().take(3) {
rle_builder.append(item);
}
for item in [Some(&3)].iter().cycle().cloned().take(3) {
rle_builder.append(item);
}
let data = rle_builder.finish();
let (rle_num, rle_data, block_data) = decode_rle_block(Bytes::from(data));
let block_iter = PlainPrimitiveBlockIterator::new(block_data, rle_num);
let mut scanner = RleBlockIterator::<I32Array, PlainPrimitiveBlockIterator<i32>>::new(
block_iter, rle_data, rle_num,
);
let mut builder = I32ArrayBuilder::new();
assert_eq!(scanner.next_batch(Some(1), &mut builder), 1);
assert_eq!(builder.finish().to_vec(), vec![Some(1)]);
scanner.skip(3);
assert_eq!(scanner.remaining_items(), 5);
let mut builder = I32ArrayBuilder::new();
assert_eq!(scanner.next_batch(Some(2), &mut builder), 2);
assert_eq!(builder.finish().to_vec(), vec![Some(2), Some(2)]);
let mut builder = I32ArrayBuilder::new();
assert_eq!(scanner.next_batch(Some(2), &mut builder), 2);
assert_eq!(builder.finish().to_vec(), vec![Some(3), Some(3)]);
let mut builder = I32ArrayBuilder::new();
assert_eq!(scanner.next_batch(Some(3), &mut builder), 1);
assert_eq!(builder.finish().to_vec(), vec![Some(3)]);
let mut builder = I32ArrayBuilder::new();
assert_eq!(scanner.next_batch(None, &mut builder), 0);
} | rust_cleaned_test_functions.jsonl/38167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 856
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
1710,
273,
5318,
18,
17,
368,
341,
286,
442,
3393,
27594,
435,
273,
2504,
15091,
369,
600,
18,
17,
198,
286,
1077,
7363,
284,
43199,
33313,
4713,
3297,
486,
931,
7,
17,
15,
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... | 4 |
#[test]
fn test_ns_return_struct() {
let cxx = indoc! {"
A::B::Bob give_bob() {
A::B::Bob a;
a.a = 3;
a.b = 4;
return a;
}
"};
let hdr = indoc! {"
#include <cstdint>
namespace A {
namespace B {
struct Bob {
uint32_t a;
uint32_t b;
};
}
}
A::B::Bob give_bob();
"};
let rs = quote! {
assert_eq!(ffi::give_bob().b, 4);
};
run_test(cxx, hdr, rs, &["give_bob"], &["A::B::Bob"]);
} | rust_cleaned_test_functions.jsonl/9784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34728,
12511,
15126,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
362,
486,
33,
486,
32388,
2968,
880,
674,
368,
341,
310,
362,
486,
33,
486,
32388,
264,
280,
310,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplify_composed_and() {
let expr = binary_expr(
binary_expr(col("c2").gt(lit(5)), Operator::And, col("d").lt(lit(6))),
Operator::And,
col("c2").gt(lit(5)),
);
let expected =
binary_expr(col("c2").gt(lit(5)), Operator::And, col("d").lt(lit(6)));
assert_eq!(simplify(&expr), expected);
} | rust_cleaned_test_functions.jsonl/19683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
2965,
3865,
8378,
368,
341,
1789,
286,
1077,
15169,
284,
7868,
21915,
1006,
310,
7868,
21915,
19611,
445,
66,
17,
1827,
5178,
2333,
275,
7,
20,
5731,
28498,
486,
3036,
11,
1375,
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_conditional_keywords() {
// property names
assert_parses("const obj = {if: 3, function: 4};");
assert_parses("const obj = {true: 1, false: 0, null: NaN};");
assert_parses("assert(obj.if == 3);");
assert_parses("assert(obj.true + obj.false + obj.null == NaN);");
// method names
assert_parses(
"
class C {
if() {}
function() {}
}
",
);
assert_not_implemented("let a = 1;");
assert_parses(
"
var of = [1, 2, 3];
for (of of of) console.log(of); // logs 1, 2, 3
",
);
// Not implemented:
assert_parses("class X { get y() {} }");
// Not implemented:
assert_parses("var get = { get get() {}, set get(v) {}, set: 3 };");
} | rust_cleaned_test_functions.jsonl/7979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24433,
3005,
51354,
368,
341,
262,
442,
3343,
5036,
198,
262,
2060,
77113,
288,
445,
1024,
2839,
284,
314,
333,
25,
220,
18,
11,
729,
25,
220,
19,
11061,
797,
262,
2060,
77113,
288,
445,
1024,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain_leak() {
static mut DROPS: i32 = 0;
#[derive(Debug, PartialEq)]
struct D(u32, bool);
impl Drop for D {
fn drop(&mut self) {
unsafe {
DROPS += 1;
}
if self.1 {
panic!("panic in `drop`");
}
}
}
let mut v = vec![
D(0, false),
D(1, false),
D(2, false),
D(3, false),
D(4, true),
D(5, false),
D(6, false),
];
catch_unwind(AssertUnwindSafe(|| {
v.drain(2..=5);
}))
.ok();
assert_eq!(unsafe { DROPS }, 4);
assert_eq!(v, vec![D(0, false), D(1, false), D(6, false),]);
} | rust_cleaned_test_functions.jsonl/24427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
11751,
585,
368,
341,
262,
1099,
5206,
422,
1285,
5012,
25,
600,
18,
17,
284,
220,
15,
401,
262,
11506,
27098,
42618,
11,
55039,
5563,
262,
2036,
422,
8154,
18,
17,
11,
1807,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fountain_encoder_cbor() {
let message = crate::xoshiro::test_utils::make_message("Wolf", 256);
let mut encoder = Encoder::new(&message, 30);
let expected_parts = vec![
"8501091901001a0167aa07581d916ec65cf77cadf55cd7f9cda1a1030026ddd42e905b77adc36e4f2d3c",
"8502091901001a0167aa07581dcba44f7f04f2de44f42d84c374a0e149136f25b01852545961d55f7f7a",
"8503091901001a0167aa07581d8cde6d0e2ec43f3b2dcb644a2209e8c9e34af5c4747984a5e873c9cf5f",
"8504091901001a0167aa07581d965e25ee29039fdf8ca74f1c769fc07eb7ebaec46e0695aea6cbd60b3e",
"8505091901001a0167aa07581dc4bbff1b9ffe8a9e7240129377b9d3711ed38d412fbb4442256f1e6f59",
"8506091901001a0167aa07581d5e0fc57fed451fb0a0101fb76b1fb1e1b88cfdfdaa946294a47de8fff1",
"8507091901001a0167aa07581d73f021c0e6f65b05c0a494e50791270a0050a73ae69b6725505a2ec8a5",
"8508091901001a0167aa07581d791457c9876dd34aadd192a53aa0dc66b556c0c215c7ceb8248b717c22",
"8509091901001a0167aa07581d951e65305b56a3706e3e86eb01c803bbf915d80edcd64d4d0000000000",
"850a091901001a0167aa07581d330f0f33a05eead4f331df229871bee733b50de71afd2e5a79f196de09",
"850b091901001a0167aa07581d3b205ce5e52d8c24a52cffa34c564fa1af3fdffcd349dc4258ee4ee828",
"850c091901001a0167aa07581ddd7bf725ea6c16d531b5f03254783803048ca08b87148daacd1cd7a006",
"850d091901001a0167aa07581d760be7ad1c6187902bbc04f539b9ee5eb8ea6833222edea36031306c01",
"850e091901001a0167aa07581d5bf4031217d2c3254b088fa7553778b5003632f46e21db129416f65b55",
"850f091901001a0167aa07581d73f021c0e6f65b05c0a494e50791270a0050a73ae69b6725505a2ec8a5",
"8510091901001a0167aa07581db8546ebfe2048541348910267331c643133f828afec9337c318f71b7df",
"8511091901001a0167aa07581d23dedeea74e3a0fb052befabefa13e2f80e4315c9dceed4c8630612e64",
"8512091901001a0167aa07581dd01a8daee769ce34b6b35d3ca0005302724abddae405bdb419c0a6b208",
"8513091901001a0167aa07581d3171c5dc365766eff25ae47c6f10e7de48cfb8474e050e5fe997a6dc24",
"8514091901001a0167aa07581de055c2433562184fa71b4be94f262e200f01c6f74c284b0dc6fae6673f",
];
for e in expected_parts {
assert_eq!(hex::encode(encoder.next_part().unwrap().cbor().unwrap()), e);
}
} | rust_cleaned_test_functions.jsonl/106871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
34524,
39068,
666,
9368,
368,
341,
286,
1077,
1943,
284,
17717,
486,
87,
31845,
299,
486,
1944,
17309,
486,
6927,
6462,
445,
95434,
497,
220,
17,
20,
21,
317,
286,
1077,
5206,
23668,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_validate_precedences_with_undeclared_precedence() {
let grammar = InputGrammar {
name: String::new(),
word_token: None,
extra_symbols: vec![],
external_tokens: vec![],
supertype_symbols: vec![],
expected_conflicts: vec![],
variables_to_inline: vec![],
precedence_orderings: vec![
vec![
PrecedenceEntry::Name("a".to_string()),
PrecedenceEntry::Name("b".to_string()),
],
vec![
PrecedenceEntry::Name("b".to_string()),
PrecedenceEntry::Name("c".to_string()),
PrecedenceEntry::Name("d".to_string()),
],
],
variables: vec![
Variable {
name: "v1".to_string(),
kind: VariableType::Named,
rule: Rule::Seq(vec![
Rule::prec_left(Precedence::Name("b".to_string()), Rule::string("w")),
Rule::prec(Precedence::Name("c".to_string()), Rule::string("x")),
]),
},
Variable {
name: "v2".to_string(),
kind: VariableType::Named,
rule: Rule::repeat(Rule::Choice(vec![
Rule::prec_left(Precedence::Name("omg".to_string()), Rule::string("y")),
Rule::prec(Precedence::Name("c".to_string()), Rule::string("z")),
])),
},
],
};
let result = validate_precedences(&grammar);
assert_eq!(
result.unwrap_err().to_string(),
"Undeclared precedence 'omg' in rule 'v2'",
);
} | rust_cleaned_test_functions.jsonl/113895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
10442,
1998,
2380,
6615,
62,
28865,
86251,
10442,
1998,
763,
368,
341,
286,
1077,
31428,
284,
5571,
97178,
341,
310,
829,
25,
923,
486,
931,
3148,
310,
3409,
6458,
25,
2240,
345,
310,
496... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input() {
let filename = "test_input.txt";
let contents = util::string_from_file(&filename);
assert_eq!(plant_sum(&contents, 20), 325);
} | rust_cleaned_test_functions.jsonl/65695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
368,
341,
286,
1077,
3899,
284,
330,
1944,
5898,
3909,
876,
286,
1077,
8794,
284,
4094,
486,
917,
5673,
2458,
2099,
8404,
317,
286,
2060,
10714,
10297,
20827,
10160,
2099,
17610,
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 |
#[test]
fn test_file_backend_sha256() {
let pt = vec![1u8, 2, 3];
let (key_path, _tmp_key_dir) = create_key_file("key");
let backend = FileBackend::new(EncryptionMethod::Aes256Ctr, &key_path).unwrap();
let encrypted_content = backend.encrypt(&pt).unwrap();
let plaintext = backend.decrypt(&encrypted_content).unwrap();
assert_eq!(plaintext, pt);
// Must checksum mismatch
let mut encrypted_content1 = encrypted_content.clone();
encrypted_content1
.mut_metadata()
.get_mut(MetadataKey::PlaintextSha256.as_str())
.unwrap()[0] += 1;
assert_matches!(
backend.decrypt(&encrypted_content1).unwrap_err(),
Error::WrongMasterKey(_)
);
// Must checksum not found
let mut encrypted_content2 = encrypted_content;
encrypted_content2
.mut_metadata()
.remove(MetadataKey::PlaintextSha256.as_str());
assert_matches!(
backend.decrypt(&encrypted_content2).unwrap_err(),
Error::WrongMasterKey(_)
);
} | rust_cleaned_test_functions.jsonl/81007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
40011,
48836,
17,
20,
21,
368,
341,
286,
1077,
10817,
284,
7486,
20703,
16,
84,
23,
11,
220,
17,
11,
220,
18,
4821,
286,
1077,
320,
792,
2638,
11,
716,
5173,
3097,
4334,
8,
284,
1855,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_topic_tree() {
let tree = TopicTree::build(vec![topic!("sport/tennis/+"),
topic!("sport/tennis/player1"),
topic!("sport/tennis/player1/#"),
topic!("sport/#"),
topic!("sport/+"),
topic!("#"),
topic!("+"),
topic!("+/+"),
topic!("/+"),
topic!("$SYS/#"),
topic!("$SYS/monitor/+"),
topic!("+/monitor/Clients")]);
assert_eq!(tree.topics.len(), 12);
assert_eq!(tree.states.len(), 15);
assert_eq!(tree.match_topic(&topic!("sport/tennis/player1")),
Some(vec![&topic!("#"),
&topic!("sport/#"),
&topic!("sport/tennis/player1/#"),
&topic!("sport/tennis/player1"),
&topic!("sport/tennis/+")]));
assert_eq!(tree.match_topic(&topic!("sport/tennis/player1/ranking")),
Some(vec![&topic!("#"), &topic!("sport/#"), &topic!("sport/tennis/player1/#")]));
assert_eq!(tree.match_topic(&topic!("sport/tennis/player1/score/wimbledo")),
Some(vec![&topic!("#"), &topic!("sport/#"), &topic!("sport/tennis/player1/#")]));
assert_eq!(tree.match_topic(&topic!("sport")),
Some(vec![&topic!("#"), &topic!("sport/#"), &topic!("+")]));
assert_eq!(tree.match_topic(&topic!("sport/")),
Some(vec![&topic!("#"),
&topic!("sport/#"),
&topic!("sport/+"),
&topic!("+/+")]));
assert_eq!(tree.match_topic(&topic!("/finance")),
Some(vec![&topic!("#"), &topic!("/+"), &topic!("+/+")]));
assert_eq!(tree.match_topic(&topic!("$SYS/monitor/Clients")),
Some(vec![&topic!("$SYS/#"), &topic!("$SYS/monitor/+")]));
assert_eq!(tree.match_topic(&topic!("/monitor/Clients")),
Some(vec![&topic!("#"), &topic!("+/monitor/Clients")]));
} | rust_cleaned_test_functions.jsonl/79599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31414,
11663,
368,
341,
286,
1077,
4916,
284,
32911,
6533,
486,
5834,
25592,
20703,
16411,
17223,
60901,
14,
1960,
25151,
61651,
4461,
12841,
8544,
17223,
60901,
14,
1960,
25151,
59503,
16,
4461,
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_supermajority_root_from_vote_accounts() {
let convert_to_vote_accounts =
|roots_stakes: Vec<(Slot, u64)>| -> HashMap<Pubkey, (u64, VoteAccount)> {
roots_stakes
.into_iter()
.map(|(root, stake)| {
let mut vote_state = VoteState::default();
vote_state.root_slot = Some(root);
let mut vote_account = AccountSharedData::new(
1,
VoteState::size_of(),
&solana_vote_program::id(),
);
let versioned = VoteStateVersions::new_current(vote_state);
VoteState::serialize(&versioned, vote_account.data_as_mut_slice()).unwrap();
(
solana_sdk::pubkey::new_rand(),
(stake, VoteAccount::from(vote_account)),
)
})
.collect()
};
let total_stake = 10;
let slot = 100;
// Supermajority root should be None
assert!(
supermajority_root_from_vote_accounts(slot, total_stake, &HashMap::default()).is_none()
);
// Supermajority root should be None
let roots_stakes = vec![(8, 1), (3, 1), (4, 1), (8, 1)];
let accounts = convert_to_vote_accounts(roots_stakes);
assert!(supermajority_root_from_vote_accounts(slot, total_stake, &accounts).is_none());
let roots_stakes = vec![(8, 1), (3, 1), (4, 1), (8, 5)];
let accounts = convert_to_vote_accounts(roots_stakes);
assert_eq!(
supermajority_root_from_vote_accounts(slot, total_stake, &accounts).unwrap(),
4
);
let roots_stakes = vec![(8, 1), (3, 1), (4, 1), (8, 6)];
let accounts = convert_to_vote_accounts(roots_stakes);
assert_eq!(
supermajority_root_from_vote_accounts(slot, total_stake, &accounts).unwrap(),
8
);
} | rust_cleaned_test_functions.jsonl/46827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38886,
36505,
487,
12993,
5673,
54360,
55665,
368,
341,
286,
1077,
5508,
2346,
54360,
55665,
4035,
310,
760,
37165,
1261,
2050,
25,
11312,
28706,
19877,
11,
575,
21,
19,
16018,
91,
1464,
10528,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mod_exp() {
let tests = [(0, 10, 10, 0),
(1, 10, 10, 1),
(2, 1000, 2, 0),
(2, 10, 2147483647, 1024),
(1337, 100, 2147483647, 1398068914),
(18, 112994442, 1000000001, 59108659)];
for &(a, b, m, expected) in &tests {
let a = a.to_biguint().unwrap();
let b = b.to_biguint().unwrap();
let m = m.to_biguint().unwrap();
let ans: BigUint = mod_exp(a, b, m);
assert_eq!(ans, expected.to_biguint().unwrap());
}
} | rust_cleaned_test_functions.jsonl/49964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
14214,
368,
341,
262,
1077,
7032,
284,
17826,
15,
11,
220,
16,
15,
11,
220,
16,
15,
11,
220,
15,
1326,
338,
320,
16,
11,
220,
16,
15,
11,
220,
16,
15,
11,
220,
16,
1326,
338,
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... | 2 |
#[test]
fn test_no_default_parameter_not_removed() {
test_same("function f(x,y) { }");
test_same("function f(x) { }");
test_same("function f() { }");
} | rust_cleaned_test_functions.jsonl/487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
9993,
24899,
7913,
68248,
368,
341,
262,
1273,
33574,
445,
1688,
282,
2075,
7358,
8,
314,
220,
335,
797,
262,
1273,
33574,
445,
1688,
282,
2075,
8,
314,
220,
335,
797,
262,
1273,
33574,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_block_with_specified_transactions() {
let (testkit, handler) = init_handler(Height(0));
let tx_foo = TxTimestamp::for_str("foo");
let tx_bar = TxTimestamp::for_str("bar");
{
let mut testkit = testkit.write().unwrap();
testkit.api().send(tx_foo.clone());
testkit.api().send(tx_bar.clone());
testkit.poll_events();
}
let body = json!({ "tx_hashes": [ tx_foo.hash().to_string() ] });
let block_info = extract_block_info(
post_json("http://localhost:3000/v1/blocks", &body, &handler).unwrap(),
);
assert_eq!(block_info.header.height(), Height(1));
assert_eq!(block_info.transactions.len(), 1);
assert_eq!(
*block_info.transactions[0].content(),
tx_foo.serialize_field().unwrap()
);
let body = json!({ "tx_hashes": [ tx_bar.hash().to_string() ] });
let block_info = extract_block_info(
post_json("http://localhost:3000/v1/blocks", &body, &handler).unwrap(),
);
assert_eq!(block_info.header.height(), Height(2));
assert_eq!(block_info.transactions.len(), 1);
assert_eq!(
*block_info.transactions[0].content(),
tx_bar.serialize_field().unwrap()
);
} | rust_cleaned_test_functions.jsonl/14765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
7113,
6615,
13594,
1870,
68182,
368,
341,
286,
1077,
320,
1944,
8226,
11,
7013,
8,
284,
2930,
10183,
7,
3640,
7,
15,
3237,
286,
1077,
9854,
761,
2624,
284,
39850,
20812,
486,
1958,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closures_sharing() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine.register_fn("foo", |x: INT, s: &str| s.len() as INT + x);
engine.register_fn("bar", |x: INT, s: String| s.len() as INT + x);
assert_eq!(
engine.eval::<INT>(
r#"
let s = "hello";
let f = || s;
foo(1, s)
"#
)?,
6
);
assert_eq!(
engine.eval::<String>(
r#"
let s = "hello";
let f = || s;
let n = foo(1, s);
s
"#
)?,
"hello"
);
assert_eq!(
engine.eval::<INT>(
r#"
let s = "hello";
let f = || s;
bar(1, s)
"#
)?,
6
);
Ok(())
} | rust_cleaned_test_functions.jsonl/20580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 561
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41206,
3712,
3249,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
5206,
4712,
284,
8200,
486,
931,
1428,
262,
4712,
9929,
15246,
445,
7975,
497,
760,
87,
25,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_get_state() {
let _setup = TestModeSetup::init();
assert_eq!(VcxStateType::VcxStateInitialized as u32, _issuer_sm().state());
assert_eq!(VcxStateType::VcxStateOfferSent as u32, _issuer_sm().to_offer_sent_state().state());
assert_eq!(VcxStateType::VcxStateRequestReceived as u32, _issuer_sm().to_request_received_state().state());
assert_eq!(VcxStateType::VcxStateAccepted as u32, _issuer_sm().to_finished_state().state());
} | rust_cleaned_test_functions.jsonl/20338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
4387,
368,
341,
310,
1077,
716,
15188,
284,
3393,
3636,
21821,
486,
2327,
1428,
310,
2060,
10714,
10297,
53,
25844,
1397,
929,
486,
53,
25844,
1397,
22495,
438,
575,
18,
17,
11,
716,
66817... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_destroy_duplex_stream_after_unplugging_a_default_input_device() {
test_unplug_a_device_on_an_active_stream(StreamType::DUPLEX, Scope::Input, true, 0);
} | rust_cleaned_test_functions.jsonl/23857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18066,
51932,
2571,
12673,
19844,
4907,
500,
35268,
4306,
9993,
5898,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
35,
3124,
35245,
11,
34920,
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 |
#[test]
fn test_buffer_array_min_max_with_nulls() {
let a = Int32Array::from(vec![Some(5), None, None, Some(8), Some(9)]);
assert_eq!(5, min(&a).unwrap());
assert_eq!(9, max(&a).unwrap());
} | rust_cleaned_test_functions.jsonl/27862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
3858,
7260,
6345,
6615,
15162,
82,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
20,
701,
2240,
11,
2240,
11,
4329,
7,
23,
701,
4329,
7,
24,
4195... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_put_ref_then_unref() {
let a = create_block("A", NULL_BLOCK_IDENTIFIER, 0);
let b = create_block("B", "A", 1);
let b_block_id = b.header_signature.clone();
let c = create_block("C", "B", 2);
let c_block_id = c.header_signature.clone();
let block_manager = BlockManager::new();
assert_eq!(block_manager.put(vec![a, b]), Ok(()));
assert_eq!(block_manager.put(vec![c]), Ok(()));
block_manager.ref_block(b_block_id.as_str()).unwrap();
block_manager.unref_block(c_block_id.as_str()).unwrap();
let d = create_block("D", "C", 3);
assert_eq!(
block_manager.put(vec![d]),
Err(BlockManagerError::MissingPredecessor(format!(
"During Put, missing predecessor of block D: C"
)))
);
let e = create_block("E", "B", 2);
block_manager.put(vec![e]).unwrap();
} | rust_cleaned_test_functions.jsonl/10248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
7793,
68367,
49484,
368,
341,
286,
1077,
264,
284,
1855,
7113,
445,
32,
497,
1770,
18756,
49554,
11,
220,
15,
317,
286,
1077,
293,
284,
1855,
7113,
445,
33,
497,
330,
32,
497,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_topic() {
assert!("test".match_level(&Level::normal("test")));
assert!("$SYS".match_level(&Level::metadata("$SYS")));
let t = "sport/tennis/player1/#".parse().unwrap();
assert!("sport/tennis/player1".match_topic(&t));
assert!("sport/tennis/player1/ranking".match_topic(&t));
assert!("sport/tennis/player1/score/wimbledon".match_topic(&t));
assert!("sport".match_topic(&"sport/#".parse().unwrap()));
let t = "sport/tennis/+".parse().unwrap();
assert!("sport/tennis/player1".match_topic(&t));
assert!("sport/tennis/player2".match_topic(&t));
assert!(!"sport/tennis/player1/ranking".match_topic(&t));
let t = "sport/+".parse().unwrap();
assert!(!"sport".match_topic(&t));
assert!("sport/".match_topic(&t));
assert!("/finance".match_topic(&"+/+".parse().unwrap()));
assert!("/finance".match_topic(&"/+".parse().unwrap()));
assert!(!"/finance".match_topic(&"+".parse().unwrap()));
assert!(!"$SYS".match_topic(&"#".parse().unwrap()));
assert!(!"$SYS/monitor/Clients".match_topic(&"+/monitor/Clients".parse().unwrap()));
assert!("$SYS/".match_topic(&"$SYS/#".parse().unwrap()));
assert!("$SYS/monitor/Clients".match_topic(&"$SYS/monitor/+".parse().unwrap()));
} | rust_cleaned_test_functions.jsonl/79597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
31414,
368,
341,
286,
2060,
17223,
1944,
3263,
6347,
8274,
2099,
4449,
486,
8252,
445,
1944,
17621,
286,
2060,
17223,
3,
37931,
3263,
6347,
8274,
2099,
4449,
486,
17637,
20912,
37931,
74385,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_has_same_recipient() {
let alice_pubkey = solana_sdk::pubkey::new_rand();
let bob_pubkey = solana_sdk::pubkey::new_rand();
let lockup0 = "2021-01-07T00:00:00Z".to_string();
let lockup1 = "9999-12-31T23:59:59Z".to_string();
let alice_alloc = Allocation {
recipient: alice_pubkey.to_string(),
amount: sol_to_lamports(1.0),
lockup_date: "".to_string(),
};
let alice_alloc_lockup0 = Allocation {
recipient: alice_pubkey.to_string(),
amount: sol_to_lamports(1.0),
lockup_date: lockup0.clone(),
};
let alice_info = TransactionInfo {
recipient: alice_pubkey,
lockup_date: None,
..TransactionInfo::default()
};
let alice_info_lockup0 = TransactionInfo {
recipient: alice_pubkey,
lockup_date: lockup0.parse().ok(),
..TransactionInfo::default()
};
let alice_info_lockup1 = TransactionInfo {
recipient: alice_pubkey,
lockup_date: lockup1.parse().ok(),
..TransactionInfo::default()
};
let bob_info = TransactionInfo {
recipient: bob_pubkey,
lockup_date: None,
..TransactionInfo::default()
};
assert!(!has_same_recipient(&alice_alloc, &bob_info));
assert!(!has_same_recipient(&alice_alloc, &alice_info_lockup0));
assert!(!has_same_recipient(
&alice_alloc_lockup0,
&alice_info_lockup1
)); // Different lockups
assert!(has_same_recipient(&alice_alloc, &alice_info));
assert!(has_same_recipient(
&alice_alloc_lockup0,
&alice_info_lockup0
));
} | rust_cleaned_test_functions.jsonl/18259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
33574,
7080,
14117,
368,
341,
286,
1077,
70433,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check() {
for diagnose_arg in &["-c", "--check", "--check=diagnose-first"] {
new_ucmd!()
.arg(diagnose_arg)
.arg("check_fail.txt")
.fails()
.stdout_is("sort: check_fail.txt:6: disorder: 5\n");
new_ucmd!()
.arg(diagnose_arg)
.arg("multiple_files.expected")
.succeeds()
.stdout_is("");
}
} | rust_cleaned_test_functions.jsonl/82996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
368,
341,
262,
369,
57581,
6057,
304,
609,
1183,
12,
66,
497,
14482,
2028,
497,
14482,
2028,
28,
8579,
3246,
960,
36943,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
858,
55493,
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_format_docs_handles_escape_double_hashes() {
let comment = r#"```rust
let s = "foo
## bar # baz";
```"#;
assert_eq!(format_docs(comment), "```rust\nlet s = \"foo\n# bar # baz\";\n```");
} | rust_cleaned_test_functions.jsonl/57094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
49692,
68017,
21832,
24598,
91616,
368,
341,
286,
1077,
3980,
284,
435,
55543,
73594,
35788,
198,
1149,
274,
284,
330,
7975,
198,
565,
3619,
671,
50247,
876,
73594,
57676,
401,
286,
2060,
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_script() {
let ctx = TestContext::new();
let mut con = ctx.connection();
let script = redis::Script::new(
r"
return {redis.call('GET', KEYS[1]), ARGV[1]}
",
);
let _: () = redis::cmd("SET")
.arg("my_key")
.arg("foo")
.query(&mut con)
.unwrap();
let response = script.key("my_key").arg(42).invoke(&mut con);
assert_eq!(response, Ok(("foo".to_string(), 42)));
} | rust_cleaned_test_functions.jsonl/108963 | {
"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,
14660,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
1077,
5316,
284,
20870,
486,
5910,
486,
931,
1006,
286,
435,
698,
981,
470,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aes_siv_key_sizes() {
let key_str =
"198371900187498172316311acf81d238ff7619873a61983d619c87b63a1987f987131819803719b847126381cd763871638aa71638176328761287361231321812731321de508761437195ff231765aa4913219873ac6918639816312130011abc900bba11400187984719827431246bbab1231eb4145215ff7141436616beb9817298148712fed3aab61000ff123313e";
let key = hex::decode(key_str).unwrap();
for i in 0..key.len() {
let result = tink_daead::subtle::AesSiv::new(&key[..i]);
if i == tink_daead::subtle::AES_SIV_KEY_SIZE {
assert!(
result.is_ok(),
"Rejected valid key size: {}, {:?}",
i,
result.err().unwrap()
);
} else {
assert!(result.is_err(), "Allowed invalid key size: {}", i);
}
}
} | rust_cleaned_test_functions.jsonl/131301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
643,
344,
3097,
32159,
368,
341,
262,
1077,
1376,
2895,
4035,
286,
330,
16,
24,
23,
18,
22,
16,
24,
15,
15,
16,
23,
22,
19,
24,
23,
16,
22,
17,
18,
16,
21,
18,
16,
16,
62594,
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... | 3 |
#[test]
fn test_dynamic_width_number_display_numeric_hexadecimal() {
fn num(n: usize) -> Number {
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(16));
for _ in 0..n {
number.increment().unwrap()
}
number
}
assert_eq!(format!("{}", num(0)), "00");
assert_eq!(format!("{}", num(15)), "0f");
assert_eq!(format!("{}", num(16)), "10");
assert_eq!(format!("{}", num(17)), "11");
assert_eq!(format!("{}", num(18)), "12");
assert_eq!(format!("{}", num(16 * 15 - 1)), "ef");
assert_eq!(format!("{}", num(16 * 15)), "f000");
assert_eq!(format!("{}", num(16 * 15 + 1)), "f001");
assert_eq!(format!("{}", num(16 * 255 - 1)), "feff");
assert_eq!(format!("{}", num(16 * 255)), "ff0000");
assert_eq!(format!("{}", num(16 * 255 + 1)), "ff0001");
} | rust_cleaned_test_functions.jsonl/51164 | {
"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,
45992,
7927,
5500,
14825,
29418,
32655,
49326,
368,
341,
286,
5168,
1629,
1445,
25,
22301,
8,
1464,
5624,
341,
310,
1077,
5206,
1372,
284,
5624,
486,
21752,
3327,
5432,
5040,
3327,
2833,
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... | 2 |
#[test]
fn test_query_token_info() {
let init_name = "sec-sec".to_string();
let init_admin = HumanAddr("admin".to_string());
let init_symbol = "SECSEC".to_string();
let init_decimals = 8;
let init_config: InitConfig = from_binary(&Binary::from(
r#"{ "public_total_supply": true }"#.as_bytes(),
))
.unwrap();
let init_supply = Uint128(5000);
let mut deps = mock_dependencies(20, &[]);
let env = mock_env("instantiator", &[]);
let init_msg = InitMsg {
name: init_name.clone(),
admin: Some(init_admin.clone()),
symbol: init_symbol.clone(),
decimals: init_decimals.clone(),
initial_balances: Some(vec![InitialBalance {
address: HumanAddr("giannis".to_string()),
amount: init_supply,
}]),
prng_seed: Binary::from("lolz fun yay".as_bytes()),
config: Some(init_config),
};
let init_result = init(&mut deps, env, init_msg);
assert!(
init_result.is_ok(),
"Init failed: {}",
init_result.err().unwrap()
);
let query_msg = QueryMsg::TokenInfo {};
let query_result = query(&deps, query_msg);
assert!(
query_result.is_ok(),
"Init failed: {}",
query_result.err().unwrap()
);
let query_answer: QueryAnswer = from_binary(&query_result.unwrap()).unwrap();
match query_answer {
QueryAnswer::TokenInfo {
name,
symbol,
decimals,
total_supply,
} => {
assert_eq!(name, init_name);
assert_eq!(symbol, init_symbol);
assert_eq!(decimals, init_decimals);
assert_eq!(total_supply, Some(Uint128(5000)));
}
_ => panic!("unexpected"),
}
} | rust_cleaned_test_functions.jsonl/69626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1054
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
6458,
3109,
368,
341,
286,
1077,
2930,
1269,
284,
330,
5024,
12,
5024,
3263,
983,
3904,
543,
286,
1077,
2930,
12207,
284,
11097,
13986,
445,
2882,
3263,
983,
3904,
1423,
286,
1077,
2930,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_bytes_invalid() {
let data: Vec<u8> = vec![0xF0];
let err = HeaderIdentOsAbi::from_bytes((&data, 0));
assert!(matches!(err, Err(_)));
} | rust_cleaned_test_functions.jsonl/4089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
12524,
31433,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
9770,
15,
4821,
286,
1077,
1848,
284,
12104,
28301,
28867,
5830,
72,
486,
1499,
12524,
42902,
691,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_command_enc_dec() {
let cmd = Command::Clean;
let mut encoded = vec![];
cmd.encode(&mut encoded);
let mut bytes_slice = encoded.as_slice();
let decoded_cmd = Command::decode(&mut bytes_slice).unwrap();
assert_eq!(bytes_slice.len(), 0);
assert_eq!(cmd, decoded_cmd);
} | rust_cleaned_test_functions.jsonl/48881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
13781,
13783,
368,
341,
286,
1077,
5439,
284,
7348,
486,
27529,
280,
286,
1077,
5206,
20498,
284,
7486,
0,
15078,
286,
5439,
17313,
2099,
6984,
20498,
317,
286,
1077,
5206,
5820,
26488,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_in_untagged_enum() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
enum Outer {
Inner(Inner),
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
enum Inner {
Unit,
Newtype(u8),
Tuple(u8, u8),
Struct { f: u8 },
}
assert_tokens(
&Outer::Inner(Inner::Unit),
&[Token::UnitVariant {
name: "Inner",
variant: "Unit",
}],
);
assert_tokens(
&Outer::Inner(Inner::Newtype(1)),
&[
Token::NewtypeVariant {
name: "Inner",
variant: "Newtype",
},
Token::U8(1),
],
);
assert_tokens(
&Outer::Inner(Inner::Tuple(1, 1)),
&[
Token::TupleVariant {
name: "Inner",
variant: "Tuple",
len: 2,
},
Token::U8(1),
Token::U8(1),
Token::TupleVariantEnd,
],
);
assert_tokens(
&Outer::Inner(Inner::Struct { f: 1 }),
&[
Token::StructVariant {
name: "Inner",
variant: "Struct",
len: 1,
},
Token::Str("f"),
Token::U8(1),
Token::StructVariantEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 845
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
1243,
62,
3850,
96476,
31054,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
11506,
47024,
7,
3850,
96476,
5563,
262,
7618,
55197,
341,
286,
36356,
7,
31597... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_transaction() {
let (config, key) = config_builder::test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let program =
encode_transfer_with_metadata_script(lbr_type_tag(), &address, vec![], 100, vec![], vec![]);
let transaction = transaction_test_helpers::get_test_signed_txn(
address,
1,
&key,
key.public_key(),
Some(program),
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(ret.status(), None);
} | rust_cleaned_test_functions.jsonl/19604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
28884,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1077,
2621,
284,
269... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_image_result_code_enum_values() {
assert_eq!(
mc_fog_types::ledger::KeyImageResultCode::Spent as u32,
mc_fog_api::ledger::KeyImageResultCode::Spent as u32
);
assert_eq!(
mc_fog_types::ledger::KeyImageResultCode::NotSpent as u32,
mc_fog_api::ledger::KeyImageResultCode::NotSpent as u32
);
assert_eq!(
mc_fog_types::ledger::KeyImageResultCode::KeyImageError as u32,
mc_fog_api::ledger::KeyImageResultCode::KeyImageError as u32
);
} | rust_cleaned_test_functions.jsonl/96782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
4954,
5287,
4136,
31054,
9146,
368,
341,
262,
2060,
10714,
33673,
286,
19223,
761,
538,
9763,
486,
50704,
486,
1592,
1906,
2077,
2078,
486,
6406,
306,
438,
575,
18,
17,
345,
286,
19223,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_records_out() {
new_ucmd!()
.args(&["bs=2", "status=noxfer"])
.pipe_in("abc")
.succeeds()
.stdout_is("abc")
.stderr_is("1+1 records in\n1+1 records out\n");
} | rust_cleaned_test_functions.jsonl/99841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
31279,
6068,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
1279,
28,
17,
497,
330,
2829,
30315,
87,
802,
14108,
286,
659,
13768,
1243,
445,
13683,
1138,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solid_regex_only_invert() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-s", "-og", "\\d+", "-v", "tr", "[:upper:]", "[:lower:]"])
.write_stdin("ABC123EFG\nHIJKLM456")
.assert()
.stdout("abc123efg\nhijklm456");
} | rust_cleaned_test_functions.jsonl/7895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5192,
41832,
18410,
1243,
1621,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reading_lint_fail() {
let a = indoc!(r#"
openapi: 3.0.1
info:
title: Swagger Petstore
version: 1.2.3
paths: {}
components:
schemas:
Order:
type: object
"#);
let b = serde_yaml::from_str::<Doc>(a).unwrap();
let mut x = Context::default();
b.lint(Path::default(), &mut x);
println!("{}", x);
x.check().unwrap();
} | rust_cleaned_test_functions.jsonl/59556 | {
"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,
81859,
907,
396,
22121,
368,
341,
262,
1077,
264,
284,
1257,
509,
10297,
81,
2,
698,
286,
1787,
2068,
25,
220,
18,
13,
15,
13,
16,
198,
286,
3546,
510,
310,
2265,
25,
79631,
11333,
4314,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store() {
let mut schema_builder = Schema::builder();
let name = schema_builder.add_text_field("name", STORED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
{
let mut index_writer = index.writer_for_tests().unwrap();
index_writer.add_document(doc!(name => "hi"));
index_writer.add_document(doc!(name => "this is a test"));
index_writer.add_document(
doc!(name => "some more documents with some word overlap with the other test"),
);
index_writer.add_document(doc!(name => "hello hi goodbye"));
index_writer.commit().unwrap();
}
let searcher = index.searcher().unwrap();
let searcher_space_usage = searcher.space_usage().unwrap();
assert!(searcher_space_usage.total() > 0);
assert_eq!(1, searcher_space_usage.segments().len());
let segment = &searcher_space_usage.segments()[0];
assert!(segment.total() > 0);
assert_eq!(4, segment.num_docs());
assert_eq!(0, segment.termdict().total());
assert_eq!(0, segment.postings().total());
assert_eq!(0, segment.positions().total());
assert_eq!(0, segment.fast_fields().total());
assert_eq!(0, segment.fieldnorms().total());
assert!(segment.store().total() > 0);
assert!(segment.store().total() < 512);
assert_eq!(0, segment.deletes());
} | rust_cleaned_test_functions.jsonl/62190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 671
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
829,
284,
10802,
28532,
1364,
4326,
5013,
445,
606,
497,
53771,
35,
317,
286,
1077,
10802,
284,
10802,
28532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_config()
{
let random_dir = "_random_clipbboard_sync_test_dir";
let result = generate_config(random_dir).unwrap();
assert!(result.ends_with("config.yml"));
fs::remove_file(result.clone()).unwrap();
fs::remove_dir(result.parent().unwrap()).unwrap();
} | rust_cleaned_test_functions.jsonl/109917 | {
"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,
48851,
5332,
741,
262,
341,
286,
1077,
4194,
4334,
284,
9000,
11463,
44728,
65,
2482,
23008,
4452,
4334,
876,
286,
1077,
1102,
284,
6923,
5332,
25110,
4334,
568,
15454,
543,
286,
2060,
10297,
1382... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_play_one() {
let mut state = PlaybackState::default();
state.queue(song("foo"));
state.play("foo");
assert!(state.is_playing());
assert_eq!(state.song_id(), Some("foo"));
assert!(state.prev_song().is_none());
assert!(state.next_song().is_none());
state.toggle_play();
assert!(!state.is_playing());
} | rust_cleaned_test_functions.jsonl/20824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22144,
11667,
368,
341,
286,
1077,
5206,
1584,
284,
95301,
1397,
486,
2258,
543,
286,
1584,
29598,
60873,
445,
7975,
14929,
286,
1584,
12972,
445,
7975,
797,
286,
2060,
10297,
2454,
2079,
83857,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_test() {
let fake_screen: Vec<&'static str> =
vec!["..hello***", "!!##$$$$$*", ".hello^^^^"];
let os = get_observed_screen(&fake_screen);
assert_eq!(
os[Vec2::new(0, 0)].as_ref().unwrap().letter.as_option(),
Some(&".".to_owned())
);
assert_eq!(os[Vec2::new(2, 1)], None);
} | rust_cleaned_test_functions.jsonl/69238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
368,
341,
286,
1077,
12418,
17649,
25,
11312,
52244,
6,
1978,
607,
29,
4035,
310,
7486,
0,
1183,
496,
14990,
12210,
497,
330,
2928,
565,
69502,
3,
78729,
5933,
14990,
61724,
31797,
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_process_reset() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let private_key = crypto::ecdsa::SecKey::gensk(&mut rng);
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
let credential_id = vec![0x01, 0x23, 0x45, 0x67];
let credential_source = PublicKeyCredentialSource {
key_type: PublicKeyCredentialType::PublicKey,
credential_id,
private_key,
rp_id: String::from("example.com"),
user_handle: vec![],
other_ui: None,
cred_random: None,
cred_protect_policy: None,
};
assert!(ctap_state
.persistent_store
.store_credential(credential_source)
.is_ok());
assert!(ctap_state.persistent_store.count_credentials().unwrap() > 0);
let reset_reponse = ctap_state.process_command(&[0x07], DUMMY_CHANNEL_ID);
let expected_response = vec![0x00];
assert_eq!(reset_reponse, expected_response);
assert!(ctap_state.persistent_store.count_credentials().unwrap() == 0);
} | rust_cleaned_test_functions.jsonl/35317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 567
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
18983,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
17895,
43187,
36976,
284,
66091,
7622,
7,
1423,
286,
1077,
869,
3097,
284,
19028,
486,
757,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() -> Result<(), Box<dyn std::error::Error>> {
let depool_abi = "tests/samples/fakeDepool.abi.json";
let config = get_config().unwrap();
let depool_addr = config["addr"].as_str().unwrap();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("call")
.arg("--abi")
.arg(&depool_abi)
.arg(&depool_addr)
.arg("error")
.arg(r#"{"code":101}"#);
cmd.assert()
.stdout(predicate::str::contains(r#""exit_code": 101,"#));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("call")
.arg("--abi")
.arg(&depool_abi)
.arg(&depool_addr)
.arg("outOfGas")
.arg(r#"{}"#);
cmd.assert()
.stdout(predicate::str::contains(r#""exit_code": -14,"#));
Ok(())
} | rust_cleaned_test_functions.jsonl/118332 | {
"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,
4096,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
2170,
1749,
22885,
72,
284,
330,
23841,
2687,
4023,
6663,
726,
7839,
1749,
22048,
72,
4323,
3302,
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... | 3 |
#[test]
fn test_is_in() -> Result<()> {
let df = df![
"x" => [1, 2, 3],
"y" => ["a", "b", "c"]
]?;
let s = Series::new("a", ["a", "b"]);
let out = df
.lazy()
.select([col("y").is_in(lit(s)).alias("isin")])
.collect()?;
assert_eq!(
Vec::from(out.column("isin")?.bool()?),
&[Some(true), Some(true), Some(false)]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/22295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
1243,
368,
1464,
5714,
71698,
341,
286,
1077,
6764,
284,
6764,
90515,
310,
330,
87,
1,
589,
508,
16,
11,
220,
17,
11,
220,
18,
1259,
310,
330,
88,
1,
589,
4383,
64,
497,
330,
65,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_parse_subfield() {
assert_eq!(
parse_subfield(b"\x1fa123").unwrap().1,
Subfield::from_unchecked('a', "123")
);
assert_eq!(
parse_subfield(b"\x1fa").unwrap().1,
Subfield::from_unchecked('a', "")
);
assert_eq!(parse_subfield(b"a123").is_err(), true);
assert_eq!(parse_subfield(b"").is_err(), true);
} | rust_cleaned_test_functions.jsonl/101492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5228,
2566,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
5228,
2566,
1883,
11934,
87,
16,
3632,
16,
17,
18,
1827,
15454,
1005,
16,
345,
310,
3719,
2566,
486,
1499,
4907,
7549,
492,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_with_one_like_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$or":[{{"~{}":{{"$like":"{}"}}}}]}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::Or(
vec![
Operator::Like(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
25535,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
2951,
284,
3561,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_in_place_zero_sized() {
let v = vec![(), ()];
#[deriving(PartialEq, Show)]
struct ZeroSized;
assert_eq!(v.map_in_place(|_| ZeroSized).as_slice(), [ZeroSized, ZeroSized].as_slice());
} | rust_cleaned_test_functions.jsonl/98386 | {
"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,
5376,
1243,
34548,
19359,
643,
1506,
368,
341,
286,
1077,
348,
284,
7486,
20703,
1507,
1719,
935,
286,
11506,
1107,
2249,
5304,
20894,
27312,
11,
6928,
5563,
286,
2036,
18306,
50,
1506,
280,
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_invalid_less_than_a_week() {
with_rewards_default(|set_moment, accounts| {
assert_ok!(CrowdloanRewards::initialize(Origin::root()));
for (picasso_account, remote_account) in accounts.clone().into_iter() {
assert_ok!(remote_account.associate(picasso_account));
}
set_moment(VESTING_STEP - 1);
for (picasso_account, remote_account) in accounts.clone().into_iter() {
assert_noop!(remote_account.claim(picasso_account), Error::<Test>::NothingToClaim);
}
set_moment(VESTING_STEP);
for (picasso_account, remote_account) in accounts.into_iter() {
assert_ok!(remote_account.claim(picasso_account));
}
});
} | rust_cleaned_test_functions.jsonl/41095 | {
"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,
31433,
50747,
51613,
4306,
31277,
368,
341,
46948,
77997,
9993,
22428,
746,
717,
12913,
11,
9618,
91,
341,
197,
6948,
19817,
10297,
93926,
67,
38329,
58465,
2347,
486,
21641,
7,
13298,
486,
2888,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_long_string_1() {
let index = 64587;
let timestamp = 87451651;
let prev = String::from("sdfsdgehherheherhefwt4wtttertertg");
let sign_key = String::from("0000");
let content = "a".repeat(500);
let new_block = BlockGen {
index: index.clone(),
timestamp: timestamp.clone(),
sign_key: sign_key.clone(),
prev: prev.clone(),
content: content.clone()
};
let new_block = new_block.to_bytes();
assert_eq!(new_block[1], 2);
let complete = parser::parse_payload(&new_block);
let parsed = BlockGen::parse(complete).unwrap();
assert_eq!(index, parsed.index);
assert_eq!(content, parsed.content);
assert_eq!(timestamp, parsed.timestamp);
assert_eq!(sign_key, parsed.sign_key);
assert_eq!(prev, parsed.prev);
} | rust_cleaned_test_functions.jsonl/62816 | {
"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,
17799,
3904,
62,
16,
368,
341,
286,
1077,
1922,
284,
220,
21,
19,
20,
23,
22,
280,
286,
1077,
11441,
284,
220,
23,
22,
19,
20,
16,
21,
20,
16,
280,
286,
1077,
7872,
284,
923,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_id_from_boarding_pass() {
assert_eq!(id_from_boarding_pass("BFFFBBFRRR"), 567);
assert_eq!(id_from_boarding_pass("FFFBBBFRRR"), 119);
assert_eq!(id_from_boarding_pass("BBFFBBFRLL"), 820);
} | rust_cleaned_test_functions.jsonl/114231 | {
"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,
842,
5673,
23919,
287,
15464,
368,
341,
262,
2060,
10714,
10297,
307,
5673,
23919,
287,
15464,
445,
33,
31203,
10098,
37,
8106,
49,
3975,
220,
20,
21,
22,
317,
262,
2060,
10714,
10297,
307,
5673... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_tail() {
let df = df! {
"A" => &[1, 2, 3, 4, 5],
"B" => &[5, 4, 3, 2, 1]
}
.unwrap();
let _out = df.lazy().tail(3).collect().unwrap();
} | rust_cleaned_test_functions.jsonl/139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
35471,
368,
341,
262,
1077,
6764,
284,
6764,
0,
341,
286,
330,
32,
1,
589,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
1259,
286,
330,
33,
1,
589,
44590,
20,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0174_example_1() {
let dungeon = vec![vec![-2, -3, 3], vec![-5, -10, 1], vec![10, 30, -5]];
let result = 7;
assert_eq!(Solution::calculate_minimum_hp(dungeon), result);
} | rust_cleaned_test_functions.jsonl/101381 | {
"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,
62,
15,
16,
22,
19,
39304,
62,
16,
368,
341,
286,
1077,
42439,
284,
7486,
20703,
4083,
0,
7609,
17,
11,
481,
18,
11,
220,
18,
1125,
7486,
0,
7609,
20,
11,
481,
16,
15,
11,
220,
16,
1125,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_basic_use_bars() {
// Testing various breakpoints and edge cases.
assert_eq!(calculate_basic_use_bars(0.0, 15), 0);
assert_eq!(calculate_basic_use_bars(1.0, 15), 0);
assert_eq!(calculate_basic_use_bars(5.0, 15), 1);
assert_eq!(calculate_basic_use_bars(10.0, 15), 2);
assert_eq!(calculate_basic_use_bars(40.0, 15), 6);
assert_eq!(calculate_basic_use_bars(45.0, 15), 7);
assert_eq!(calculate_basic_use_bars(50.0, 15), 8);
assert_eq!(calculate_basic_use_bars(100.0, 15), 15);
assert_eq!(calculate_basic_use_bars(150.0, 15), 15);
} | rust_cleaned_test_functions.jsonl/4466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
34729,
15951,
880,
1561,
368,
341,
286,
442,
26768,
5257,
91530,
323,
6821,
5048,
624,
286,
2060,
10714,
10297,
35597,
34729,
15951,
880,
1561,
7,
15,
13,
15,
11,
220,
16,
20,
701,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neighbours_found_dst_node_undirected() {
let mut net: Network<&str, f64> = Network::new(false);
net.add_node("A");
net.add_node("B");
net.add_edge("A", "B", 1.0);
let neighbours: Vec<&&str> = net.neighbours_of("B").unwrap();
assert_eq!(neighbours.len(), 1, "There should be one neighbour: A.");
assert!(neighbours.contains(&&"A"), "Should contain A node.");
} | rust_cleaned_test_functions.jsonl/127187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
52117,
21480,
33114,
5084,
62,
1241,
74612,
368,
341,
262,
1077,
5206,
4179,
25,
8141,
52244,
495,
11,
282,
21,
19,
29,
284,
8141,
486,
931,
3576,
626,
262,
4179,
1364,
5084,
445,
32,
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... | 3 |
#[test]
fn test_parse_stake_set_lockup() {
let mut keys: Vec<Pubkey> = vec![];
for _ in 0..3 {
keys.push(Pubkey::new_unique());
}
let unix_timestamp = 1_234_567_890;
let epoch = 11;
let custodian = Pubkey::new_unique();
let lockup = LockupArgs {
unix_timestamp: Some(unix_timestamp),
epoch: None,
custodian: None,
};
let instruction = instruction::set_lockup(&keys[1], &lockup, &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..2]).unwrap(),
ParsedInstructionEnum {
instruction_type: "setLockup".to_string(),
info: json!({
"stakeAccount": keys[1].to_string(),
"custodian": keys[0].to_string(),
"lockup": {
"unixTimestamp": unix_timestamp
}
}),
}
);
let lockup = LockupArgs {
unix_timestamp: Some(unix_timestamp),
epoch: Some(epoch),
custodian: None,
};
let instruction = instruction::set_lockup(&keys[1], &lockup, &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..2]).unwrap(),
ParsedInstructionEnum {
instruction_type: "setLockup".to_string(),
info: json!({
"stakeAccount": keys[1].to_string(),
"custodian": keys[0].to_string(),
"lockup": {
"unixTimestamp": unix_timestamp,
"epoch": epoch,
}
}),
}
);
let lockup = LockupArgs {
unix_timestamp: Some(unix_timestamp),
epoch: Some(epoch),
custodian: Some(custodian),
};
let instruction = instruction::set_lockup(&keys[1], &lockup, &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..2]).unwrap(),
ParsedInstructionEnum {
instruction_type: "setLockup".to_string(),
info: json!({
"stakeAccount": keys[1].to_string(),
"custodian": keys[0].to_string(),
"lockup": {
"unixTimestamp": unix_timestamp,
"epoch": epoch,
"custodian": custodian.to_string(),
}
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..1]).is_err());
let lockup = LockupArgs {
unix_timestamp: Some(unix_timestamp),
epoch: None,
custodian: None,
};
let instruction = instruction::set_lockup_checked(&keys[1], &lockup, &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..2]).unwrap(),
ParsedInstructionEnum {
instruction_type: "setLockupChecked".to_string(),
info: json!({
"stakeAccount": keys[1].to_string(),
"custodian": keys[0].to_string(),
"lockup": {
"unixTimestamp": unix_timestamp
}
}),
}
);
let lockup = LockupArgs {
unix_timestamp: Some(unix_timestamp),
epoch: Some(epoch),
custodian: None,
};
let instruction = instruction::set_lockup_checked(&keys[1], &lockup, &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..2]).unwrap(),
ParsedInstructionEnum {
instruction_type: "setLockupChecked".to_string(),
info: json!({
"stakeAccount": keys[1].to_string(),
"custodian": keys[0].to_string(),
"lockup": {
"unixTimestamp": unix_timestamp,
"epoch": epoch,
}
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..1]).is_err());
let lockup = LockupArgs {
unix_timestamp: Some(unix_timestamp),
epoch: Some(epoch),
custodian: Some(keys[1]),
};
let instruction = instruction::set_lockup_checked(&keys[2], &lockup, &keys[0]);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..3]).unwrap(),
ParsedInstructionEnum {
instruction_type: "setLockupChecked".to_string(),
info: json!({
"stakeAccount": keys[2].to_string(),
"custodian": keys[0].to_string(),
"lockup": {
"unixTimestamp": unix_timestamp,
"epoch": epoch,
"custodian": keys[1].to_string(),
}
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..2]).is_err());
} | rust_cleaned_test_functions.jsonl/16469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1261,
726,
2602,
9818,
454,
368,
341,
286,
1077,
5206,
6894,
25,
11312,
21604,
392,
792,
29,
284,
7486,
0,
15078,
286,
369,
716,
304,
220,
15,
496,
18,
341,
310,
6894,
2552,
5304,
392,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_slerp_regression() {
let a = Quaternion::<f32>::new(0.00052311074, 0.9999999, 0.00014682197, -0.000016342687);
let b = Quaternion::<f32>::new(0.019973433, -0.99980056, -0.00015678025, 0.000013882192);
assert_ulps_eq!(a.slerp(b, 0.5).magnitude(), 1.0);
} | rust_cleaned_test_functions.jsonl/15364 | {
"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,
643,
1536,
79,
91144,
368,
341,
286,
1077,
264,
284,
24801,
27638,
69,
18,
17,
6831,
931,
7,
15,
13,
15,
15,
15,
20,
17,
18,
16,
16,
15,
22,
19,
11,
220,
15,
13,
24,
24,
24,
24,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_starts_with_impl() {
assert!(function_starts_with(
"_<futures..task_impl..Spawn<T>>::enter::_{{closure}}",
"futures::"
));
assert!(!function_starts_with(
"_<futures..task_impl..Spawn<T>>::enter::_{{closure}}",
"tokio::"
));
} | rust_cleaned_test_functions.jsonl/46633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
86552,
6615,
21007,
368,
341,
286,
2060,
10297,
1688,
86552,
6615,
1006,
310,
9000,
27,
69,
74606,
496,
8202,
21007,
496,
41005,
3125,
77595,
1950,
13541,
2979,
46916,
3417,
756,
310,
330,
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_prefix_unimportant() -> Result<(), Box<dyn Error>> {
assert_eq!(Path::Guilds, Path::from_str("guilds")?);
assert_eq!(Path::Guilds, Path::from_str("/guilds")?);
Ok(())
} | rust_cleaned_test_functions.jsonl/13620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13974,
4907,
15333,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
2060,
10714,
10297,
1820,
486,
72574,
82,
11,
7933,
486,
1499,
2895,
445,
57877,
82,
899,
30,
317,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 3 |
#[test]
fn test_vec3_align() {
use std::mem;
if cfg!(feature = "scalar-math") {
assert_eq!(12, mem::size_of::<Vec3>());
assert_eq!(4, mem::align_of::<Vec3>());
assert_eq!(12, mem::size_of::<Vec3Mask>());
assert_eq!(4, mem::align_of::<Vec3Mask>());
} else {
assert_eq!(16, mem::size_of::<Vec3>());
assert_eq!(16, mem::align_of::<Vec3>());
assert_eq!(16, mem::size_of::<Vec3Mask>());
assert_eq!(16, mem::align_of::<Vec3Mask>());
}
} | rust_cleaned_test_functions.jsonl/48579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
37015,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
421,
13286,
10297,
12753,
284,
330,
35342,
1448,
587,
899,
341,
286,
2060,
10714,
10297,
16,
17,
11,
1833,
486,
2141,
3575,
2763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_done_modify() {
let subcommand = Subcommand::Modify {
filter: Filter {
conditions: vec![Condition::IdList(vec![TaskId::WorkingSetId(123)])],
},
modification: Modification {
description: DescriptionMod::Set(s!("now-finished")),
status: Some(Status::Completed),
..Default::default()
},
};
assert_eq!(
Subcommand::parse(argv!["123", "done", "now-finished"]).unwrap(),
(&EMPTY[..], subcommand)
);
} | rust_cleaned_test_functions.jsonl/84278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24390,
57725,
368,
341,
286,
1077,
1186,
5631,
284,
3719,
5631,
486,
44427,
341,
310,
4051,
25,
12339,
341,
394,
4682,
25,
7486,
20703,
10547,
486,
764,
852,
25592,
20703,
6262,
764,
486,
33978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffer_array_min_max_with_nulls() {
let a = PrimitiveArray::from(vec![Some(5), None, None, Some(8), Some(9)]);
assert_eq!(5, a.min().unwrap());
assert_eq!(9, a.max().unwrap());
} | rust_cleaned_test_functions.jsonl/32616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
3858,
7260,
6345,
6615,
15162,
82,
368,
341,
286,
1077,
264,
284,
51460,
1857,
486,
1499,
25592,
20703,
8373,
7,
20,
701,
2240,
11,
2240,
11,
4329,
7,
23,
701,
4329,
7,
24,
41958,
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_bit_set_difference_with() {
// Explicitly 0'ed bits
let mut a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b00000000]));
let b = BitSet::from_bit_vec(BitVec::from_bytes(&[0b10100010]));
a.difference_with(&b);
assert!(a.is_empty());
// Uninitialized bits should behave like 0's
let mut a = BitSet::new();
let b = BitSet::from_bit_vec(BitVec::from_bytes(&[0b11111111]));
a.difference_with(&b);
assert!(a.is_empty());
// Standard
let mut a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b10100010]));
let mut b = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01100010]));
let c = a.clone();
a.difference_with(&b);
b.difference_with(&c);
assert_eq!(a.len(), 1);
assert_eq!(b.len(), 1);
} | rust_cleaned_test_functions.jsonl/76234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
2602,
47525,
6615,
368,
341,
286,
442,
31330,
398,
220,
15,
6,
291,
9472,
198,
286,
1077,
5206,
264,
284,
57227,
486,
1499,
13996,
13251,
68653,
10050,
486,
1499,
12524,
2099,
58,
15,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_igmp_integration_not_last_dont_send_leave() {
let mut ctx = setup_simple_test_environment();
igmp_join_group(&mut ctx, DummyDeviceId, MulticastAddr::new(GROUP_ADDR).unwrap());
assert_eq!(ctx.timers().len(), 1);
assert_eq!(ctx.frames().len(), 1);
receive_igmp_report(&mut ctx, DummyDeviceId);
assert_eq!(ctx.timers().len(), 0);
// The report should be discarded because we have received from someone else.
assert_eq!(ctx.frames().len(), 1);
assert!(igmp_leave_group(&mut ctx, DummyDeviceId, MulticastAddr::new(GROUP_ADDR).unwrap())
.is_ok());
// A leave message is not sent
assert_eq!(ctx.frames().len(), 1);
ensure_ttl_ihl_rtr(&ctx);
} | rust_cleaned_test_functions.jsonl/30906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
343,
1307,
90250,
7913,
12195,
814,
544,
13565,
62666,
368,
341,
286,
1077,
5206,
5635,
284,
6505,
30015,
4452,
51774,
543,
286,
19373,
1307,
31017,
6288,
2099,
6984,
5635,
11,
50567,
6985,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_primitive() {
let a: Complex<f32> = Complex { re: 2.0, im: 0.2 };
let a_: i32 = a.as_();
assert_eq!(a_, 2_i32);
} | rust_cleaned_test_functions.jsonl/99588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
84087,
368,
341,
286,
1077,
264,
25,
22096,
63895,
18,
17,
29,
284,
22096,
314,
312,
25,
220,
17,
13,
15,
11,
732,
25,
220,
15,
13,
17,
2605,
286,
1077,
264,
23211,
600,
18,
17,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_level_filter_case_insensitive() {
let cases = [
(LevelFilter::Off, [level_filter_token("off")]),
(LevelFilter::Fatal, [level_filter_token("fatal")]),
(LevelFilter::Error, [level_filter_token("error")]),
(LevelFilter::Warn, [level_filter_token("warn")]),
(LevelFilter::Info, [level_filter_token("info")]),
(LevelFilter::Debug, [level_filter_token("debug")]),
(LevelFilter::Trace, [level_filter_token("trace")]),
];
for &(s, expected) in &cases {
assert_de_tokens(&s, &expected);
}
} | rust_cleaned_test_functions.jsonl/91801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8274,
8727,
19096,
34386,
18723,
368,
341,
286,
1077,
5048,
284,
2278,
310,
320,
4449,
5632,
486,
4596,
11,
508,
3294,
8727,
6458,
445,
1847,
899,
17036,
310,
320,
4449,
5632,
486,
62396,
11,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rate_limiter_default() {
let mut l = RateLimiter::default();
// limiter should not be blocked
assert!(!l.is_blocked());
assert!(l.consume(u64::max_value(), TokenType::Ops));
assert!(l.consume(u64::max_value(), TokenType::Bytes));
// calling the handler without there having been an event should error
assert!(l.event_handler().is_err());
assert_eq!(
format!("{:?}", l.event_handler().err().unwrap()),
"SpuriousRateLimiterEvent(\
\"Rate limiter event handler called without a present timer\")"
);
} | rust_cleaned_test_functions.jsonl/15886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9246,
907,
17700,
9993,
368,
341,
286,
1077,
5206,
326,
284,
19775,
43,
17700,
486,
2258,
1428,
286,
442,
4568,
2015,
1265,
537,
387,
19299,
198,
286,
2060,
0,
3471,
75,
2079,
89223,
1423,
1789,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_self() {
let (analysis, position) = single_file_with_position(
"
struct Thing { x: u32 }
impl Thing {
fn new() -> Self {
Self<|> { x: 0 }
}
}
",
);
let hover = analysis.hover(position).unwrap().unwrap();
assert_eq!(trim_markup_opt(hover.info.first()), Some("Thing"));
assert_eq!(hover.info.is_exact(), true);
} | rust_cleaned_test_functions.jsonl/33502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
25637,
368,
341,
286,
1077,
320,
34484,
11,
2309,
8,
284,
3175,
2458,
6615,
9661,
1006,
310,
6228,
310,
2036,
37200,
314,
856,
25,
575,
18,
17,
456,
310,
11605,
37200,
341,
394,
5168,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check() {
for diagnose_arg in ["-c", "--check", "--check=diagnose-first"] {
new_ucmd!()
.arg(diagnose_arg)
.arg("check_fail.txt")
.arg("--buffer-size=10b")
.fails()
.stderr_only("sort: check_fail.txt:6: disorder: 5\n");
new_ucmd!()
.arg(diagnose_arg)
.arg("multiple_files.expected")
.succeeds()
.stderr_is("");
}
} | rust_cleaned_test_functions.jsonl/20526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
368,
341,
262,
369,
57581,
6057,
304,
4383,
12,
66,
497,
14482,
2028,
497,
14482,
2028,
28,
8579,
3246,
960,
36943,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
858,
55493,
3246,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_debug() {
let resp = HttpResponse::Ok()
.header(COOKIE, HeaderValue::from_static("cookie1=value1; "))
.header(COOKIE, HeaderValue::from_static("cookie2=value2; "))
.finish();
let dbg = format!("{:?}", resp);
assert!(dbg.contains("HttpResponse"));
} | rust_cleaned_test_functions.jsonl/2943 | {
"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,
15446,
368,
341,
286,
1077,
9039,
284,
17580,
486,
11578,
741,
310,
659,
2708,
3025,
46,
23588,
11,
12104,
1130,
486,
1499,
25360,
445,
16236,
16,
46538,
16,
26,
40964,
310,
659,
2708,
3025,
46,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example_1() {
// No example to validate whole part
assert_eq!(Seat::from(test::EXAMPLE_INPUT_1).id(), 357);
assert_eq!(Seat::from(test::EXAMPLE_INPUT_2).id(), 567);
assert_eq!(Seat::from(test::EXAMPLE_INPUT_3).id(), 119);
assert_eq!(Seat::from(test::EXAMPLE_INPUT_4).id(), 820);
} | rust_cleaned_test_functions.jsonl/5311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
62,
16,
368,
341,
262,
442,
2308,
3110,
311,
9593,
4361,
949,
198,
262,
2060,
10714,
10297,
75324,
486,
1499,
8623,
486,
95875,
21022,
62,
16,
568,
307,
1507,
220,
18,
20,
22,
317,
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_preprocessor() -> Result<()> {
lex_ok! {
r#"use "foo.tremor" ;"#,
r#"~"# => Token::Use,
r#" ~"# => Token::DQuote,
r#" ~"# => Token::StringLiteral("foo.tremor".into()),
r#" ~"# => Token::DQuote,
r#" ~"# => Token::Semi,
};
Ok(())
} | rust_cleaned_test_functions.jsonl/45956 | {
"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,
10442,
29474,
368,
1464,
5714,
71698,
341,
286,
22429,
19817,
0,
341,
310,
435,
55543,
810,
330,
7975,
734,
1826,
269,
1,
2587,
57676,
345,
310,
435,
55543,
93,
57676,
589,
9660,
486,
10253,
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_parse_short_log_entry() {
assert_debug_snapshot!(
LogEntry::parse(b"Nov 20 21:56:01 herzog com.apple.xpc.launchd[1] (com.apple.preference.displays.MirrorDisplays): Service only ran for 0 seconds. Pushing respawn out by 10 seconds."),
@r###"
LogEntry {
timestamp: Some(
Local(
2017-11-20T21:56:01+01:00,
),
),
message: "herzog com.apple.xpc.launchd[1] (com.apple.preference.displays.MirrorDisplays): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.",
}
"###
);
} | rust_cleaned_test_functions.jsonl/64700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16673,
5224,
9078,
368,
341,
262,
2060,
15446,
53265,
33673,
262,
2835,
5874,
486,
6400,
1883,
1,
18944,
220,
17,
15,
220,
17,
16,
25,
20,
21,
25,
15,
16,
1059,
89,
538,
469,
39390,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lints_tracking_hash_different_values() {
let mut v1 = Options::default();
let mut v2 = Options::default();
let mut v3 = Options::default();
v1.lint_opts = vec![
(String::from("a"), Level::Allow),
(String::from("b"), Level::Warn),
(String::from("c"), Level::Deny),
(String::from("d"), Level::Forbid),
];
v2.lint_opts = vec![
(String::from("a"), Level::Allow),
(String::from("b"), Level::Warn),
(String::from("X"), Level::Deny),
(String::from("d"), Level::Forbid),
];
v3.lint_opts = vec![
(String::from("a"), Level::Allow),
(String::from("b"), Level::Warn),
(String::from("c"), Level::Forbid),
(String::from("d"), Level::Deny),
];
assert_non_crate_hash_different(&v1, &v2);
assert_non_crate_hash_different(&v1, &v3);
assert_non_crate_hash_different(&v2, &v3);
} | rust_cleaned_test_functions.jsonl/100717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
21042,
66105,
8950,
82741,
9146,
368,
341,
262,
1077,
5206,
348,
16,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
17,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
18,
284,
14566,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_offset() {
let offset = OffsetLayer::new_offset(Point::new_f32(20.0, 10.0));
assert_eq!(offset.offset, Point::new_f32(20.0, 10.0));
assert_eq!(offset.count_layers(), 0);
} | rust_cleaned_test_functions.jsonl/76895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
6917,
368,
341,
286,
1077,
4347,
284,
16861,
9188,
486,
931,
6917,
32737,
486,
931,
761,
18,
17,
7,
17,
15,
13,
15,
11,
220,
16,
15,
13,
15,
1106,
286,
2060,
10714,
10297,
3176,
14760,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recursion() {
let input = ParseBlock::from(
&[
ParseStatement::LoopDo(
ParseIdent::Static(2),
ParseBlock::from(
&[
ParseStatement::AddToInto(
nat(5),
ParseIdent::Dynamic(DynamicIdent::Named("A".into())),
ParseIdent::Dynamic(DynamicIdent::Named("C".into())),
),
ParseStatement::AddToInto(
nat(9),
ParseIdent::Dynamic(DynamicIdent::Named("B".into())),
ParseIdent::Dynamic(DynamicIdent::Named("A".into())),
),
][..],
),
),
ParseStatement::WhileDo(
ParseIdent::Dynamic(DynamicIdent::Named("x".into())),
ParseBlock::from(
&[
ParseStatement::AddToInto(
nat(8),
ParseIdent::Dynamic(DynamicIdent::Named("A".into())),
ParseIdent::Static(1),
),
ParseStatement::AddToInto(
nat(4),
ParseIdent::Dynamic(DynamicIdent::Named("E".into())),
ParseIdent::Dynamic(DynamicIdent::Named("x".into())),
),
][..],
),
),
][..],
);
let expected = PloopBlock::from(
&[
/* Note: `0` is reserved. */
PloopStatement::LoopDo(
VarIdent(2),
PloopBlock::from(
&[
PloopStatement::AddToInto(nat(5), VarIdent(3), VarIdent(4)),
PloopStatement::AddToInto(nat(9), VarIdent(5), VarIdent(3)),
][..],
),
),
PloopStatement::WhileDo(
VarIdent(6),
PloopBlock::from(
&[
PloopStatement::AddToInto(nat(8), VarIdent(3), VarIdent(1)),
PloopStatement::AddToInto(nat(4), VarIdent(7), VarIdent(6)),
][..],
),
),
][..],
);
let actual = PloopBlock::from(&input);
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/119138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1865
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
34280,
368,
341,
286,
1077,
1946,
284,
14775,
4713,
486,
1499,
1006,
310,
609,
9640,
394,
14775,
8636,
486,
14620,
5404,
1006,
503,
14775,
28301,
486,
11690,
7,
17,
1326,
503,
14775,
4713,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_object() {
let bser_v2 =
b"\x00\x02\x00\x00\x00\x00\x05\x0f\x00\x00\x00\x01\x03\x01\x02\x03\x03abc\x02\x03\x03def";
let decoded = from_slice::<BytestringObject>(bser_v2).unwrap();
let mut expected = HashMap::new();
expected.insert(Bytestring::from(&b"abc"[..]), Bytestring::from(&b"def"[..]));
assert_eq!(decoded.0, expected);
} | rust_cleaned_test_functions.jsonl/34064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
5314,
368,
341,
262,
1077,
293,
799,
2273,
17,
4035,
286,
293,
11934,
87,
15,
15,
3462,
15,
17,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
20,
3462,
15,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_semantic_fn() {
let mut vm = VersionMap::new();
vm.new_version()
.set_type_version(Test::type_id(), 2)
.new_version()
.set_type_version(Test::type_id(), 3)
.new_version()
.set_type_version(Test::type_id(), 4);
let state = Test {
field0: 0,
field1: 1,
field2: 2,
field3: "test".to_owned(),
field4: vec![4, 3, 2, 1],
field_x: 0,
};
let mut snapshot_mem = vec![0u8; 1024];
// Serialize as v1.
let mut snapshot = Snapshot::new(vm.clone(), 1);
snapshot
.save_without_crc(&mut snapshot_mem.as_mut_slice(), &state)
.unwrap();
let mut restored_state: Test =
Snapshot::unchecked_load(&mut snapshot_mem.as_slice(), vm.clone()).unwrap();
assert_eq!(restored_state.field0, state.field4.iter().sum::<u64>());
// The semantic deserializer for field4 will change field's value to vec![field0; 4].
assert_eq!(restored_state.field4, vec![restored_state.field0; 4]);
// The semantic serializer and deserializer for field3 will both increment field_x value.
assert_eq!(restored_state.field_x, 2);
// field1 should have the original value.
assert_eq!(restored_state.field1, 1);
// field2 should have the default value as this field was added at version 2.
assert_eq!(restored_state.field2, 20);
// Serialize as v3.
let mut snapshot = Snapshot::new(vm.clone(), 3);
snapshot
.save_without_crc(&mut snapshot_mem.as_mut_slice(), &state)
.unwrap();
restored_state =
Snapshot::unchecked_load(&mut snapshot_mem.as_slice(), vm.clone()).unwrap();
// We expect only the semantic serializer and deserializer for field4 to be called at version 3.
assert_eq!(restored_state.field0, state.field4.iter().sum::<u64>());
// The semantic deserializer will create a 4 elements vec with all values == field0.
assert_eq!(restored_state.field4, vec![restored_state.field0; 4]);
// The semantic fn for field3 must not be called at version 3.
assert_eq!(restored_state.field_x, 0);
// Serialize as v4.
snapshot = Snapshot::new(vm.clone(), 4);
snapshot
.save_without_crc(&mut snapshot_mem.as_mut_slice(), &state)
.unwrap();
restored_state =
Snapshot::unchecked_load(&mut snapshot_mem.as_slice(), vm.clone()).unwrap();
// The 4 semantic fns must not be called at version 4.
assert_eq!(restored_state.field0, 0);
assert_eq!(restored_state.field4, vec![4, 3, 2, 1]);
// Test error propagation from `versionize` crate.
// Load operation should fail if we don't use the whole `snapshot_mem` resulted from
// serialization.
snapshot_mem.truncate(10);
let restored_state_result: Result<Test, Error> =
Snapshot::unchecked_load(&mut snapshot_mem.as_slice(), vm);
assert_eq!(
restored_state_result.unwrap_err(),
Error::Versionize(versionize::VersionizeError::Deserialize(
"Io(Custom { kind: UnexpectedEof, error: \"failed to fill whole buffer\" })"
.to_owned()
))
);
} | rust_cleaned_test_functions.jsonl/43354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
30442,
8159,
15246,
368,
341,
286,
1077,
5206,
10995,
284,
6079,
2227,
486,
931,
543,
286,
10995,
4618,
9438,
741,
310,
659,
746,
1819,
9438,
31159,
486,
1313,
842,
1507,
220,
17,
340,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_report_generation() {
let config = Config::default();
let repo = GitHubRepo {
org: "brson".into(),
name: "hello-rs".into(),
sha: Some("f00".into()),
};
let gh = Crate::GitHub(repo);
let reg = Crate::Registry(RegistryCrate {
name: "syn".into(),
version: "1.0.0".into(),
});
let ex = Experiment {
name: "foo".to_string(),
toolchains: [MAIN_TOOLCHAIN.clone(), TEST_TOOLCHAIN.clone()],
mode: Mode::BuildAndTest,
cap_lints: CapLints::Forbid,
priority: 0,
created_at: ::chrono::Utc::now(),
started_at: None,
completed_at: None,
github_issue: None,
status: Status::GeneratingReport,
assigned_to: None,
report_url: None,
ignore_blacklist: false,
requirement: None,
};
let mut db = DummyDB::default();
db.add_dummy_result(
&ex,
gh.clone(),
MAIN_TOOLCHAIN.clone(),
TestResult::TestPass,
);
db.add_dummy_result(
&ex,
gh.clone(),
TEST_TOOLCHAIN.clone(),
TestResult::BuildFail(FailureReason::Unknown),
);
db.add_dummy_log(
&ex,
gh.clone(),
MAIN_TOOLCHAIN.clone(),
EncodedLog::Plain(b"stable log".to_vec()),
);
db.add_dummy_log(
&ex,
gh.clone(),
TEST_TOOLCHAIN.clone(),
EncodedLog::Plain(b"beta log".to_vec()),
);
db.add_dummy_result(
&ex,
reg.clone(),
MAIN_TOOLCHAIN.clone(),
TestResult::TestPass,
);
db.add_dummy_result(
&ex,
reg.clone(),
TEST_TOOLCHAIN.clone(),
TestResult::BuildFail(FailureReason::Unknown),
);
db.add_dummy_log(
&ex,
reg.clone(),
MAIN_TOOLCHAIN.clone(),
EncodedLog::Plain(b"stable log".to_vec()),
);
db.add_dummy_log(
&ex,
reg.clone(),
TEST_TOOLCHAIN.clone(),
EncodedLog::Plain(b"beta log".to_vec()),
);
let writer = DummyWriter::default();
gen(&db, &ex, &[gh, reg], &writer, &config, false).unwrap();
assert_eq!(
writer.get("config.json", &mime::APPLICATION_JSON),
serde_json::to_vec(&ex).unwrap()
);
assert_eq!(
&writer.get("stable/gh/brson.hello-rs/log.txt", &mime::TEXT_PLAIN_UTF_8),
b"stable log"
);
assert_eq!(
&writer.get("beta/gh/brson.hello-rs/log.txt", &mime::TEXT_PLAIN_UTF_8),
b"beta log"
);
let result: RawTestResults =
serde_json::from_slice(&writer.get("results.json", &mime::APPLICATION_JSON)).unwrap();
assert_eq!(result.crates.len(), 2);
let gh_result = &result.crates[0];
let reg_result = &result.crates[1];
assert_eq!(gh_result.name.as_str(), "brson.hello-rs.f00");
assert_eq!(
gh_result.url.as_str(),
"https://github.com/brson/hello-rs/tree/f00"
);
assert_eq!(gh_result.res, Comparison::Regressed);
assert_eq!(
(&gh_result.runs[0]).as_ref().unwrap().res,
TestResult::TestPass
);
assert_eq!(
(&gh_result.runs[1]).as_ref().unwrap().res,
TestResult::BuildFail(FailureReason::Unknown)
);
assert_eq!(
(&gh_result.runs[0]).as_ref().unwrap().log.as_str(),
"stable/gh/brson.hello-rs"
);
assert_eq!(
(&gh_result.runs[1]).as_ref().unwrap().log.as_str(),
"beta/gh/brson.hello-rs"
);
assert_eq!(reg_result.name.as_str(), "syn-1.0.0");
assert_eq!(
reg_result.url.as_str(),
"https://crates.io/crates/syn/1.0.0"
);
assert_eq!(reg_result.res, Comparison::Regressed);
assert_eq!(
(®_result.runs[0]).as_ref().unwrap().res,
TestResult::TestPass
);
assert_eq!(
(®_result.runs[1]).as_ref().unwrap().res,
TestResult::BuildFail(FailureReason::Unknown)
);
assert_eq!(
(®_result.runs[0]).as_ref().unwrap().log.as_str(),
"stable/reg/syn-1.0.0"
);
assert_eq!(
(®_result.runs[1]).as_ref().unwrap().log.as_str(),
"beta/reg/syn-1.0.0"
);
assert_eq!(
writer.get("retry-regressed-list.txt", &mime::TEXT_PLAIN_UTF_8),
b"brson/hello-rs\nsyn\n",
);
} | rust_cleaned_test_functions.jsonl/12518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2749
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
64191,
368,
341,
286,
1077,
2193,
284,
5532,
486,
2258,
1428,
286,
1077,
15867,
284,
32095,
25243,
341,
310,
1240,
25,
330,
1323,
930,
3263,
18122,
3148,
310,
829,
25,
330,
14990,
3795,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
let mut seg = Seg::new(10, || 0);
assert_eq!(seg.reduce(0, 10), 0);
seg.set(5, 5);
assert_eq!(seg.reduce(0, 10), 5);
seg.set(5, 10);
assert_eq!(seg.reduce(0, 10), 10);
} | rust_cleaned_test_functions.jsonl/38811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
972,
310,
1077,
5206,
4810,
284,
17209,
486,
931,
7,
16,
15,
11,
1369,
220,
15,
736,
310,
2060,
10714,
10297,
14607,
23792,
7,
15,
11,
220,
16,
15,
701,
220,
15,
736,
310,
4810,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_runtime_update_balloon_config() {
let req = VmmAction::UpdateBalloon(BalloonUpdateConfig { amount_mb: 0 });
check_runtime_request(req, |result, vmm| {
assert_eq!(result, Ok(VmmData::Empty));
assert!(vmm.update_balloon_config_called)
});
let req = VmmAction::UpdateBalloon(BalloonUpdateConfig { amount_mb: 0 });
check_runtime_request_err(
req,
VmmActionError::BalloonConfig(BalloonConfigError::DeviceNotFound),
);
} | rust_cleaned_test_functions.jsonl/44544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
8882,
56441,
31335,
5332,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
4289,
37889,
31335,
5349,
278,
31335,
4289,
2648,
314,
3311,
53812,
25,
220,
15,
1625,
286,
1779,
33232,
7893... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte() {
let mut mem = Memory::new(1024);
for data in 0..0xFF {
for addr in 0..16 {
mem.write_byte(addr, data).unwrap();
assert_eq!(data, mem.read_byte(addr).unwrap());
}
}
} | rust_cleaned_test_functions.jsonl/92778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
368,
341,
286,
1077,
5206,
1833,
284,
13850,
486,
931,
7,
16,
15,
17,
19,
626,
286,
369,
821,
304,
220,
15,
496,
15,
9264,
341,
310,
369,
10789,
304,
220,
15,
496,
16,
21,
341,
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... | 3 |
#[test]
fn test_solution1() {
assert_eq!(Solution1::length_of_longest_substring("abcabcbb"), 3);
assert_eq!(Solution1::length_of_longest_substring("bbbbbbb"), 1);
assert_eq!(Solution1::length_of_longest_substring("pwwkew"), 3);
} | rust_cleaned_test_functions.jsonl/28107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50274,
16,
368,
341,
286,
2060,
10714,
10297,
36842,
16,
486,
4129,
3575,
17799,
477,
5228,
917,
445,
13683,
13683,
6066,
3975,
220,
18,
317,
286,
2060,
10714,
10297,
36842,
16,
486,
4129,
3575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symlink_is_symlink() {
let scenario = TestScenario::new(util_name!());
let at = &scenario.fixtures;
at.symlink_file("regular_file", "symlink");
// FIXME: implement on Windows
scenario.ucmd().args(&["-h", "symlink"]).succeeds();
scenario.ucmd().args(&["-L", "symlink"]).succeeds();
} | rust_cleaned_test_functions.jsonl/11015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58530,
44243,
6892,
58530,
44243,
368,
341,
262,
1077,
15048,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
61422,
67785,
18513,
401,
262,
518,
77577,
44243,
2458,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kyc_change() {
let mut services = TransferQuotaServiceCollection::default();
services.set_user_1_tags(L1);
services.set_record((*ASSET_ID).clone(), (*USER_1).clone(), Record {
last_op_time: *TIME_ORIGINAL,
daily_used_amount: 2000,
monthly_used_amount: 0,
yearly_used_amount: 0,
});
let res = quota_transfer!(services, 1);
assert_eq!(res.code, *ERROR_EXCEED_DAILY);
services.set_user_1_tags(L2);
let res = quota_transfer!(services, 1);
assert_eq!(res.code, 0);
services.set_user_1_tags(L2);
services.set_record((*ASSET_ID).clone(), (*USER_1).clone(), Record {
last_op_time: *TIME_ORIGINAL,
daily_used_amount: 5000,
monthly_used_amount: 0,
yearly_used_amount: 0,
});
let res = quota_transfer!(services, 1);
assert_eq!(res.code, *ERROR_EXCEED_DAILY);
services.set_user_1_tags(L3);
let res = quota_transfer!(services, 1);
assert_eq!(res.code, 0);
services.set_user_1_tags(ANY_TAG);
services.set_record((*ASSET_ID).clone(), (*USER_1).clone(), Record {
last_op_time: *TIME_ORIGINAL,
daily_used_amount: 1000,
monthly_used_amount: 0,
yearly_used_amount: 0,
});
let res = quota_transfer!(services, 1);
assert_eq!(res.code, *ERROR_EXCEED_DAILY);
services.set_user_1_tags(L1);
let res = quota_transfer!(services, 1);
assert_eq!(res.code, 0);
services.clear_user_1_tags();
let res = services.get_user_tags(context_admin(), GetUserTags {
org_name: OrgName::from_str("Huobi").unwrap(),
user: USER_1.clone(),
});
assert!(res.succeed_data.is_empty());
services.set_record((*ASSET_ID).clone(), (*USER_1).clone(), Record {
last_op_time: *TIME_ORIGINAL,
daily_used_amount: 400,
monthly_used_amount: 0,
yearly_used_amount: 0,
});
let res = quota_transfer!(services, 100);
assert_eq!(res.code, 0);
let res = quota_transfer!(services, 1);
assert_eq!(res.code, *ERROR_EXCEED_SINGLE_BILL);
} | rust_cleaned_test_functions.jsonl/68195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 991
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
3337,
15947,
368,
341,
262,
1077,
5206,
3516,
284,
23200,
2183,
6089,
1860,
6482,
486,
2258,
1428,
262,
3516,
980,
3317,
62,
16,
16333,
4957,
16,
626,
262,
3516,
980,
14192,
26609,
1911,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_ancestor_of() {
macro_rules! t(
(s: $path:expr, $dest:expr, $exp:expr) => (
{
let path = Path::new($path);
let dest = Path::new($dest);
assert_eq!(path.is_ancestor_of(&dest), $exp);
}
)
)
t!(s: "a/b/c", "a/b/c/d", true);
t!(s: "a/b/c", "a/b/c", true);
t!(s: "a/b/c", "a/b", false);
t!(s: "/a/b/c", "/a/b/c", true);
t!(s: "/a/b", "/a/b/c", true);
t!(s: "/a/b/c/d", "/a/b/c", false);
t!(s: "/a/b", "a/b/c", false);
t!(s: "a/b", "/a/b/c", false);
t!(s: "a/b/c", "a/b/d", false);
t!(s: "../a/b/c", "a/b/c", false);
t!(s: "a/b/c", "../a/b/c", false);
t!(s: "a/b/c", "a/b/cd", false);
t!(s: "a/b/cd", "a/b/c", false);
t!(s: "../a/b", "../a/b/c", true);
t!(s: ".", "a/b", true);
t!(s: ".", ".", true);
t!(s: "/", "/", true);
t!(s: "/", "/a/b", true);
t!(s: "..", "a/b", true);
t!(s: "../..", "a/b", true);
} | rust_cleaned_test_functions.jsonl/7695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 761
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
62,
66878,
3575,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
4979,
96011,
11,
400,
4580,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_chunks_mut_count() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5];
let c = v.array_chunks_mut::<3>();
assert_eq!(c.count(), 2);
let v2: &mut [i32] = &mut [0, 1, 2, 3, 4];
let c2 = v2.array_chunks_mut::<2>();
assert_eq!(c2.count(), 2);
let v3: &mut [i32] = &mut [];
let c3 = v3.array_chunks_mut::<2>();
assert_eq!(c3.count(), 0);
} | rust_cleaned_test_functions.jsonl/9650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
65470,
29523,
3180,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.