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_validate_signature_with_header_jwt_hs256() {
let secret = "secret".to_string();
let jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOiJDUklTUCIsImdyb3VwIjoiQVRJIiwicmVzb3VyY2VzIjpbXX0.K9nfZnbMzF1-P1zXEQHeYYUz35NTbTPpT560wNG16DM".to_string();
let maybe_res = validate_signature(&jwt, &secret, Algorithm::HS256);
assert!(maybe_res.unwrap());
} | rust_cleaned_test_functions.jsonl/51723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
39859,
6615,
8757,
95576,
85956,
17,
20,
21,
368,
341,
981,
1077,
6234,
284,
330,
20474,
3263,
983,
3904,
543,
981,
1077,
24589,
284,
330,
84609,
49039,
38,
5855,
81096,
45064,
52,
89,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_inplace() {
Python::with_gil(|py| {
let v = vec!["foo", "bar"];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
let rep_seq = seq.in_place_repeat(3).unwrap();
assert_eq!(6, seq.len().unwrap());
assert_eq!(seq, rep_seq);
let conc_seq = seq.in_place_concat(seq).unwrap();
assert_eq!(12, seq.len().unwrap());
assert_eq!(seq, conc_seq);
});
} | rust_cleaned_test_functions.jsonl/70327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
1243,
2007,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
6332,
310,
1077,
1508,
284,
348,
2389,
5314,
46827,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_parsing() {
assert_eq!(skip_next("[test]", '['), Some("test]"));
assert_eq!(take_until("one/two", '/'), ("one", "/two"));
assert_eq!(take_and_skip("one/two", '/'), Some(("one", "two")));
} | rust_cleaned_test_functions.jsonl/44006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
620,
28598,
368,
341,
262,
2060,
10714,
10297,
20599,
11257,
10937,
1944,
19076,
48290,
701,
4329,
445,
1944,
60,
4010,
262,
2060,
10714,
10297,
22769,
44352,
445,
603,
5523,
1126,
497,
3353,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remote_included() {
let opt = Default::default();
let m = mount_info("ext4", "/mnt/foo", true, false);
assert!(is_included(&m, &opt));
} | rust_cleaned_test_functions.jsonl/7065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36425,
1243,
10181,
368,
341,
310,
1077,
3387,
284,
7899,
486,
2258,
543,
310,
1077,
296,
284,
6470,
3109,
445,
427,
19,
497,
3521,
40882,
60555,
497,
830,
11,
895,
317,
310,
2060,
10297,
285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_as_metered() {
let client: Box<dyn Metered<u64>> = Box::new(StatsdClient::from_sink("prefix", NopMetricSink));
client.meter("some.meter", 9).unwrap();
} | rust_cleaned_test_functions.jsonl/10619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
79338,
291,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
52539,
291,
34837,
21,
19,
2452,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_insert_character() {
let querier = new_valid_db("insert_character.db");
let inserted = querier.insert_character(models::Character {
name: String::from("Test_Character_Insert"),
components: Some(String::from("{ \"interactable\": true }")),
});
assert_eq!(1, inserted);
} | rust_cleaned_test_functions.jsonl/107695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
40988,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
4208,
40988,
7076,
3071,
286,
1077,
21578,
284,
29134,
1268,
7030,
40988,
20289,
486,
12404,
341,
310,
829,
25,
923,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_special_cases() {
cov_mark::check!(useless_type_special_case);
check_assist(
generate_getter,
r#"
struct S { foo: $0String }
"#,
r#"
struct S { foo: String }
impl S {
/// Get a reference to the s's foo.
fn $0foo(&self) -> &str {
self.foo.as_str()
}
}
"#,
);
check_assist(
generate_getter,
r#"
struct S { foo: $0Box<Sweets> }
"#,
r#"
struct S { foo: Box<Sweets> }
impl S {
/// Get a reference to the s's foo.
fn $0foo(&self) -> &Sweets {
self.foo.as_ref()
}
}
"#,
);
check_assist(
generate_getter,
r#"
struct S { foo: $0Vec<()> }
"#,
r#"
struct S { foo: Vec<()> }
impl S {
/// Get a reference to the s's foo.
fn $0foo(&self) -> &[()] {
self.foo.as_slice()
}
}
"#,
);
check_assist(
generate_getter,
r#"
struct S { foo: $0Option<Failure> }
"#,
r#"
struct S { foo: Option<Failure> }
impl S {
/// Get a reference to the s's foo.
fn $0foo(&self) -> Option<&Failure> {
self.foo.as_ref()
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/127258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41629,
41427,
368,
341,
286,
21836,
18924,
486,
2028,
10297,
810,
1717,
1819,
41629,
19096,
317,
286,
1779,
12083,
380,
1006,
310,
6923,
3062,
465,
345,
310,
435,
2,
698,
1235,
328,
314,
15229,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_module_gen_code() {
let root = from_protos(protos());
assert_eq!(
root.gen_code(),
r###"pub mod a { #[cfg(any(feature = "a",))]
include_proto!("a");
}
pub mod b { #[cfg(any(feature = "a",feature = "b",))]
include_proto!("b");
}
pub mod c { #[cfg(any(feature = "a",feature = "b",feature = "c",))]
include_proto!("c");
}
pub mod d { #[cfg(any(feature = "a",feature = "c",feature = "d",))]
include_proto!("d");
}
"###
);
} | rust_cleaned_test_functions.jsonl/8979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12993,
10750,
16322,
4136,
368,
341,
286,
1077,
3704,
284,
504,
22357,
436,
7,
4391,
436,
1423,
286,
2060,
10714,
33673,
310,
3704,
22822,
4136,
3148,
310,
435,
14374,
1,
9585,
1463,
264,
314,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_hidden_filtering() {
check(
r#"
//- /lib.rs crate:lib deps:dep
fn foo(a: dep::A) { a.$0 }
//- /dep.rs crate:dep
pub struct A {
#[doc(hidden)]
pub hidden_field: u32,
pub pub_field: u32,
}
impl A {
pub fn pub_method(&self) {}
#[doc(hidden)]
pub fn hidden_method(&self) {}
}
"#,
expect![[r#"
fd pub_field u32
me pub_method() fn(&self)
"#]],
)
} | rust_cleaned_test_functions.jsonl/76772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
26739,
8727,
287,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
17717,
25,
2740,
48178,
25,
14891,
198,
8822,
15229,
2877,
25,
2170,
486,
32,
8,
314,
264,
2418,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_secret_key() {
// Take the lock so changing the environment doesn't cause races.
let _env_lock = ENV_LOCK.lock().unwrap();
env::remove_var(CONFIG_ENV);
assert!(RocketConfig::parse(r#"
[dev]
secret_key = true
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
assert!(RocketConfig::parse(r#"
[dev]
secret_key = 1283724897238945234897
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
assert!(RocketConfig::parse(r#"
[dev]
secret_key = "abcv"
"#.to_string(), TEST_CONFIG_FILENAME).is_err());
} | rust_cleaned_test_functions.jsonl/35251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
21962,
3097,
368,
341,
286,
442,
11778,
279,
5296,
773,
10018,
279,
4573,
3171,
944,
5240,
20588,
624,
286,
1077,
716,
3160,
9818,
284,
32791,
27661,
21003,
1005,
15454,
543,
286,
6105,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_geo_distance() {
let value: Document = serde_json::from_str(
r#"{
"_geo": {
"lat": 50.629973371633746,
"lng": 3.0569447399419567
},
"city": "Lille",
"id": "1"
}"#,
)
.unwrap();
let sorters = &["_geoPoint(50.629973371633746,3.0569447399419567):desc".to_string()];
let mut document = value.clone();
insert_geo_distance(sorters, &mut document);
assert_eq!(document.get("_geoDistance"), Some(&json!(0)));
let sorters = &["_geoPoint(50.629973371633746, 3.0569447399419567):asc".to_string()];
let mut document = value.clone();
insert_geo_distance(sorters, &mut document);
assert_eq!(document.get("_geoDistance"), Some(&json!(0)));
let sorters =
&["_geoPoint( 50.629973371633746 , 3.0569447399419567 ):desc".to_string()];
let mut document = value.clone();
insert_geo_distance(sorters, &mut document);
assert_eq!(document.get("_geoDistance"), Some(&json!(0)));
let sorters = &[
"prix:asc",
"villeneuve:desc",
"_geoPoint(50.629973371633746, 3.0569447399419567):asc",
"ubu:asc",
]
.map(|s| s.to_string());
let mut document = value.clone();
insert_geo_distance(sorters, &mut document);
assert_eq!(document.get("_geoDistance"), Some(&json!(0)));
// only the first geoPoint is used to compute the distance
let sorters = &[
"chien:desc",
"_geoPoint(50.629973371633746, 3.0569447399419567):asc",
"pangolin:desc",
"_geoPoint(100.0, -80.0):asc",
"chat:asc",
]
.map(|s| s.to_string());
let mut document = value.clone();
insert_geo_distance(sorters, &mut document);
assert_eq!(document.get("_geoDistance"), Some(&json!(0)));
// there was no _geoPoint so nothing is inserted in the document
let sorters = &["chien:asc".to_string()];
let mut document = value;
insert_geo_distance(sorters, &mut document);
assert_eq!(document.get("_geoDistance"), None);
} | rust_cleaned_test_functions.jsonl/60016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
60308,
19464,
368,
341,
286,
1077,
897,
25,
11789,
284,
61570,
9455,
486,
1499,
2895,
1006,
310,
435,
55543,
515,
1060,
9000,
13052,
788,
341,
394,
330,
5524,
788,
220,
20,
15,
13,
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_register() {
let result = register(CompleteStr("$0"));
assert_eq!(result.is_ok(), true);
let result = register(CompleteStr("0"));
assert_eq!(result.is_ok(), false);
let result = register(CompleteStr("$a"));
assert_eq!(result.is_ok(), false);
} | rust_cleaned_test_functions.jsonl/15341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14000,
368,
341,
286,
1077,
1102,
284,
4161,
7,
12548,
2580,
20912,
15,
4010,
286,
2060,
10714,
10297,
1382,
2079,
19817,
1507,
830,
317,
286,
1077,
1102,
284,
4161,
7,
12548,
2580,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_apply_snapshot() {
let ents = vec![
new_entry(3, 3),
new_entry(4, 4),
new_entry(5, 5),
new_entry(6, 6),
];
let mut cs = ConfState::default();
cs.set_nodes(vec![1, 2, 3]);
let td1 = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let snap_dir = Builder::new().prefix("snap").tempdir().unwrap();
let mgr = SnapManager::new(snap_dir.path().to_str().unwrap(), None);
let mut worker = Worker::new("snap-manager");
let sched = worker.scheduler();
let s1 = new_storage_from_ents(sched.clone(), &td1, &ents);
let (router, _) = mpsc::sync_channel(100);
let runner = RegionRunner::new(
s1.engines.clone(),
mgr,
0,
true,
Duration::from_secs(0),
CoprocessorHost::default(),
router,
);
worker.start(runner).unwrap();
assert!(s1.snapshot(0).is_err());
let gen_task = s1.gen_snap_task.borrow_mut().take().unwrap();
gen_task
.generate_and_schedule_snapshot(&s1.engines, &sched)
.unwrap();
let snap1 = match *s1.snap_state.borrow() {
SnapState::Generating(ref rx) => rx.recv_timeout(Duration::from_secs(3)).unwrap(),
ref s => panic!("unexpected state: {:?}", s),
};
assert_eq!(s1.truncated_index(), 3);
assert_eq!(s1.truncated_term(), 3);
worker.stop().unwrap().join().unwrap();
let td2 = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let mut s2 = new_storage(sched.clone(), &td2);
assert_eq!(s2.first_index(), s2.applied_index() + 1);
let mut ctx = InvokeContext::new(&s2);
assert_ne!(ctx.last_term, snap1.get_metadata().get_term());
let kv_wb = WriteBatch::default();
let raft_wb = WriteBatch::default();
s2.apply_snapshot(&mut ctx, &snap1, &kv_wb, &raft_wb)
.unwrap();
assert_eq!(ctx.last_term, snap1.get_metadata().get_term());
assert_eq!(ctx.apply_state.get_applied_index(), 6);
assert_eq!(ctx.raft_state.get_last_index(), 6);
assert_eq!(ctx.apply_state.get_truncated_state().get_index(), 6);
assert_eq!(ctx.apply_state.get_truncated_state().get_term(), 6);
assert_eq!(s2.first_index(), s2.applied_index() + 1);
validate_cache(&s2, &[]);
let td3 = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let ents = &[new_entry(3, 3), new_entry(4, 3)];
let mut s3 = new_storage_from_ents(sched, &td3, ents);
validate_cache(&s3, &ents[1..]);
let mut ctx = InvokeContext::new(&s3);
assert_ne!(ctx.last_term, snap1.get_metadata().get_term());
let kv_wb = WriteBatch::default();
let raft_wb = WriteBatch::default();
s3.apply_snapshot(&mut ctx, &snap1, &kv_wb, &raft_wb)
.unwrap();
assert_eq!(ctx.last_term, snap1.get_metadata().get_term());
assert_eq!(ctx.apply_state.get_applied_index(), 6);
assert_eq!(ctx.raft_state.get_last_index(), 6);
assert_eq!(ctx.apply_state.get_truncated_state().get_index(), 6);
assert_eq!(ctx.apply_state.get_truncated_state().get_term(), 6);
validate_cache(&s3, &[]);
} | rust_cleaned_test_functions.jsonl/38622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
36551,
53265,
368,
341,
286,
1077,
36852,
284,
7486,
90515,
310,
501,
9078,
7,
18,
11,
220,
18,
1326,
310,
501,
9078,
7,
19,
11,
220,
19,
1326,
310,
501,
9078,
7,
20,
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,
1... | 2 |
#[test]
fn test_version_long() {
let oup = exec_target(TARGET_EXE_PATH, &["--version", "inp"]);
assert_eq!(oup.status.success(), true);
assert_eq!(&oup.stdout[0..13], "Version:0.1.1");
assert_eq!(oup.stderr, "");
} | rust_cleaned_test_functions.jsonl/79973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
17799,
368,
341,
262,
1077,
5908,
79,
284,
3883,
11123,
4140,
16474,
4966,
36,
7944,
11,
609,
1183,
313,
4366,
497,
330,
42092,
15049,
262,
2060,
10714,
10297,
13346,
4299,
15426,
1507,
830,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_md2() {
// A.5 Test suite
assert_eq!(&md2(""),
&hex::decode("8350e5a3e24c153df2275c9f80692773").unwrap()[..]);
assert_eq!(&md2("a"),
&hex::decode("32ec01ec4a6dac72c0ab96fb34c0b5d1").unwrap()[..]);
assert_eq!(&md2("abc"),
&hex::decode("da853b0d3f88d99b30283a69e6ded6bb").unwrap()[..]);
assert_eq!(&md2("message digest"),
&hex::decode("ab4f496bfb2a530b219ff33031fe06b0").unwrap()[..]);
assert_eq!(&md2("abcdefghijklmnopqrstuvwxyz"),
&hex::decode("4e8ddff3650292ab5a4108c3aa47940b").unwrap()[..]);
assert_eq!(&md2("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"),
&hex::decode("da33def2a42df13975352846c30338cd").unwrap()[..]);
assert_eq!(&md2("12345678901234567890123456789012345678901234567890123456789012345678901234567890"),
&hex::decode("d5976f79d83d3a0dc9806c3c66f3efd8").unwrap()[..]);
} | rust_cleaned_test_functions.jsonl/63308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32994,
17,
368,
341,
262,
442,
362,
13,
20,
3393,
16182,
7213,
262,
2060,
10714,
0,
2099,
2277,
17,
445,
4461,
286,
609,
17308,
486,
18196,
445,
23,
18,
20,
15,
68,
20,
64,
18,
68,
17,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_tx_with_custom_rbf_csv() {
let (wallet, _, _) = get_funded_wallet(get_test_single_sig_csv());
let addr = wallet.get_new_address().unwrap();
wallet
.create_tx(
TxBuilder::with_recipients(vec![(addr.script_pubkey(), 25_000)])
.enable_rbf_with_sequence(3),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/11319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17805,
6615,
15875,
1710,
13233,
14020,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
19487,
29252,
14020,
1423,
286,
1077,
10789,
284,
15085,
670,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add() {
let a = Jacobian::from(Affine::new(
FieldElement::from(u256h!(
"01ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca"
)),
FieldElement::from(u256h!(
"005668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"
)),
));
let b = Jacobian::from(Affine::new(
FieldElement::from(u256h!(
"00f24921907180cd42c9d2d4f9490a7bc19ac987242e80ac09a8ac2bcf0445de"
)),
FieldElement::from(u256h!(
"018a7a2ab4e795405f924de277b0e723d90eac55f2a470d8532113d735bdedd4"
)),
));
let c = Jacobian::from(Affine::new(
FieldElement::from(u256h!(
"0457342950d2475d9e83a4de8beb3c0850181342ea04690d804b37aa907b735f"
)),
FieldElement::from(u256h!(
"00011bd6102b929632ce605b5ae1c9c6c1b8cba2f83aa0c5a6d1247318871137"
)),
));
assert_eq!(a + b, c);
} | rust_cleaned_test_functions.jsonl/74018 | {
"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,
2891,
368,
341,
286,
1077,
264,
284,
24521,
1103,
486,
1499,
4346,
542,
482,
486,
931,
1006,
310,
8601,
1691,
486,
1499,
8154,
17,
20,
21,
71,
33673,
394,
330,
15,
16,
823,
16,
20,
66,
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_process_new_vote_state_expired_ancestor_not_removed() {
// Construct on-chain vote state
let mut vote_state1 = VoteState::default();
vote_state1.process_slot_votes_unchecked(&[1, 2, 3, 9]);
assert_eq!(
vote_state1
.votes
.iter()
.map(|vote| vote.slot)
.collect::<Vec<Slot>>(),
vec![1, 9]
);
// because 9 is not popped off yet
let mut vote_state2 = vote_state1.clone();
vote_state2.process_slot_vote_unchecked(10);
// 9 which has not been expired yet.
assert_eq!(vote_state2.votes[0].slot, 1);
assert_eq!(vote_state2.votes[0].last_locked_out_slot(), 9);
assert_eq!(
vote_state2
.votes
.iter()
.map(|vote| vote.slot)
.collect::<Vec<Slot>>(),
vec![1, 9, 10]
);
// Should be able to update vote_state1
vote_state1
.process_new_vote_state(
vote_state2.votes.clone(),
vote_state2.root_slot,
None,
vote_state2.current_epoch(),
None,
)
.unwrap();
assert_eq!(vote_state1, vote_state2,);
} | rust_cleaned_test_functions.jsonl/6128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
5921,
54360,
4387,
80221,
62,
66878,
7913,
68248,
368,
341,
286,
442,
18678,
389,
65186,
6910,
1584,
198,
286,
1077,
5206,
6910,
4387,
16,
284,
34034,
1397,
486,
2258,
543,
286,
6910,
4387,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_c_call_r() {
fn cxx_run_test() {
extern "C" {
fn cxx_run_test() -> *const i8;
}
let failure = unsafe { cxx_run_test() };
if !failure.is_null() {
let msg = unsafe { CStr::from_ptr(failure as *mut std::os::raw::c_char) };
eprintln!("{}", msg.to_string_lossy());
}
}
check!(cxx_run_test());
} | rust_cleaned_test_functions.jsonl/50899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
13429,
1710,
368,
341,
262,
5168,
272,
4146,
14007,
4452,
368,
341,
286,
15637,
330,
34,
1,
341,
310,
5168,
272,
4146,
14007,
4452,
368,
1464,
353,
1024,
600,
23,
280,
286,
456,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_add() {
assert_eq!((b(0) + b(0)).round_u128(), 0);
assert_eq!((b(5) + b(2)).round_u128(), 7);
assert_eq!((b(2) + b(5)).round_u128(), 7);
assert_eq!((b(5) + b(0)).round_u128(), 5);
assert_eq!((b(0) + b(5)).round_u128(), 5);
} | rust_cleaned_test_functions.jsonl/57390 | {
"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,
30015,
2891,
368,
341,
286,
2060,
10714,
0,
1188,
65,
7,
15,
8,
488,
293,
7,
15,
4579,
1049,
7300,
16,
17,
23,
1507,
220,
15,
317,
286,
2060,
10714,
0,
1188,
65,
7,
20,
8,
488,
293,
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_set() {
let mut bitmap = MutableBitmap::from_len_zeroed(12);
bitmap.set(0, true);
assert!(bitmap.get(0));
bitmap.set(0, false);
assert!(!bitmap.get(0));
bitmap.set(11, true);
assert!(bitmap.get(11));
bitmap.set(11, false);
assert!(!bitmap.get(11));
bitmap.set(11, true);
let bitmap: Option<Bitmap> = bitmap.into();
let bitmap = bitmap.unwrap();
assert_eq!(bitmap.len(), 12);
assert_eq!(bitmap.as_slice()[0], 0b00000000);
} | rust_cleaned_test_functions.jsonl/64523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
368,
341,
286,
1077,
5206,
19746,
284,
31143,
16773,
486,
1499,
6043,
19359,
291,
7,
16,
17,
317,
286,
19746,
980,
7,
15,
11,
830,
317,
286,
2060,
10297,
40954,
670,
7,
15,
1106,
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_slice_from() {
let vec: &[_] = &[1, 2, 3, 4];
assert_eq!(&vec[..], vec);
let b: &[_] = &[3, 4];
assert_eq!(&vec[2..], b);
let b: &[_] = &[];
assert_eq!(&vec[4..], b);
} | rust_cleaned_test_functions.jsonl/12857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
5673,
368,
341,
262,
1077,
7486,
25,
609,
13496,
60,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
2060,
10714,
0,
2099,
4083,
95874,
1125,
7486,
317,
262,
1077,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stream_batch_row_limit() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, Some("name:1"), 4),
(8, Some("name:2"), 4),
];
let product = ProductTable::new();
let stream_row_limit = 2;
let (_, mut end_point) = {
let engine = engine::new_local_engine(TEMP_DIR, ALL_CFS).unwrap();
let mut cfg = Config::default();
cfg.end_point_stream_batch_row_limit = stream_row_limit;
init_data_with_details(Context::new(), engine, &product, &data, true, cfg)
};
let req = DAGSelect::from(&product.table).build();
assert_eq!(req.get_ranges().len(), 1);
let mut expected_ranges_last_byte = vec![(0, 3), (3, 6), (6, 255)];
let check_range = move |resp: &Response| {
let (start_last_byte, end_last_byte) = expected_ranges_last_byte.remove(0);
let start = resp.get_range().get_start();
let end = resp.get_range().get_end();
assert_eq!(start[start.len() - 1], start_last_byte);
assert_eq!(end[end.len() - 1], end_last_byte);
};
let resps = handle_streaming_select(&end_point, req, check_range);
assert_eq!(resps.len(), 3);
let expected_output_counts = vec![vec![2 as i64], vec![2 as i64], vec![1 as i64]];
for (i, resp) in resps.into_iter().enumerate() {
assert_eq!(resp.get_encode_type(), EncodeType::TypeDefault);
let mut chunk = Chunk::new();
chunk.merge_from_bytes(resp.get_data()).unwrap();
assert_eq!(
resp.get_output_counts(),
expected_output_counts[i].as_slice()
);
let chunks = vec![chunk];
let chunk_data_limit = stream_row_limit * 3; // we have 3 fields.
check_chunk_datum_count(&chunks, chunk_data_limit);
let spliter = DAGChunkSpliter::new(chunks, 3);
let j = cmp::min((i + 1) * stream_row_limit, data.len());
let cur_data = &data[i * stream_row_limit..j];
for (row, &(id, name, cnt)) in spliter.zip(cur_data) {
let name_datum = name.map(|s| s.as_bytes()).into();
let expected_encoded =
datum::encode_value(&[Datum::I64(id), name_datum, cnt.into()]).unwrap();
let result_encoded = datum::encode_value(&row).unwrap();
assert_eq!(result_encoded, &*expected_encoded);
}
}
end_point.stop().unwrap().join().unwrap();
} | rust_cleaned_test_functions.jsonl/47089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
14534,
8530,
14763,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
3975,
220,
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... | 3 |
#[test]
fn test_encode_float() {
let config = Config::new_empty();
let mut buffer = Buffer::new();
let value = Value::Float(12345.123);
td_rp::encode_field(&mut buffer, &config, &value).unwrap();
td_rp::encode_field(&mut buffer, &config, &value).unwrap();
// first read field
test_head_field(&mut buffer, 0, td_rp::TYPE_FLOAT);
// after index type is data
let data: &mut [u8; 4] = &mut [0, 0, 0, 0];
let size = buffer.read(data).unwrap();
assert_eq!(size, 4);
let val = u32::from_le(unsafe { mem::transmute::<[u8;4], u32>(*data) });
let val = val as f32 / 1000.0;
assert_eq!(val, 12345.123);
// second read field
let read = td_rp::decode_field(&mut buffer, &config).unwrap();
match read {
Value::Float(val) => assert_eq!(val, 12345.123),
_ => unreachable!("it will not read"),
}
let size = buffer.read(data).unwrap();
assert_eq!(size, 0);
} | rust_cleaned_test_functions.jsonl/121845 | {
"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,
11224,
17586,
368,
341,
262,
1077,
2193,
284,
5532,
486,
931,
15124,
543,
262,
1077,
5206,
4147,
284,
10312,
486,
931,
543,
262,
1077,
897,
284,
5162,
486,
5442,
7,
16,
17,
18,
19,
20,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_flatten_end() {
let segment = CubicBezierSegment {
from: Point::new(0.0, 0.0),
ctrl1: Point::new(100.0, 0.0),
ctrl2: Point::new(100.0, 100.0),
to: Point::new(100.0, 200.0),
};
let mut last = segment.from;
segment.for_each_flattened(0.0001, &mut |p| {
last = p;
});
assert_eq!(last, segment.to);
} | rust_cleaned_test_functions.jsonl/49784 | {
"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,
5081,
14456,
6213,
368,
341,
262,
1077,
10238,
284,
18030,
292,
95050,
21086,
341,
286,
504,
25,
5126,
486,
931,
7,
15,
13,
15,
11,
220,
15,
13,
15,
1326,
286,
23743,
16,
25,
5126,
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_keysend_msg_with_secret_err() {
// Test that we error as expected if we receive a keysend payment that includes a payment secret.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let payer_pubkey = nodes[0].node.get_our_node_id();
let payee_pubkey = nodes[1].node.get_our_node_id();
nodes[0].node.peer_connected(&payee_pubkey, &msgs::Init { features: InitFeatures::known() });
nodes[1].node.peer_connected(&payer_pubkey, &msgs::Init { features: InitFeatures::known() });
let _chan = create_chan_between_nodes(&nodes[0], &nodes[1], InitFeatures::known(), InitFeatures::known());
let network_graph = nodes[0].net_graph_msg_handler.network_graph.read().unwrap();
let first_hops = nodes[0].node.list_usable_channels();
let route = get_keysend_route(&payer_pubkey, &network_graph, &payee_pubkey,
Some(&first_hops.iter().collect::<Vec<_>>()), &vec![], 10000, 40,
nodes[0].logger).unwrap();
let test_preimage = PaymentPreimage([42; 32]);
let test_secret = PaymentSecret([43; 32]);
let payment_hash = PaymentHash(Sha256::hash(&test_preimage.0).into_inner());
let _ = nodes[0].node.send_payment_internal(&route, payment_hash, &Some(test_secret), Some(test_preimage)).unwrap();
check_added_monitors!(nodes[0], 1);
let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
assert_eq!(updates.update_add_htlcs.len(), 1);
assert!(updates.update_fulfill_htlcs.is_empty());
assert!(updates.update_fail_htlcs.is_empty());
assert!(updates.update_fail_malformed_htlcs.is_empty());
assert!(updates.update_fee.is_none());
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
nodes[1].logger.assert_log_contains("lightning::ln::channelmanager".to_string(), "We don't support MPP keysend payments".to_string(), 1);
} | rust_cleaned_test_functions.jsonl/94569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
6681,
6483,
6615,
21962,
9266,
368,
341,
197,
197,
322,
3393,
429,
582,
1465,
438,
3601,
421,
582,
5258,
264,
1376,
6681,
8160,
429,
5646,
264,
8160,
6234,
624,
197,
10217,
26023,
1645,
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_vincenty_distance_1() {
let a = Point::<f64>::new(17.072561, 48.154563);
let b = Point::<f64>::new(17.072562, 48.154564);
assert_relative_eq!(
a.vincenty_distance(&b).unwrap(),
0.13378944117648012,
epsilon = 1.0e-6
);
} | rust_cleaned_test_functions.jsonl/15215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
258,
1168,
88,
19464,
62,
16,
368,
341,
286,
1077,
264,
284,
5126,
27638,
69,
21,
19,
6831,
931,
7,
16,
22,
13,
15,
22,
17,
20,
21,
16,
11,
220,
19,
23,
13,
16,
20,
19,
20,
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_requested_attrs_constructed_correctly_for_names() {
let _setup = SetupDefaults::init();
let attr_info = json!({
"names": ["name", "age", "email"],
"restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schema_name:0.0.11"}]
});
let attr_info_2 = json!({
"name":"name",
"restrictions": [{"schema_id": "6XFh8yBzrpJQmNyZzgoTqB:2:schema_name:0.0.11" }]
});
let requested_attrs = json!([ attr_info, attr_info_2 ]).to_string();
let request = ProofRequestData::create()
.set_nonce().unwrap()
.set_requested_attributes(requested_attrs.into()).unwrap();
let mut expected_req_attrs: HashMap<String, AttrInfo> = HashMap::new();
expected_req_attrs.insert("attribute_0".to_string(), serde_json::from_value(attr_info).unwrap());
expected_req_attrs.insert("attribute_1".to_string(), serde_json::from_value(attr_info_2).unwrap());
assert_eq!(request.requested_attributes, expected_req_attrs);
} | rust_cleaned_test_functions.jsonl/65276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72709,
39578,
64803,
291,
31550,
398,
5478,
9187,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16273,
486,
2327,
1428,
286,
1077,
6376,
3109,
284,
2951,
0,
2262,
688,
330,
11400,
788,
4383,
606,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
assert_eq!(Parser::from_reader("0".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Uint(0)));
assert_eq!(Parser::from_reader("10".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Uint(10)));
assert_eq!(Parser::from_reader("-10".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Int(-10)));
assert_eq!(Parser::from_reader("1e0".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Uint(1)));
assert_eq!(Parser::from_reader("1e2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Uint(100)));
assert_eq!(Parser::from_reader("-1e2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Int(-100)));
assert_eq!(Parser::from_reader("0.0".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Float(0.0)));
assert_eq!(Parser::from_reader("123.456".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Float(123.456)));
assert_eq!(Parser::from_reader("123.456e3".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Uint(123456)));
assert_eq!(Parser::from_reader("-123.456e3".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Int(-123456)));
assert_eq!(Parser::from_reader("-123.456e2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Float(-12345.6)));
assert_eq!(Parser::from_reader("1e-2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Float(0.01)));
assert_eq!(Parser::from_reader("100e+2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Uint(10000)));
assert_eq!(Parser::from_reader("100e-2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Float(1.0)));
assert_eq!(Parser::from_reader("-100e+2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Int(-10000)));
assert_eq!(Parser::from_reader("-100e-2".as_bytes()).next().unwrap().unwrap(),
Event::Number(N::Float(-1.0)));
} | rust_cleaned_test_functions.jsonl/12578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 979
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
368,
341,
262,
2060,
10714,
10297,
6570,
486,
1499,
22306,
445,
15,
3263,
300,
12524,
6011,
3600,
1005,
15454,
1005,
15454,
3148,
2290,
3665,
486,
2833,
8204,
486,
21570,
7,
15,
4945,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_str_by_up() {
let cxx = indoc! {"
std::unique_ptr<std::string> get_str() {
return std::make_unique<std::string>(\"hello\");
}
"};
let hdr = indoc! {"
#include <string>
#include <memory>
std::unique_ptr<std::string> get_str();
"};
let rs = quote! {
assert_eq!(ffi::get_str().as_ref().unwrap(), "hello");
};
run_test(cxx, hdr, rs, &["get_str"], &[]);
} | rust_cleaned_test_functions.jsonl/9748 | {
"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,
3062,
2895,
3710,
8237,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
262,
1460,
486,
9587,
4348,
8050,
486,
917,
29,
633,
2895,
368,
341,
310,
470,
1460,
486,
6927,
21218,
8050... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_cannot_be_a_base_urls() {
assert!(ident(&url("github.com:PistonDevelopers/piston")).is_err());
assert!(ident(&url("google.com:PistonDevelopers/piston")).is_err());
} | rust_cleaned_test_functions.jsonl/21286 | {
"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,
27421,
22391,
551,
666,
3401,
21263,
4306,
7651,
32822,
368,
341,
286,
2060,
10297,
1713,
2099,
1085,
445,
5204,
905,
92411,
58819,
20444,
388,
4322,
58819,
15197,
285,
9266,
1423,
286,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_y_candidates() {
let y_range = RangeInclusive::new(-10, -5);
let y_candidates = possible_y_velocities(&y_range);
assert_eq!(y_candidates[&7], (2, 3));
assert_eq!(y_candidates[&9], (3, 6));
assert_eq!(y_candidates[&10], (4, 10));
assert_eq!(y_candidates[&12], (5, 15));
assert_eq!(y_candidates[&14], (6, 21));
assert_eq!(y_candidates[&16], (7, 28));
assert_eq!(y_candidates[&18], (8, 36));
assert_eq!(y_candidates[&20], (9, 45));
} | rust_cleaned_test_functions.jsonl/95806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4178,
73553,
368,
341,
286,
1077,
379,
9698,
284,
16437,
641,
8336,
486,
931,
4080,
16,
15,
11,
481,
20,
317,
286,
1077,
379,
73553,
284,
3204,
4178,
34504,
80449,
2099,
88,
9698,
626,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type() {
let input = buffer(r#"(@interface type (func (param i32 i32) (result i32)))"#);
let output = Interface::Type(Type {
inputs: vec![InterfaceType::I32, InterfaceType::I32],
outputs: vec![InterfaceType::I32],
});
assert_eq!(parser::parse::<Interface>(&input).unwrap(), output);
} | rust_cleaned_test_functions.jsonl/102972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
368,
341,
286,
1077,
1946,
284,
4147,
2601,
55543,
5957,
4970,
943,
320,
2830,
320,
903,
600,
18,
17,
600,
18,
17,
8,
320,
1382,
600,
18,
17,
7705,
57676,
317,
286,
1077,
2550,
284,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_min() {
assert_eq!((0..20).min(), Some(0));
assert_eq!((-20..0).min(), Some(-20));
assert_eq!((5..5).min(), None);
} | rust_cleaned_test_functions.jsonl/54161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
7260,
368,
341,
262,
2060,
10714,
0,
1188,
15,
496,
17,
15,
568,
1065,
1507,
4329,
7,
15,
1106,
262,
2060,
10714,
0,
54934,
17,
15,
496,
15,
568,
1065,
1507,
4329,
4080,
17,
15,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_adding_ip_to_farm_works() {
ExternalityBuilder::build().execute_with(|| {
create_entity();
create_twin();
create_farm();
assert_ok!(TfgridModule::add_farm_ip(
Origin::signed(alice()),
1,
"1.1.1.2".as_bytes().to_vec(),
"1.1.1.1".as_bytes().to_vec()
));
});
} | rust_cleaned_test_functions.jsonl/35357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
287,
10385,
2346,
761,
2178,
11498,
82,
368,
341,
262,
1374,
4160,
2719,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1855,
19169,
543,
286,
1855,
528,
7526,
543,
286,
1855,
761,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_mixed() -> Result<()> {
let fixture = rc().append_fixture_trace(
r#"
git init origin
origin <<EOF
git config user.name "Origin Test"
git config user.email "origin@test"
echo "Hello World!" > README.md
git add README.md
git commit -m "Initial commit"
EOF
git clone origin local
local <<EOF
git config user.name "Local Test"
git config user.email "local@test"
git config remote.pushdefault origin
git config push.default simple
EOF
# prepare awesome patch
mk_test_branches() {
BASE=$1
NAME=$2
COUNT=$3
git checkout -b "$NAME" "$BASE"
for i in $(seq "$COUNT"); do
touch "$NAME-$i"
git add "$NAME-$i"
git commit -m "Add $NAME-$i"
done
git push -u origin "$NAME"
}
local <<EOF
mk_test_branches master rebaseme 3
mk_test_branches master squashme 3
mk_test_branches master noffme 3
EOF
"#,
);
let guard = fixture.prepare(
"local",
r#"
origin <<EOF
# squash
git checkout master
git merge squashme --squash && git commit --no-edit
git branch -D squashme
# rebaseme
git checkout -b rebase-tmp rebaseme
git rebase master
git checkout master
git merge rebase-tmp --ff-only
git branch -D rebase-tmp rebaseme
# noff
git checkout master
git merge noffme --no-ff
git branch -D noffme
EOF
"#,
)?;
let git = Git::try_from(Repository::open(guard.working_directory())?)?;
let plan = get_trim_plan(&git, &test_default_param())?;
assert_eq!(
plan.to_delete,
set! {
ClassifiedBranch::MergedLocal(LocalBranch::new("refs/heads/squashme")),
ClassifiedBranch::MergedLocal(LocalBranch::new("refs/heads/rebaseme")),
ClassifiedBranch::MergedLocal(LocalBranch::new("refs/heads/noffme")),
},
);
Ok(())
} | rust_cleaned_test_functions.jsonl/97317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
3286,
368,
1464,
5714,
71698,
341,
262,
1077,
12507,
284,
10192,
1005,
5090,
74409,
23575,
1006,
286,
435,
2,
698,
286,
16345,
2930,
6238,
198,
286,
6238,
1115,
23483,
198,
310,
16345,
2193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_drop_on_notify() {
// task that holds the associated socket. If this notification results in
// that same lock in order to clean up state.
// the task is notified. This simulates an executor in the process of
// dropped.
let mut reactor = assert_ok!(Reactor::new());
let (addr_tx, addr_rx) = mpsc::channel();
// Define a task that just drains the listener
let task = Arc::new(Task::new(async move {
let addr = assert_ok!("127.0.0.1:0".parse());
// Create a listener
let mut listener = assert_ok!(TcpListener::bind(&addr));
// Send the address
let addr = listener.local_addr().unwrap();
addr_tx.send(addr).unwrap();
loop {
let _ = listener.accept().await;
}
}));
let _enter = tokio_executor::enter().unwrap();
tokio_net::with_default(&reactor.handle(), || {
let waker = waker_ref(&task);
let mut cx = Context::from_waker(&waker);
assert_pending!(task.future.lock().unwrap().as_mut().poll(&mut cx));
});
// Get the address
let addr = addr_rx.recv().unwrap();
drop(task);
// Establish a connection to the acceptor
let _s = TcpStream::connect(&addr).unwrap();
reactor.turn(None).unwrap();
} | rust_cleaned_test_functions.jsonl/706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
4470,
36654,
368,
341,
1066,
262,
442,
3383,
429,
9982,
279,
5815,
7575,
13,
1416,
419,
11540,
3059,
304,
7213,
41693,
262,
442,
429,
1852,
5296,
304,
1973,
311,
4240,
705,
1584,
624,
940... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cowrc_clone_weak() {
{
let mut cow0 = Cc::new(75);
let cow1_weak = cow0.downgrade();
assert!(75 == *cow0);
assert!(75 == *cow1_weak.upgrade().unwrap());
*cow0.make_unique() += 1;
assert!(76 == *cow0);
assert!(cow1_weak.upgrade().is_none());
}
collect_cycles();
} | rust_cleaned_test_functions.jsonl/110854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
363,
1287,
54742,
86356,
368,
341,
286,
341,
310,
1077,
5206,
19362,
15,
284,
356,
66,
486,
931,
7,
22,
20,
317,
310,
1077,
19362,
16,
86356,
284,
19362,
15,
18148,
6937,
1428,
310,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_account_with_seed() {
let TestValidator {
server,
leader_data,
alice: mint_keypair,
ledger_path,
..
} = TestValidator::run_with_options(TestValidatorOptions {
fees: 1,
bootstrap_validator_lamports: 42_000,
..TestValidatorOptions::default()
});
let (sender, receiver) = channel();
run_local_faucet(mint_keypair, sender, None);
let faucet_addr = receiver.recv().unwrap();
let offline_nonce_authority_signer = keypair_from_seed(&[1u8; 32]).unwrap();
let online_nonce_creator_signer = keypair_from_seed(&[2u8; 32]).unwrap();
let to_address = Pubkey::new(&[3u8; 32]);
// Setup accounts
let rpc_client = RpcClient::new_socket(leader_data.rpc);
request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&offline_nonce_authority_signer.pubkey(),
42,
)
.unwrap();
request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&online_nonce_creator_signer.pubkey(),
4242,
)
.unwrap();
check_balance(42, &rpc_client, &offline_nonce_authority_signer.pubkey());
check_balance(4242, &rpc_client, &online_nonce_creator_signer.pubkey());
check_balance(0, &rpc_client, &to_address);
// Create nonce account
let creator_pubkey = online_nonce_creator_signer.pubkey();
let authority_pubkey = offline_nonce_authority_signer.pubkey();
let seed = authority_pubkey.to_string()[0..32].to_string();
let nonce_address =
Pubkey::create_with_seed(&creator_pubkey, &seed, &system_program::id()).unwrap();
check_balance(0, &rpc_client, &nonce_address);
let mut creator_config = CliConfig::default();
creator_config.json_rpc_url =
format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
creator_config.signers = vec![&online_nonce_creator_signer];
creator_config.command = CliCommand::CreateNonceAccount {
nonce_account: 0,
seed: Some(seed),
nonce_authority: Some(authority_pubkey),
lamports: 241,
};
process_command(&creator_config).unwrap();
check_balance(241, &rpc_client, &nonce_address);
check_balance(42, &rpc_client, &offline_nonce_authority_signer.pubkey());
check_balance(4000, &rpc_client, &online_nonce_creator_signer.pubkey());
check_balance(0, &rpc_client, &to_address);
// Fetch nonce hash
let nonce_hash = nonce::get_account(&rpc_client, &nonce_address)
.and_then(|ref a| nonce::data_from_account(a))
.unwrap()
.blockhash;
let mut authority_config = CliConfig::default();
authority_config.json_rpc_url = String::default();
authority_config.signers = vec![&offline_nonce_authority_signer];
// Verify we cannot contact the cluster
authority_config.command = CliCommand::ClusterVersion;
process_command(&authority_config).unwrap_err();
authority_config.command = CliCommand::Transfer {
lamports: 10,
to: to_address,
from: 0,
sign_only: true,
no_wait: false,
blockhash_query: BlockhashQuery::None(nonce_hash),
nonce_account: Some(nonce_address),
nonce_authority: 0,
fee_payer: 0,
};
let sign_only_reply = process_command(&authority_config).unwrap();
let sign_only = parse_sign_only_reply_string(&sign_only_reply);
let authority_presigner = sign_only.presigner_of(&authority_pubkey).unwrap();
assert_eq!(sign_only.blockhash, nonce_hash);
// And submit it
let mut submit_config = CliConfig::default();
submit_config.json_rpc_url =
format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
submit_config.signers = vec![&authority_presigner];
submit_config.command = CliCommand::Transfer {
lamports: 10,
to: to_address,
from: 0,
sign_only: false,
no_wait: false,
blockhash_query: BlockhashQuery::FeeCalculator(
blockhash_query::Source::NonceAccount(nonce_address),
sign_only.blockhash,
),
nonce_account: Some(nonce_address),
nonce_authority: 0,
fee_payer: 0,
};
process_command(&submit_config).unwrap();
check_balance(241, &rpc_client, &nonce_address);
check_balance(31, &rpc_client, &offline_nonce_authority_signer.pubkey());
check_balance(4000, &rpc_client, &online_nonce_creator_signer.pubkey());
check_balance(10, &rpc_client, &to_address);
server.close().unwrap();
remove_dir_all(ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/77782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1980
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
13500,
6615,
33809,
368,
341,
262,
1077,
3393,
14256,
341,
286,
3538,
345,
286,
7653,
1769,
345,
286,
70433,
25,
28337,
3097,
12670,
345,
286,
46933,
2638,
345,
286,
54538,
262,
335,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_install_help() {
let (_, mut ucmd) = at_and_ucmd!();
ucmd.arg("--help")
.succeeds()
.no_stderr()
.stdout_contains("FLAGS:");
} | rust_cleaned_test_functions.jsonl/47011 | {
"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,
34245,
26926,
368,
341,
262,
1077,
39464,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
1428,
262,
575,
8710,
21186,
21549,
8653,
1138,
286,
659,
82,
29264,
82,
741,
286,
659,
2152,
93033,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_indexes_and_variables() {
let p = Point2::new(1, 2);
assert_eq!(p[0], p.x);
assert_eq!(p[1], p.y);
} | rust_cleaned_test_functions.jsonl/4545 | {
"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,
50161,
8378,
28182,
368,
341,
286,
1077,
281,
284,
5126,
17,
486,
931,
7,
16,
11,
220,
17,
626,
286,
2060,
10714,
10297,
79,
58,
15,
1125,
281,
1993,
317,
286,
2060,
10714,
10297,
79,
58,
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 |
#[test]
fn test_rotate_grandchildren() {
let (shapes, mut bvh) = create_predictable_bvh();
// Switch two nodes.
bvh.rotate(3, 5, &shapes);
// Check if the resulting tree is as expected.
let BVH { nodes } = bvh;
assert_eq!(nodes[0].parent(), 0);
assert_eq!(nodes[0].child_l(), 1);
assert_eq!(nodes[0].child_r(), 2);
assert_eq!(nodes[1].parent(), 0);
assert_eq!(nodes[1].child_l(), 5);
assert_eq!(nodes[1].child_r(), 4);
assert_eq!(nodes[2].parent(), 0);
assert_eq!(nodes[2].child_l(), 3);
assert_eq!(nodes[2].child_r(), 6);
assert_eq!(nodes[3].parent(), 2);
assert_eq!(nodes[4].parent(), 1);
assert_eq!(nodes[5].parent(), 1);
assert_eq!(nodes[6].parent(), 2);
assert!(nodes[1]
.child_l_aabb()
.relative_eq(&shapes[2].aabb(), EPSILON));
assert!(nodes[1]
.child_r_aabb()
.relative_eq(&shapes[1].aabb(), EPSILON));
assert!(nodes[2]
.child_l_aabb()
.relative_eq(&shapes[0].aabb(), EPSILON));
assert!(nodes[2]
.child_r_aabb()
.relative_eq(&shapes[3].aabb(), EPSILON));
} | rust_cleaned_test_functions.jsonl/90326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
15682,
437,
5864,
368,
341,
286,
1077,
320,
92059,
11,
5206,
293,
29919,
8,
284,
1855,
26815,
480,
880,
29919,
1428,
286,
442,
15586,
1378,
7798,
624,
286,
293,
29919,
35944,
7,
18,
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_rpc_get_cluster_nodes() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let RpcHandler {
io,
meta,
leader_pubkey,
..
} = start_rpc_handler_with_tx(&bob_pubkey);
let req = r#"{"jsonrpc":"2.0","id":1,"method":"getClusterNodes"}"#;
let res = io.handle_request_sync(req, meta);
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
let expected = format!(
r#"{{"jsonrpc":"2.0","result":[{{"pubkey": "{}", "gossip": "127.0.0.1:1235", "shredVersion": 0, "tpu": "127.0.0.1:1234", "rpc": "127.0.0.1:{}", "version": null, "featureSet": null}}],"id":1}}"#,
leader_pubkey,
rpc_port::DEFAULT_RPC_PORT
);
let expected: Response =
serde_json::from_str(&expected).expect("expected response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/3017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
28441,
14896,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
79961,
3050,
341,
310,
6399,
345,
310,
8823,
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_extract_unsigned_limits() {
assert_eq!(
extract_unsigned(cbor_unsigned!(std::u64::MAX)),
Ok(std::u64::MAX)
);
assert_eq!(
extract_unsigned(cbor_unsigned!((std::i64::MAX as u64) + 1)),
Ok((std::i64::MAX as u64) + 1)
);
assert_eq!(
extract_unsigned(cbor_int!(std::i64::MAX)),
Ok(std::i64::MAX as u64)
);
assert_eq!(extract_unsigned(cbor_int!(123)), Ok(123));
assert_eq!(extract_unsigned(cbor_int!(1)), Ok(1));
assert_eq!(extract_unsigned(cbor_int!(0)), Ok(0));
assert_eq!(
extract_unsigned(cbor_int!(-1)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_unsigned(cbor_int!(-123)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_unsigned(cbor_int!(std::i64::MIN)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
} | rust_cleaned_test_functions.jsonl/48991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
67830,
31820,
368,
341,
286,
2060,
10714,
33673,
310,
8649,
67830,
1337,
9368,
67830,
10297,
1834,
486,
84,
21,
19,
486,
10586,
6965,
310,
7622,
5194,
486,
84,
21,
19,
486,
10586,
340,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alice29() {
assert_decompressed_input_matches_output(ALICE29_BR, ALICE29, 65536, 65536);
} | rust_cleaned_test_functions.jsonl/26426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 52
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8418,
558,
17,
24,
368,
341,
220,
2060,
2259,
45703,
5898,
38344,
7645,
46232,
5487,
17,
24,
26543,
11,
8753,
5487,
17,
24,
11,
220,
21,
20,
20,
18,
21,
11,
220,
21,
20,
20,
18,
21,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dispatch_table_ptrs_mut_none() {
let signatures = &[];
let fn_ptrs = &mut [];
let mut dispatch_table = fake_dispatch_table(signatures, fn_ptrs);
assert_eq!(dispatch_table.ptrs_mut().len(), 0);
} | rust_cleaned_test_functions.jsonl/47219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
5237,
79533,
29523,
31488,
368,
341,
286,
1077,
32628,
284,
609,
15078,
286,
1077,
5168,
79533,
284,
609,
6984,
5907,
286,
1077,
5206,
6845,
5237,
284,
12418,
42991,
5237,
40046,
2789,
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 |
#[test]
fn test_pd_cfg() {
let mut cfg = Config::default();
// endpoints is required.
cfg.validate().unwrap_err();
cfg.endpoints = vec!["127.0.0.1:2333".to_owned()];
cfg.validate().unwrap();
} | rust_cleaned_test_functions.jsonl/51868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31322,
18343,
368,
341,
286,
1077,
5206,
13286,
284,
5532,
486,
2258,
543,
286,
442,
36342,
374,
2567,
624,
286,
13286,
19520,
1005,
15454,
9266,
543,
286,
13286,
5073,
7706,
284,
7486,
0,
1183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_checked_add_tocks_overflow2() {
let key = Pubkey::new_unique();
let (_account1, mut account2) = make_two_accounts(&key);
account2.checked_add_tocks(u64::MAX).unwrap();
} | rust_cleaned_test_functions.jsonl/56006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
56456,
2891,
528,
25183,
79073,
17,
368,
341,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5453,
4608,
16,
11,
5206,
2692,
17,
8,
284,
1281,
23241,
55665,
2099,
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 |
#[test]
fn test_braces() {
let input = "echo {c[a,b],d}";
let expected = vec![
WordToken::Normal("echo".into(), false, false),
WordToken::Whitespace(" "),
WordToken::Brace(vec!["c[a,b]", "d"]),
];
compare(input, expected);
} | rust_cleaned_test_functions.jsonl/33794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17682,
2434,
368,
341,
262,
1077,
1946,
284,
330,
3047,
314,
66,
15481,
8402,
1125,
67,
26259,
262,
1077,
3601,
284,
7486,
90515,
286,
9322,
3323,
486,
12206,
445,
3047,
3263,
18122,
1507,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold() {
assert_eq!(fold_(range(0, 0)
.map(|_| Ok::<(), ()>(()))),
Ok(()));
assert_eq!(fold(range(0, 3)
.map(|x| Ok::<int, ()>(x)),
0, |a, b| a + b),
Ok(3));
assert_eq!(fold_(range(0, 3)
.map(|x| if x > 1 { Err(x) } else { Ok(()) })),
Err(2));
// test that it does not take more elements than it needs
let functions = [|| Ok(()), || Err(1), || fail!()];
assert_eq!(fold_(functions.iter()
.map(|f| (*f)())),
Err(1));
} | rust_cleaned_test_functions.jsonl/6933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
368,
341,
286,
2060,
10714,
10297,
19961,
8361,
9669,
7,
15,
11,
220,
15,
340,
664,
659,
2186,
22428,
35395,
7622,
27638,
1507,
1719,
2235,
10131,
1326,
4293,
7622,
5065,
1106,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_from_tle() -> Result<()> {
let elements = Elements::from_tle(
Some("ISS (ZARYA)".to_owned()),
"1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927".as_bytes(),
"2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537".as_bytes(),
)?;
match elements.object_name.as_ref() {
Some(object_name) => assert_eq!(object_name, "ISS (ZARYA)"),
None => panic!(),
}
assert_eq!(elements.norad_id, 25544);
assert!(matches!(
elements.classification,
Classification::Unclassified
));
assert_eq!(
elements.international_designator.as_ref().unwrap(),
"1998-067A"
);
assert_eq!(
elements.datetime,
chrono::NaiveDate::from_yo(2008, 264).and_time(
chrono::NaiveTime::from_num_seconds_from_midnight(44740, 104192001)
)
);
assert_eq_f64(elements.epoch(), 8.720103559972621);
assert_eq_f64(
elements.epoch_afspc_compatibility_mode(),
8.7201035599722125,
);
assert_eq_f64(elements.mean_motion_dot, -0.00002182);
assert_eq_f64(elements.mean_motion_ddot, 0.0);
assert_eq_f64(elements.drag_term, -0.11606e-4);
assert_eq!(elements.ephemeris_type, 0);
assert_eq!(elements.element_set_number, 292);
assert_eq_f64(elements.inclination, 51.6416);
assert_eq_f64(elements.right_ascension, 247.4627);
assert_eq_f64(elements.eccentricity, 0.0006703);
assert_eq_f64(elements.argument_of_perigee, 130.5360);
assert_eq_f64(elements.mean_anomaly, 325.0288);
assert_eq_f64(elements.mean_motion, 15.72125391);
assert_eq!(elements.revolution_number, 56353);
let elements = Elements::from_tle(
None,
"1 11801U 80230.29629788 .01431103 00000-0 14311-1 0 13".as_bytes(),
"2 11801 46.7916 230.4354 7318036 47.4722 10.4117 2.28537848 13".as_bytes(),
)?;
assert!(elements.object_name.is_none());
assert_eq!(elements.norad_id, 11801);
assert!(matches!(
elements.classification,
Classification::Unclassified
));
assert!(elements.international_designator.is_none());
assert_eq!(
elements.datetime,
chrono::NaiveDate::from_yo(1980, 230).and_time(
chrono::NaiveTime::from_num_seconds_from_midnight(25600, 136832000)
)
);
assert_eq_f64(elements.epoch(), -19.373589875756331);
assert_eq_f64(
elements.epoch_afspc_compatibility_mode(),
-19.373589875756632,
);
assert_eq_f64(elements.mean_motion_dot, 0.01431103);
assert_eq_f64(elements.mean_motion_ddot, 0.0);
assert_eq_f64(elements.drag_term, 0.014311);
assert_eq!(elements.ephemeris_type, 0);
assert_eq!(elements.element_set_number, 1);
assert_eq_f64(elements.inclination, 46.7916);
assert_eq_f64(elements.right_ascension, 230.4354);
assert_eq_f64(elements.eccentricity, 0.7318036);
assert_eq_f64(elements.argument_of_perigee, 47.4722);
assert_eq_f64(elements.mean_anomaly, 10.4117);
assert_eq_f64(elements.mean_motion, 2.28537848);
assert_eq!(elements.revolution_number, 1);
Ok(())
} | rust_cleaned_test_functions.jsonl/74833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1821
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
528,
273,
368,
1464,
5714,
71698,
341,
286,
1077,
5424,
284,
34157,
486,
1499,
528,
273,
1006,
310,
4329,
445,
30849,
320,
57,
8642,
32,
94010,
983,
51973,
14702,
310,
330,
16,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_realtime_activation_condition() {
let spec = "output a: Int32 @10Hz := 0\noutput b: Int32 @5Hz := 0\noutput x := a+b";
let type_table = type_check(spec);
// node ids can be verified using `rtlola-analyze spec.lola ast`
// output `a` has NodeId = 6
let _a_id = NodeId::new(6);
// output `b` has NodeId = 13
let _b_id = NodeId::new(13);
// output `x` has NodeId = 19
let x_id = NodeId::new(19);
assert_eq!(type_table.get_value_type(x_id), &ValueTy::Int(IntTy::I32));
assert_eq!(
type_table.get_stream_type(x_id),
&StreamTy::RealTime(Freq::new(UOM_Frequency::new::<hertz>(Rational::from_u8(5).unwrap())))
);
} | rust_cleaned_test_functions.jsonl/110719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
1678,
52404,
27656,
368,
341,
286,
1077,
1398,
284,
330,
3006,
264,
25,
1333,
18,
17,
569,
16,
15,
11475,
1669,
220,
15,
1699,
3006,
293,
25,
1333,
18,
17,
569,
20,
11475,
1669,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_treemap() -> Result<(), Error> {
let mut v1 = MapHolder::default();
v1.values.insert(1, vec![0, 2]);
v1.values.insert(5, vec![1]);
let mut src = vec![];
v1.encode(&mut src, 0)?;
assert_eq!(src.len(), 30);
let v2 = MapHolder::decode_from(&mut Cursor::new(src), 0)?;
assert_eq!(v2.values.len(), 2);
let r1 = v2.values.get(&1).unwrap();
assert_eq!(r1.len(), 2);
assert_eq!(r1[0], 0);
assert_eq!(r1[1], 2);
let r2 = v2.values.get(&5).unwrap();
assert_eq!(r2[0], 1);
Ok(())
} | rust_cleaned_test_functions.jsonl/125322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
528,
265,
42040,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
5206,
348,
16,
284,
5027,
8589,
486,
2258,
543,
262,
348,
16,
10656,
7030,
7,
16,
11,
7486,
20703,
15,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_constant_folding_binops() {
let expr = parse("4+2").constant_fold();
check_literal(expr, 6.);
let expr = parse("4-2").constant_fold();
check_literal(expr, 2.);
let expr = parse("4*2").constant_fold();
check_literal(expr, 8.);
let expr = parse("4/2").constant_fold();
check_literal(expr, 2.);
let expr = parse("4%2").constant_fold();
check_literal(expr, 0.);
} | rust_cleaned_test_functions.jsonl/553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
761,
14995,
21816,
3721,
368,
341,
286,
1077,
15169,
284,
4715,
445,
19,
10,
17,
1827,
18077,
61187,
543,
286,
1779,
34100,
34322,
11,
220,
21,
13,
626,
286,
1077,
15169,
284,
4715,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer_properties_dictionary_encoding() {
// writer version 1 and 2.
for version in vec![WriterVersion::PARQUET_1_0, WriterVersion::PARQUET_2_0] {
let props = WriterProperties::builder()
.set_writer_version(version)
.build();
assert_eq!(props.dictionary_page_encoding(), Encoding::PLAIN);
assert_eq!(
props.dictionary_data_page_encoding(),
Encoding::RLE_DICTIONARY
);
}
} | rust_cleaned_test_functions.jsonl/56723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
25158,
42605,
37613,
368,
341,
1789,
286,
442,
6916,
2319,
220,
16,
323,
220,
17,
624,
286,
369,
2319,
304,
7486,
20703,
6492,
5637,
486,
16567,
5757,
1348,
62,
16,
62,
15,
11,
29404,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_coinbase_transaction_input() {
let raw_input = sample_coinbase_transaction_input();
let input_bytes = hex::decode(&raw_input).unwrap();
let mut parser = BytesParser::new(&input_bytes);
let input: TransactionInput = parser.parse_with(2).unwrap();
assert!(matches!(input.source, TransactionInputSource::Coinbase(Some(328014))));
assert_eq!(input.sequence, 0);
assert_eq!(input.script.len(), 37); // 0x29 - 4
} | rust_cleaned_test_functions.jsonl/132188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
75718,
3152,
28884,
5898,
368,
341,
286,
1077,
7112,
5898,
284,
6077,
75718,
3152,
28884,
5898,
543,
286,
1077,
1946,
12524,
284,
12371,
486,
18196,
2099,
1041,
5898,
568,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ok() {
xx_eq!(
"The cat sat in the hat",
"[csh].. [csh].. in",
concat!(
"The ",
color_start!(),
"cat sat in",
color_end!(),
" the hat",
"\n",
)
);
// alternation operator : pat|abc
xx_eq!(
"Feliformia",
"and|or",
concat!("Felif", color_start!(), "or", color_end!(), "mia", "\n",)
);
xx_eq!(
"furandi",
"and|or",
concat!("fur", color_start!(), "and", color_end!(), "i", "\n",)
);
xx_eq!("dissemblance", "and|or", "");
// anchor
//// line head
xx_eq!(
"surrealist",
"^sur",
concat!("", color_start!(), "sur", color_end!(), "realist", "\n",)
);
xx_eq!("surrealist", "^real", "");
//// line tail
xx_eq!(
"surrealist",
"list$",
concat!("surrea", color_start!(), "list", color_end!(), "\n")
);
xx_eq!("surrealist", "real$", "");
} | rust_cleaned_test_functions.jsonl/62178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19817,
368,
341,
286,
20908,
10714,
33673,
310,
330,
785,
8251,
7578,
304,
279,
8896,
756,
310,
10545,
66,
927,
60,
496,
508,
66,
927,
60,
496,
304,
756,
310,
33720,
33673,
394,
330,
785,
2179... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_system_name() {
#[super::system(dynec_as(crate))]
fn simulate(
#[dynec(local = 0)] counter_one: &mut u16,
#[dynec(param)] counter_two: &mut i64,
) {
*counter_one += 1u16;
*counter_two += 3i64;
}
let system = simulate.build(2i64);
{
use crate::system::Sendable;
assert_eq!(
system.get_spec().debug_name.as_str(),
"dynec::macros::system_tests::simulate"
);
}
} | rust_cleaned_test_functions.jsonl/103065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
1269,
368,
341,
286,
11506,
9522,
486,
8948,
1500,
73930,
11898,
54907,
22297,
286,
5168,
37453,
1006,
310,
11506,
43085,
757,
18082,
284,
220,
15,
7252,
5546,
11667,
25,
609,
6984,
575,
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_generic_params() {
use super::group_hash::BlakeHasher;
let params = AltJubjubBn256::new();
let generic_params = AltJubjubBn256::new_with_hasher::<BlakeHasher>();
assert!(params.pedersen_hash_generators == generic_params.pedersen_hash_generators);
assert!(params.fixed_base_generators == generic_params.fixed_base_generators);
assert_eq!(params.pedersen_circuit_generators, generic_params.pedersen_circuit_generators);
assert_eq!(params.fixed_base_circuit_generators, generic_params.fixed_base_circuit_generators);
} | rust_cleaned_test_functions.jsonl/51607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
6745,
368,
341,
262,
990,
2256,
486,
4074,
8950,
486,
91038,
6370,
261,
401,
262,
1077,
3628,
284,
23682,
41,
392,
73,
392,
33,
77,
17,
20,
21,
486,
931,
543,
262,
1077,
13954,
6745,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incomplete() {
let mut dec = MultiResponseDecoder::<TO>::new();
{
let mut stream = dec.process_next_chunk(b"{");
assert!(stream.next().is_none());
}
assert_eq!(dec.finish().unwrap_err(), b"{");
} | rust_cleaned_test_functions.jsonl/14557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
14737,
368,
341,
286,
1077,
5206,
1622,
284,
17439,
2582,
20732,
27638,
5207,
6831,
931,
1428,
286,
341,
310,
1077,
5206,
4269,
284,
1622,
16988,
11257,
30539,
1883,
14129,
797,
310,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_details() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
// Make sure we can execute 'fd --list-details' without any errors.
te.assert_success_and_get_output(".", &["--list-details"]);
} | rust_cleaned_test_functions.jsonl/10901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
13260,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
442,
7405,
2704,
582,
646,
9026,
364,
6902,
1177,
1607,
30433,
6,
2041,
894,
5975,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_to_flags() {
let flags = to_flags(0xF000_0000_0000_0001);
assert_eq!(1, flags.get_ref());
assert_eq!(true, flags.is_rundown_in_progress());
} | rust_cleaned_test_functions.jsonl/52968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
14130,
368,
341,
286,
1077,
8042,
284,
311,
14130,
7,
15,
9770,
15,
15,
15,
62,
15,
15,
15,
15,
62,
15,
15,
15,
15,
62,
15,
15,
15,
16,
317,
286,
2060,
10714,
10297,
16,
11,
8042,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error() {
let cols = vec!["not_exist".to_string()];
let vals = vec![Value::String {
val: "Enter".to_string(),
span: Span::test_data(),
}];
let span = Span::test_data();
let b = EventType::try_from_columns(&cols, &vals, &span);
assert!(matches!(b, Err(ShellError::MissingConfigValue(_, _))));
} | rust_cleaned_test_functions.jsonl/86564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
368,
341,
286,
1077,
17000,
284,
7486,
0,
1183,
1921,
35906,
3263,
983,
3904,
33800,
286,
1077,
28356,
284,
7486,
20703,
1130,
486,
703,
341,
310,
1044,
25,
330,
6269,
3263,
983,
3904,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_weighted_choice_zero_weight() {
WeightedChoice::new(&mut [Weighted { weight: 0, item: 0},
Weighted { weight: 0, item: 1}]);
} | rust_cleaned_test_functions.jsonl/100784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
31936,
19359,
15876,
368,
341,
286,
16516,
291,
24728,
486,
931,
2099,
6984,
508,
8295,
291,
314,
4680,
25,
220,
15,
11,
1509,
25,
220,
15,
1583,
6656,
16516,
291,
314,
4680,
25,
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 |
#[test]
fn test_extended_euclid_div_steps() {
let x = 935;
let y = 1491;
let (abs, k, sts) = extended_euclidean_steps(x, y);
assert_eq!(
abs,
vec![
(935, 1491),
(556, 935),
(379, 556),
(177, 379),
(25, 177),
(2, 25),
(1, 2)
]
);
assert_eq!(k, vec![1, 1, 1, 2, 7, 12]);
assert_eq!(
sts,
vec![
(716, -449),
(-449, 267),
(267, -182),
(-182, 85),
(85, -12),
(-12, 1),
(1, 0)
]
);
} | rust_cleaned_test_functions.jsonl/13572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61678,
2204,
84,
75044,
16237,
22731,
368,
341,
286,
1077,
856,
284,
220,
24,
18,
20,
280,
286,
1077,
379,
284,
220,
16,
19,
24,
16,
280,
286,
1077,
320,
3435,
11,
595,
11,
51756,
8,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_cloudfront_get_invalidation() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudfront-get-invalidation.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudFrontClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetInvalidationRequest::default();
let result = client.get_invalidation(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/44880 | {
"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,
21039,
8337,
37356,
6951,
3062,
1243,
12284,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
12361,
6951,
2249... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_game_and_engine_data() {
let actual =
Unreal4Context::parse(&ROOT_WITH_GAME_AND_ENGINE_DATA.as_bytes()).expect("default struct");
assert_eq!(
actual
.engine_data
.get("RHI.IsGPUOverclocked")
.map(|x| x.as_str()),
Some("false")
);
assert_eq!(
actual.game_data.get("sentry").map(|x| x.as_str()),
Some(r#"{"release":"foo.bar.baz@1.0.0"}"#)
);
} | rust_cleaned_test_functions.jsonl/28094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
18547,
8378,
24823,
1769,
368,
341,
262,
1077,
5042,
4035,
286,
79919,
19,
1972,
486,
6400,
2099,
23888,
23929,
40908,
21767,
62177,
7896,
5357,
12524,
6011,
17119,
445,
2258,
2036,
797,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_profile() {
let cwd = env::current_dir().unwrap().to_string_lossy().into_owned();
let xd = BaseDirectories::with_env("myapp", "default_profile", &*make_env(vec![
("HOME", format!("{}/test_files/user", cwd)),
("XDG_CONFIG_HOME", format!("{}/test_files/user/config", cwd)),
("XDG_CONFIG_DIRS", format!("{}/test_files/system1/config", cwd)),
])).unwrap();
assert_eq!(xd.find_config_file("system1_config.file").unwrap(),
// Does *not* include default_profile
PathBuf::from(&format!("{}/test_files/system1/config/myapp/system1_config.file", cwd)));
assert_eq!(xd.find_config_file("user_config.file").unwrap(),
// Includes default_profile
PathBuf::from(&format!("{}/test_files/user/config/myapp/default_profile/user_config.file", cwd)));
} | rust_cleaned_test_functions.jsonl/83591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13789,
368,
341,
262,
1077,
46938,
284,
6105,
486,
3231,
4334,
1005,
15454,
1005,
983,
3904,
11193,
88,
1005,
18122,
51973,
543,
262,
1077,
79052,
284,
5351,
56397,
486,
4197,
15879,
445,
2408,
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,
1... | 1 |
#[test]
fn test_age_increment() {
solana_logger::setup();
let bins = 4;
let test = BucketMapHolder::<u64>::new(bins, &Some(AccountsIndexConfig::default()), 1);
for age in 0..513 {
assert_eq!(test.current_age(), (age % 256) as Age);
// inc all
for _ in 0..bins {
assert!(!test.all_buckets_flushed_at_current_age());
}
// this would normally happen once time went off and all buckets had been flushed at the previous age
test.count_buckets_flushed
.fetch_add(bins, Ordering::Release);
test.increment_age();
}
} | rust_cleaned_test_functions.jsonl/5425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32053,
51482,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
28518,
284,
220,
19,
280,
286,
1077,
1273,
284,
47768,
2227,
8589,
27638,
84,
21,
19,
6831,
931,
1883,
1330,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_find_in_set() {
let cases = vec![
("foo", "foo,bar", Collation::Utf8Mb4Bin, 1),
("foo", "foobar,bar", Collation::Utf8Mb4Bin, 0),
(" foo ", "foo, foo ", Collation::Utf8Mb4Bin, 2),
("", "foo,bar,", Collation::Utf8Mb4Bin, 3),
("", "", Collation::Utf8Mb4Bin, 0),
("a,b", "a,b,c", Collation::Utf8Mb4Bin, 0),
("测试", "中文,测试,英文", Collation::Utf8Mb4Bin, 2),
("foo", "A,FOO,BAR", Collation::Utf8Mb4GeneralCi, 2),
("b", "A,B,C", Collation::Utf8Mb4GeneralCi, 2),
];
for (s, str_list, collation, exp) in cases {
let s = Some(s.as_bytes().to_vec());
let str_list = Some(str_list.as_bytes().to_vec());
let got = RpnFnScalarEvaluator::new()
.return_field_type(
FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.collation(collation)
.build(),
)
.push_param(s)
.push_param(str_list)
.evaluate::<Int>(ScalarFuncSig::FindInSet)
.unwrap();
assert_eq!(got, Some(exp))
}
let null_cases = vec![
(Some(b"foo".to_vec()), None, Collation::Utf8Mb4Bin, None),
(None, Some(b"bar".to_vec()), Collation::Utf8Mb4Bin, None),
(None, None, Collation::Utf8Mb4Bin, None),
];
for (s, str_list, collation, exp) in null_cases {
let got = RpnFnScalarEvaluator::new()
.return_field_type(
FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.collation(collation)
.build(),
)
.push_param(s)
.push_param(str_list)
.evaluate::<Int>(ScalarFuncSig::FindInSet)
.unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/60530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
1243,
2602,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
7975,
497,
330,
7975,
11,
2257,
497,
12905,
367,
486,
38980,
23,
87313,
19,
28794,
11,
220,
16,
1326,
310,
3489,
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... | 3 |
#[test]
fn test_auth_challenge() {
let cmd = ChanCmd::AUTH_CHALLENGE;
assert_eq!(Into::<u8>::into(cmd), 130_u8);
let challenge = hex!("00DA5C085DEE4F3656710DA3B73652E48ACD5BAE608335FCA3FB6C4DEE104A51");
vbody(
cmd,
"00DA5C085DEE4F3656710DA3B73652E48ACD5BAE608335FCA3FB6C4DEE104A51
0002 0001 0003",
&msg::AuthChallenge::new(challenge, vec![1_u16, 3_u16]).into(),
);
} | rust_cleaned_test_functions.jsonl/6026 | {
"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,
14014,
87406,
368,
341,
262,
1077,
5439,
284,
41302,
15613,
486,
26694,
6466,
88074,
36,
280,
262,
2060,
10714,
10297,
26591,
27638,
84,
23,
6831,
18122,
14160,
701,
220,
16,
18,
15,
7300,
23,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uninstall() {
setup(None, false, &|url,
toolchain,
prefix,
download_cfg,
temp_cfg| {
update_from_dist(
url,
toolchain,
prefix,
&[],
&[],
download_cfg,
temp_cfg,
false,
)
.unwrap();
uninstall(toolchain, prefix, temp_cfg, &|_| ()).unwrap();
assert!(!utils::path_exists(&prefix.path().join("bin/rustc")));
assert!(!utils::path_exists(&prefix.path().join("lib/libstd.rlib")));
});
} | rust_cleaned_test_functions.jsonl/33454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12248,
368,
341,
262,
6505,
26717,
11,
895,
11,
609,
91,
1085,
345,
5108,
5392,
8819,
345,
5108,
9252,
345,
5108,
4139,
18343,
345,
5108,
2730,
18343,
91,
341,
286,
2647,
5673,
16031,
1006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_async_commit_pushed_min_commit_ts() {
let engine = TestEngineBuilder::new().build().unwrap();
let cm = ConcurrencyManager::new(42.into());
// Simulate that min_commit_ts is pushed forward larger than latest_ts
must_acquire_pessimistic_lock_impl(&engine, b"key", b"key", 2, false, 20000, 2, false, 100);
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut txn = MvccTxn::new(snapshot, TimeStamp::new(2), true, cm);
let mutation = Mutation::Put((Key::from_raw(b"key"), b"value".to_vec()));
let (min_commit_ts, _) = prewrite(
&mut txn,
&txn_props(
TimeStamp::new(2),
b"key",
CommitKind::Async(TimeStamp::zero()),
Some(4.into()),
4,
false,
),
mutation,
&Some(vec![b"key1".to_vec(), b"key2".to_vec(), b"key3".to_vec()]),
true,
)
.unwrap();
assert_eq!(min_commit_ts.into_inner(), 100);
} | rust_cleaned_test_functions.jsonl/16093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
36346,
14218,
291,
7260,
36346,
25023,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
9961,
284,
1200,
15973,
2043,
486,
931,
7,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bench_tps_local_cluster_solana() {
test_bench_tps_local_cluster(Config {
tx_count: 100,
duration: Duration::from_secs(10),
..Config::default()
});
} | rust_cleaned_test_functions.jsonl/6390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
528,
1690,
13564,
28441,
53668,
3362,
368,
341,
262,
1273,
880,
19762,
528,
1690,
13564,
28441,
33687,
341,
286,
9854,
3180,
25,
220,
16,
15,
15,
345,
286,
8090,
25,
21045,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_slice_vec() {
let test_bytes: &[Option<Bytes>] = &[
None,
Some("我好菜啊".as_bytes().to_vec()),
None,
Some("我菜爆了".as_bytes().to_vec()),
Some("我失败了".as_bytes().to_vec()),
None,
Some("💩".as_bytes().to_vec()),
None,
];
assert_eq!(ChunkedVecBytes::from_slice(test_bytes).to_vec(), test_bytes);
assert_eq!(ChunkedVecBytes::from_slice(test_bytes).to_vec(), test_bytes);
} | rust_cleaned_test_functions.jsonl/105136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
13251,
368,
341,
286,
1077,
1273,
12524,
25,
44590,
5341,
27,
7078,
53529,
284,
609,
9640,
310,
2240,
345,
310,
4329,
445,
35946,
52801,
99800,
103924,
3263,
300,
12524,
1005,
983,
13251,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resultify() {
let side_effect = |i, effect: &mut _| -> i32 {
*effect += 1;
return i;
};
let mut calls = 0;
let ret: Result<i32, _> = resultify!(side_effect(0, &mut calls));
assert!(match ret { Ok(0) => true, _ => false });
assert_eq!(calls, 1);
calls = 0;
let ret: Result<i32, _> = resultify!(side_effect(1, &mut calls));
assert!(match ret { Ok(1) => true, _ => false });
assert_eq!(calls, 1);
calls = 0;
let ret: Result<i32, _> = resultify!(side_effect(-1, &mut calls));
assert!(match ret { Err(e) if e.raw_os_error() == Some(1) => true, _ => false });
assert_eq!(calls, 1);
} | rust_cleaned_test_functions.jsonl/44098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5287,
1437,
368,
341,
286,
1077,
3108,
27125,
284,
760,
72,
11,
2456,
25,
609,
6984,
85137,
1464,
600,
18,
17,
341,
310,
353,
26061,
1421,
220,
16,
280,
310,
470,
600,
280,
286,
3634,
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... | 5 |
#[test]
fn test_parse_macro_def_rules() {
mark::check!(parse_macro_def_rules);
parse_macro2(
r#"
macro foo {
($id:ident) => {
fn $id() {}
}
}
"#,
)
.assert_expand_items("foo!(bar);", "fn bar () {}");
} | rust_cleaned_test_functions.jsonl/28727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
58810,
7844,
21407,
368,
341,
262,
1868,
486,
2028,
10297,
6400,
58810,
7844,
21407,
626,
262,
4715,
58810,
17,
1006,
286,
435,
2,
698,
32606,
15229,
341,
262,
1711,
307,
25,
1713,
8,
589... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_fail() {
let mut perms = Permissions {
read: Permissions::new_read(&None, true),
write: Permissions::new_write(&None, true),
net: Permissions::new_net(&None, true),
env: Permissions::new_env(&None, true),
run: Permissions::new_run(&None, true),
ffi: Permissions::new_ffi(&None, true),
hrtime: Permissions::new_hrtime(false, true),
};
let _guard = PERMISSION_PROMPT_GUARD.lock();
set_prompt_result(false);
assert!(perms.read.check(Path::new("/foo")).is_err());
set_prompt_result(true);
assert!(perms.read.check(Path::new("/foo")).is_err());
assert!(perms.read.check(Path::new("/bar")).is_ok());
set_prompt_result(false);
assert!(perms.read.check(Path::new("/bar")).is_ok());
set_prompt_result(false);
assert!(perms.write.check(Path::new("/foo")).is_err());
set_prompt_result(true);
assert!(perms.write.check(Path::new("/foo")).is_err());
assert!(perms.write.check(Path::new("/bar")).is_ok());
set_prompt_result(false);
assert!(perms.write.check(Path::new("/bar")).is_ok());
set_prompt_result(false);
assert!(perms.net.check(&("127.0.0.1", Some(8000))).is_err());
set_prompt_result(true);
assert!(perms.net.check(&("127.0.0.1", Some(8000))).is_err());
assert!(perms.net.check(&("127.0.0.1", Some(8001))).is_ok());
assert!(perms.net.check(&("deno.land", Some(8000))).is_ok());
set_prompt_result(false);
assert!(perms.net.check(&("127.0.0.1", Some(8001))).is_ok());
assert!(perms.net.check(&("deno.land", Some(8000))).is_ok());
set_prompt_result(false);
assert!(perms.run.check("cat").is_err());
set_prompt_result(true);
assert!(perms.run.check("cat").is_err());
assert!(perms.run.check("ls").is_ok());
set_prompt_result(false);
assert!(perms.run.check("ls").is_ok());
set_prompt_result(false);
assert!(perms.env.check("HOME").is_err());
set_prompt_result(true);
assert!(perms.env.check("HOME").is_err());
assert!(perms.env.check("PATH").is_ok());
set_prompt_result(false);
assert!(perms.env.check("PATH").is_ok());
set_prompt_result(false);
assert!(perms.hrtime.check().is_err());
set_prompt_result(true);
assert!(perms.hrtime.check().is_err());
} | rust_cleaned_test_functions.jsonl/24818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
22121,
368,
341,
262,
1077,
5206,
82282,
284,
53357,
341,
414,
1349,
25,
53357,
486,
931,
6443,
2099,
4064,
11,
830,
1326,
414,
3270,
25,
53357,
486,
931,
9165,
2099,
4064,
11,
830,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commit_decoration_style_empty_string() {
_do_test_commit_style_no_decoration(&[
"--commit-style",
"blue",
"--commit-decoration-style",
"",
]);
} | rust_cleaned_test_functions.jsonl/70058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
2259,
26452,
15117,
15124,
3904,
368,
341,
286,
716,
2982,
4452,
36346,
15117,
6536,
2259,
26452,
2099,
9640,
310,
14482,
17413,
11297,
756,
310,
330,
12203,
756,
310,
14482,
17413,
30266,
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 |
#[test]
fn test_rpc_get_balance_via_client() {
let genesis = create_genesis_config(20);
let mint_pubkey = genesis.mint_keypair.pubkey();
let bank = Arc::new(Bank::new(&genesis.genesis_config));
let meta = JsonRpcRequestProcessor::new_from_bank(&bank);
let mut io = MetaIoHandler::default();
io.extend_with(RpcSafeImpl.to_delegate());
async fn use_client(client: gen_client::Client, mint_pubkey: Pubkey) -> u64 {
client
.get_balance(mint_pubkey.to_string(), None)
.await
.unwrap()
.value
}
let fut = async {
let (client, server) =
local::connect_with_metadata::<gen_client::Client, _, _>(&io, meta);
let client = use_client(client, mint_pubkey);
futures::join!(client, server)
};
let (response, _) = futures::executor::block_on(fut);
assert_eq!(response, 20);
} | rust_cleaned_test_functions.jsonl/57639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
29396,
80710,
8179,
368,
341,
286,
1077,
59366,
284,
1855,
16322,
13774,
5332,
7,
17,
15,
317,
286,
1077,
28337,
34014,
792,
284,
59366,
744,
396,
3097,
12670,
47773,
792,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_freeze_account() {
let program_id = crate::id();
let account_key = Pubkey::new_unique();
let mut account_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let account_owner_key = Pubkey::new_unique();
let mut account_owner_account = SolanaAccount::default();
let owner_key = Pubkey::new_unique();
let mut owner_account = SolanaAccount::default();
let owner2_key = Pubkey::new_unique();
let mut owner2_account = SolanaAccount::default();
let mint_key = Pubkey::new_unique();
let mut mint_account =
SolanaAccount::new(mint_minimum_balance(), Mint::get_packed_len(), &program_id);
let mut rent_sysvar = rent_sysvar();
// create new mint with owner different from account owner
do_process_instruction(
initialize_mint(&program_id, &mint_key, &owner_key, None, 2).unwrap(),
vec![&mut mint_account, &mut rent_sysvar],
)
.unwrap();
// create account
do_process_instruction(
initialize_account(&program_id, &account_key, &mint_key, &account_owner_key).unwrap(),
vec![
&mut account_account,
&mut mint_account,
&mut account_owner_account,
&mut rent_sysvar,
],
)
.unwrap();
// mint to account
do_process_instruction(
mint_to(&program_id, &mint_key, &account_key, &owner_key, &[], 1000).unwrap(),
vec![&mut mint_account, &mut account_account, &mut owner_account],
)
.unwrap();
// mint cannot freeze
assert_eq!(
Err(TokenError::MintCannotFreeze.into()),
do_process_instruction(
freeze_account(&program_id, &account_key, &mint_key, &owner_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner_account],
)
);
// missing freeze_authority
let mut mint = Mint::unpack_unchecked(&mint_account.data).unwrap();
mint.freeze_authority = COption::Some(owner_key);
Mint::pack(mint, &mut mint_account.data).unwrap();
assert_eq!(
Err(TokenError::OwnerMismatch.into()),
do_process_instruction(
freeze_account(&program_id, &account_key, &mint_key, &owner2_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner2_account],
)
);
// check explicit thaw
assert_eq!(
Err(TokenError::InvalidState.into()),
do_process_instruction(
thaw_account(&program_id, &account_key, &mint_key, &owner2_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner2_account],
)
);
// freeze
do_process_instruction(
freeze_account(&program_id, &account_key, &mint_key, &owner_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner_account],
)
.unwrap();
let account = Account::unpack_unchecked(&account_account.data).unwrap();
assert_eq!(account.state, AccountState::Frozen);
// check explicit freeze
assert_eq!(
Err(TokenError::InvalidState.into()),
do_process_instruction(
freeze_account(&program_id, &account_key, &mint_key, &owner_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner_account],
)
);
// check thaw authority
assert_eq!(
Err(TokenError::OwnerMismatch.into()),
do_process_instruction(
thaw_account(&program_id, &account_key, &mint_key, &owner2_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner2_account],
)
);
// thaw
do_process_instruction(
thaw_account(&program_id, &account_key, &mint_key, &owner_key, &[]).unwrap(),
vec![&mut account_account, &mut mint_account, &mut owner_account],
)
.unwrap();
let account = Account::unpack_unchecked(&account_account.data).unwrap();
assert_eq!(account.state, AccountState::Initialized);
} | rust_cleaned_test_functions.jsonl/44648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8905,
2986,
13500,
368,
341,
286,
1077,
2025,
842,
284,
17717,
486,
307,
543,
286,
1077,
2692,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5206,
2692,
13500,
284,
11473,
3362,
7365,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_draw_calendar() {
let test_case = |expected: &Buffer| {
let mut app = TTApp::new().unwrap();
app.task_report_next();
app.context_next();
app.update(true).unwrap();
app.calendar_year = 2020;
app.mode = AppMode::Calendar;
let backend = TestBackend::new(50, 15);
let mut terminal = Terminal::new(backend).unwrap();
terminal
.draw(|f| {
app.draw(f);
app.draw(f);
})
.unwrap();
assert_eq!(terminal.backend().size().unwrap(), expected.area);
terminal.backend().assert_buffer(expected);
};
let mut expected = Buffer::with_lines(vec![
"╭Task|Calendar───────────────────────────────────╮",
"│ │",
"│ 2020 │",
"│ │",
"│ January February │",
"│ Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa │",
"│ 1 2 3 4 1 │",
"│ 5 6 7 8 9 10 11 2 3 4 5 6 7 8 │",
"│ 12 13 14 15 16 17 18 9 10 11 12 13 14 15 │",
"│ 19 20 21 22 23 24 25 16 17 18 19 20 21 22 │",
"│ 26 27 28 29 30 31 23 24 25 26 27 28 29 │",
"│ │",
"│ │",
"│ │",
"╰────────────────────────────────────────────────╯",
]);
for i in 1..=4 {
// Task
expected
.get_mut(i, 0)
.set_style(Style::default().add_modifier(Modifier::DIM));
}
for i in 6..=13 {
// Calendar
expected
.get_mut(i, 0)
.set_style(Style::default().add_modifier(Modifier::BOLD));
}
for i in 1..=48 {
expected
.get_mut(i, 2 .set_style(Style::default().add_modifier(Modifier::UNDERLINED));
}
for i in 3..=22 {
expected.get_mut(i, 4).set_style(Style::default().bg(Color::Black));
}
for i in 25..=44 {
expected.get_mut(i, 4).set_style(Style::default().bg(Color::Black));
}
for i in 3..=22 {
expected
.get_mut(i, 5)
.set_style(Style::default().bg(Color::Black).add_modifier(Modifier::UNDERLINED));
}
for i in 25..=44 {
expected
.get_mut(i, 5)
.set_style(Style::default().bg(Color::Black).add_modifier(Modifier::UNDERLINED));
}
test_case(&expected);
} | rust_cleaned_test_functions.jsonl/45046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1843
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23021,
57665,
368,
341,
286,
1077,
1273,
19096,
284,
760,
7325,
25,
609,
4095,
91,
341,
310,
1077,
5206,
906,
284,
32744,
2164,
486,
931,
1005,
15454,
1428,
310,
906,
15034,
14813,
11257,
543,
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... | 8 |
#[test]
fn test_minimum_bytes_needed() {
use speedy::{
Readable,
Endianness
};
assert_eq!( <DerivedStruct as Readable< Endianness >>::minimum_bytes_needed(), 7 );
assert_eq!( <DerivedTupleStruct as Readable< Endianness >>::minimum_bytes_needed(), 7 );
assert_eq!( <DerivedUnitStruct as Readable< Endianness >>::minimum_bytes_needed(), 0 );
assert_eq!( <DerivedEmptyStruct as Readable< Endianness >>::minimum_bytes_needed(), 0 );
assert_eq!( <DerivedSimpleEnum as Readable< Endianness >>::minimum_bytes_needed(), 4 );
assert_eq!( <DerivedEnum as Readable< Endianness >>::minimum_bytes_needed(), 4 );
assert_eq!( <DerivedStructWithLifetime as Readable< Endianness >>::minimum_bytes_needed(), 4 );
assert_eq!( <DerivedStructWithDefaultOnEof as Readable< Endianness >>::minimum_bytes_needed(), 1 );
} | rust_cleaned_test_functions.jsonl/35398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84855,
12524,
57426,
368,
341,
262,
990,
65483,
74843,
286,
4457,
480,
345,
286,
3972,
72,
82033,
198,
262,
3634,
262,
2060,
10714,
10297,
366,
67843,
9422,
438,
4457,
480,
27,
3972,
72,
82033,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_discard() -> Result<()> {
let db = Connection::open_in_memory()?;
let cache = &db.cache;
let sql = "PRAGMA schema_version";
{
let mut stmt = db.prepare_cached(sql)?;
assert_eq!(0, cache.len());
assert_eq!(0, stmt.query_row([], |r| r.get::<_, i64>(0))?);
stmt.discard();
}
assert_eq!(0, cache.len());
Ok(())
} | rust_cleaned_test_functions.jsonl/14520 | {
"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,
37745,
567,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
1077,
6500,
284,
609,
1999,
20087,
401,
286,
1077,
5704,
284,
330,
6480,
76168,
10802,
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... | 4 |
#[test]
fn test_part_from_cbor_unsigned_types() {
// u8
Part::from_cbor(&[0x85, 0x1, 0x2, 0x3, 0x4, 0x41, 0x5]).unwrap();
// u16
Part::from_cbor(&[
0x85, 0x19, 0x1, 0x2, 0x19, 0x3, 0x4, 0x19, 0x5, 0x6, 0x19, 0x7, 0x8, 0x41, 0x5,
])
.unwrap();
// u32
Part::from_cbor(&[
0x85, 0x1a, 0x1, 0x2, 0x3, 0x4, 0x1a, 0x5, 0x6, 0x7, 0x8, 0x1a, 0x9, 0x10, 0x11, 0x12,
0x1a, 0x13, 0x14, 0x15, 0x16, 0x41, 0x5,
])
.unwrap();
// u64
assert_eq!(
Part::from_cbor(&[
0x85, 0x1b, 0x1, 0x2, 0x3, 0x4, 0xa, 0xb, 0xc, 0xd, 0x1a, 0x5, 0x6, 0x7, 0x8, 0x1a,
0x9, 0x10, 0x11, 0x12, 0x1a, 0x13, 0x14, 0x15, 0x16, 0x41, 0x5,
])
.unwrap_err()
.to_string(),
"unexpected item at position 0"
);
assert_eq!(
Part::from_cbor(&[
0x85, 0x1a, 0x1, 0x2, 0x3, 0x4, 0x1b, 0x5, 0x6, 0x7, 0x8, 0xa, 0xb, 0xc, 0xd, 0x1a,
0x9, 0x10, 0x11, 0x12, 0x1a, 0x13, 0x14, 0x15, 0x16, 0x41, 0x5,
])
.unwrap_err()
.to_string(),
"unexpected item at position 1"
);
assert_eq!(
Part::from_cbor(&[
0x85, 0x1a, 0x1, 0x2, 0x3, 0x4, 0x1a, 0x5, 0x6, 0x7, 0x8, 0x1b, 0x9, 0x10, 0x11,
0x12, 0xa, 0xb, 0xc, 0xd, 0x1a, 0x13, 0x14, 0x15, 0x16, 0x41, 0x5,
])
.unwrap_err()
.to_string(),
"unexpected item at position 2"
);
assert_eq!(
Part::from_cbor(&[
0x85, 0x1a, 0x1, 0x2, 0x3, 0x4, 0x1a, 0x5, 0x6, 0x7, 0x8, 0x1a, 0x9, 0x10, 0x11,
0x12, 0x1b, 0x13, 0x14, 0x15, 0x16, 0xa, 0xb, 0xc, 0xd, 0x41, 0x5,
])
.unwrap_err()
.to_string(),
"unexpected item at position 3"
);
} | rust_cleaned_test_functions.jsonl/106878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
5673,
666,
9368,
67830,
9763,
368,
341,
286,
442,
575,
23,
198,
286,
3660,
486,
1499,
666,
9368,
2099,
58,
15,
87,
23,
20,
11,
220,
15,
87,
16,
11,
220,
15,
87,
17,
11,
220,
15,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_header_size() {
let h = BlockHeader::new(BlockType::DBlock);
let mut serializer = AllocSerializer::<256>::default();
serializer.serialize_value(&h).unwrap();
let buffer = serializer.into_serializer().into_inner().to_vec();
assert_eq!(buffer.len(), SERIALIZED_BLOCK_HEADER_BUFFER_SIZE);
} | rust_cleaned_test_functions.jsonl/69341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
8757,
2368,
368,
341,
286,
1077,
305,
284,
8362,
4047,
486,
931,
55243,
929,
486,
3506,
1023,
317,
286,
1077,
5206,
21759,
284,
46685,
13909,
27638,
17,
20,
21,
6831,
2258,
543,
286,
21759... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_all_refs_super_mod_vis() {
check(
r#"
//- /lib.rs
mod foo;
//- /foo.rs
mod some;
use some::Foo;
fn f() {
let i = Foo { n: 5 };
}
//- /foo/some.rs
pub(super) struct Foo<|> {
pub n: u32,
}
"#,
expect![[r#"
Foo Struct FileId(2) 0..41 18..21 Other
FileId(1) 20..23 Other
FileId(1) 47..50 StructLiteral
"#]],
);
} | rust_cleaned_test_functions.jsonl/47778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
38886,
7480,
15887,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
401,
61463,
608,
7975,
25638,
198,
2593,
1045,
280,
810,
1045,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_config_yaml() {
let mut tmp = NamedTempFile::new().unwrap();
if let Ok(_) = tmp.write_all("foo: bar".as_bytes()) {
let _: DynamicConfig<ConfigYaml, ConfigObj> =
DynamicConfig::new(String::from(
tmp.into_temp_path().as_os_str().to_str().unwrap()),
false).unwrap();
} else {
panic!("Failed to write tmp yaml file");
}
} | rust_cleaned_test_functions.jsonl/25064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
5332,
64380,
368,
341,
286,
1077,
5206,
4174,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
421,
1077,
7622,
48139,
284,
4174,
3836,
5705,
445,
7975,
25,
3619,
3263,
300,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_try_from_alogithm_id() {
assert_eq!(
AsymmetricEncryptionScheme::try_from(TPM2_ALG_OAEP).unwrap(),
AsymmetricEncryptionScheme::Oaep
);
assert_eq!(
AsymmetricEncryptionScheme::try_from(TPM2_ALG_RSAES).unwrap(),
AsymmetricEncryptionScheme::RsaEs
);
assert_eq!(
AsymmetricEncryptionScheme::try_from(TPM2_ALG_ECDH).unwrap(),
AsymmetricEncryptionScheme::EcDh
);
assert!(
AsymmetricEncryptionScheme::try_from(TPM2_ALG_ERROR).is_err(),
"Error should not exist in AsymmetricEncryptionScheme"
);
} | rust_cleaned_test_functions.jsonl/41510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
1634,
29459,
79239,
28906,
486,
1539,
5673,
4140,
8795,
17,
8912,
38,
2232,
32,
9197,
568,
15454,
3148,
310,
1634,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_add_use() {
check_assist(
replace_qualified_name_with_use,
"
use stdx;
impl std::fmt::Debug<|> for Foo {
}
",
"
use stdx;
use std::fmt::Debug;
impl Debug<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/19564 | {
"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,
10633,
2891,
15951,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8290,
62,
36335,
1269,
6615,
15951,
345,
310,
6228,
810,
1460,
87,
401,
6383,
1460,
486,
12501,
486,
7939,
27,
91,
29,
369,
33428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_duplicate_column_family() {
let n = DBPath::new("_rust_rocksdb_create_duplicate_column_family");
{
let mut opts = Options::default();
opts.create_if_missing(true);
opts.create_missing_column_families(true);
let mut db = match DB::open_cf(&opts, &n, &["cf1"]) {
Ok(d) => d,
Err(e) => panic!("failed to create new column family: {}", e),
};
assert!(db.create_cf("cf1", &opts).is_err());
}
} | rust_cleaned_test_functions.jsonl/79609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
70434,
8744,
26823,
368,
341,
262,
1077,
308,
284,
5952,
1820,
486,
931,
16975,
35788,
26608,
14553,
1999,
8657,
70434,
8744,
26823,
797,
262,
341,
286,
1077,
5206,
12185,
284,
14566,
486,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_keys_with_expiry() {
struct TestRdbHandler {}
impl EventHandler for TestRdbHandler {
fn handle(&mut self, data: Event) {
match data {
Event::RDB(rdb) => match rdb {
Object::String(kv) => {
let key = String::from_utf8_lossy(kv.key).to_string();
let val = String::from_utf8_lossy(kv.value).to_string();
assert_eq!("expires_ms_precision", key);
assert_eq!("2022-12-25 10:11:12.573 UTC", val);
if let Some((ExpireType::Millisecond, val)) = kv.meta.expire {
assert_eq!(1671963072573, val);
} else {
panic!("错误的过期类型")
}
}
_ => {}
},
Event::AOF(_) => {}
}
}
}
start_redis_test("keys_with_expiry.rdb", 10007, Rc::new(RefCell::new(TestRdbHandler {})));
} | rust_cleaned_test_functions.jsonl/93091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12631,
6615,
96509,
368,
341,
262,
2036,
3393,
49,
1999,
3050,
10086,
262,
11605,
31957,
369,
3393,
49,
1999,
3050,
341,
286,
5168,
3705,
2099,
6984,
656,
11,
821,
25,
3665,
8,
341,
310,
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... | 4 |
#[test]
fn test_compress_string() {
let short_str = "testing".to_string();
assert_eq!(display_compressed_string(short_str.clone(), 5, 5), short_str);
let long_str = "abcdefghijklmnopqrstuvwxyz".to_string();
assert_eq!(
display_compressed_string(long_str.clone(), 3, 3),
"abc...xyz".to_string()
);
let emoji_str = "🐾💎🎤🎨📌🍄🎰🍉🚧💉💡👟🚒📌🔌🐶🐾🐢🔭🐨😻💨🐎🐊🚢👟🚧🐞🚜🌂🎩🎱📈".to_string();
assert_eq!(
display_compressed_string(emoji_str.clone(), 3, 6),
"🐾💎🎤...🐞🚜🌂🎩🎱📈".to_string()
);
} | rust_cleaned_test_functions.jsonl/103079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
3904,
368,
341,
286,
1077,
2805,
2895,
284,
330,
8840,
3263,
983,
3904,
543,
286,
2060,
10714,
10297,
5493,
2965,
14318,
3904,
37890,
2895,
15997,
1507,
220,
20,
11,
220,
20,
701,
2805,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_shift_binary()
{
assert_eq!(BinaryDigit(0x0u8).max_shift(), 8);
assert_eq!(BinaryDigit(0x1u8).max_shift(), 7);
assert_eq!(BinaryDigit(0x80u8).max_shift(), 0);
assert_eq!(BinaryDigit(0x0u16).max_shift(), 16);
assert_eq!(BinaryDigit(0x70u16).max_shift(), 9);
assert_eq!(BinaryDigit(0xe2u16).max_shift(), 8);
assert_eq!(BinaryDigit(0x58e2u16).max_shift(), 1);
assert_eq!(BinaryDigit(0x80e2u16).max_shift(), 0);
assert_eq!(BinaryDigit(0x0u32).max_shift(), 32);
assert_eq!(BinaryDigit(0x70u32).max_shift(), 25);
assert_eq!(BinaryDigit(0x58e2u32).max_shift(), 17);
assert_eq!(BinaryDigit(0x80e2u32).max_shift(), 16);
assert_eq!(BinaryDigit(0x76acd561u32).max_shift(), 1);
assert_eq!(BinaryDigit(0xffffffffu32).max_shift(), 0);
} | rust_cleaned_test_functions.jsonl/26383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
22230,
31761,
741,
262,
341,
286,
2060,
10714,
10297,
21338,
36420,
7,
15,
87,
15,
84,
23,
568,
2810,
22230,
1507,
220,
23,
317,
286,
2060,
10714,
10297,
21338,
36420,
7,
15,
87,
16,
84,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chain_fork_by_first_received() {
let (chain_controller, shared, parent) = start_chain(None);
let final_number = 20;
let mock_store = MockStore::new(&parent, shared.store());
let mut chain1 = MockChain::new(parent.clone(), shared.consensus());
let mut chain2 = MockChain::new(parent.clone(), shared.consensus());
let mut chain3 = MockChain::new(parent.clone(), shared.consensus());
for _ in 0..final_number {
chain1.gen_empty_block_with_diff(100u64, &mock_store);
}
for _ in 0..(final_number * 2) {
chain2.gen_empty_block_with_diff(50u64, &mock_store);
}
for _ in 0..(final_number * 5) {
chain3.gen_empty_block_with_diff(20u64, &mock_store);
}
for chain in vec![chain1.clone(), chain2.clone(), chain3.clone()] {
for block in chain.blocks() {
chain_controller
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_ALL)
.expect("process block ok");
}
}
assert_eq!(chain1.total_difficulty(), chain2.total_difficulty());
assert_eq!(chain1.total_difficulty(), chain3.total_difficulty());
// fist received will be the main chain
assert_eq!(
shared.store().get_block_hash(8),
chain1.blocks().get(7).map(|b| b.header().hash().to_owned())
);
assert_eq!(
shared.store().get_block_hash(19),
chain1
.blocks()
.get(18)
.map(|b| b.header().hash().to_owned())
);
} | rust_cleaned_test_functions.jsonl/105198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
761,
669,
3710,
12978,
40783,
368,
341,
262,
1077,
320,
8819,
21600,
11,
6094,
11,
2681,
8,
284,
1191,
30583,
26717,
317,
262,
1077,
1590,
5500,
284,
220,
17,
15,
401,
262,
1077,
7860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_added_empty_line_is_not_whitespace_error() {
let plus_style = "bold yellow red ul";
let config = integration_test_utils::make_config_from_args(&[
"--light",
"--keep-plus-minus-markers",
"--plus-style",
plus_style,
]);
let output = integration_test_utils::run_delta(DIFF_WITH_ADDED_EMPTY_LINE, &config);
ansi_test_utils::assert_line_has_style(&output, 8, "", plus_style, &config)
} | rust_cleaned_test_functions.jsonl/70108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37653,
15124,
6528,
6892,
7913,
86175,
4096,
368,
341,
286,
1077,
5519,
15117,
284,
330,
14824,
13753,
2518,
8557,
876,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_section_map() {
let mut obj = fake_obj();
assert_matches!(
obj.parse_section(fake_section(
"maps/foo",
bytes_of(&bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
..Default::default()
})
),),
Ok(())
);
assert!(obj.maps.get("foo").is_some());
} | rust_cleaned_test_functions.jsonl/132927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16221,
5376,
368,
341,
286,
1077,
5206,
2839,
284,
12418,
7328,
1428,
286,
2060,
38344,
33673,
310,
2839,
4632,
16221,
74138,
16221,
1006,
394,
330,
17640,
60555,
756,
394,
5820,
3575,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_openai_gpt_tokenizer_no_lower_casing() {
// Given
let vocab = generate_test_vocab();
let merges = generate_test_merges();
let openai_gpt_tokenizer: OpenAiGptTokenizer =
OpenAiGptTokenizer::from_existing_vocab_and_merges(vocab, merges, false);
let test_tuples = [
("The Earth", vec!["T", "h", "e</w>", "E", "a", "rth</w>"]),
("", vec![]),
(" ", vec![]),
(" \n ", vec![]),
];
let source_texts: Vec<&str> = test_tuples.iter().map(|v| v.0).collect();
let expected_results: Vec<Vec<&str>> = test_tuples.iter().map(|v| v.1.clone()).collect();
for (source_text, expected_result) in test_tuples.iter() {
assert_eq!(
openai_gpt_tokenizer.tokenize(*source_text),
*expected_result
);
}
assert_eq!(
MultiThreadedTokenizer::tokenize_list(&openai_gpt_tokenizer, &source_texts),
expected_results
);
} | rust_cleaned_test_functions.jsonl/114295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
2143,
1889,
417,
6458,
3135,
6536,
30425,
666,
4422,
368,
341,
286,
442,
286,
16246,
198,
286,
1077,
23820,
284,
6923,
4452,
52823,
543,
286,
1077,
80953,
284,
6923,
4452,
717,
2375,
288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_album() {
// Or set client_id and client_secret explictly
let spotify = Spotify::default()
.client_credentials_manager(CLIENT_CREDENTIAL.lock().unwrap().clone())
.build();
let birdy_uri = "spotify:album:0sNOF9WDwhWunNAHPD3Baj";
let albums = spotify.album(birdy_uri);
assert!(albums.is_ok());
} | rust_cleaned_test_functions.jsonl/96511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53241,
368,
341,
14808,
262,
442,
2521,
738,
2943,
842,
323,
2943,
21962,
1343,
21242,
398,
7213,
41693,
262,
1077,
87790,
284,
40537,
486,
2258,
741,
286,
659,
2972,
47396,
12144,
52991,
10757,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_big() {
let square = Square::from(vec![25, 13, 1, 19, 7, 16, 9, 22, 15, 3, 12, 5,
18, 6, 24, 8, 21, 14, 2, 20, 4, 17, 10, 23, 11]);
assert!(square.is_magic());
} | rust_cleaned_test_functions.jsonl/13905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
368,
341,
262,
1077,
9334,
284,
15619,
486,
1499,
25592,
20703,
17,
20,
11,
220,
16,
18,
11,
220,
16,
11,
220,
16,
24,
11,
220,
22,
11,
220,
16,
21,
11,
220,
24,
11,
220,
17,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.