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_parse_valid_elasticbeanstalk_retrieve_environment_info() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"elasticbeanstalk-retrieve-environment-info.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
ElasticBeanstalkClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = RetrieveEnvironmentInfoMessage::default();
let result = client.retrieve_environment_info(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/15245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
21602,
5064,
17479,
89749,
1288,
34216,
51774,
3109,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_width_without_value() {
let input: [u8; 40] = [0; 40];
let expected_output = unindent("
0000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
0000040 000000 000000 000000 000000
0000050
");
new_ucmd!()
.arg("-w")
.run_piped_stdin(&input[..])
.success()
.no_stderr()
.stdout_is(expected_output);
} | rust_cleaned_test_functions.jsonl/48811 | {
"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,
7927,
39904,
3142,
368,
341,
262,
1077,
1946,
25,
508,
84,
23,
26,
220,
19,
15,
60,
284,
508,
15,
26,
220,
19,
15,
935,
262,
1077,
3601,
7645,
284,
650,
32840,
70576,
310,
220,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_bound() {
err(
"class A[T: Foo]",
pos(1, 12),
SemError::UnknownType("Foo".into()),
);
ok("class Foo class A[T: Foo]");
ok("trait Foo {} class A[T: Foo]");
} | rust_cleaned_test_functions.jsonl/84186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
19447,
368,
341,
286,
1848,
1006,
310,
330,
1040,
362,
20340,
25,
33428,
45016,
310,
1133,
7,
16,
11,
220,
16,
17,
1326,
310,
14248,
1454,
486,
13790,
929,
445,
40923,
3263,
18122,
14702,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_snapshot_data_file_over_limit() {
let expected_data = 2323_u32;
let expected_consumed_size = size_of::<u32>() as u64;
let temp_dir = tempfile::TempDir::new().unwrap();
serialize_snapshot_data_file_capped(
&temp_dir.path().join("data-file"),
expected_consumed_size,
|stream| {
serialize_into(stream, &expected_data)?;
Ok(())
},
)
.unwrap();
let result = deserialize_snapshot_data_file_capped(
&temp_dir.path().join("data-file"),
expected_consumed_size - 1,
|stream| Ok(deserialize_from::<_, u32>(stream)?),
);
assert_matches!(result, Err(SnapshotError::Io(ref message)) if message.to_string().starts_with("too large snapshot data file to deserialize"));
} | rust_cleaned_test_functions.jsonl/53295 | {
"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,
15768,
9050,
53265,
1769,
2458,
15431,
14763,
368,
341,
286,
1077,
3601,
1769,
284,
220,
17,
18,
17,
18,
7300,
18,
17,
280,
286,
1077,
3601,
69870,
291,
2368,
284,
1379,
3575,
27638,
84,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_serde_ser_externally_tagged_enum() -> Result<(), Box<EvalAltResult>> {
#[derive(Serialize)]
enum MyEnum {
VariantUnit,
#[cfg(not(feature = "no_index"))]
VariantUnitTuple(),
VariantNewtype(i32),
#[cfg(not(feature = "no_index"))]
VariantTuple(i32, i32),
VariantEmptyStruct {},
VariantStruct {
a: i32,
},
}
{
assert_eq!(
"VariantUnit",
to_dynamic(MyEnum::VariantUnit)?
.into_immutable_string()
.unwrap()
.as_str()
);
}
#[cfg(not(feature = "no_index"))]
{
let mut map = to_dynamic(MyEnum::VariantUnitTuple())?.cast::<Map>();
let content = map.remove("VariantUnitTuple").unwrap().cast::<Array>();
assert!(map.is_empty());
assert!(content.is_empty());
}
let mut map = to_dynamic(MyEnum::VariantNewtype(123))?.cast::<Map>();
let content = map.remove("VariantNewtype").unwrap();
assert!(map.is_empty());
assert_eq!(Ok(123), content.as_int());
#[cfg(not(feature = "no_index"))]
{
let mut map = to_dynamic(MyEnum::VariantTuple(123, 456))?.cast::<Map>();
let content = map.remove("VariantTuple").unwrap().cast::<Array>();
assert!(map.is_empty());
assert_eq!(2, content.len());
assert_eq!(Ok(123), content[0].as_int());
assert_eq!(Ok(456), content[1].as_int());
}
let mut map = to_dynamic(MyEnum::VariantEmptyStruct {})?.cast::<Map>();
let map_inner = map.remove("VariantEmptyStruct").unwrap().cast::<Map>();
assert!(map.is_empty());
assert!(map_inner.is_empty());
let mut map = to_dynamic(MyEnum::VariantStruct { a: 123 })?.cast::<Map>();
let mut map_inner = map.remove("VariantStruct").unwrap().cast::<Map>();
assert!(map.is_empty());
assert_eq!(Ok(123), map_inner.remove("a").unwrap().as_int());
assert!(map_inner.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/97328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 957
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
75861,
62,
4301,
745,
9372,
3556,
31054,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
3759,
9050,
5563,
262,
7618,
3017,
10766,
341,
286,
39292,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_create_tx_absolute_high_fee() {
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
let addr = wallet.get_new_address().unwrap();
let (_psbt, _details) = wallet
.create_tx(
TxBuilder::new()
.set_single_recipient(addr.script_pubkey())
.drain_wallet()
.fee_absolute(60_000),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/11330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17805,
50874,
22680,
34305,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
1670,
20819,
71,
1423,
286,
1077,
10789,
284,
15085,
670,
5921,
6744,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_linuxcontainer_do_init_child() {
let ret = do_init_child(std::io::stdin().as_raw_fd());
assert!(ret.is_err(), "Expecting Err, Got {:?}", ret);
} | rust_cleaned_test_functions.jsonl/16633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77463,
3586,
26309,
6137,
17268,
368,
341,
286,
1077,
2112,
284,
653,
6137,
17268,
5194,
486,
815,
486,
51602,
1005,
300,
16067,
17676,
1423,
286,
2060,
10297,
2122,
2079,
9266,
1507,
330,
17536,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cli_error_display() {
assert_eq!(format!("{}", AppError::Cli("An error".to_owned())), format!("{} An error", Red.bold().paint("[CliError]")));
} | rust_cleaned_test_functions.jsonl/63283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
4096,
14825,
368,
341,
286,
2060,
10714,
10297,
2243,
79878,
1845,
1454,
486,
87014,
445,
2082,
1465,
3263,
983,
51973,
96501,
3561,
17223,
6257,
1527,
1465,
497,
3731,
31675,
1005,
33617,
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 |
#[test]
fn test_nearest_neighbor_iterator() {
let mut points = create_random_points(1000, SEED_1);
let tree = RTree::bulk_load(points.clone());
let sample_points = create_random_points(50, SEED_2);
for sample_point in &sample_points {
points.sort_by(|r, l| {
r.distance_2(sample_point)
.partial_cmp(&l.distance_2(&sample_point))
.unwrap()
});
let collected: Vec<_> = tree.nearest_neighbor_iter(sample_point).cloned().collect();
assert_eq!(points, collected);
}
} | rust_cleaned_test_functions.jsonl/70398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
15432,
71888,
13491,
368,
341,
286,
1077,
5206,
3501,
284,
1855,
22644,
12928,
7,
16,
15,
15,
15,
11,
5052,
1479,
62,
16,
317,
286,
1077,
4916,
284,
431,
6533,
486,
67142,
12411,
32450,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_case_20() {
let key = "a63672d582bb83d92249800324cbc9a6e5b37d36887e7c79093f58ef8f1a0015";
let nonce = "85321bfee1714260dd6130cc768d20b1";
let expected_output =
"97e05360aca70058389d93be38d49fa26df01a4d3b4c4f10c3ec31e0ed64f08e";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
17,
15,
368,
341,
310,
1077,
1376,
284,
330,
64,
21,
18,
21,
22,
17,
67,
20,
23,
17,
6066,
23,
18,
67,
24,
17,
17,
19,
24,
23,
15,
15,
18,
17,
19,
80766,
24,
64,
21,
68,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ping_pong_close() {
let (mut mock, service, _other) = mock::multiplex_client();
let pong = service.call(Message::WithoutBody("ping"));
let wr = mock.next_write();
assert_eq!(0, wr.request_id());
assert_eq!("ping", wr.unwrap_msg());
mock.send(msg(0, "pong"));
assert_eq!("pong", pong.wait().unwrap().into_inner());
mock.allow_and_assert_drop();
} | rust_cleaned_test_functions.jsonl/120130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71661,
62,
59102,
12704,
368,
341,
262,
1077,
320,
6984,
7860,
11,
2473,
11,
716,
1575,
8,
284,
7860,
486,
77976,
2571,
8179,
1428,
262,
1077,
77622,
284,
2473,
8524,
29359,
486,
26040,
5444,
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_parse_record_only_properties() {
let mut p = Parser::new(r#"{a:int, b:uint}"#);
let parsed = p.parse_record();
let loc = Locator::new(&p.source[..]);
assert_eq!(
parsed,
MonoType::Record(RecordType {
base: BaseNode {
location: loc.get(1, 1, 1, 16),
..BaseNode::default()
},
tvar: None,
properties: vec![
PropertyType {
base: BaseNode {
location: loc.get(1, 2, 1, 7),
..BaseNode::default()
},
name: Identifier {
name: "a".to_string(),
base: BaseNode {
location: loc.get(1, 2, 1, 3),
..BaseNode::default()
},
},
monotype: MonoType::Basic(NamedType {
base: BaseNode {
location: loc.get(1, 4, 1, 7),
..BaseNode::default()
},
name: Identifier {
name: "int".to_string(),
base: BaseNode {
location: loc.get(1, 4, 1, 7),
..BaseNode::default()
},
}
})
},
PropertyType {
base: BaseNode {
location: loc.get(1, 9, 1, 15),
..BaseNode::default()
},
name: Identifier {
name: "b".to_string(),
base: BaseNode {
location: loc.get(1, 9, 1, 10),
..BaseNode::default()
},
},
monotype: MonoType::Basic(NamedType {
base: BaseNode {
location: loc.get(1, 11, 1, 15),
..BaseNode::default()
},
name: Identifier {
name: "uint".to_string(),
base: BaseNode {
location: loc.get(1, 11, 1, 15),
..BaseNode::default()
},
}
})
}
]
},)
)
} | rust_cleaned_test_functions.jsonl/67826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1820
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14192,
18410,
25158,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
2601,
2,
14129,
64,
14337,
11,
293,
62921,
9863,
2,
317,
262,
1077,
15676,
284,
281,
4632,
14192,
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... | 1 |
#[test]
fn test_t106() {
init();
let result = t106(
*UIN,
0,
*APP_ID,
*SSO_VERSION,
&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
true,
&*GUID,
&*TGTGT_KEY,
0,
);
println!("{}", result.len());
println!("{:?}", result)
} | rust_cleaned_test_functions.jsonl/104725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
16,
15,
21,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
16,
15,
21,
1006,
310,
353,
52,
687,
345,
310,
220,
15,
345,
310,
353,
14707,
3450,
345,
310,
353,
1220,
46,
10678,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_specific_bin_target() {
let prj = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
[[bin]]
name="bin1"
path="src/bin1.rs"
[[bin]]
name="bin2"
path="src/bin2.rs"
"#,
)
.file("src/bin1.rs", "#[test] fn test1() { }")
.file("src/bin2.rs", "#[test] fn test2() { }")
.build();
prj.cargo("test --bin bin2")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/bin2-[..][EXE]",
)
.with_stdout_contains("test test2 ... ok")
.run();
} | rust_cleaned_test_functions.jsonl/95357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
56592,
21816,
11123,
368,
341,
262,
1077,
548,
73,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
1722,
921,
310,
829,
284,
330,
7975... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_mario_demo() {
run_cpu_ppu(
"../roms/my_dump/mario.nes".to_string(),
"mario_demo.bmp".to_string(),
1000,
|_cpu, _sys, fb| {
// FBの結果を精査する
let _ = validate_framebuffer(fb, "../screenshot/mario_demo.bmp".to_string());
},
)
} | rust_cleaned_test_functions.jsonl/66837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
717,
3290,
47830,
368,
341,
286,
1598,
21795,
31600,
84,
1006,
310,
7005,
441,
82,
34198,
18296,
3183,
3290,
1253,
288,
3263,
983,
3904,
3148,
310,
330,
76,
3290,
47830,
55476,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chmod_non_existing_file() {
new_ucmd!()
.arg("-R")
.arg("--verbose")
.arg("-r,a+w")
.arg("does-not-exist")
.fails()
.stderr_contains(&"cannot access 'does-not-exist': No such file or directory");
} | rust_cleaned_test_functions.jsonl/127211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2593,
21637,
62630,
2458,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
49,
1138,
286,
659,
858,
21549,
14883,
1138,
286,
659,
858,
13645,
81,
15012,
65105,
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_get_request_pdu_len() {
let mut buf = BytesMut::new();
buf.extend_from_slice(&[0x66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
assert!(get_request_pdu_len(&buf).is_err());
buf[1] = 0x01;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x02;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x03;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x04;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x05;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x06;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(5));
buf[1] = 0x07;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(1));
// TODO: 0x08
buf[1] = 0x0B;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(1));
buf[1] = 0x0C;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(1));
buf[1] = 0x0F;
buf[4] = 99;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(105));
buf[1] = 0x10;
buf[4] = 99;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(105));
buf[1] = 0x11;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(1));
// TODO: 0x14
// TODO: 0x15
buf[1] = 0x16;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(7));
buf[1] = 0x17;
buf[10] = 99; // write byte count
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(109));
buf[1] = 0x18;
assert_eq!(get_request_pdu_len(&buf).unwrap(), Some(3));
// TODO: 0x2B
} | rust_cleaned_test_functions.jsonl/17494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 950
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7893,
95249,
6043,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
931,
1428,
286,
6607,
15831,
5673,
26488,
2099,
58,
15,
87,
21,
21,
11,
220,
15,
11,
220,
15,
11,
220,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_skip_leading_space_from_stdin() {
new_ucmd!()
.args(&["--from=auto"])
.pipe_in(" 2Ki")
.run()
.stdout_is("2048\n");
// multi-line
new_ucmd!()
.args(&["--from=auto"])
.pipe_in("\t1Ki\n 2K")
.run()
.stdout_is("1024\n2000\n");
} | rust_cleaned_test_functions.jsonl/46007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
44830,
11751,
2228,
14663,
5673,
15656,
258,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
1499,
28,
3902,
14108,
286,
659,
13768,
1243,
445,
220,
17,
72572,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_object_writer() {
let mut buf: Vec<u8> = Vec::new();
let obj = TestSingleObjectWriter {
a: 300,
b: 34.555,
c: vec!["cat".into(), "dog".into()],
};
let mut writer = GenericSingleObjectWriter::new_with_capacity(
&TestSingleObjectWriter::get_schema(),
1024,
)
.expect("Should resolve schema");
let value = obj.into();
let written_bytes = writer
.write_value_ref(&value, &mut buf)
.expect("Error serializing properly");
assert!(buf.len() > 10, "no bytes written");
assert_eq!(buf.len(), written_bytes);
assert_eq!(buf[0], 0xC3);
assert_eq!(buf[1], 0x01);
assert_eq!(
&buf[2..10],
&TestSingleObjectWriter::get_schema()
.fingerprint::<Rabin>()
.bytes[..]
);
let mut msg_binary = Vec::new();
encode(
&value,
&TestSingleObjectWriter::get_schema(),
&mut msg_binary,
)
.expect("encode should have failed by here as a dependency of any writing");
assert_eq!(&buf[10..], &msg_binary[..])
} | rust_cleaned_test_functions.jsonl/130966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 635
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
5314,
28908,
368,
341,
286,
1077,
5206,
6607,
25,
11312,
34837,
23,
29,
284,
11312,
486,
931,
543,
286,
1077,
2839,
284,
3393,
10888,
1190,
6492,
341,
310,
264,
25,
220,
18,
15,
15,
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_get_non_default_port() {
assert!(get_non_default_port(&"http://hyper.rs".parse::<Uri>().unwrap()).is_none());
assert!(get_non_default_port(&"http://hyper.rs:80".parse::<Uri>().unwrap()).is_none());
assert!(get_non_default_port(&"https://hyper.rs:443".parse::<Uri>().unwrap()).is_none());
assert!(get_non_default_port(&"hyper.rs:80".parse::<Uri>().unwrap()).is_none());
assert_eq!(
get_non_default_port(&"http://hyper.rs:123".parse::<Uri>().unwrap())
.unwrap()
.as_u16(),
123
);
assert_eq!(
get_non_default_port(&"https://hyper.rs:80".parse::<Uri>().unwrap())
.unwrap()
.as_u16(),
80
);
assert_eq!(
get_non_default_port(&"hyper.rs:123".parse::<Uri>().unwrap())
.unwrap()
.as_u16(),
123
);
} | rust_cleaned_test_functions.jsonl/56960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
21637,
9993,
8716,
368,
341,
286,
2060,
10297,
455,
21637,
9993,
8716,
2099,
1,
1254,
1110,
68192,
25638,
3263,
6400,
27638,
13899,
10483,
15454,
6011,
285,
31488,
1423,
286,
2060,
10297,
455,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_packet_update_ipv4_tcp() {
// Ether / IPv4 / TCP / Raw
let test_data = hex!("feff2000010000000100000008004500 AAAA 0f4540008006 AAAA 91fea0ed41d0e4df0d2c005038affe14114c618c501825bc AAAA 0000474554202f646f776e6c6f61642e68746d6c20485454502f312e310d0a486f73743a207777772e657468657265616c2e636f6d0d0a557365722d4167656e743a204d6f7a696c6c612f352e30202857696e646f77733b20553b2057696e646f7773204e5420352e313b20656e2d55533b2072763a312e3629204765636b6f2f32303034303131330d0a4163636570743a20746578742f786d6c2c6170706c69636174696f6e2f786d6c2c6170706c69636174696f6e2f7868746d6c2b786d6c2c746578742f68746d6c3b713d302e392c746578742f706c61696e3b713d302e382c696d6167652f706e672c696d6167652f6a7065672c696d6167652f6769663b713d302e322c2a2f2a3b713d302e310d0a4163636570742d4c616e67756167653a20656e2d75732c656e3b713d302e350d0a4163636570742d456e636f64696e673a20677a69702c6465666c6174650d0a4163636570742d436861727365743a2049534f2d383835392d312c7574662d383b713d302e372c2a3b713d302e370d0a4b6565702d416c6976653a203330300d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a526566657265723a20687474703a2f2f7777772e657468657265616c2e636f6d2f646576656c6f706d656e742e68746d6c0d0a0d0a");
let mut pkt = Packet::from_bytes(test_data.as_ref()).unwrap();
assert_eq!(4, pkt.layers.len());
assert_eq!(0xAAAA, pkt.ipv4().unwrap().length);
assert_eq!(0xAAAA, pkt.ipv4().unwrap().checksum);
assert_eq!(0xAAAA, pkt.tcp().unwrap().checksum);
pkt.update().unwrap();
assert_eq!(0x0207, pkt.ipv4().unwrap().length);
assert_eq!(0x9010, pkt.ipv4().unwrap().checksum);
assert_eq!(0xa958, pkt.tcp().unwrap().checksum);
} | rust_cleaned_test_functions.jsonl/78716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 907
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
8882,
49378,
19,
45562,
368,
341,
286,
442,
34878,
608,
31560,
19,
608,
26656,
608,
23022,
198,
286,
1077,
1273,
1769,
284,
12371,
17223,
1859,
542,
17,
15,
15,
15,
15,
16,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_special_path() {
let mut db_url = url::Url::parse("postgres://postgres@localhost/").unwrap();
assert_eq!(db_url.as_str(), "postgres://postgres@localhost/");
db_url.set_path("diesel_foo");
assert_eq!(db_url.as_str(), "postgres://postgres@localhost/diesel_foo");
assert_eq!(db_url.path(), "/diesel_foo");
} | rust_cleaned_test_functions.jsonl/79053 | {
"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,
21637,
41629,
2638,
368,
341,
262,
1077,
5206,
2927,
2903,
284,
2515,
486,
2864,
486,
6400,
445,
43070,
1110,
43070,
31,
8301,
14,
1827,
15454,
543,
262,
2060,
10714,
10297,
1999,
2903,
5357,
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_jnz_reg_nope() {
let input = "jnz a 2
inc a
inc a";
let regs = compute(input);
assert_eq!(2, regs.get('a'));
} | rust_cleaned_test_functions.jsonl/21648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
50824,
4920,
1089,
2792,
368,
341,
10217,
1946,
284,
330,
73,
50824,
264,
220,
17,
198,
2840,
264,
198,
2840,
264,
876,
10217,
44498,
284,
12564,
5384,
317,
6948,
10714,
10297,
17,
11,
444... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_chown_recursive() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let result = scene.cmd("whoami").run();
if skipping_test_is_okay(&result, "whoami: cannot find name for user ID") {
return;
}
let user_name = String::from(result.stdout_str().trim());
assert!(!user_name.is_empty());
at.mkdir_all("a/b/c");
at.mkdir("z");
at.touch(&at.plus_as_string("a/a"));
at.touch(&at.plus_as_string("a/b/b"));
at.touch(&at.plus_as_string("a/b/c/c"));
at.touch(&at.plus_as_string("z/y"));
let result = scene
.ucmd()
.arg("-R")
.arg("--verbose")
.arg(user_name)
.arg("a")
.arg("z")
.run();
result.stderr_contains(&"ownership of 'a/a' retained as");
result.stderr_contains(&"ownership of 'z/y' retained as");
} | rust_cleaned_test_functions.jsonl/26597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
779,
66242,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
401,
262,
1077,
1102,
284,
6109,
25724,
445,
14623,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_remove() {
let mut a = vec![1,2,3,4];
assert_eq!(a.remove(2), Some(3));
assert_eq!(a, vec![1,2,4]);
assert_eq!(a.remove(2), Some(4));
assert_eq!(a, vec![1,2]);
assert_eq!(a.remove(2), None);
assert_eq!(a, vec![1,2]);
assert_eq!(a.remove(0), Some(1));
assert_eq!(a, vec![2]);
assert_eq!(a.remove(0), Some(2));
assert_eq!(a, vec![]);
assert_eq!(a.remove(0), None);
assert_eq!(a.remove(10), None);
} | rust_cleaned_test_functions.jsonl/75618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
341,
286,
1077,
5206,
264,
284,
7486,
20703,
16,
11,
17,
11,
18,
11,
19,
4821,
286,
2060,
10714,
10297,
64,
4850,
7,
17,
701,
4329,
7,
18,
1106,
286,
2060,
10714,
10297,
64,
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_xclip_suffix_custom() {
let x = b"GAAAA";
let y = b"CG";
let score = |a: u8, b: u8| if a == b { 1i32 } else { -1i32 };
let scoring = Scoring::new(-5, -1, &score).xclip(-5).yclip(0);
let mut aligner = banded::Aligner::with_scoring(scoring, 10, 10);
let alignment = aligner.custom(x, y);
assert_eq!(alignment.operations, [Yclip(1), Match, Xclip(4)]);
} | rust_cleaned_test_functions.jsonl/126761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
7974,
37151,
15875,
368,
341,
286,
1077,
856,
284,
293,
89199,
25699,
876,
286,
1077,
379,
284,
293,
1,
8798,
3302,
286,
1077,
5456,
284,
760,
64,
25,
575,
23,
11,
293,
25,
575,
23,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_punycode() {
match from_str(include_str!("punycode_tests.json")) {
Ok(List(tests)) => for test in tests.iter() {
match test {
&Object(ref o) => one_test(
get_string(o, "description"),
get_string(o, "decoded"),
get_string(o, "encoded")
),
_ => panic!(),
}
},
other => panic!("{}", other)
}
} | rust_cleaned_test_functions.jsonl/92874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
359,
88,
1851,
368,
1476,
286,
2432,
504,
2895,
77863,
2895,
17223,
64907,
88,
1851,
32509,
4323,
2761,
341,
310,
7622,
10278,
8623,
82,
593,
589,
369,
1273,
304,
7032,
19471,
368,
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... | 4 |
#[test]
fn test_minimal_with_filter_identity_column_test() {
let req = json!({
"search_req": {
"search": {
"terms":["test"],
"path": "field"
}
},
"filter":{
"search": {
"terms":["test"],
"path": "field"
}
}
});
let hits = search_testo_to_doc!(req).data;
assert_eq!(hits.len(), 1);
assert_eq!(
TEST_PERSISTENCE.metadata.columns.get("field").expect("field.textindex not found").is_anchor_identity_column,
true
);
assert_eq!(hits[0].doc["field"], "test");
} | rust_cleaned_test_functions.jsonl/8312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
2861,
6615,
8727,
46244,
8744,
4452,
368,
341,
262,
1077,
4232,
284,
2951,
0,
2262,
286,
330,
1836,
17644,
788,
341,
310,
330,
1836,
788,
341,
394,
330,
18347,
36799,
1944,
8097,
394,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_with_tags_send_success() {
struct StoringSink {
metrics: Arc<Mutex<RefCell<Vec<String>>>>,
}
impl MetricSink for StoringSink {
fn emit(&self, metric: &str) -> io::Result<usize> {
let mutex = self.metrics.as_ref();
let cell = mutex.lock().unwrap();
cell.borrow_mut().push(metric.to_owned());
Ok(0)
}
}
fn panic_handler(err: MetricError) {
panic!("Metric send error: {}", err);
}
let metrics = Arc::new(Mutex::new(RefCell::new(Vec::new())));
let metrics_ref = Arc::clone(&metrics);
let sink = StoringSink { metrics: metrics_ref };
let client = StatsdClient::builder("prefix", sink)
.with_error_handler(panic_handler)
.build();
client.incr_with_tags("some.key").with_tag("test", "a").send();
let mutex = metrics.as_ref();
let cell = mutex.lock().unwrap();
assert_eq!(1, cell.borrow().len());
} | rust_cleaned_test_functions.jsonl/48389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
6615,
16333,
13565,
18632,
368,
341,
286,
2036,
794,
5503,
45094,
341,
310,
16734,
25,
19689,
33274,
9371,
27,
3945,
3599,
50439,
3464,
18153,
345,
286,
555,
286,
11605,
52458,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fastq_empty_lines_end() {
// up to 3 newlines at end possible
let mut reader = Reader::new(&b"@id\nATGC\n+\n~~~~\n\n\n"[..]);
assert_eq!(reader.next().unwrap().unwrap().id_bytes(), b"id");
assert!(reader.next().is_none());
} | rust_cleaned_test_functions.jsonl/40337 | {
"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,
35743,
80,
15124,
18323,
6213,
368,
341,
262,
442,
705,
311,
220,
18,
501,
7969,
518,
835,
3204,
198,
262,
1077,
5206,
6604,
284,
25166,
486,
931,
2099,
65,
96270,
307,
1699,
828,
22863,
1699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_take_val() {
let env = Env {
vars: hashmap! {
"hoge".to_owned() => Val::Map(hashmap! {
"fuga".to_owned() => Val::Map(hashmap! {
"bar".to_owned() => Val::Int(123)
})
})
},
};
assert_eq!(
take_val(&env, &crate::Fqid::new(&["hoge", "fuga", "bar"])),
Ok(&Val::Int(123))
);
assert_eq!(
take_val(&env, &crate::Fqid::new(&["hoge", "fuga", "foo"])),
Err(Error::UndefinedVariable(crate::Fqid::new(&[
"hoge", "fuga", "foo"
])))
);
assert_eq!(
take_val(&env, &crate::Fqid::new(&["hoge", "fuga", "bar", "foo"])),
Err(Error::MismatchedType {
expected: Type::Map(hashmap! {"bar".to_owned() => Type::Any}),
real: Type::Int,
})
);
} | rust_cleaned_test_functions.jsonl/113310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
6189,
368,
341,
286,
1077,
6105,
284,
37039,
341,
310,
19942,
25,
92148,
0,
341,
394,
330,
71,
40532,
3263,
983,
51973,
368,
589,
4104,
486,
2227,
27580,
2186,
0,
341,
503,
330,
69,
369... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_progress_leader() {
let l = default_logger();
let mut raft = new_test_raft(1, vec![1, 2], 5, 1, new_storage(), &l);
raft.become_candidate();
raft.become_leader();
raft.mut_prs().get_mut(2).unwrap().become_replicate();
let prop_msg = new_message(1, 1, MessageType::MsgPropose, 1);
for i in 0..5 {
assert_eq!(
raft.mut_prs().get_mut(1).unwrap().state,
ProgressState::Replicate
);
let matched = raft.mut_prs().get_mut(1).unwrap().matched;
let next_idx = raft.mut_prs().get_mut(1).unwrap().next_idx;
assert_eq!(matched, i + 1);
assert_eq!(next_idx, matched + 1);
assert!(raft.step(prop_msg.clone()).is_ok());
}
} | rust_cleaned_test_functions.jsonl/19081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27200,
79991,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
52455,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
20,
11,
220,
16,
11,
501,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_setter_only_array() {
let mut fb = FooBar(0);
fb.setter_only_array(0, 0);
assert_eq!(0x0, fb.0);
fb.setter_only_array(0, 0b111);
assert_eq!(0b111 << (4 + 0 * 2), fb.0);
fb.setter_only_array(0, 0);
fb.setter_only_array(1, 0b111);
assert_eq!(0b111 << (4 + 1 * 3), fb.0);
fb.setter_only_array(1, 0);
fb.setter_only_array(2, 0b111);
assert_eq!(0b111 << (4 + 2 * 3), fb.0);
} | rust_cleaned_test_functions.jsonl/2267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
465,
18410,
3858,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
25469,
46594,
18410,
3858,
7,
15,
11,
220,
15,
317,
262,
2060,
10714,
10297,
15,
87,
15,
11,
25469,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 dir = tempdir().unwrap().into_path();
let mut loader = FileArtifactReader::new(&dir, &dir);
let mut file = File::create(dir.join("foo")).unwrap();
file.write_all(b"test_data").unwrap();
file.sync_all().unwrap();
let result = loader.read_bytes(&Path::new("foo"));
assert_eq!(result.is_ok(), true);
let data = result.unwrap();
assert_eq!(data, b"test_data");
} | rust_cleaned_test_functions.jsonl/62915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
1005,
18122,
2638,
543,
286,
1077,
5206,
16047,
284,
2887,
85578,
5062,
486,
931,
2099,
3741,
11,
609,
3741,
317,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_plus_return_sum() {
let five: Expression = Money::dollar(5).into();
let result = &five + &five;
let sum = match result {
Expression::Sum(x) => x,
_ => panic!("Sumが来るはず")
};
assert_eq!(Box::new(five.clone()), sum.augend);
assert_eq!(Box::new(five.clone()), sum.addend);
} | rust_cleaned_test_functions.jsonl/115304 | {
"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,
28043,
12511,
10160,
368,
341,
286,
1077,
4236,
25,
16378,
284,
17633,
486,
67,
21295,
7,
20,
568,
18122,
543,
286,
1077,
1102,
284,
609,
52670,
488,
609,
52670,
280,
286,
1077,
2629,
284,
2432,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_e2e_ones_tinybuf() {
let data = [1u8, 2u8, 3u8, 4u8,255u8,1u8,2u8,3u8,0u8,1u8,2u8,3u8,8u8,4u8,3u8,
7u8, 2u8, 3u8, 4u8,6u8,1u8,2u8,4u8,0u8,1u8,16u8,31u8,83u8,43u8,34u8,
217u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
217u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
217u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
227u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
237u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
247u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
247u8, 252u8, 253u8, 254u8,244u8,251u8,252u8,254u8,250u8,251u8,216u8,231u8,183u8,243u8,234u8,
247u8, 252u8, 253u8, 254u8,244u8,
];
e2e_no_ir(1, false, false, &data[..], 0.99);
} | rust_cleaned_test_functions.jsonl/19824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 770
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
17,
68,
62,
3154,
528,
6441,
5909,
368,
341,
262,
1077,
821,
284,
508,
16,
84,
23,
11,
220,
17,
84,
23,
11,
220,
18,
84,
23,
11,
220,
19,
84,
23,
11,
17,
20,
20,
84,
23,
11,
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_rotate180_in_place() {
let mut image: GrayImage =
ImageBuffer::from_raw(3, 2, vec![00u8, 01u8, 02u8, 10u8, 11u8, 12u8]).unwrap();
let expected: GrayImage =
ImageBuffer::from_raw(3, 2, vec![12u8, 11u8, 10u8, 02u8, 01u8, 00u8]).unwrap();
rotate180_in_place(&mut image);
assert_pixels_eq!(&image, &expected);
} | rust_cleaned_test_functions.jsonl/118194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
16,
23,
15,
1243,
34548,
368,
341,
286,
1077,
5206,
2168,
25,
23366,
1906,
4035,
310,
4654,
4095,
486,
1499,
16067,
7,
18,
11,
220,
17,
11,
7486,
20703,
15,
15,
84,
23,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_midpoint_of_range() {
assert_eq!(midpoint_of_range(&(0..127)), 64);
assert_eq!(midpoint_of_range(&(32..63)), 48);
assert_eq!(midpoint_of_range(&(44..47)), 46);
} | rust_cleaned_test_functions.jsonl/114232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43733,
2768,
3575,
9698,
368,
341,
262,
2060,
10714,
10297,
16106,
2768,
3575,
9698,
29089,
15,
496,
16,
17,
22,
5731,
220,
21,
19,
317,
262,
2060,
10714,
10297,
16106,
2768,
3575,
9698,
29089,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prf_empty_key() {
let key: [u8; 0] = [];
let actual = prf(&key[..], "something is happening", "Lorem ipsum".as_bytes(), 256);
assert_eq!(actual.is_ok(), true);
let expected =
Vec::from_hex("5b154287399baeabd7d2c9682989e0933b3fdef8211ae7ae0c6586bb1e38de7c")
.unwrap();
assert_eq!(actual.unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/132287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
69,
15124,
3097,
368,
341,
286,
1077,
1376,
25,
508,
84,
23,
26,
220,
15,
60,
284,
5907,
286,
1077,
5042,
284,
548,
69,
2099,
792,
95874,
1125,
330,
33331,
374,
12482,
497,
330,
32783,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let out = Duration::parse("1ns");
assert_eq!(out.nsecs, 1);
let out = Duration::parse("1ns1ms");
assert_eq!(out.nsecs, NS_MILLISECOND + 1);
let out = Duration::parse("123ns40ms");
assert_eq!(out.nsecs, 40 * NS_MILLISECOND + 123);
let out = Duration::parse("123ns40ms1w");
assert_eq!(out.nsecs, 40 * NS_MILLISECOND + 123 + NS_WEEK);
let out = Duration::parse("-123ns40ms1w");
assert!(out.negative);
} | rust_cleaned_test_functions.jsonl/30919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
700,
284,
21045,
486,
6400,
445,
16,
4412,
797,
286,
2060,
10714,
10297,
411,
1253,
53281,
11,
220,
16,
317,
286,
1077,
700,
284,
21045,
486,
6400,
445,
16,
4412,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tight_infinite_loop_unconditional() {
test_interpreter_and_jit_asm!(
"
ja -1
exit",
[],
(),
{
|_vm, res: Result| {
matches!(res.unwrap_err(),
EbpfError::ExceededMaxInstructions(pc, initial_insn_count)
if pc == 30 && initial_insn_count == 4
)
}
},
4
);
} | rust_cleaned_test_functions.jsonl/59058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
491,
1243,
25722,
17198,
4907,
45368,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
11937,
481,
16,
198,
286,
4869,
756,
286,
10239,
286,
84201,
286,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_tag_new_type() {
let file = File::new_type(TEST_MP3, FileType::MPEG).unwrap();
let tag = file.tag().unwrap();
assert_eq!(tag.artist().unwrap(), "Artist");
} | rust_cleaned_test_functions.jsonl/79492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9372,
5921,
1819,
368,
341,
286,
1077,
1034,
284,
2887,
486,
931,
1819,
50320,
53052,
18,
11,
93238,
486,
44,
22061,
568,
15454,
543,
286,
1077,
4772,
284,
1034,
12399,
1005,
15454,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_host() {
assert_eq!(
host("localhost:8080"),
Ok((":8080", Host::HOST("localhost".to_string())))
);
assert_eq!(
host("example.org:8080"),
Ok((":8080", Host::HOST("example.org".to_string())))
);
assert_eq!(
host("some-subsite.example.org:8080"),
Ok((":8080", Host::HOST("some-subsite.example.org".to_string())))
);
assert_eq!(
host("example.123"),
Ok((".123", Host::HOST("example".to_string())))
);
assert_eq!(
host("$$$.com"),
Err(NomErr::Error(VerboseError {
errors: vec![
("$$$.com", VerboseErrorKind::Nom(ErrorKind::AlphaNumeric)),
("$$$.com", VerboseErrorKind::Nom(ErrorKind::ManyMN)),
("$$$.com", VerboseErrorKind::Nom(ErrorKind::Alt)),
("$$$.com", VerboseErrorKind::Context("host")),
]
}))
);
assert_eq!(
host(".com"),
Err(NomErr::Error(VerboseError {
errors: vec![
(".com", VerboseErrorKind::Nom(ErrorKind::AlphaNumeric)),
(".com", VerboseErrorKind::Nom(ErrorKind::ManyMN)),
(".com", VerboseErrorKind::Nom(ErrorKind::Alt)),
(".com", VerboseErrorKind::Context("host")),
]
}))
);
} | rust_cleaned_test_functions.jsonl/118914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 857
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
368,
341,
286,
2060,
10714,
33673,
310,
3468,
445,
8301,
25,
23,
15,
23,
15,
4461,
310,
7622,
7,
18893,
23,
15,
23,
15,
497,
16102,
486,
28687,
445,
8301,
3263,
983,
3904,
60131,
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_bad_parse_bos() {
// Too short
assert_eq!(parse_bos(&[0x03, 0x0F, 0x03]), None);
// bLength too large
assert_eq!(parse_bos(&[0x06, 0x0F, 0x05, 0x00, 0x01]), None);
// wTotalLength less than bLength
assert_eq!(parse_bos(&[0x05, 0x0F, 0x04, 0x00, 0x01]), None);
// wTotalLength too large
assert_eq!(parse_bos(&[0x05, 0x0F, 0x06, 0x00, 0x01]), None);
// bNumDeviceCaps == 1 but there are no actual descriptors
assert_eq!(parse_bos(&[0x05, 0x0F, 0x05, 0x00, 0x01]), None);
// the single capability descriptor too short
assert_eq!(parse_bos(&[0x05, 0x0F, 0x06, 0x00, 0x01, 0x02, 0x10]), None);
// The bLength on a capability descriptor in the BOS descriptor is longer than
// the remaining space defined by wTotalLength
assert_eq!(
parse_bos(&[0x05, 0x0F, 0x08, 0x00, 0x01, 0x04, 0x10, 0x05]),
None
);
// There is something other than a device capability descriptor in the BOS
// descriptor
assert_eq!(
parse_bos(&[0x05, 0x0F, 0x08, 0x00, 0x01, 0x03, 0x0F, 0x05]),
None
);
assert_eq!(
// Platform capability descriptor is too short for a UUID
parse_bos(&[
0x05, 0x0F, 0x18, 0x00, 0x01, 0x13, 0x10, 0x05, 0x00, 0x2A, 0xF9, 0xF6,
0xC2, 0x98, 0x10, 0x2B, 0x49, 0x8E, 0x64, 0xFF, 0x01, 0x0C, 0x7F, 0x94
]),
None,
);
assert_eq!(
// Bad PlatformCapabilityUUID value
parse_bos(&[
// BOS descriptor.
0x05, 0x0F, 0x4C, 0x00, 0x03, // Container ID descriptor.
0x14, 0x10, 0x04, 0x00, 0x2A, 0xF9, 0xF6, 0xC2, 0x98, 0x10, 0x2B, 0x49,
0x8E, 0x64, 0xFF, 0x01, 0x0C, 0x7F, 0x94, 0xE1,
// WebUSB Platform Capability descriptor.
0x18, 0x10, 0x05, 0x00, 0x31, // <-- This one byte is wrong ;)
0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, 0x8B, 0xFD, 0xA0, 0x76, 0x88,
0x15, 0xB6, 0x65, 0x00, 0x01, 0x42, 0x01,
0x1C, 0x10, 0x05, 0x00, 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C,
0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F, 0x00, 0x00, 0x03, 0x06,
0x00, 0x00, 0x01, 0x00,
]),
None,
);
assert_eq!(
// Bad bcdVersion
parse_bos(&[
// BOS descriptor.
0x05, 0x0F, 0x4C, 0x00, 0x03, // Container ID descriptor.
0x14, 0x10, 0x04, 0x00, 0x2A, 0xF9, 0xF6, 0xC2, 0x98, 0x10, 0x2B, 0x49,
0x8E, 0x64, 0xFF, 0x01, 0x0C, 0x7F, 0x94, 0xE1,
// WebUSB Platform Capability descriptor.
0x18, 0x10, 0x05, 0x00, 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47,
0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65,
// bcdVersion
0x00, 0x00, // <-- This one byte is wrong ;)
0x42, 0x01,
0x1C, 0x10, 0x05, 0x00, 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C,
0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F, 0x00, 0x00, 0x03, 0x06,
0x00, 0x00, 0x01, 0x00,
]),
None,
)
} | rust_cleaned_test_functions.jsonl/91367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1725
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
21039,
880,
436,
368,
341,
262,
442,
24599,
2805,
198,
262,
2060,
10714,
10297,
6400,
880,
436,
2099,
58,
15,
87,
15,
18,
11,
220,
15,
87,
15,
37,
11,
220,
15,
87,
15,
18,
9719,
224... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words = words.iter().map(|x| capitalize_first(x)).collect::<Vec<_>>().join("");
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/113091 | {
"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,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
284,
4244,
19471,
1005,
2186,
22428,
87,
91,
52725,
12978,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_return_type_handles_type_aliases() {
check_fix(
r#"
//- minicore: option, result
type MyResult<T> = Result<T, ()>;
fn div(x: i32, y: i32) -> MyResult<i32> {
if y == 0 {
return Err(());
}
x $0/ y
}
"#,
r#"
type MyResult<T> = Result<T, ()>;
fn div(x: i32, y: i32) -> MyResult<i32> {
if y == 0 {
return Err(());
}
Ok(x / y)
}
"#,
);
} | rust_cleaned_test_functions.jsonl/51838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
12511,
1819,
68017,
1819,
90233,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
2999,
11,
1102,
198,
1313,
3017,
2077,
3125,
29,
284,
5714,
3125,
11,
1719,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_host_ipa_limit() {
let kvm = Kvm::new().unwrap();
let host_ipa_limit = kvm.get_host_ipa_limit();
if host_ipa_limit > 0 {
assert!(host_ipa_limit >= 32);
} else {
assert_eq!(host_ipa_limit, 0);
}
} | rust_cleaned_test_functions.jsonl/127385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12848,
10385,
64,
14763,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
543,
286,
1077,
3468,
10385,
64,
14763,
284,
94748,
670,
12848,
10385,
64,
14763,
1428,
286,
421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rpc_get_program_accounts() {
let bob = Keypair::new();
let (io, meta, bank, blockhash, _alice, _leader_pubkey) =
start_rpc_handler_with_tx(&bob.pubkey());
let new_program_id = Pubkey::new_rand();
let tx = system_transaction::assign(&bob, blockhash, &new_program_id);
bank.process_transaction(&tx).unwrap();
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getProgramAccounts","params":["{}"]}}"#,
new_program_id
);
let res = io.handle_request_sync(&req, meta);
let expected = format!(
r#"{{
"jsonrpc":"2.0",
"result":[["{}", {{
"owner": {:?},
"lamports": 20,
"data": [],
"executable": false
}}]],
"id":1}}
"#,
bob.pubkey(),
new_program_id.as_ref()
);
let expected: Response =
serde_json::from_str(&expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/20302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 684
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
25096,
55665,
368,
341,
286,
1077,
35192,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
320,
815,
11,
8823,
11,
6073,
11,
2504,
8296,
11,
716,
63195,
11,
716,
37391,
34014,
792,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_hisha_nari_border_sente() {
let mut banmen = Banmen([[Blank; 9]; 9]);
for x in 0..9 {
banmen.0[2][x] = GFu;
}
banmen.0[3][4] = SHisha;
assert_eq!(legal_moves_from_banmen(&Teban::Sente,&banmen),
Rule::legal_moves_from_banmen(Teban::Sente,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
} | rust_cleaned_test_functions.jsonl/81185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
1523,
34940,
1089,
2780,
31940,
643,
6817,
368,
972,
10217,
5206,
8943,
5676,
284,
22730,
5676,
27119,
22770,
26,
220,
24,
5265,
220,
24,
55531,
2023,
856,
304,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_struct() {
test_parse_err::<Outer>(&[
(
"5",
if cfg!(feature = "arbitrary_precision") {
"invalid type: number, expected struct Outer at line 1 column 1"
} else {
"invalid type: integer `5`, expected struct Outer at line 1 column 1"
},
),
(
"\"hello\"",
"invalid type: string \"hello\", expected struct Outer at line 1 column 7",
),
(
"{\"inner\": true}",
"invalid type: boolean `true`, expected a sequence at line 1 column 14",
),
("{}", "missing field `inner` at line 1 column 2"),
(
r#"{"inner": [{"b": 42, "c": []}]}"#,
"missing field `a` at line 1 column 29",
),
]);
test_parse_ok(vec![
(
"{
\"inner\": []
}",
Outer { inner: vec![] },
),
(
"{
\"inner\": [
{ \"a\": null, \"b\": 2, \"c\": [\"abc\", \"xyz\"] }
]
}",
Outer {
inner: vec![Inner {
a: (),
b: 2,
c: vec!["abc".to_string(), "xyz".to_string()],
}],
},
),
]);
let v: Outer = from_str(
"[
[
[ null, 2, [\"abc\", \"xyz\"] ]
]
]",
).unwrap();
assert_eq!(
v,
Outer {
inner: vec![Inner {
a: (),
b: 2,
c: vec!["abc".to_string(), "xyz".to_string()],
}],
}
);
let j = json!([null, 2, []]);
Inner::deserialize(&j).unwrap();
Inner::deserialize(j).unwrap();
} | rust_cleaned_test_functions.jsonl/29841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15126,
368,
341,
262,
1273,
21039,
9266,
27638,
51322,
44784,
9640,
286,
2399,
310,
330,
20,
756,
310,
421,
13286,
10297,
12753,
284,
330,
277,
87851,
54618,
899,
341,
394,
330,
11808,
943,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_internal_error() {
let err = InternalError::from_response(ParseError::Method, HttpResponse::Ok().finish());
let resp: HttpResponse = err.error_response();
assert_eq!(resp.status(), StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/33573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23472,
4096,
368,
341,
286,
1077,
1848,
284,
15412,
1454,
486,
1499,
9655,
71812,
1454,
486,
3523,
11,
17580,
486,
11578,
1005,
30150,
1423,
286,
1077,
9039,
25,
17580,
284,
1848,
4417,
9655,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_type_18() {
let ast = check_parse("type rar = (&u32)[];");
check_name(ast.get(0),"rar");
assert_eq!(ast.get(1),&Node::IntType(false,32));
assert_eq!(ast.get(2),&Node::ReferenceType(Type(1)));
assert_eq!(ast.get(3),&Node::ArrayType(Type(2)));
} | rust_cleaned_test_functions.jsonl/96548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
62,
16,
23,
368,
341,
262,
1077,
11763,
284,
1779,
21039,
445,
1313,
95566,
284,
15899,
84,
18,
17,
8,
1294,
34649,
262,
1779,
1269,
52574,
670,
7,
15,
35393,
43983,
797,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_struct() {
init!("true");
let offer = create_default_proof();
assert_eq!(offer.from_did, Some(::settings::get_config_value(::settings::CONFIG_INSTITUTION_DID).unwrap()));
} | rust_cleaned_test_functions.jsonl/74788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
15126,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3010,
284,
1855,
9993,
86757,
543,
286,
2060,
10714,
10297,
25077,
6387,
814,
307,
11,
4329,
38732,
6511,
486,
455,
5332,
3142,
3873... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_remove_dbg_field_chaining() {
check_assist(remove_dbg, r#"let res = $0dbg!(foo.bar).baz;"#, r#"let res = foo.bar.baz;"#);
} | rust_cleaned_test_functions.jsonl/13612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
44124,
5013,
4138,
2056,
368,
341,
286,
1779,
12083,
380,
67709,
44124,
11,
435,
55543,
1149,
592,
284,
400,
15,
54318,
10297,
7975,
22001,
568,
42573,
10892,
60778,
435,
55543,
1149,
592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_index(){
let json_value = Json::from_str("{\"animals\":[\"dog\",\"cat\",\"mouse\"]}").unwrap();
let ref array = json_value["animals"];
assert_eq!(array[0].as_string().unwrap(), "dog");
assert_eq!(array[1].as_string().unwrap(), "cat");
assert_eq!(array[2].as_string().unwrap(), "mouse");
} | rust_cleaned_test_functions.jsonl/22738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
3032,
286,
1077,
2951,
3142,
284,
8308,
486,
1499,
2895,
99141,
76796,
59,
8899,
2105,
18457,
34333,
4616,
34333,
13237,
75104,
92,
1827,
15454,
543,
286,
1077,
2053,
1334,
284,
2951,
3142,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type_url() {
tink_daead::init();
let km = tink::registry::get_key_manager(tink_testutil::AES_SIV_TYPE_URL)
.expect("cannot obtain AESSIV key manager");
assert_eq!(km.type_url(), tink_testutil::AES_SIV_TYPE_URL);
// Also check other parameters.
assert_eq!(
km.key_material_type(),
tink::proto::key_data::KeyMaterialType::Symmetric
);
assert!(!km.supports_private_keys());
} | rust_cleaned_test_functions.jsonl/64382 | {
"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,
90958,
643,
344,
1819,
2903,
368,
341,
262,
90584,
47070,
3149,
486,
2327,
543,
262,
1077,
13136,
284,
90584,
486,
29172,
486,
455,
3097,
12144,
1155,
766,
4452,
1314,
486,
69168,
1098,
3090,
4189... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_login_response_parse_missing_webcookie() {
let result = serde_json::from_str::<LoginResponse>(include_str!(
"fixtures/api-responses/login-response-missing-webcookie.json"
));
assert!(
matches!(result, Ok(_)),
"got error: {}",
result.unwrap_err()
);
let resp = result.unwrap();
let oauth = resp.oauth.unwrap();
assert_eq!(oauth.steamid, "92591609556178617");
assert_eq!(oauth.oauth_token, "1cc83205dab2979e558534dab29f6f3aa");
assert_eq!(oauth.wgtoken, "3EDA9DEF07D7B39361D95203525D8AFE82A");
assert_eq!(oauth.wgtoken_secure, "F31641B9AFC2F8B0EE7B6F44D7E73EA3FA48");
assert_eq!(oauth.webcookie, "");
} | rust_cleaned_test_functions.jsonl/52549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13681,
9655,
21039,
40447,
25960,
16236,
368,
341,
10217,
1102,
284,
61570,
9455,
486,
1499,
2895,
27638,
6231,
2582,
2235,
997,
2895,
33673,
197,
197,
1,
45247,
10508,
11588,
22648,
16543,
58469,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_message_type_compare_1() -> Result<()> {
let schema = "
message root {
optional fixed_len_byte_array(5) f1 (DECIMAL(9, 3));
optional fixed_len_byte_array (16) f2 (DECIMAL (38, 18));
}
";
let mut iter = Tokenizer::from_str(schema);
let message = Parser {
tokenizer: &mut iter,
}
.parse_message_type()
.unwrap();
let fields = vec![
ParquetType::try_from_primitive(
"f1".to_string(),
PhysicalType::FixedLenByteArray(5),
Repetition::Optional,
Some(PrimitiveConvertedType::Decimal(9, 3)),
None,
None,
)?,
ParquetType::try_from_primitive(
"f2".to_string(),
PhysicalType::FixedLenByteArray(16),
Repetition::Optional,
Some(PrimitiveConvertedType::Decimal(38, 18)),
None,
None,
)?,
];
let expected = ParquetType::new_root("root".to_string(), fields);
assert_eq!(message, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/37574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6462,
1819,
32235,
62,
16,
368,
1464,
5714,
71698,
341,
286,
1077,
10802,
284,
6228,
262,
1943,
3704,
341,
414,
10101,
8356,
6043,
19737,
3858,
7,
20,
8,
282,
16,
320,
30726,
37577,
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_round_bracket_open() {
{
let code = r#"()"#;
let tokenization_result = tokenize(code);
let tokens = tokenization_result.unwrap();
assert_eq_code_and_tokens_length(code, &tokens);
assert!(tokens.len() == 2);
let token = &tokens[0];
assert!(token.id == TokenId::RoundBracketOpen);
assert!(token.index == 0);
assert!(token.length == 1);
}
} | rust_cleaned_test_functions.jsonl/116443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
17682,
5709,
11311,
368,
341,
286,
341,
310,
1077,
2038,
284,
435,
55543,
35065,
2,
401,
310,
1077,
3950,
2022,
5287,
284,
77651,
15842,
317,
310,
1077,
11211,
284,
3950,
2022,
5287,
55395,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_p2shwpkh() {
// stolen from Bitcoin transaction: ad3fd9c6b52e752ba21425435ff3dd361d6ac271531fc1d2144843a9f550ad01
let mut key = hex_key!("026c468be64d22761c30cd2f12cbc7de255d592d7904b1bab07236897cc4c2e766");
let addr = Address::p2shwpkh(&key, Digibyte).unwrap();
assert_eq!(&addr.to_string(), "3QBRmWNqqBGme9er7fMkGqtZtp4gjMFxhE");
assert_eq!(addr.address_type(), Some(AddressType::P2sh));
roundtrips(&addr);
// Test uncompressed pubkey
key.compressed = false;
assert_eq!(Address::p2wpkh(&key, Digibyte), Err(Error::UncompressedPubkey));
} | rust_cleaned_test_functions.jsonl/63232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
927,
8421,
30664,
368,
341,
286,
442,
22329,
504,
13127,
7745,
25,
993,
18,
6902,
24,
66,
21,
65,
20,
17,
68,
22,
20,
17,
4645,
17,
16,
19,
17,
20,
19,
18,
20,
542,
18,
631,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stmt_expr() {
let code = String::from("
engine.blub += 12.7;
}
");
let parser = Parser::new(code.clone());
let mut lexer = Token::lexer(code.as_str());
let stmt_list_res = parser.parse_statement_list(&mut lexer);
assert!(stmt_list_res.is_ok());
} | rust_cleaned_test_functions.jsonl/43222 | {
"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,
21039,
21824,
21915,
368,
341,
262,
1077,
2038,
284,
923,
486,
1499,
70576,
310,
4712,
10404,
392,
1421,
220,
16,
17,
13,
22,
280,
286,
456,
262,
39887,
262,
1077,
6729,
284,
21102,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transactional_behavior_with_deletes() {
let mut registry = Registry::new();
assert_empty!(apply_mutations_skip_invariant_checks(
&mut registry,
vec![insert(b"shakira", b"colombia")]
));
apply_mutations_skip_invariant_checks(
&mut registry,
vec![insert(b"rihanna", b"barbados"), insert(b"m.i.a", b"uk")],
);
assert_empty!(apply_mutations_skip_invariant_checks(
&mut registry,
vec![delete(b"rihanna")]
));
// We should be at version 3
assert_eq!(registry.latest_version(), 3);
assert_eq!(registry.get(b"rihanna", 3), None);
} | rust_cleaned_test_functions.jsonl/86104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
278,
74540,
6615,
2259,
13881,
368,
341,
286,
1077,
5206,
19424,
284,
32112,
486,
931,
543,
1789,
286,
2060,
15124,
10297,
10280,
29523,
804,
44830,
1243,
15969,
75797,
1006,
310,
609,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verifies_out_file() {
let inputs = ["" /* no input */, "some input"];
for &input in &inputs {
new_ucmd!()
.args(&["-o", "nonexistent_dir/nonexistent_file"])
.pipe_in(input)
.ignore_stdin_write_error()
.fails()
.status_code(2)
.stderr_only(
#[cfg(not(windows))]
"sort: open failed: nonexistent_dir/nonexistent_file: No such file or directory",
#[cfg(windows)]
"sort: open failed: nonexistent_dir/nonexistent_file: The system cannot find the path specified.",
);
}
} | rust_cleaned_test_functions.jsonl/20541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26042,
9606,
6068,
2458,
368,
341,
262,
1077,
11127,
284,
508,
3014,
1391,
902,
1946,
36572,
330,
14689,
1946,
6332,
262,
369,
609,
1355,
304,
609,
24941,
341,
286,
501,
68887,
2277,
0,
741,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_debug_value_range_builder() {
use super::ValueLabelRangesBuilder;
use wasmtime_environ::entity::EntityRef;
use wasmtime_environ::ir::StackSlots;
use wasmtime_environ::wasm::DefinedFuncIndex;
use wasmtime_environ::ModuleMemoryOffset;
let addr_tr = create_mock_address_transform();
let stack_slots = StackSlots::new();
let (value_ranges, value_labels) = create_mock_value_ranges();
let fi = FunctionFrameInfo {
memory_offset: ModuleMemoryOffset::None,
stack_slots: &stack_slots,
value_ranges: &value_ranges,
};
let builder = ValueLabelRangesBuilder::new(&[(10, 20)], &addr_tr, Some(&fi));
let ranges = builder.into_ranges().collect::<Vec<_>>();
assert_eq!(ranges.len(), 1);
assert_eq!(ranges[0].func_index, DefinedFuncIndex::new(0));
assert_eq!(ranges[0].start, 0);
assert_eq!(ranges[0].end, 30);
let mut builder = ValueLabelRangesBuilder::new(&[(10, 20)], &addr_tr, Some(&fi));
builder.process_label(value_labels.0);
builder.process_label(value_labels.1);
let ranges = builder.into_ranges().collect::<Vec<_>>();
assert_eq!(ranges.len(), 1);
assert_eq!(ranges[0].start, 5);
assert_eq!(ranges[0].end, 25);
// also narrows range.
let mut builder = ValueLabelRangesBuilder::new(&[(11, 17)], &addr_tr, Some(&fi));
builder.process_label(value_labels.0);
builder.process_label(value_labels.1);
builder.process_label(value_labels.2);
let ranges = builder.into_ranges().collect::<Vec<_>>();
assert_eq!(ranges.len(), 2);
assert_eq!(ranges[0].start, 5);
assert_eq!(ranges[0].end, 10);
assert_eq!(ranges[1].start, 20);
assert_eq!(ranges[1].end, 23);
} | rust_cleaned_test_functions.jsonl/116117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 909
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
3142,
9698,
28532,
368,
341,
286,
990,
2256,
486,
1130,
2476,
74902,
3297,
280,
286,
990,
572,
60976,
6205,
2772,
486,
2996,
486,
3030,
3945,
280,
286,
990,
572,
60976,
6205,
2772,
486,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag_duplication() {
let mut clusters = BlogClusters::new();
clusters.add_tags(
"
life
things about current life
life
things about current life
",
);
} | rust_cleaned_test_functions.jsonl/39032 | {
"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,
9372,
51932,
1693,
368,
341,
286,
1077,
5206,
26968,
284,
14163,
94992,
486,
931,
543,
286,
26968,
1364,
16333,
1006,
310,
6228,
310,
2272,
198,
310,
2513,
911,
1482,
2272,
198,
310,
2272,
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 |
#[test]
fn test_hello_world() {
let ast = estree::Program {
sourceType: estree::SourceType::Module,
body: vec![Either::Left(estree::Statement::Expression {
expression: Box::new(estree::Expression::Call {
callee: Either::Left(Box::new(estree::Expression::Member {
object: Either::Left(Box::new(estree::Expression::Identifier {
name: String::from("console"),
})),
property: Box::new(estree::Expression::Identifier {
name: String::from("log"),
}),
computed: false,
})),
arguments: vec![Either::Left(estree::Expression::Literal {
value: estree::Value::String(String::from("Hello, world!")),
})],
}),
})],
};
let mut codegen = Codegen::new();
let code = codegen.gen(&ast).unwrap();
assert_eq!(code, "console.log(\"Hello, world!\");\n");
} | rust_cleaned_test_functions.jsonl/49168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 630
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96724,
31792,
368,
341,
286,
1077,
11763,
284,
1788,
765,
486,
10690,
341,
310,
2530,
929,
25,
1788,
765,
486,
93363,
486,
3332,
345,
310,
2487,
25,
7486,
20703,
49244,
486,
5415,
89882,
765,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_latin_with_lowercase_normalizer() {
let mut pipeline_map: HashMap<(Script, Language), Pipeline> = HashMap::new();
pipeline_map.insert(
(Script::Latin, Language::Other),
Pipeline::default().set_normalizer(LowercaseNormalizer),
);
let analyzer = Analyzer::new(AnalyzerConfig::<Vec<u8>>::new(pipeline_map));
let orig = "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!";
let analyzed = analyzer.analyze(orig);
assert_eq!("the", analyzed.tokens().next().unwrap().text());
} | rust_cleaned_test_functions.jsonl/125059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
907,
14768,
6615,
93129,
13973,
3135,
368,
341,
286,
1077,
5206,
15301,
5376,
25,
10528,
28706,
5910,
11,
11434,
701,
40907,
29,
284,
10528,
486,
931,
543,
286,
15301,
5376,
7030,
1006,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_explicit_enum_values() {
#[derive(CheckBytes, Debug)]
#[repr(u8)]
enum Test {
A,
B = 100,
C,
D = 200,
E,
}
check_as_bytes(&Test::A, &mut ());
check_as_bytes(&Test::B, &mut ());
check_as_bytes(&Test::C, &mut ());
check_as_bytes(&Test::D, &mut ());
check_as_bytes(&Test::E, &mut ());
unsafe {
Test::check_bytes(bytes![1u8].cast(), &mut ()).unwrap_err();
Test::check_bytes(bytes![99u8].cast(), &mut ()).unwrap_err();
Test::check_bytes(bytes![102u8].cast(), &mut ()).unwrap_err();
Test::check_bytes(bytes![199u8].cast(), &mut ()).unwrap_err();
Test::check_bytes(bytes![202u8].cast(), &mut ()).unwrap_err();
Test::check_bytes(bytes![255u8].cast(), &mut ()).unwrap_err();
}
} | rust_cleaned_test_functions.jsonl/28479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
6026,
31054,
9146,
368,
341,
286,
11506,
27098,
3025,
1227,
7078,
11,
11091,
5563,
286,
11506,
30837,
8154,
23,
5563,
286,
7618,
3393,
341,
310,
362,
345,
310,
425,
284,
220,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syn_ny_beach() {
let context = Context::new(
String::from("us"),
Some(String::from("ny")),
Tokens::new(HashMap::new(), HashMap::new(), HashMap::new()),
);
assert_eq!(
syn_ny_beach(&Name::new(String::from(""), 0, None, &context), &context),
vec![]
);
// original name priority == 0
let results = vec![
Name::new(
String::from("Beach 31st St"),
1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("B 31st St"),
-1,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_ny_beach(
&Name::new(String::from("Beach 31st St"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_ny_beach(
&Name::new(String::from("Bch 31st St"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_ny_beach(
&Name::new(String::from("B 31st St"), 0, None, &context),
&context
),
vec![]
);
assert_eq!(
syn_ny_beach(
&Name::new(String::from("9B 31st St"), 0, None, &context),
&context
),
vec![]
);
// original name priority < 0
let results = vec![
Name::new(
String::from("Beach 31st St"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("B 31st St"),
-2,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_ny_beach(
&Name::new(String::from("Beach 31st St"), -1, None, &context),
&context
),
results
);
// original name priority > 0
let results = vec![
Name::new(
String::from("Beach 31st St"),
2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("B 31st St"),
-1,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_ny_beach(
&Name::new(String::from("Beach 31st St"), 1, None, &context),
&context
),
results
);
} | rust_cleaned_test_functions.jsonl/25028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
1089,
88,
880,
9547,
368,
341,
286,
1077,
2266,
284,
9608,
486,
931,
1006,
310,
923,
486,
1499,
445,
355,
4461,
310,
4329,
2242,
486,
1499,
445,
3834,
30154,
310,
58166,
486,
931,
7,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rwlock_try_upgrade() {
let lock = RwLock::new(0isize);
{
let read_guard = lock.read();
let upgrade_result = lock.try_upgradable_read();
assert!(
upgrade_result.is_some(),
"try_upgradable_read should succeed while read_guard is in scope"
);
drop(read_guard);
}
{
let upgrade_guard = lock.upgradable_read();
let upgrade_result = lock.try_upgradable_read();
assert!(
upgrade_result.is_none(),
"try_upgradable_read should fail while upgrade_guard is in scope"
);
drop(upgrade_guard);
}
{
let write_guard = lock.write();
let upgrade_result = lock.try_upgradable_read();
assert!(
upgrade_result.is_none(),
"try_upgradable should fail while write_guard is in scope"
);
drop(write_guard);
}
} | rust_cleaned_test_functions.jsonl/15755 | {
"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,
98850,
53283,
67794,
368,
341,
286,
1077,
5296,
284,
55294,
11989,
486,
931,
7,
15,
285,
551,
317,
286,
341,
310,
1077,
1349,
36796,
284,
5296,
4125,
1428,
310,
1077,
13910,
5287,
284,
5296,
487... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_jql_null() {
let json = r#"{"post code": "90210", "country": "United States", "country abbreviation": "US", "places": [{"place name": "Beverly Hills", "longitude": -118.4065, "state": "California", "state abbreviation": "CA", "latitude": 34.0901, "university":null}]}"#;
let selectors = r#"."places"[0]."university""#;
let value: String = apply_jql(json, selectors).unwrap();
assert_eq!("null".to_string(), value);
} | rust_cleaned_test_functions.jsonl/14761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
5374,
1470,
15162,
368,
341,
262,
1077,
2951,
284,
435,
55543,
4913,
2203,
2038,
788,
330,
24,
15,
17,
16,
15,
497,
330,
11141,
788,
330,
22372,
4180,
497,
330,
11141,
71478,
788,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resume_asm_2_asm_2_asm() {
resume_asm_2_asm_2_asm(VERSION1, 8126917);
resume_asm_2_asm_2_asm(VERSION0, 8126917);
} | rust_cleaned_test_functions.jsonl/82894 | {
"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,
58132,
67529,
62,
17,
67529,
62,
17,
67529,
368,
341,
262,
15688,
67529,
62,
17,
67529,
62,
17,
67529,
7,
17636,
16,
11,
220,
23,
16,
17,
21,
24,
16,
22,
317,
262,
15688,
67529,
62,
17,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_next_multiple_of_four() {
for x in 0usize..=(std::u16::MAX - 3) as usize {
let y = next_multiple_of_four(x);
assert_eq!(y % 4, 0);
assert!(y >= x);
if x % 4 == 0 {
assert_eq!(x, y);
} else {
assert_eq!(x + (4 - x % 4), y);
}
}
} | rust_cleaned_test_functions.jsonl/52092 | {
"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,
11257,
45233,
3575,
56142,
368,
341,
286,
369,
856,
304,
220,
15,
51878,
496,
4539,
1834,
486,
84,
16,
21,
486,
10586,
481,
220,
18,
8,
438,
22301,
341,
310,
1077,
379,
284,
1790,
45233,
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... | 3 |
#[test]
fn test_side_metadata_sanity_verify_local_specs_size() {
let spec_1 = SideMetadataSpec {
name: "spec_1",
is_global: false,
offset: SideMetadataOffset::rel(0),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
assert!(verify_local_specs_size(&[spec_1]).is_ok());
assert!(verify_local_specs_size(&[spec_1, spec_1]).is_err());
assert!(verify_local_specs_size(&[spec_1, spec_1, spec_1, spec_1, spec_1]).is_err());
} | rust_cleaned_test_functions.jsonl/50091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30862,
22220,
643,
38270,
35638,
13564,
71200,
2368,
368,
341,
286,
1077,
1398,
62,
16,
284,
16659,
14610,
8327,
341,
310,
829,
25,
330,
9535,
62,
16,
756,
310,
374,
19296,
25,
895,
345,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pubsub_new() {
let pubsub_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0);
let exit = Arc::new(AtomicBool::new(false));
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let subscriptions = Arc::new(RpcSubscriptions::new(
&exit,
bank_forks,
Arc::new(RwLock::new(
BlockCommitmentCache::new_for_tests_with_blockstore(blockstore),
)),
));
let pubsub_service = PubSubService::new(&subscriptions, pubsub_addr, &exit);
let thread = pubsub_service.thread_hdl.thread();
assert_eq!(thread.name().unwrap(), "solana-pubsub");
} | rust_cleaned_test_functions.jsonl/66300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
1966,
5921,
368,
341,
286,
1077,
6675,
1966,
7387,
284,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
15,
11,
220,
15,
11,
220,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_eof_seek() {
// The decoder must validate the final chunk as part of seeking to or
// past EOF.
for &case in crate::test::TEST_CASES {
let input = make_test_input(case);
let (encoded, hash) = encode::encode(&input);
// Seeking to EOF should succeed with the right hash.
let mut output = Vec::new();
let mut decoder = Decoder::new(Cursor::new(&encoded), &hash);
decoder.seek(SeekFrom::Start(case as u64)).unwrap();
decoder.read_to_end(&mut output).unwrap();
assert_eq!(&output, &[]);
// Seeking to EOF should fail if the root hash is wrong.
let mut bad_hash_bytes = *hash.as_bytes();
bad_hash_bytes[0] ^= 1;
let bad_hash = bad_hash_bytes.into();
let mut decoder = Decoder::new(Cursor::new(&encoded), &bad_hash);
let result = decoder.seek(SeekFrom::Start(case as u64));
assert!(result.is_err(), "a bad hash is supposed to fail!");
assert_eq!(result.unwrap_err().kind(), io::ErrorKind::InvalidData);
// It should also fail if the final chunk has been corrupted.
if case > 0 {
let mut bad_encoded = encoded.clone();
*bad_encoded.last_mut().unwrap() ^= 1;
let mut decoder = Decoder::new(Cursor::new(&bad_encoded), &hash);
let result = decoder.seek(SeekFrom::Start(case as u64));
assert!(result.is_err(), "a bad hash is supposed to fail!");
assert_eq!(result.unwrap_err().kind(), io::ErrorKind::InvalidData);
}
}
} | rust_cleaned_test_functions.jsonl/118140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
90792,
74473,
368,
341,
286,
442,
576,
24551,
1969,
9593,
279,
1590,
11879,
438,
949,
315,
10887,
311,
476,
198,
286,
442,
3267,
29457,
624,
286,
369,
609,
5638,
304,
17717,
486,
1944,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_compression_with_prefix() {
let size = 65536;
let mut to_compress = Vec::with_capacity(size);
for i in 0..size {
to_compress.push(i as u8);
}
let mut v: Vec<Vec<u8>> = vec![];
for i in 1..100 {
v.push(compress(&to_compress, Some(CompressionMode::FAST(i)), true).unwrap());
}
// 12 is max high compression parameter
for i in 1..12 {
v.push(
compress(
&to_compress,
Some(CompressionMode::HIGHCOMPRESSION(i)),
true,
)
.unwrap(),
);
}
v.push(compress(&to_compress, None, true).unwrap());
for val in v {
assert_eq!(decompress(&val, None).unwrap(), to_compress);
}
} | rust_cleaned_test_functions.jsonl/62388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
4011,
6615,
13974,
368,
341,
286,
1077,
1379,
284,
220,
21,
20,
20,
18,
21,
280,
286,
1077,
5206,
311,
87845,
284,
11312,
486,
4197,
35603,
6856,
317,
286,
369,
600,
304,
220,
15,
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... | 5 |
#[test]
fn test_update_config() {
let mut deps = mock_dependencies(&[]);
deps.querier
.with_terraswap_pairs(&[(&"uusdmirror0000".to_string(), &"MIRLP0000".to_string())]);
let msg = InstantiateMsg {
base_denom: BASE_DENOM.to_string(),
token_code_id: TOKEN_CODE_ID,
distribution_schedule: vec![],
};
let info = mock_info("addr0000", &[]);
let _res = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();
let msg = ExecuteMsg::PostInitialize {
owner: "owner0000".to_string(),
mirror_token: "mirror0000".to_string(),
mint_contract: "mint0000".to_string(),
staking_contract: "staking0000".to_string(),
commission_collector: "collector0000".to_string(),
oracle_contract: "oracle0000".to_string(),
terraswap_factory: "terraswapfactory".to_string(),
};
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
// upate owner
let msg = ExecuteMsg::UpdateConfig {
owner: Some("owner0001".to_string()),
distribution_schedule: None,
token_code_id: None,
};
let info = mock_info("owner0000", &[]);
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
let res = query(deps.as_ref(), mock_env(), QueryMsg::Config {}).unwrap();
let config: ConfigResponse = from_binary(&res).unwrap();
assert_eq!(
config,
ConfigResponse {
owner: "owner0001".to_string(),
mirror_token: "mirror0000".to_string(),
mint_contract: "mint0000".to_string(),
staking_contract: "staking0000".to_string(),
commission_collector: "collector0000".to_string(),
oracle_contract: "oracle0000".to_string(),
terraswap_factory: "terraswapfactory".to_string(),
base_denom: BASE_DENOM.to_string(),
token_code_id: TOKEN_CODE_ID,
genesis_time: 1_571_797_419,
distribution_schedule: vec![],
}
);
// update rest part
let msg = ExecuteMsg::UpdateConfig {
owner: None,
distribution_schedule: Some(vec![(1, 2, Uint128::from(123u128))]),
token_code_id: Some(TOKEN_CODE_ID + 1),
};
let info = mock_info("owner0001", &[]);
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
let res = query(deps.as_ref(), mock_env(), QueryMsg::Config {}).unwrap();
let config: ConfigResponse = from_binary(&res).unwrap();
assert_eq!(
config,
ConfigResponse {
owner: "owner0001".to_string(),
mirror_token: "mirror0000".to_string(),
mint_contract: "mint0000".to_string(),
staking_contract: "staking0000".to_string(),
commission_collector: "collector0000".to_string(),
oracle_contract: "oracle0000".to_string(),
terraswap_factory: "terraswapfactory".to_string(),
base_denom: BASE_DENOM.to_string(),
token_code_id: TOKEN_CODE_ID + 1,
genesis_time: 1_571_797_419,
distribution_schedule: vec![(1, 2, Uint128::from(123u128))],
}
);
// failed unauthoirzed
let msg = ExecuteMsg::UpdateConfig {
owner: None,
distribution_schedule: None,
token_code_id: Some(TOKEN_CODE_ID + 1),
};
let info = mock_info("owner0000", &[]);
let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap_err();
match res {
StdError::GenericErr { msg, .. } => assert_eq!(msg, "unauthorized"),
_ => panic!("DO NOT ENTER HERE"),
}
} | rust_cleaned_test_functions.jsonl/36369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1630
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5332,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
56703,
262,
48178,
13,
15959,
1268,
198,
286,
659,
4197,
72493,
12784,
21726,
36430,
2099,
58,
2099,
1,
84,
355,
13849,
28812,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_split() {
let mut input_data = HashMap::new();
let data = (1..=2 * 6).map(|x| x as f32).collect::<Vec<f32>>();
input_data.insert("X".to_string(), data.as_slice().into());
let model = model(graph(
vec![tensor("X", &[2, 6])],
vec![tensor("Y", &[2, 3]), tensor("W", &[2, 3])],
vec![],
vec![],
vec![node(
vec!["X"],
vec!["Y", "W"],
"Split",
"Split",
vec![attribute("axis", 1)],
)],
));
let session =
pollster::block_on(wonnx::Session::from_model(model)).expect("session did not create");
let result = pollster::block_on(session.run(&input_data)).unwrap();
let test_y = vec![1., 2., 3., 7., 8., 9.];
assert_eq!(result["Y"], test_y);
let test_w = vec![4., 5., 6., 10., 11., 12.];
assert_eq!(result["W"], test_w);
} | rust_cleaned_test_functions.jsonl/59612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
368,
341,
262,
1077,
5206,
1946,
1769,
284,
10528,
486,
931,
543,
262,
1077,
821,
284,
320,
16,
496,
28,
17,
353,
220,
21,
568,
2186,
22428,
87,
91,
856,
438,
282,
18,
17,
568,
17384,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_number_literal_decimal() {
// decimal
assert_parse_success!(numeric_literal, "0", NumericLiteral(0f64));
assert_parse_failure!(numeric_literal, "01");
assert_parse_failure!(numeric_literal, "01.");
assert_parse_success!(numeric_literal, "9", NumericLiteral(9f64));
assert_parse_success!(numeric_literal, "10", NumericLiteral(10f64));
assert_parse_success!(numeric_literal, "0.1", NumericLiteral(0.1f64));
assert_parse_success!(numeric_literal, ".1", NumericLiteral(0.1f64));
assert_parse_success!(numeric_literal, "1e1", NumericLiteral(10f64));
assert_parse_success!(numeric_literal, ".1e1", NumericLiteral(1f64));
assert_parse_success!(numeric_literal, "1.1e1", NumericLiteral(11f64));
} | rust_cleaned_test_functions.jsonl/66451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
34100,
74429,
368,
341,
262,
442,
12122,
198,
262,
2060,
21039,
18632,
10297,
19600,
34100,
11,
330,
15,
497,
50367,
17350,
7,
15,
69,
21,
19,
1106,
262,
2060,
21039,
43618,
10297,
19600,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_response_encode_title_case() {
use crate::proto::BodyLength;
use http::header::HeaderValue;
let mut head = MessageHead::default();
head.headers
.insert("content-length", HeaderValue::from_static("10"));
head.headers
.insert("content-type", HeaderValue::from_static("application/json"));
head.headers
.insert("weird--header", HeaderValue::from_static(""));
let mut vec = Vec::new();
Server::encode(
Encode {
head: &mut head,
body: Some(BodyLength::Known(10)),
keep_alive: true,
req_method: &mut None,
title_case_headers: true,
},
&mut vec,
)
.unwrap();
let expected_response =
b"HTTP/1.1 200 OK\r\nContent-Length: 10\r\nContent-Type: application/json\r\nWeird--Header: \r\n";
assert_eq!(&vec[..expected_response.len()], &expected_response[..]);
} | rust_cleaned_test_functions.jsonl/7671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
9655,
11224,
6112,
19096,
368,
341,
286,
990,
17717,
486,
15110,
486,
5444,
4373,
280,
286,
990,
1758,
486,
2708,
486,
97721,
401,
286,
1077,
5206,
1968,
284,
4856,
12346,
486,
2258,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_search() {
static ARGS: [ArgInfo; 1] = [take_arg!("-include", String, Concatenated)];
static ARGS2: [ArgInfo; 1] = [take_arg!("-include-pch", String, Concatenated)];
static ARGS3: [ArgInfo; 1] = [take_arg!("-include", Path, Concatenated)];
assert_eq!((&ARGS[..], &ARGS2[..]).search("-include"), Some(&ARGS[0]));
assert_eq!(
(&ARGS[..], &ARGS2[..]).search("-include-pch"),
Some(&ARGS2[0])
);
assert_eq!((&ARGS2[..], &ARGS[..]).search("-include"), Some(&ARGS[0]));
assert_eq!(
(&ARGS2[..], &ARGS[..]).search("-include-pch"),
Some(&ARGS2[0])
);
assert_eq!((&ARGS[..], &ARGS3[..]).search("-include"), Some(&ARGS3[0]));
} | rust_cleaned_test_functions.jsonl/108772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
10716,
368,
341,
286,
1099,
84149,
25,
508,
2735,
1731,
26,
220,
16,
60,
284,
508,
22769,
6057,
0,
13645,
997,
497,
923,
11,
78195,
268,
657,
12587,
286,
1099,
84149,
17,
25,
508,
2735,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_using_other_iterator_trait_methods() {
let sum: u32 = Counter::new()
.zip(Counter::new().skip(1))
.map(|(a, b)| a * b)
.filter(|x| x % 3 == 0)
.sum();
assert_eq!(18, sum);
} | rust_cleaned_test_functions.jsonl/89817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75180,
30456,
13491,
78491,
36084,
368,
341,
286,
1077,
2629,
25,
575,
18,
17,
284,
19735,
486,
931,
741,
310,
659,
9964,
7,
14099,
486,
931,
1005,
20599,
7,
16,
1171,
310,
659,
2186,
22428,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_claim_owner() {
new_test_ext().execute_with(|| {
let claim = vec![1];
// create
assert_ok!(PoeModule::create_claim(Origin::signed(1), claim.clone()));
// case 1 - transfer
assert_noop!(PoeModule::transfer_claim(Origin::signed(2), 2, claim.clone()), Error::<Test>::NotClaimOwner);
// case 2 - revoke
assert_noop!(PoeModule::revoke_claim(Origin::signed(2), claim.clone()), Error::<Test>::NotClaimOwner);
});
} | rust_cleaned_test_functions.jsonl/12049 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
84969,
29027,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
3717,
284,
7486,
20703,
16,
4821,
197,
197,
322,
1855,
198,
197,
6948,
19817,
10297,
47,
4644,
3332,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_handle_arp_request() {
// address information and send an ARP response.
let mut ctx = DummyContext::default();
send_arp_packet(
&mut ctx,
ArpOp::Request,
TEST_REMOTE_IPV4,
TEST_LOCAL_IPV4,
TEST_REMOTE_MAC,
TEST_LOCAL_MAC,
);
// Make sure we cached the sender's address information.
assert_eq!(
lookup(&mut ctx, (), TEST_LOCAL_MAC, TEST_REMOTE_IPV4).unwrap(),
TEST_REMOTE_MAC
);
// We should have sent an ARP response.
validate_last_arp_packet(
&ctx,
1,
TEST_REMOTE_MAC,
ArpOp::Response,
TEST_LOCAL_IPV4,
TEST_REMOTE_IPV4,
TEST_LOCAL_MAC,
TEST_REMOTE_MAC,
);
} | rust_cleaned_test_functions.jsonl/16995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
62,
7876,
7893,
368,
341,
1789,
286,
442,
2621,
1995,
323,
3624,
458,
91337,
2033,
382,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
1428,
286,
3624,
62,
7876,
21078,
1006,
310,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_certification_pool_inserts() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
let mut pool =
CertificationPoolImpl::new(pool_config, no_op_logger(), MetricsRegistry::new());
pool.insert(fake_share(1, 0));
pool.insert(fake_share(2, 1));
pool.insert(fake_cert(1));
let mut other = fake_cert(1);
if let CertificationMessage::Certification(x) = &mut other {
x.signed.signature.signer = NiDkgId {
start_block_height: Height::from(10),
dealer_subnet: subnet_test_id(0),
dkg_tag: NiDkgTag::HighThreshold,
target_subnet: NiDkgTargetSubnet::Local,
};
}
pool.insert(other);
assert_eq!(
pool.unvalidated_shares_at_height(Height::from(1)).count(),
1
);
assert_eq!(
pool.unvalidated_shares_at_height(Height::from(2)).count(),
1
);
assert_eq!(
pool.unvalidated_certifications_at_height(Height::from(1))
.count(),
2
);
assert_eq!(
pool.all_heights_with_artifacts(),
vec![Height::from(1), Height::from(2)]
);
})
} | rust_cleaned_test_functions.jsonl/8473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 822
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37097,
2404,
15709,
17678,
82,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
1077,
5206,
7314,
4035,
394,
50210,
10551,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_remaining_bytes() {
let path = get_append_vec_path("test_append");
let sz = 1024 * 1024;
let sz64 = sz as u64;
let av = AppendVec::new(&path.path, true, sz);
assert_eq!(av.capacity(), sz64);
assert_eq!(av.remaining_bytes(), sz64);
let account = create_test_account(0);
let acct_size = 136;
av.append_account_test(&account).unwrap();
assert_eq!(av.capacity(), sz64);
assert_eq!(av.remaining_bytes(), sz64 - acct_size);
} | rust_cleaned_test_functions.jsonl/39492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59244,
12524,
368,
341,
286,
1077,
1815,
284,
633,
26041,
13251,
2638,
445,
1944,
26041,
797,
286,
1077,
10038,
284,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
280,
286,
1077,
10038,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_response_h09_allowed() {
let _ = pretty_env_logger::try_init();
let mut raw = BytesMut::from(H09_RESPONSE);
let ctx = ParseContext {
cached_headers: &mut None,
req_method: &mut Some(crate::Method::GET),
h1_parser_config: Default::default(),
h1_header_read_timeout: None,
h1_header_read_timeout_fut: &mut None,
h1_header_read_timeout_running: &mut false,
preserve_header_case: false,
h09_responses: true,
#[cfg(feature = "ffi")]
on_informational: &mut None,
#[cfg(feature = "ffi")]
raw_headers: false,
};
let msg = Client::parse(&mut raw, ctx).unwrap().unwrap();
assert_eq!(raw, H09_RESPONSE);
assert_eq!(msg.head.subject, crate::StatusCode::OK);
assert_eq!(msg.head.version, crate::Version::HTTP_09);
assert_eq!(msg.head.headers.len(), 0);
} | rust_cleaned_test_functions.jsonl/7660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9655,
1523,
15,
24,
42155,
368,
341,
286,
1077,
716,
284,
5020,
15879,
27413,
486,
1539,
6137,
543,
286,
1077,
5206,
7112,
284,
30024,
51440,
486,
1499,
10896,
15,
24,
35901,
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_cbrt() {
assert!(close(_0_0i.cbrt(), _0_0i));
assert!(close(_1_0i.cbrt(), _1_0i));
assert!(close(
Complex::new(-1.0, 0.0).cbrt(),
Complex::new(0.5, 0.75.sqrt())
));
assert!(close(
Complex::new(-1.0, -0.0).cbrt(),
Complex::new(0.5, -(0.75.sqrt()))
));
assert!(close(_0_1i.cbrt(), Complex::new(0.75.sqrt(), 0.5)));
assert!(close(_0_1i.conj().cbrt(), Complex::new(0.75.sqrt(), -0.5)));
for &c in all_consts.iter() {
assert!(close(c.conj().cbrt(), c.cbrt().conj()));
assert!(
-f64::consts::FRAC_PI_3 <= c.cbrt().arg()
&& c.cbrt().arg() <= f64::consts::FRAC_PI_3
);
assert!(close(c.cbrt() * c.cbrt() * c.cbrt(), c));
}
} | rust_cleaned_test_functions.jsonl/105688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 665
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
1323,
83,
368,
341,
310,
2060,
10297,
5552,
2490,
15,
62,
15,
72,
520,
1323,
83,
1507,
716,
15,
62,
15,
72,
1106,
310,
2060,
10297,
5552,
2490,
16,
62,
15,
72,
520,
1323,
83,
1507,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rand() {
let mut rng1 = Xoshiro256Plus::seed_from_u64(0);
let a: (f32, f32, f32) = rng1.gen();
let mut rng2 = Xoshiro256Plus::seed_from_u64(0);
let b: Vec3 = rng2.gen();
assert_eq!(a, b.into());
} | rust_cleaned_test_functions.jsonl/48602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
33864,
368,
341,
262,
1077,
5206,
28422,
16,
284,
1599,
31845,
299,
17,
20,
21,
21807,
486,
22602,
5673,
7300,
21,
19,
7,
15,
317,
262,
1077,
264,
25,
320,
69,
18,
17,
11,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_text_objects() {
let actor = amp::ActorId::random();
let mut frontend = Frontend::new();
let patch = amp::Patch {
actor: None,
seq: None,
max_op: 4,
pending_changes: 0,
deps: Vec::new(),
clock: hashmap! {
actor.clone() => 2,
},
diffs: RootDiff {
props: hashmap! {
"name".into() => hashmap!{
actor.op_id_at(1) => amp::Diff::Text(amp::TextDiff{
object_id: actor.op_id_at(1).into(),
edits: vec![
amp::DiffEdit::SingleElementInsert {
index: 0,
elem_id: actor.op_id_at(2).into(),
op_id: actor.op_id_at(2),
value: amp::Diff::Value("b".into()),
},
amp::DiffEdit::SingleElementInsert {
index: 1,
elem_id: actor.op_id_at(3).into(),
op_id: actor.op_id_at(3),
value: amp::Diff::Value("e".into()),
},
amp::DiffEdit::SingleElementInsert {
index: 2,
elem_id: actor.op_id_at(4).into(),
op_id: actor.op_id_at(4),
value: amp::Diff::Value("n".into()),
},
],
})
}
},
},
};
frontend.apply_patch(patch).unwrap();
assert_eq!(
frontend.state(),
&Into::<Value>::into(
hashmap! {"name" => Value::Text("ben".graphemes(true).map(|s|s.into()).collect())}
)
);
let patch2 = amp::Patch {
actor: None,
seq: None,
max_op: 5,
pending_changes: 0,
deps: Vec::new(),
clock: hashmap! {
actor.clone() => 3,
},
diffs: RootDiff {
props: hashmap! {
"name".into() => hashmap!{
actor.op_id_at(1) => amp::Diff::Text(amp::TextDiff{
object_id: actor.op_id_at(1).into(),
edits: vec![
amp::DiffEdit::Remove { index: 1, count: 1 },
amp::DiffEdit::Update{
index: 1,
op_id: actor.op_id_at(5),
value: amp::Diff::Value(amp::ScalarValue::Str("i".into())),
}
],
})
}
},
},
};
frontend.apply_patch(patch2).unwrap();
assert_eq!(
frontend.state(),
&Into::<Value>::into(
hashmap! {"name" => Value::Text("bi".graphemes(true).map(|s|s.into()).collect())}
)
);
} | rust_cleaned_test_functions.jsonl/77848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2008
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
24873,
368,
341,
262,
1077,
12089,
284,
22758,
486,
18870,
764,
486,
11463,
543,
262,
1077,
5206,
45645,
284,
14902,
408,
486,
931,
543,
262,
1077,
10900,
284,
22758,
486,
43622,
341,
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_push_prev() {
let mut ll = LinkedList::<u8>::new();
let node1 = ll.push_head(1);
let node2 = ll.push_head(2);
let node3 = ll.push_head(3);
let n_node1 = ll.push_prev(&node1, 11).unwrap();
assert_node!(ll, node1, LAST, 1, 4);
assert_node!(ll, n_node1, MIDDLE, 11, 4);
assert_order!(ll, n_node1, 11, node1, 1);
assert_order!(ll, node2, 2, n_node1, 11);
assert_order!(ll, node3, 3, node2, 2);
let n_node2 = ll.push_prev(&node2, 22).unwrap();
assert_node!(ll, n_node2, MIDDLE, 22, 5);
assert_order!(ll, n_node1, 11, node1, 1);
assert_order!(ll, node2, 2, n_node1, 11);
assert_order!(ll, n_node2, 22, node2, 2);
assert_order!(ll, node3, 3, n_node2, 22);
let n_node3 = ll.push_prev(&node3, 33).unwrap();
assert_node!(ll, n_node3, FIRST, 33, 6);
assert_order!(ll, n_node1, 11, node1, 1);
assert_order!(ll, node2, 2, n_node1, 11);
assert_order!(ll, n_node2, 22, node2, 2);
assert_order!(ll, node3, 3, n_node2, 22);
assert_order!(ll, n_node3, 33, node3, 3);
} | rust_cleaned_test_functions.jsonl/59895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
25566,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
1077,
2436,
16,
284,
9323,
2552,
13138,
7,
16,
317,
286,
1077,
2436,
17,
284,
9323,
2552,
13138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_propose() {
let prev_hash = hash(&[1, 2, 3]);
let txs = vec![hash(&[1]), hash(&[2]), hash(&[2])];
let (public_key, secret_key) = gen_keypair();
// write
let propose = Propose::new(VALIDATOR, HEIGHT, ROUND, &prev_hash, &txs, &secret_key);
// read
assert_eq!(propose.validator(), VALIDATOR);
assert_eq!(propose.height(), HEIGHT);
assert_eq!(propose.round(), ROUND);
assert_eq!(propose.prev_hash(), &prev_hash);
assert_eq!(propose.transactions().len(), 3);
assert_eq!(propose.transactions()[0], txs[0]);
assert_eq!(propose.transactions()[1], txs[1]);
assert_eq!(propose.transactions()[2], txs[2]);
assert!(propose.verify_signature(&public_key));
} | rust_cleaned_test_functions.jsonl/118855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
960,
368,
341,
262,
1077,
7872,
8950,
284,
5175,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
2558,
262,
1077,
9854,
82,
284,
7486,
20703,
8296,
2099,
58,
16,
9719,
5175,
2099,
58,
17,
971... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_mut_mutates() {
let mut cache = LruCache::new(4);
cache.put("a", 1);
cache.put("b", 2);
cache.put("c", 3);
cache.put("d", 4);
for (i, (_key, val)) in cache.iter_mut().enumerate() {
assert_eq!(4 - i, *val);
*val = 100 + i;
}
let mut iter = cache.iter_mut();
assert_opt_eq_mut_tuple(iter.next(), ("d", 100));
assert_opt_eq_mut_tuple(iter.next(), ("c", 101));
assert_opt_eq_mut_tuple(iter.next(), ("b", 102));
assert_opt_eq_mut_tuple(iter.next(), ("a", 103));
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/77940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
29523,
29523,
973,
368,
341,
286,
1077,
5206,
6500,
284,
444,
2672,
8233,
486,
931,
7,
19,
317,
286,
6500,
3597,
445,
64,
497,
220,
16,
317,
286,
6500,
3597,
445,
65,
497,
220,
17,
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... | 2 |
#[test]
fn test_part1() {
assert_eq!(part1(&parse_claims(&as_input("#1 @ 1,3: 4x4\n #2 @ 3,1: 4x4\n #3 @ 5,5: 2x2")).unwrap()), 4);
} | rust_cleaned_test_functions.jsonl/41491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
341,
286,
2060,
10714,
10297,
4480,
16,
2099,
6400,
6794,
25676,
2099,
300,
5898,
3584,
16,
569,
220,
16,
11,
18,
25,
220,
19,
87,
19,
1699,
671,
17,
569,
220,
18,
11,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_wrong_arch() -> Result<(), Error> {
let vmo = zx::Vmo::create(HEADER_DATA_WRONG_ARCH.len() as u64)?;
vmo.write(&HEADER_DATA, 0)?;
match Elf64Headers::from_vmo(&vmo) {
Err(ElfParseError::InvalidFileHeader(msg)) => {
assert_eq!(msg, "Invalid ELF architecture");
}
_ => {}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/134231 | {
"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,
21039,
75198,
34330,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
348,
6355,
284,
71322,
486,
53,
6355,
486,
3182,
7,
38098,
7896,
89607,
40049,
19406,
368,
438,
575,
21,
19,
40007,
286,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_parse_datetime_system_timezone() {
let tables = vec![
(1988, 04, 09, 23, 59, 59),
(1988, 04, 10, 01, 00, 00),
(1988, 09, 11, 00, 00, 00),
(1988, 09, 11, 00, 00, 01),
(1988, 09, 10, 23, 59, 59),
(1988, 09, 10, 23, 00, 00),
(1988, 09, 10, 22, 59, 59),
(2015, 01, 02, 23, 59, 59),
(1919, 03, 30, 01, 59, 59),
(1919, 03, 30, 03, 00, 00),
(1988, 04, 10, 00, 00, 00),
(1988, 04, 10, 00, 59, 59),
];
// These are supposed to be local time zones
let local_tzs = vec![
Tz::from_tz_name("SYSTEM").unwrap(),
Tz::from_tz_name("system").unwrap(),
Tz::from_tz_name("System").unwrap(),
Tz::local(),
];
for (year, month, day, hour, minute, second) in tables {
for tz in &local_tzs {
// so we need to check it first.
let local_time = Local
.ymd_opt(year, month, day)
.and_hms_opt(hour, minute, second)
.earliest();
if let Some(local_time) = local_time {
let time_str =
format!("{}-{}-{} {}:{}:{}", year, month, day, hour, minute, second);
let t = Time::parse_datetime(&time_str, UNSPECIFIED_FSP, tz).unwrap();
assert_eq!(t.time, local_time);
}
}
}
} | rust_cleaned_test_functions.jsonl/93951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 930
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28943,
17687,
53193,
368,
341,
1789,
286,
1077,
12632,
284,
7486,
90515,
310,
320,
16,
24,
23,
23,
11,
220,
15,
19,
11,
220,
15,
24,
11,
220,
17,
18,
11,
220,
20,
24,
11,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_encrypt_special_characters() {
assert_eq!(encrypt(&WINDOWS_1250.encode("14326 say dfskjda12312ąśąźżźżććżąąąśąąą2137dadaęóąśłżźćń;1122", EncoderTrap::Strict).unwrap(), 34353, false),
b"\xF7\xC9\xE7\x12\x74\xFD\x0F\xF7\xF2\x81\x78\x0C\x0A\xFD\x05\x06\x0C\x0F\xF6\xC7\xE6\xD1\x82\xB7\xD4\xB7\xD1\xB1\xD1\xB1\x8A\x8A\xB1\xB7\xB7\xB7\xD4\xB7\xB7\xB7\xF5\xD6\xEC\x7F\x0C\x0F\x0C\x0F\x86\x7D\xB7\xD4\xBD\xB1\xD1\x8A\x7F\x35\xF5\xC6\xD7\x70".to_vec());
} | rust_cleaned_test_functions.jsonl/74794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
41629,
79060,
368,
341,
286,
2060,
10714,
10297,
32826,
2099,
75067,
62,
16,
17,
20,
15,
17313,
445,
16,
19,
18,
17,
21,
1977,
25792,
92697,
3235,
16,
17,
18,
16,
17,
5861,
7393,
5861,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_problematic_yaml() {
struct TestCase {
description: &'static str,
input: &'static str,
expected: Result<Value, ShellError>,
}
let tt: Vec<TestCase> = vec![
TestCase {
description: "Double Curly Braces With Quotes",
input: r#"value: "{{ something }}""#,
expected: Ok(Value::Record {
cols: vec!["value".to_string()],
vals: vec![Value::String {
val: "{{ something }}".to_string(),
span: Span::test_data(),
}],
span: Span::test_data(),
}),
},
TestCase {
description: "Double Curly Braces Without Quotes",
input: r#"value: {{ something }}"#,
expected: Ok(Value::Record {
cols: vec!["value".to_string()],
vals: vec![Value::String {
val: "{{ something }}".to_string(),
span: Span::test_data(),
}],
span: Span::test_data(),
}),
},
];
let config = Config::default();
for tc in tt {
let actual = from_yaml_string_to_value(tc.input.to_owned(), Span::test_data());
if actual.is_err() {
assert!(
tc.expected.is_err(),
"actual is Err for test:\nTest Description {}\nErr: {:?}",
tc.description,
actual
);
} else {
assert_eq!(
actual.unwrap().into_string("", &config),
tc.expected.unwrap().into_string("", &config)
);
}
}
} | rust_cleaned_test_functions.jsonl/110372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60139,
774,
64380,
368,
341,
286,
2036,
30573,
341,
310,
4008,
25,
30136,
1978,
607,
345,
310,
1946,
25,
30136,
1978,
607,
345,
310,
3601,
25,
5714,
48325,
11,
29402,
1454,
12520,
286,
456,
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... | 3 |
#[test]
fn test_param_completion_trait_param() {
check_magic_completion(
"param_completion_trait_param",
r"
pub(crate) trait SourceRoot {
pub fn contains(&self, file_id: FileId) -> bool;
pub fn module_map(&self) -> &ModuleMap;
pub fn lines(&self, file_id: FileId) -> &LineIndex;
pub fn syntax(&self, file<|>)
}
",
);
} | rust_cleaned_test_functions.jsonl/23556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
60164,
78491,
4090,
368,
341,
286,
1779,
54612,
60164,
1006,
310,
330,
903,
60164,
78491,
4090,
756,
310,
435,
698,
310,
6675,
54907,
8,
17567,
8748,
8439,
341,
394,
6675,
5168,
5610,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.