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_pdf() {
let pdf = |arg: f64| move |x: FisherSnedecor| x.pdf(arg);
test_almost(0.1, 0.1, 0.0234154207226588982471, 1e-16, pdf(1.0));
test_almost(1.0, 0.1, 0.0396064560910663979961, 1e-16, pdf(1.0));
test_almost(10.0, 0.1, 0.0418440630400545297349, 1e-14, pdf(1.0));
test_almost(0.1, 1.0, 0.0396064560910663979961, 1e-16, pdf(1.0));
test_almost(1.0, 1.0, 0.1591549430918953357689, 1e-16, pdf(1.0));
test_almost(10.0, 1.0, 0.230361989229138647108, 1e-16, pdf(1.0));
test_almost(0.1, 0.1, 0.00221546909694001013517, 1e-18, pdf(10.0));
test_almost(1.0, 0.1, 0.00369960370387922619592, 1e-17, pdf(10.0));
test_almost(10.0, 0.1, 0.00390179721174142927402, 1e-15, pdf(10.0));
test_almost(0.1, 1.0, 0.00319864073359931548273, 1e-17, pdf(10.0));
test_almost(1.0, 1.0, 0.009150765837179460915678, 1e-17, pdf(10.0));
test_almost(10.0, 1.0, 0.0116493859171442148446, 1e-17, pdf(10.0));
test_almost(0.1, 10.0, 0.00305087016058573989694, 1e-15, pdf(10.0));
test_almost(1.0, 10.0, 0.00271897749113479577864, 1e-17, pdf(10.0));
test_almost(10.0, 10.0, 2.4289227234060500084E-4, 1e-18, pdf(10.0));
} | rust_cleaned_test_functions.jsonl/42689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39948,
368,
341,
286,
1077,
12782,
284,
760,
858,
25,
282,
21,
19,
91,
3271,
760,
87,
25,
35504,
50,
18694,
757,
269,
91,
856,
15995,
9404,
317,
286,
1273,
94418,
7,
15,
13,
16,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concat_idents_expand() {
check_expansion(
r##"
#[rustc_builtin_macro]
macro_rules! concat_idents {}
concat_idents!(foo, bar);
"##,
expect![[r#"foobar"#]],
);
} | rust_cleaned_test_functions.jsonl/112680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
842,
805,
67875,
368,
341,
286,
1779,
14214,
10501,
1006,
310,
435,
565,
698,
310,
11506,
35788,
66,
73829,
58810,
921,
310,
18072,
21407,
0,
33720,
842,
805,
5613,
310,
33720,
842,
805,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_load_start_event() {
let event: LoadStartEvent = js!(
return new ProgressEvent( @{LoadStartEvent::EVENT_TYPE} );
).try_into().unwrap();
assert_eq!( event.event_type(), LoadStartEvent::EVENT_TYPE );
} | rust_cleaned_test_functions.jsonl/997 | {
"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,
12411,
4906,
6748,
368,
341,
286,
1077,
1538,
25,
8893,
3479,
1556,
284,
6994,
33673,
310,
470,
501,
16033,
1556,
7,
33267,
5879,
3479,
1556,
486,
37349,
4189,
92,
1439,
286,
7457,
1539,
45514,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_runnables_multiple_depth_module() {
let (analysis, pos) = analysis_and_position(
r#"
//- /lib.rs
<|> //empty
mod foo {
mod bar {
mod test_mod {
#[test]
fn test_foo1() {}
}
}
}
"#,
);
let runnables = analysis.runnables(pos.file_id).unwrap();
assert_debug_snapshot!(&runnables,
@r###"
[
Runnable {
range: 41..115,
kind: TestMod {
path: "foo::bar::test_mod",
},
},
Runnable {
range: 68..105,
kind: Test {
test_id: Path(
"foo::bar::test_mod::test_foo1",
),
attr: TestAttr {
ignore: false,
},
},
},
]
"###
);
} | rust_cleaned_test_functions.jsonl/89930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 723
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
77,
4788,
45233,
19061,
10750,
368,
341,
286,
1077,
320,
34484,
11,
1133,
8,
284,
6358,
8378,
9661,
1006,
310,
435,
2,
698,
286,
78406,
608,
2740,
25638,
198,
286,
82639,
29,
442,
3194,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_app() {
let input = r#"
app "webstorm" {
home {
search ".WebStorm*" {
cd "config" {
cd "keymaps" {
files "*.xml"
}
cd "options" {
file "editor.xml"
}
}
}
}
}"#
.chars()
.collect::<Vec<_>>();
let r = parse_vacuum_file().parse(&input);
assert_eq!(
r,
Ok(App {
name: "webstorm".into(),
actions: vec![Action::Context(
Folder::Home,
vec![Action::Context(
Folder::Search(".WebStorm*".into()),
vec![Action::Context(
Folder::Custom("config".into()),
vec![
Action::Context(
Folder::Custom("keymaps".into()),
vec![Action::Files("*.xml".into())],
),
Action::Context(
Folder::Custom("options".into()),
vec![Action::File("editor.xml".into(), None)],
),
],
)],
)],
)],
dependencies: None
})
);
} | rust_cleaned_test_functions.jsonl/50007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8191,
368,
341,
286,
1077,
1946,
284,
435,
2,
698,
310,
906,
330,
2911,
26413,
1,
341,
394,
2114,
341,
503,
2711,
5933,
5981,
34291,
64110,
341,
664,
15307,
330,
1676,
1,
341,
999,
1530... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rate_limits() {
let scoping = Scoping {
organization_id: 42,
project_id: ProjectId::new(21),
project_key: ProjectKey::parse("a94ae32be2584e0bbd7a4cbb95971fee").unwrap(),
key_id: Some(17),
};
let formatted =
"42::organization:my_limit, invalid, 4711:foobar;transaction;security:project";
let rate_limits: Vec<RateLimit> =
parse_rate_limits(&scoping, formatted).into_iter().collect();
assert_eq!(
rate_limits,
vec![
RateLimit {
categories: DataCategories::new(),
scope: RateLimitScope::Organization(42),
reason_code: Some(ReasonCode::new("my_limit")),
retry_after: rate_limits[0].retry_after,
},
RateLimit {
categories: smallvec![
DataCategory::Unknown,
DataCategory::Transaction,
DataCategory::Security,
],
scope: RateLimitScope::Project(ProjectId::new(21)),
reason_code: None,
retry_after: rate_limits[1].retry_after,
}
]
);
assert_eq!(42, rate_limits[0].retry_after.remaining_seconds());
assert_eq!(4711, rate_limits[1].retry_after.remaining_seconds());
} | rust_cleaned_test_functions.jsonl/101158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 824
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9246,
31820,
368,
341,
286,
1077,
1136,
33707,
284,
2463,
33707,
341,
310,
7321,
842,
25,
220,
19,
17,
345,
310,
2390,
842,
25,
5787,
764,
486,
931,
7,
17,
16,
1326,
310,
2390,
3097,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parking_lot_eviction() {
let mut config = NodeConfig::random();
config.mempool.capacity = 5;
let mut pool = CoreMempool::new(&config);
// add transactions with following sequence numbers to Mempool
for seq in &[0, 1, 2, 9, 10] {
add_txn(&mut pool, TestTransaction::new(1, *seq, 1)).unwrap();
}
// Mempool is full. Insert few txns for other account
for seq in &[0, 1] {
add_txn(&mut pool, TestTransaction::new(0, *seq, 1)).unwrap();
}
// Make sure that we have correct txns in Mempool
let mut txns: Vec<_> = pool
.get_block(5, HashSet::new())
.iter()
.map(SignedTransaction::sequence_number)
.collect();
txns.sort();
assert_eq!(txns, vec![0, 0, 1, 1, 2]);
assert!(add_txn(&mut pool, TestTransaction::new(0, 2, 1)).is_err());
} | rust_cleaned_test_functions.jsonl/14071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
33452,
91849,
43713,
2479,
368,
341,
262,
1077,
5206,
2193,
284,
6018,
2648,
486,
11463,
543,
262,
2193,
744,
3262,
1749,
59168,
284,
220,
20,
280,
262,
1077,
5206,
7314,
284,
9518,
44,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parser() {
let log = "<12>Feb 5 01:02:03 10.1.99.1 10.1.99.1 aaa= 123%= id=firewall sn=SERIALNUMBER111 time=\"2021-02-05 01:02:03 UTC\" 123%= 123%=fw=111.222.111.222 pri=6 c=1024 m=1153 msg=\"SSL VPN Traffic\" sess=\"sslvpnc\" n=1234567890 usr=\"test@usiem.com\" src=10.1.2.3:3080:X6-V80 dst=10.2.3.4:50005:X1 srcMac=98:90:96:de:f1:78 dstMac=ec:f4:bb:fb:f7:f6 proto=tcp/50005 rcvd=392 rule=\"123 (SSLVPN->NET_RRHH1)\"";
let log = SiemLog::new(log.to_string(), 0, SiemIp::V4(0));
let siem_log = parse_log(log);
match siem_log {
Ok(log) => {
assert_eq!(log.service(), "firewall");
assert_eq!(
log.field("observer.id"),
Some(&SiemField::from_str("SERIALNUMBER111"))
);
assert_eq!(log.field("observer.name"), None);
assert_eq!(
log.origin(),
&SiemIp::V4(ipv4_from_str("10.1.99.1").unwrap())
);
assert_eq!(
log.field("source.mac"),
Some(&SiemField::from_str("98:90:96:de:f1:78"))
);
assert_eq!(
log.field("destination.mac"),
Some(&SiemField::from_str("ec:f4:bb:fb:f7:f6"))
);
assert_eq!(
log.field("source.ip"),
Some(&SiemField::IP(SiemIp::V4(
ipv4_from_str("10.1.2.3").unwrap()
)))
);
assert_eq!(
log.field("destination.ip"),
Some(&SiemField::IP(SiemIp::V4(
ipv4_from_str("10.2.3.4").unwrap()
)))
);
}
Err(_) => assert_eq!(1, 0),
}
} | rust_cleaned_test_functions.jsonl/94474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
368,
341,
286,
1077,
1487,
284,
4055,
16,
17,
29,
40591,
220,
20,
220,
15,
16,
25,
15,
17,
25,
15,
18,
220,
16,
15,
13,
16,
13,
24,
24,
13,
16,
220,
16,
15,
13,
16,
13,
24,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cdc_1pc() {
let mut suite = TestSuite::new(1);
let req = suite.new_changedata_request(1);
let (mut req_tx, _, receive_event) = new_event_feed(suite.get_region_cdc_client(1));
block_on(req_tx.send((req, WriteFlags::default()))).unwrap();
let event = receive_event(false);
event.events.into_iter().for_each(|e| {
match e.event.unwrap() {
// it should always outputs an Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
other => panic!("unknown event {:?}", other),
}
});
let (k1, v1) = (b"k1", b"v1");
let (k2, v2) = (b"k2", &[0u8; 512]);
let start_ts = block_on(suite.cluster.pd_client.get_tso()).unwrap();
// Let resolved_ts update.
sleep_ms(500);
// Prewrite
let mut prewrite_req = PrewriteRequest::default();
let region_id = 1;
prewrite_req.set_context(suite.get_context(region_id));
let mut m1 = Mutation::default();
m1.set_op(Op::Put);
m1.key = k1.to_vec();
m1.value = v1.to_vec();
prewrite_req.mut_mutations().push(m1);
let mut m2 = Mutation::default();
m2.set_op(Op::Put);
m2.key = k2.to_vec();
m2.value = v2.to_vec();
prewrite_req.mut_mutations().push(m2);
prewrite_req.primary_lock = k1.to_vec();
prewrite_req.start_version = start_ts.into_inner();
prewrite_req.lock_ttl = prewrite_req.start_version + 1;
prewrite_req.set_try_one_pc(true);
let prewrite_resp = suite
.get_tikv_client(region_id)
.kv_prewrite(&prewrite_req)
.unwrap();
assert!(prewrite_resp.get_one_pc_commit_ts() > 0);
let mut resolved_ts = 0;
loop {
let mut cde = receive_event(true);
if cde.get_resolved_ts().get_ts() > resolved_ts {
resolved_ts = cde.get_resolved_ts().get_ts();
}
let events = cde.mut_events();
if !events.is_empty() {
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
Event_oneof_event::Entries(entries) => {
assert_eq!(entries.entries.len(), 2);
let (e0, e1) = (&entries.entries[0], &entries.entries[1]);
assert_eq!(e0.get_type(), EventLogType::Committed);
assert_eq!(e0.get_key(), k1);
assert_eq!(e0.get_value(), v1);
assert!(e0.commit_ts > resolved_ts);
assert_eq!(e1.get_type(), EventLogType::Committed);
assert_eq!(e1.get_key(), k2);
assert_eq!(e1.get_value(), v2);
assert!(e1.commit_ts > resolved_ts);
break;
}
other => panic!("unknown event {:?}", other),
}
}
}
suite.stop();
} | rust_cleaned_test_functions.jsonl/13011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7628,
62,
16,
3992,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
16,
626,
262,
1077,
4232,
284,
16182,
4618,
25213,
459,
7893,
7,
16,
317,
262,
1077,
320,
6984,
4232,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_null_dictionary() {
let values = vec![None, None, None, None, None, None, None, None, None]
as Vec<Option<&str>>;
let array: DictionaryArray<Int8Type> = values.into_iter().collect();
let array = Arc::new(array) as ArrayRef;
let null_array = new_null_array(array.data_type(), 9);
assert_eq!(&array, &null_array);
} | rust_cleaned_test_functions.jsonl/11765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
42605,
368,
341,
286,
1077,
2750,
284,
7486,
20703,
4064,
11,
2240,
11,
2240,
11,
2240,
11,
2240,
11,
2240,
11,
2240,
11,
2240,
11,
2240,
921,
310,
438,
11312,
94150,
52244,
495,
2452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_base() {
let rules = create_rules(
r#"
macro_rules! int_base {
($Trait:ident for $T:ident as $U:ident -> $Radix:ident) => {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::$Trait for $T {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
$Radix.fmt_int(*self as $U, f)
}
}
}
}
"#,
);
assert_expansion(MacroKind::Items, &rules, r#" int_base!{Binary for isize as usize -> Binary}"#,
"# [stable (feature = \"rust1\" , since = \"1.0.0\")] impl fmt ::Binary for isize {fn fmt (& self , f : & mut fmt :: Formatter < \'_ >) -> fmt :: Result {Binary . fmt_int (* self as usize , f)}}"
);
} | rust_cleaned_test_functions.jsonl/14731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
7651,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
435,
2,
698,
32606,
21407,
0,
526,
7651,
341,
262,
1711,
49257,
25,
1713,
369,
400,
51,
25,
1713,
438,
400,
52,
25,
1713,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_followees() {
let p: PathBuf = ["tests", "neurons.csv"].iter().collect();
let mut builder = GovernanceCanisterInitPayloadBuilder::new();
let init_neurons = &mut builder.add_all_neurons_from_csv_file(&p).proto.neurons;
let voter_pid = *init_neurons[&42].controller.as_ref().unwrap();
let voter_neuron = init_neurons[&42].id.as_ref().unwrap().clone();
init_neurons.get_mut(&42).unwrap().dissolve_state = Some(DissolveState::DissolveDelaySeconds(
MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS,
));
let (mut driver, mut gov) =
governance_with_neurons(&init_neurons.values().cloned().collect::<Vec<Neuron>>());
let default_followees = hashmap![
Topic::ExchangeRate as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::NetworkEconomics as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::Governance as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::NodeAdmin as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::ParticipantManagement as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::SubnetManagement as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::NetworkCanisterManagement as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::Kyc as i32 => Followees { followees: vec![voter_neuron.clone()]},
];
gov.proto.default_followees = default_followees.clone();
let from = *TEST_NEURON_1_OWNER_PRINCIPAL;
let neuron_stake_e8s = 100 * 100_000_000;
let nonce = 1234u64;
let to_subaccount = Subaccount({
let mut sha = Sha256::new();
sha.write(&[0x0c]);
sha.write(b"neuron-stake");
sha.write(from.as_slice());
sha.write(&nonce.to_be_bytes());
sha.finish()
});
driver.create_account_with_funds(
AccountIdentifier::new(GOVERNANCE_CANISTER_ID.get(), Some(to_subaccount)),
neuron_stake_e8s,
);
let id =
claim_or_refresh_neuron_by_memo(&mut gov, &from, None, to_subaccount, Memo(nonce), None)
.unwrap();
assert_eq!(gov.get_neuron(&id).unwrap().followees, default_followees);
let default_followees2 = hashmap![
Topic::ExchangeRate as i32 => Followees { followees: vec![]},
Topic::NetworkEconomics as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::Governance as i32 => Followees { followees: vec![]},
Topic::NodeAdmin as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::ParticipantManagement as i32 => Followees { followees: vec![]},
Topic::SubnetManagement as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::NetworkCanisterManagement as i32 => Followees { followees: vec![voter_neuron.clone()]},
Topic::Kyc as i32 => Followees { followees: vec![]},
];
// Make a proposal to chante the deafult followees.
let pid = match gov
.manage_neuron(
&voter_pid,
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(voter_neuron)),
command: Some(manage_neuron::Command::MakeProposal(Box::new(Proposal {
title: Some("Change Network Economics".to_string()),
summary: "Just want to change this param.".to_string(),
url: "".to_string(),
action: Some(proposal::Action::SetDefaultFollowees(SetDefaultFollowees {
default_followees: default_followees2.clone(),
})),
}))),
},
)
.now_or_never()
.unwrap()
.expect("Couldn't submit proposal.")
.command
.unwrap()
{
manage_neuron_response::Command::MakeProposal(resp) => resp.proposal_id.unwrap(),
_ => panic!("Invalid response"),
};
assert_eq!(
gov.get_proposal_data(pid).unwrap().status(),
ProposalStatus::Executed
);
let nonce = 2345u64;
let to_subaccount = Subaccount({
let mut sha = Sha256::new();
sha.write(&[0x0c]);
sha.write(b"neuron-stake");
sha.write(from.as_slice());
sha.write(&nonce.to_be_bytes());
sha.finish()
});
driver.create_account_with_funds(
AccountIdentifier::new(GOVERNANCE_CANISTER_ID.get(), Some(to_subaccount)),
neuron_stake_e8s,
);
let id2 =
claim_or_refresh_neuron_by_memo(&mut gov, &from, None, to_subaccount, Memo(nonce), None)
.unwrap();
// The second neuron should have the default followees we set with the proposal.
assert!(id != id2);
assert_eq!(gov.get_neuron(&id2).unwrap().followees, default_followees2);
} | rust_cleaned_test_functions.jsonl/1170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
43490,
5516,
368,
341,
262,
1077,
281,
25,
7933,
15064,
284,
4383,
23841,
497,
330,
811,
53669,
11219,
5521,
2015,
1005,
17384,
543,
262,
1077,
5206,
7363,
284,
80589,
6713,
1571,
3803,
2968... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_rgba_hex() {
assert_eq!(
Color32::from_rgba_unmultiplied(0x20, 0x21, 0x22, 0x50),
hex_color!("20212250")
);
} | rust_cleaned_test_functions.jsonl/133540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
95229,
32655,
368,
341,
262,
2060,
10714,
33673,
286,
3478,
18,
17,
486,
1499,
95229,
4907,
26268,
3440,
7,
15,
87,
17,
15,
11,
220,
15,
87,
17,
16,
11,
220,
15,
87,
17,
17,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_address() {
let addr = "ckt1qyqr79tnk3pp34xp92gerxjc4p3mus2690psf0dd70";
let res = parse_address(addr);
assert!(res.is_ok());
assert_eq!(res.unwrap().network(), NetworkType::Testnet);
} | rust_cleaned_test_functions.jsonl/48678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6744,
368,
341,
286,
1077,
10789,
284,
330,
68412,
16,
80,
88,
23004,
22,
24,
1517,
74,
18,
602,
18,
19,
35725,
24,
17,
1389,
87,
62987,
19,
79,
18,
37727,
17,
21,
24,
15,
1690,
69,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_with_options() {
let query = "query";
let file = File::open("./test-data/test.txt").unwrap();
let config = Config::new(Some("iw"), query, &file);
assert_eq!(config.is_ok(), true);
let config = config.unwrap();
let options = config.get_options();
assert_eq!(options.is_some(), true);
let options = options.unwrap();
assert_eq!(options.is_case_sensitive(), true);
assert_eq!(options.is_exact_match(), true);
assert_eq!(config.get_query(), query);
assert_eq!(
config.get_file().metadata().unwrap().len(),
file.metadata().unwrap().len()
);
} | rust_cleaned_test_functions.jsonl/63336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
6615,
8743,
368,
341,
286,
1077,
3239,
284,
330,
1631,
876,
286,
1077,
1034,
284,
2887,
486,
2508,
13988,
1944,
13945,
12697,
3909,
1827,
15454,
543,
286,
1077,
2193,
284,
5532,
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_multihash_error_no_alloc_size() {
let input = quote! {
#[derive(Clone, Multihash)]
pub enum Code {
#[mh(code = 0x14, hasher = multihash::Sha2_256, digest = multihash::Sha2Digest<U32>)]
Sha2_256,
}
};
let derive_input = syn::parse2(input).unwrap();
let s = Structure::new(&derive_input);
multihash(s);
} | rust_cleaned_test_functions.jsonl/97855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
6996,
988,
4096,
6536,
14802,
2368,
368,
341,
286,
1077,
1946,
284,
12641,
0,
341,
1843,
11506,
27098,
65297,
11,
22162,
6996,
988,
5563,
1843,
6675,
7618,
6119,
341,
2290,
11506,
51916,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_formatting() {
let a = Complex::new(1.23456, 123.456);
assert_eq!(format!("{}", a), "1.23456+123.456i");
assert_eq!(format!("{:.2}", a), "1.23+123.46i");
assert_eq!(format!("{:.2e}", a), "1.23e0+1.23e2i");
assert_eq!(format!("{:+.2E}", a), "+1.23E0+1.23E2i");
#[cfg(feature = "std")]
assert_eq!(format!("{:+20.2E}", a), " +1.23E0+1.23E2i");
let b = Complex::new(0x80, 0xff);
assert_eq!(format!("{:X}", b), "80+FFi");
assert_eq!(format!("{:#x}", b), "0x80+0xffi");
assert_eq!(format!("{:+#b}", b), "+0b10000000+0b11111111i");
assert_eq!(format!("{:+#o}", b), "+0o200+0o377i");
#[cfg(feature = "std")]
assert_eq!(format!("{:+#16o}", b), " +0o200+0o377i");
let c = Complex::new(-10, -10000);
assert_eq!(format!("{}", c), "-10-10000i");
#[cfg(feature = "std")]
assert_eq!(format!("{:16}", c), " -10-10000i");
} | rust_cleaned_test_functions.jsonl/105661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
8955,
1280,
368,
341,
286,
1077,
264,
284,
22096,
486,
931,
7,
16,
13,
17,
18,
19,
20,
21,
11,
220,
16,
17,
18,
13,
19,
20,
21,
317,
286,
2060,
10714,
10297,
2243,
79878,
264,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dec_ipv4_hop_limit() {
let init_ttl = 64;
let mac_data: Vec<u8> = vec![0xde, 0xad, 0xbe, 0xef, 0xff, 0xff, 1, 2, 3, 4, 5, 6, 0, 0];
let ip_data: Vec<u8> = vec![
0x45, 0, 0, 20, 0, 0, 0, 0, 64, 17, 0, 0, 192, 178, 128, 0, 10, 0, 0, 1,
];
let mut frame = EthernetFrame::from_buffer(mac_data, 0).unwrap();
frame.set_payload(&ip_data);
let mut packet = Ipv4Packet::try_from(frame).unwrap();
packet.set_ttl(init_ttl);
let mut elem = DecIpv4HopLimit::new();
let packet = elem.process(packet).unwrap();
assert_eq!(packet.ttl(), init_ttl - 1);
} | rust_cleaned_test_functions.jsonl/69641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
49378,
19,
98193,
14763,
368,
341,
286,
1077,
2930,
87157,
284,
220,
21,
19,
280,
286,
1077,
8978,
1769,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
56185,
11,
220,
15,
55254,
11,
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_drain_iterator() {
const SIZE: usize = 1000;
let points = create_random_points(SIZE, SEED_1);
let mut tree = RTree::bulk_load(points.clone());
let drain_count = DrainIterator::new(&mut tree, SelectAllFunc)
.take(250)
.count();
assert_eq!(drain_count, 250);
assert_eq!(tree.size(), 750);
let drain_count = DrainIterator::new(&mut tree, SelectAllFunc)
.take(250)
.count();
assert_eq!(drain_count, 250);
assert_eq!(tree.size(), 500);
// Test Drain forget soundness
forget(DrainIterator::new(&mut tree, SelectAllFunc));
// Check tree has no nodes
// Tests below will check the same tree can be used again
assert_eq!(tree.size(), 0);
let points = create_random_points(1000, SEED_1);
points.clone().into_iter().for_each(|pt| tree.insert(pt));
let env = AABB::from_corners([-2., -0.6], [0.5, 0.85]);
let sel = SelectInEnvelopeFuncIntersecting::new(env);
let drain_count = DrainIterator::new(&mut tree, sel).take(80).count();
assert_eq!(drain_count, 80);
let sel = SelectInEnvelopeFuncIntersecting::new(env);
let drain_count = DrainIterator::new(&mut tree, sel).count();
assert_eq!(drain_count, 326);
let sel = SelectInEnvelopeFuncIntersecting::new(env);
let sel_count = tree.locate_with_selection_function(sel).count();
assert_eq!(sel_count, 0);
assert_eq!(tree.size(), 1000 - 80 - 326);
} | rust_cleaned_test_functions.jsonl/24152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 722
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
13491,
368,
341,
286,
733,
25341,
25,
22301,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
3501,
284,
1855,
22644,
12928,
3759,
3282,
11,
5052,
1479,
62,
16,
317,
286,
1077,
5206,
4916... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_nan() {
let nan: f64 = NAN;
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
assert!(nan.is_nan());
assert!(!0.0f64.is_nan());
assert!(!5.3f64.is_nan());
assert!(!(-10.732f64).is_nan());
assert!(!inf.is_nan());
assert!(!neg_inf.is_nan());
} | rust_cleaned_test_functions.jsonl/7820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
73936,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
92129,
280,
286,
1077,
4132,
25,
282,
21,
19,
284,
1964,
55990,
280,
286,
1077,
4184,
26051,
25,
282,
21,
19,
284,
84065,
91110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let django = Django {
version: DjangoVersion::V1_9,
};
let encoded = django.make_password("lètmein");
assert!(encoded.starts_with("pbkdf2_sha256$"));
assert!(is_password_usable(&encoded));
assert!(check_password("lètmein", &encoded).unwrap());
assert!(!check_password("lètmeinz", &encoded).unwrap());
// Blank passwords
let blank_encoded = django.make_password("");
assert!(blank_encoded.starts_with("pbkdf2_sha256$"));
assert!(is_password_usable(&blank_encoded));
assert!(check_password("", &blank_encoded).unwrap());
assert!(!check_password(" ", &blank_encoded).unwrap());
} | rust_cleaned_test_functions.jsonl/104125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
262,
1077,
8262,
284,
52604,
341,
286,
2319,
25,
52604,
5637,
486,
53,
16,
62,
24,
345,
262,
2605,
262,
1077,
20498,
284,
8262,
10117,
10122,
445,
75,
4458,
83,
2660,
258,
797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incinerator() {
let (genesis_config, mint_keypair) = create_genesis_config(1_000_000_000_000);
let bank0 = Arc::new(Bank::new(&genesis_config));
// Move to the first normal slot so normal rent behaviour applies
let bank = Bank::new_from_parent(
&bank0,
&Pubkey::default(),
genesis_config.epoch_schedule.first_normal_slot,
);
let pre_capitalization = bank.capitalization();
// Burn a non-rent exempt amount
let burn_amount = bank.get_minimum_balance_for_rent_exemption(0) - 1;
assert_eq!(bank.get_balance(&incinerator::id()), 0);
bank.transfer(burn_amount, &mint_keypair, &incinerator::id())
.unwrap();
assert_eq!(bank.get_balance(&incinerator::id()), burn_amount);
bank.freeze();
assert_eq!(bank.get_balance(&incinerator::id()), 0);
// capitalization
assert_eq!(bank.capitalization(), pre_capitalization - burn_amount);
} | rust_cleaned_test_functions.jsonl/2631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31285,
10453,
850,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pattern_matches_require_literal_leading_dot() {
let options_require_literal_leading_dot = MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: true
};
let options_not_require_literal_leading_dot = MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: false
};
let f = |options| Pattern::new("*.txt").matches_with(".hello.txt", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(!f(options_require_literal_leading_dot));
let f = |options| Pattern::new(".*.*").matches_with(".hello.txt", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(f(options_require_literal_leading_dot));
let f = |options| Pattern::new("aaa/bbb/*").matches_with("aaa/bbb/.ccc", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(!f(options_require_literal_leading_dot));
let f = |options| Pattern::new("aaa/bbb/*").matches_with("aaa/bbb/c.c.c.", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(f(options_require_literal_leading_dot));
let f = |options| Pattern::new("aaa/bbb/.*").matches_with("aaa/bbb/.ccc", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(f(options_require_literal_leading_dot));
let f = |options| Pattern::new("aaa/?bbb").matches_with("aaa/.bbb", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(!f(options_require_literal_leading_dot));
let f = |options| Pattern::new("aaa/[.]bbb").matches_with("aaa/.bbb", options);
assert!(f(options_not_require_literal_leading_dot));
assert!(!f(options_require_literal_leading_dot));
} | rust_cleaned_test_functions.jsonl/13359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 838
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21260,
38344,
13793,
34100,
11751,
2228,
30941,
368,
1476,
286,
1077,
2606,
13793,
34100,
11751,
2228,
30941,
284,
14152,
3798,
341,
310,
1142,
65324,
25,
830,
345,
310,
1373,
34100,
58204,
25,
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_display_mock_matching_regex_query() {
let mock = mock("GET", "/test").match_query(Matcher::Regex("hello=world".to_string()));
assert_eq!("\r\nGET /test?hello=world (regex)\r\n", format!("{}", mock));
} | rust_cleaned_test_functions.jsonl/82420 | {
"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,
14825,
34134,
70763,
41832,
5738,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
1944,
1827,
6347,
5738,
3189,
28058,
486,
32464,
445,
14990,
28,
14615,
3263,
983,
3904,
25138,
262,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_during_repair() {
let dir = tempfile::Builder::new()
.prefix("test_error_during_repair")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
target_file_size: ReadableSize(1),
..Default::default()
};
let fs = Arc::new(ObfuscatedFileSystem::default());
let entry = vec![b'x'; 1024];
let engine = Engine::open_with_file_system(cfg.clone(), fs.clone()).unwrap();
for rid in 1..=10 {
engine
.write(&mut generate_batch(rid, 1, 11, Some(&entry)), true)
.unwrap();
}
drop(engine);
let script = "
fn filter_append(id, first, count, rewrite_count, queue, ifirst, ilast) {
1 // discard incoming
}
"
.to_owned();
{
let _f = FailGuard::new("log_fd::write::err", "return");
assert!(
Engine::unsafe_repair_with_file_system(dir.path(), None, script, fs.clone()).is_err()
);
}
let engine = Engine::open_with_file_system(cfg, fs).unwrap();
for rid in 1..=10 {
assert_eq!(
10,
engine
.fetch_entries_to::<MessageExtTyped>(rid, 1, 11, None, &mut vec![])
.unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/53491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
814,
1677,
1288,
12670,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
286,
659,
11849,
445,
1944,
4096,
814,
1677,
1288,
12670,
1138,
286,
659,
3888,
3741,
741,
286,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_ofd_read_lock() {
use nix::sys::stat::fstat;
use std::mem;
let tmp = NamedTempFile::new().unwrap();
let fd = tmp.as_raw_fd();
let statfs = nix::sys::statfs::fstatfs(&tmp).unwrap();
if statfs.filesystem_type() == nix::sys::statfs::OVERLAYFS_SUPER_MAGIC {
// OverlayFS is a union file system. It returns one inode value in
// skip the test.
skip!("/proc/locks does not work on overlayfs");
}
let inode = fstat(fd).expect("fstat failed").st_ino as usize;
let mut flock: libc::flock = unsafe {
mem::zeroed() // required for Linux/mips
};
flock.l_type = libc::F_RDLCK as libc::c_short;
flock.l_whence = libc::SEEK_SET as libc::c_short;
flock.l_start = 0;
flock.l_len = 0;
flock.l_pid = 0;
fcntl(fd, FcntlArg::F_OFD_SETLKW(&flock)).expect("read lock failed");
assert_eq!(
Some(("OFDLCK".to_string(), "READ".to_string())),
lock_info(inode)
);
flock.l_type = libc::F_UNLCK as libc::c_short;
fcntl(fd, FcntlArg::F_OFD_SETLKW(&flock)).expect("read unlock failed");
assert_eq!(None, lock_info(inode));
} | rust_cleaned_test_functions.jsonl/129577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3575,
67,
6443,
9818,
368,
341,
286,
990,
308,
941,
486,
7791,
486,
9878,
486,
69,
9878,
280,
286,
990,
1460,
486,
10536,
401,
286,
1077,
4174,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fp2_doubling() {
let a = Fp2::new(
Fp::from_u64s_le(&[
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
0xb966ce3bc2108b13,
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])
.unwrap(),
Fp::from_u64s_le(&[
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
0xb3f8afc0ee248cad,
0x4e464dea5bcfd41e,
0x12d1137b8a6a837,
])
.unwrap(),
);
assert_eq!(
a.double(),
Fp2::new(
Fp::from_u64s_le(&[
0x5a00f006d247ff8e,
0x23cb3d4443476da4,
0x1634a5c1521eb3da,
0x72cd9c7784211627,
0x998c938972a657e7,
0x1f1a52b65bdb3b9
])
.unwrap(),
Fp::from_u64s_le(&[
0x2efbeddf9b5dc1b6,
0x28d5ca5ad09f4fdb,
0x7c4068238cdf674b,
0x67f15f81dc49195b,
0x9c8c9bd4b79fa83d,
0x25a226f714d506e
])
.unwrap(),
)
);
} | rust_cleaned_test_functions.jsonl/62486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1098
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34160,
17,
814,
283,
9695,
368,
341,
286,
1077,
264,
284,
434,
79,
17,
486,
931,
1006,
310,
434,
79,
486,
1499,
7300,
21,
19,
82,
11751,
2099,
9640,
394,
220,
15,
87,
17,
67,
15,
15,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_out_of_bounds() {
let mem = Memory::new(1024);
match mem.read_byte(1028) {
Err(why) => assert_eq!(why, RiscvError::MemoryOutOfBoundsError(1028)),
_ => panic!(),
};
} | rust_cleaned_test_functions.jsonl/92775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
3575,
36878,
368,
341,
286,
1077,
1833,
284,
13850,
486,
931,
7,
16,
15,
17,
19,
317,
286,
2432,
1833,
4125,
19737,
7,
16,
15,
17,
23,
8,
341,
310,
15495,
7,
34634,
8,
589,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_delete() {
let mutation = delete("Guild", all_keys());
match mutation.operation.unwrap() {
v1::mutation::Operation::Delete(w) => {
assert_eq!("Guild", w.table);
assert_eq!(true, w.key_set.unwrap().all);
}
_ => panic!("invalid operation"),
}
} | rust_cleaned_test_functions.jsonl/132336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
368,
341,
286,
1077,
26374,
284,
3698,
445,
72574,
497,
678,
12631,
1423,
286,
2432,
26374,
48856,
55395,
368,
341,
310,
348,
16,
486,
30971,
486,
8432,
486,
6435,
3622,
8,
589,
341,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decode_ldrd_w() {
assert_eq!(
decode_32(0xe9d50100),
Instruction::LDRD_imm {
params: Reg2DoubleParams {
rt: Reg::R0,
rt2: Reg::R1,
rn: Reg::R5,
imm32: 0,
index: true,
add: true,
wback: false,
},
}
);
} | rust_cleaned_test_functions.jsonl/64837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
6498,
1670,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
8371,
24,
67,
20,
15,
16,
15,
15,
1326,
286,
29051,
486,
43,
7687,
35,
71370,
341,
310,
3628... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_on_date() {
let mut accounts = vec![
Account::new(1, 0, id()),
Account::new(0, 512, id()),
Account::new(0, 0, id()),
];
let from_account = 0;
let contract_account = 1;
let to_account = 2;
let from = Keypair::new();
let contract = Keypair::new();
let to = Keypair::new();
let rando = Keypair::new();
let dt = Utc::now();
let tx = BudgetTransaction::new_on_date(
&from,
to.pubkey(),
contract.pubkey(),
dt,
from.pubkey(),
None,
1,
Hash::default(),
);
process_transaction(&tx, &mut accounts).unwrap();
assert_eq!(accounts[from_account].tokens, 0);
assert_eq!(accounts[contract_account].tokens, 1);
let program = BudgetProgram::deserialize(&accounts[contract_account].userdata).unwrap();
assert!(program.is_pending());
// Attack! Try to payout to a rando key
let tx = BudgetTransaction::new_timestamp(
&from,
contract.pubkey(),
rando.pubkey(),
dt,
Hash::default(),
);
assert_eq!(
process_transaction(&tx, &mut accounts),
Err(BudgetError::DestinationMissing)
);
assert_eq!(accounts[from_account].tokens, 0);
assert_eq!(accounts[contract_account].tokens, 1);
assert_eq!(accounts[to_account].tokens, 0);
let program = BudgetProgram::deserialize(&accounts[contract_account].userdata).unwrap();
assert!(program.is_pending());
// that pubkey's funds are now available.
let tx = BudgetTransaction::new_timestamp(
&from,
contract.pubkey(),
to.pubkey(),
dt,
Hash::default(),
);
process_transaction(&tx, &mut accounts).unwrap();
assert_eq!(accounts[from_account].tokens, 0);
assert_eq!(accounts[contract_account].tokens, 0);
assert_eq!(accounts[to_account].tokens, 1);
let program = BudgetProgram::deserialize(&accounts[contract_account].userdata).unwrap();
assert!(!program.is_pending());
// try to replay the timestamp contract
assert_eq!(
process_transaction(&tx, &mut accounts),
Err(BudgetError::ContractNotPending)
);
assert_eq!(accounts[from_account].tokens, 0);
assert_eq!(accounts[contract_account].tokens, 0);
assert_eq!(accounts[to_account].tokens, 1);
} | rust_cleaned_test_functions.jsonl/30410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
4470,
4164,
368,
341,
286,
1077,
5206,
9618,
284,
7486,
90515,
310,
8615,
486,
931,
7,
16,
11,
220,
15,
11,
877,
14702,
310,
8615,
486,
931,
7,
15,
11,
220,
20,
16,
17,
11,
877,
147... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_trait() {
use super::SetLoggerError;
let e = SetLoggerError(());
assert_eq!(
&e.to_string(),
"attempted to set a logger after the logging system \
was already initialized"
);
} | rust_cleaned_test_functions.jsonl/71736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
78491,
368,
341,
286,
990,
2256,
486,
1649,
7395,
1454,
280,
286,
1077,
384,
284,
2573,
7395,
1454,
7,
1423,
286,
2060,
10714,
33673,
310,
609,
68,
2389,
3904,
3148,
310,
330,
55505,
291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_epoll_stdin_event() {
let mut epoll_context = EpollContext::new().unwrap();
epoll_context.enable_stdin_event();
assert_eq!(
epoll_context.dispatch_table[epoll_context.stdin_index as usize].unwrap(),
EpollDispatch::Stdin
);
// This should trigger a warn!. When logger will not be a global var we will be able to test
// it.
epoll_context.enable_stdin_event();
epoll_context.disable_stdin_event();
assert!(epoll_context.dispatch_table[epoll_context.stdin_index as usize].is_none());
} | rust_cleaned_test_functions.jsonl/105798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12476,
965,
15656,
258,
6748,
368,
341,
286,
1077,
5206,
95861,
8467,
284,
11020,
965,
1972,
486,
931,
1005,
15454,
543,
286,
95861,
8467,
28697,
15656,
258,
6748,
543,
286,
2060,
10714,
33673,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poll_returns_true_for_matching_event_in_queue_at_back() {
let mut reader = InternalEventReader {
events: vec![
InternalEvent::Event(Event::Resize(10, 10)),
InternalEvent::CursorPosition(10, 20),
]
.into(),
source: None,
};
assert!(reader.poll(None, &CursorPositionFilter).unwrap());
} | rust_cleaned_test_functions.jsonl/101469 | {
"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,
40002,
58900,
16082,
5478,
70763,
6748,
1243,
10841,
3752,
3895,
368,
341,
286,
1077,
5206,
6604,
284,
15412,
1556,
5062,
341,
310,
4357,
25,
7486,
90515,
394,
15412,
1556,
486,
1556,
30469,
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_sign() {
let tests = vec![
(Datum::F64(42f64), Datum::I64(1)),
(Datum::F64(0f64), Datum::I64(0)),
(Datum::F64(-47f64), Datum::I64(-1)),
(Datum::Null, Datum::Null),
];
let mut ctx = EvalContext::default();
for (arg, exp) in tests {
let arg = datum_expr(arg);
let op = scalar_func_expr(ScalarFuncSig::Sign, &[arg]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/125525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
37,
21,
19,
7,
19,
17,
69,
21,
19,
701,
68459,
486,
40,
21,
19,
7,
16,
6965,
310,
320,
68036,
486,
37,
21,
19,
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... | 2 |
#[test]
fn test_process_pull_request() {
let thread_pool = ThreadPoolBuilder::new().build().unwrap();
let node_keypair = Keypair::new();
let mut node_crds = Crds::default();
let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&node_keypair.pubkey(),
0,
)));
let caller = entry.clone();
let node = CrdsGossipPull::default();
node_crds.insert(entry, 0).unwrap();
let mut ping_cache = PingCache::new(
Duration::from_secs(20 * 60), // ttl
128, // capacity
);
let new = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), 0);
ping_cache.mock_pong(new.id, new.gossip, Instant::now());
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(new));
node_crds.insert(new, 0).unwrap();
let mut pings = Vec::new();
let req = node.new_pull_request(
&thread_pool,
&node_crds,
&node_keypair,
0,
0,
None,
&HashMap::new(),
PACKET_DATA_SIZE,
&Mutex::new(ping_cache),
&mut pings,
);
let mut dest_crds = Crds::default();
let mut dest = CrdsGossipPull::default();
let (_, filters) = req.unwrap();
let filters: Vec<_> = filters.into_iter().map(|f| (caller.clone(), f)).collect();
let rsp = dest.generate_pull_responses(
&thread_pool,
&dest_crds,
&filters,
usize::MAX, // output_size_limit
0, // now
);
dest.process_pull_requests(
&mut dest_crds,
filters.into_iter().map(|(caller, _)| caller),
1,
);
assert!(rsp.iter().all(|rsp| rsp.is_empty()));
assert!(dest_crds.get(&caller.label()).is_some());
assert_eq!(dest_crds.get(&caller.label()).unwrap().local_timestamp, 1);
} | rust_cleaned_test_functions.jsonl/112076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1066
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
65693,
7893,
368,
341,
286,
1077,
4516,
15709,
284,
72716,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
2436,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shutdown_force_shutdown() {
let (_tx_initiate_shutdown, rx_initiate_shutdown) = oneshot::channel();
let (tx_shutdown_event, rx_shutdown_event) = oneshot::channel();
let mut shutdown = ShutdownHandler::new(rx_initiate_shutdown, tx_shutdown_event);
assert_eq!(shutdown.state(), ShutdownState::Running);
shutdown.force_shutdown();
assert_eq!(shutdown.state(), ShutdownState::Shutdown);
assert!(current_thread::block_on_all(&mut shutdown).is_ok());
assert!(current_thread::block_on_all(rx_shutdown_event).is_ok());
assert_eq!(shutdown.state(), ShutdownState::Shutdown);
} | rust_cleaned_test_functions.jsonl/36423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54804,
40739,
54804,
368,
341,
286,
1077,
5453,
3998,
6137,
6493,
54804,
11,
19111,
6137,
6493,
54804,
8,
284,
389,
4288,
354,
486,
10119,
543,
286,
1077,
320,
3998,
54804,
6748,
11,
19111,
54804,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cumulative_histogram() {
let image = gray_image!(1u8, 2u8, 3u8, 2u8, 1u8);
let hist = cumulative_histogram(&image).channels[0];
assert_eq!(hist[0..4], [0, 2, 4, 5]);
assert!(hist.iter().skip(4).all(|x| *x == 5));
} | rust_cleaned_test_functions.jsonl/38564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91328,
22160,
68564,
368,
341,
286,
1077,
2168,
284,
17545,
4954,
10297,
16,
84,
23,
11,
220,
17,
84,
23,
11,
220,
18,
84,
23,
11,
220,
17,
84,
23,
11,
220,
16,
84,
23,
317,
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... | 1 |
#[test]
fn test_journal() {
// test that this message can be inserted
let conn = Connection::open_in_memory().expect("could not create in memory DB");
let mut journal = Journal::new(conn).unwrap();
journal.schema_up().unwrap();
let mut authority = create_example();
authority.set_journal(journal);
authority.persist_to_journal().unwrap();
let new_name = Name::from_str("new.example.com").unwrap();
let delete_name = Name::from_str("www.example.com").unwrap();
let new_record = Record::new()
.set_name(new_name.clone())
.set_rdata(RData::A(Ipv4Addr::new(10, 11, 12, 13)))
.clone();
let delete_record = Record::new()
.set_name(delete_name.clone())
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 34)))
.set_dns_class(DNSClass::NONE)
.clone();
authority
.update_records(&[new_record.clone(), delete_record], true)
.unwrap();
// assert that the correct set of records is there.
let new_rrset: Vec<Record> = authority
.lookup(
&new_name.clone().into(),
RecordType::A,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap()
.iter()
.cloned()
.collect();
assert!(new_rrset.iter().all(|r| *r == new_record));
let lower_delete_name = LowerName::from(delete_name.clone());
let delete_rrset = authority
.lookup(
&lower_delete_name,
RecordType::A,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap();
assert!(delete_rrset.was_empty());
let in_memory =
InMemoryAuthority::empty(authority.origin().clone().into(), ZoneType::Master, false);
let mut recovered_authority = SqliteAuthority::new(in_memory, false, false);
recovered_authority
.recover_with_journal(authority.journal().expect("journal not Some"))
.expect("recovery");
// assert that the correct set of records is there.
let new_rrset: Vec<Record> = recovered_authority
.lookup(
&new_name.into(),
RecordType::A,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap()
.iter()
.cloned()
.collect();
assert!(new_rrset.iter().all(|r| *r == new_record));
let delete_rrset = authority
.lookup(
&lower_delete_name,
RecordType::A,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap();
assert!(delete_rrset.was_empty());
} | rust_cleaned_test_functions.jsonl/48172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85075,
368,
341,
262,
442,
1273,
429,
419,
1943,
646,
387,
21578,
198,
262,
1077,
4534,
284,
11032,
486,
2508,
1243,
19195,
1005,
17119,
445,
28077,
537,
1855,
304,
4938,
5952,
797,
262,
1077,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_grpc_slice() {
let empty = GrpcSlice::default();
assert!(empty.is_empty());
assert_eq!(empty.len(), 0);
assert!(empty.as_slice().is_empty());
let a = vec![0, 2, 1, 3, 8];
let slice = GrpcSlice::from(a.clone());
assert_eq!(a.as_slice(), slice.as_slice());
assert_eq!(a.len(), slice.len());
assert_eq!(&slice, &*a);
let a = vec![5; 64];
let slice = GrpcSlice::from(a.clone());
assert_eq!(a.as_slice(), slice.as_slice());
assert_eq!(a.len(), slice.len());
assert_eq!(&slice, &*a);
let a = vec![];
let slice = GrpcSlice::from(a);
assert_eq!(empty, slice);
} | rust_cleaned_test_functions.jsonl/50383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15682,
3992,
26488,
368,
341,
286,
1077,
4287,
284,
2825,
3992,
33236,
486,
2258,
543,
286,
2060,
10297,
3194,
2079,
15124,
1423,
286,
2060,
10714,
10297,
3194,
19406,
1507,
220,
15,
317,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_setter() {
let mut fb = FooBar(0);
// We just check that the parameter type is correct
fb.set_into_foo1(0u8);
fb.set_into_foo2(0u8);
fb.set_into_foo3(0u8);
fb.set_into_foo4(0u8);
} | rust_cleaned_test_functions.jsonl/2271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
2602,
465,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
442,
1205,
1101,
1779,
429,
279,
5733,
943,
374,
4396,
198,
262,
25469,
980,
45514,
761,
2624,
16,
7,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raster_direct() {
let image_info = ImageInfo::new(
(20, 20),
crate::ColorType::RGBA8888,
crate::AlphaType::Unpremul,
None,
);
let min_row_bytes = image_info.min_row_bytes();
let mut pixels = vec![0u8; image_info.compute_byte_size(min_row_bytes)];
let mut surface = Surface::new_raster_direct(
&image_info,
pixels.as_mut_slice(),
Some(min_row_bytes),
None,
)
.unwrap();
let paint = Paint::default();
surface.canvas().draw_circle((10, 10), 10.0, &paint);
} | rust_cleaned_test_functions.jsonl/77684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
2300,
32871,
368,
972,
262,
1077,
2168,
3109,
284,
4654,
1731,
486,
931,
7805,
286,
320,
17,
15,
11,
220,
17,
15,
9912,
286,
17717,
486,
1636,
929,
486,
58927,
23,
23,
23,
23,
1871,
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_register_signal_handler() {
unsafe {
// testing bad value
assert!(register_signal_handler(
SIGRTMAX(),
SignalHandler::Siginfo(handle_signal),
true,
SA_SIGINFO
)
.is_err());
format!(
"{:?}",
register_signal_handler(
SIGRTMAX(),
SignalHandler::Siginfo(handle_signal),
true,
SA_SIGINFO
)
);
assert!(register_signal_handler(
0,
SignalHandler::Siginfo(handle_signal),
true,
SA_SIGINFO
)
.is_ok());
assert!(register_signal_handler(
libc::SIGSYS,
SignalHandler::Siginfo(handle_signal),
false,
SA_SIGINFO
)
.is_ok());
}
} | rust_cleaned_test_functions.jsonl/86271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 673
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
21137,
10183,
368,
341,
286,
19860,
341,
310,
442,
7497,
3873,
897,
198,
310,
2060,
10297,
6343,
21137,
10183,
1006,
394,
25038,
5350,
10586,
3148,
394,
27230,
3050,
486,
47246,
2733,
26405,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two() {
let classes = vec![String::from("Cat"), String::from("Dog")];
let mut metrics = MulticlassClassificationMetrics::new(classes.len());
let labels = arr1(&[
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(1).unwrap()),
Some(NonZeroUsize::new(2).unwrap()),
Some(NonZeroUsize::new(2).unwrap()),
Some(NonZeroUsize::new(2).unwrap()),
Some(NonZeroUsize::new(2).unwrap()),
Some(NonZeroUsize::new(2).unwrap()),
]);
let probabilities = arr2(&[
[1.0, 0.0], // correct
[1.0, 0.0], // correct
[1.0, 0.0], // correct
[1.0, 0.0], // correct
[1.0, 0.0], // correct
[0.0, 1.0], // incorrect
[0.0, 1.0], // incorrect
[0.0, 1.0], // incorrect
[0.0, 1.0], // correct
[0.0, 1.0], // correct
[0.0, 1.0], // correct
[1.0, 0.0], // incorrect
[1.0, 0.0], // incorrect
]);
metrics.update(MulticlassClassificationMetricsInput {
probabilities: probabilities.view(),
labels: labels.view(),
});
let metrics = metrics.finalize();
insta::assert_debug_snapshot!(metrics, @r###"
MulticlassClassificationMetricsOutput {
class_metrics: [
ClassMetrics {
true_positives: 5,
false_positives: 2,
true_negatives: 3,
false_negatives: 3,
accuracy: 0.61538464,
precision: 0.71428573,
recall: 0.625,
f1_score: 0.6666667,
},
ClassMetrics {
true_positives: 3,
false_positives: 3,
true_negatives: 5,
false_negatives: 2,
accuracy: 0.61538464,
precision: 0.5,
recall: 0.6,
f1_score: 0.54545456,
},
],
accuracy: 0.61538464,
precision_unweighted: 0.60714287,
precision_weighted: 0.6318681,
recall_unweighted: 0.6125,
recall_weighted: 0.61538464,
}
"###);
} | rust_cleaned_test_functions.jsonl/112681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1054
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
368,
341,
10217,
6846,
284,
7486,
20703,
703,
486,
1499,
445,
26801,
3975,
923,
486,
1499,
445,
48940,
899,
935,
10217,
5206,
16734,
284,
22162,
69503,
85040,
27328,
486,
931,
56286,
19406,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_too_large_cmsgspace() {
use nix::sys::socket::CmsgSpace;
test_impl_scm_credentials_and_rights(CmsgSpace::<[u8; 1024]>::new());
} | rust_cleaned_test_functions.jsonl/44200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
45228,
666,
3236,
8746,
368,
341,
262,
990,
308,
941,
486,
7791,
486,
9556,
486,
34,
3236,
9914,
401,
262,
1273,
21007,
643,
6226,
47396,
8378,
98053,
3025,
3236,
9914,
27638,
58,
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 |
#[test]
fn test_mode() {
assert_eq!(Arcsine::new_unchecked(0.0, 1.0).modes(), vec![0.0, 1.0]);
assert_eq!(Arcsine::new_unchecked(-1.0, 1.0).modes(), vec![-1.0, 0.0]);
assert_eq!(Arcsine::new_unchecked(-1.0, 2.0).modes(), vec![-1.0, 1.0]);
} | rust_cleaned_test_functions.jsonl/107415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7302,
368,
341,
286,
2060,
10714,
10297,
36809,
82,
482,
486,
931,
4907,
7549,
7,
15,
13,
15,
11,
220,
16,
13,
15,
568,
89822,
1507,
7486,
20703,
15,
13,
15,
11,
220,
16,
13,
15,
2558,
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_select_ipv6_source_address() {
use AddressState::*;
// Test the comparison operator used by `select_ipv6_source_address`
// by separately testing each comparison condition.
let remote = SpecifiedAddr::new(Ipv6Addr::from_bytes([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 1,
]))
.unwrap();
let local0 = SpecifiedAddr::new(Ipv6Addr::from_bytes([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 2,
]))
.unwrap();
let local1 = SpecifiedAddr::new(Ipv6Addr::from_bytes([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 168, 0, 3,
]))
.unwrap();
let dev0 = DeviceId::new_ethernet(0);
let dev1 = DeviceId::new_ethernet(1);
let dev2 = DeviceId::new_ethernet(2);
// Rule 1: Prefer same address
assert_eq!(rule_1(remote, remote, local0), Ordering::Greater);
assert_eq!(rule_1(remote, local0, remote), Ordering::Less);
assert_eq!(rule_1(remote, local0, local1), Ordering::Equal);
// Rule 3: Avoid deprecated states
assert_eq!(rule_3(Assigned, Deprecated), Ordering::Greater);
assert_eq!(rule_3(Deprecated, Assigned), Ordering::Less);
assert_eq!(rule_3(Assigned, Assigned), Ordering::Equal);
assert_eq!(rule_3(Deprecated, Deprecated), Ordering::Equal);
// Rule 5: Prefer outgoing interface
assert_eq!(rule_5(dev0, dev0, dev2), Ordering::Greater);
assert_eq!(rule_5(dev0, dev2, dev0), Ordering::Less);
assert_eq!(rule_5(dev0, dev0, dev0), Ordering::Equal);
assert_eq!(rule_5(dev0, dev2, dev2), Ordering::Equal);
// Rule 8: Use longest matching prefix.
{
let new_addr_entry = |bytes, prefix_len| {
Ipv6AddressEntry::<()>::new(
AddrSubnet::new(Ipv6Addr::from_bytes(bytes), prefix_len).unwrap(),
AddressState::Assigned,
AddrConfig::Manual,
)
};
// using addresses whose common prefix length is shorter than
// the subnet prefix length.
// 4 leading 0x01 bytes.
let remote = SpecifiedAddr::new(Ipv6Addr::from_bytes([
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]))
.unwrap();
// 3 leading 0x01 bytes.
let local0 = new_addr_entry([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 64);
// 2 leading 0x01 bytes.
let local1 = new_addr_entry([1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 64);
assert_eq!(rule_8(remote, &local0, &local1), Ordering::Greater);
assert_eq!(rule_8(remote, &local1, &local0), Ordering::Less);
assert_eq!(rule_8(remote, &local0, &local0), Ordering::Equal);
assert_eq!(rule_8(remote, &local1, &local1), Ordering::Equal);
// subnet prefix length.
let local0 = new_addr_entry([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 8);
let local1 = new_addr_entry([1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 8);
assert_eq!(rule_8(remote, &local0, &local1), Ordering::Equal);
assert_eq!(rule_8(remote, &local1, &local0), Ordering::Equal);
assert_eq!(rule_8(remote, &local0, &local0), Ordering::Equal);
assert_eq!(rule_8(remote, &local1, &local1), Ordering::Equal);
}
{
let new_addr_entry = |addr| {
Ipv6AddressEntry::<()>::new(
AddrSubnet::new(addr, 128).unwrap(),
Assigned,
AddrConfig::Manual,
)
};
assert_eq!(
select_ipv6_source_address_cmp(
remote,
dev0,
&new_addr_entry(*local0),
dev1,
&new_addr_entry(*local1),
dev2
),
Ordering::Equal
);
}
} | rust_cleaned_test_functions.jsonl/15849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
49378,
21,
10347,
6744,
368,
341,
310,
990,
9177,
1397,
79304,
310,
442,
3393,
279,
12313,
5675,
1483,
553,
1565,
1742,
49378,
21,
10347,
6744,
3989,
310,
442,
553,
25156,
7497,
1817,
12313... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f32x4_only_first_not_all() {
let x1 = f32x4::new(1.0, 2.0, 2.0, 2.0);
let x2 = f32x4::splat(1.0);
assert!(!(x1.eq(x2)).all());
} | rust_cleaned_test_functions.jsonl/43324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
18,
17,
87,
19,
18410,
12978,
7913,
5705,
368,
341,
286,
1077,
856,
16,
284,
282,
18,
17,
87,
19,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
17,
13,
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... | 1 |
#[test]
fn test_crds_value_indices() {
fn check_crds_value_indices(crds: &Crds) -> (usize, usize) {
let num_nodes = crds
.table
.values()
.filter(|value| matches!(value.value.data, CrdsData::ContactInfo(_)))
.count();
let num_votes = crds
.table
.values()
.filter(|value| matches!(value.value.data, CrdsData::Vote(_, _)))
.count();
assert_eq!(num_nodes, crds.get_nodes_contact_info().count());
assert_eq!(num_votes, crds.get_votes().count());
for vote in crds.get_votes() {
match vote.value.data {
CrdsData::Vote(_, _) => (),
_ => panic!("not a vote!"),
}
}
(num_nodes, num_votes)
}
let mut rng = thread_rng();
let keypairs: Vec<_> = repeat_with(Keypair::new).take(128).collect();
let mut crds = Crds::default();
let mut num_inserts = 0;
let mut num_overrides = 0;
for k in 0..4096 {
let keypair = &keypairs[rng.gen_range(0, keypairs.len())];
let value = VersionedCrdsValue::new_rand(&mut rng, Some(keypair));
match crds.insert_versioned(value) {
Ok(None) => {
num_inserts += 1;
}
Ok(Some(_)) => {
num_inserts += 1;
num_overrides += 1;
}
Err(_) => (),
}
if k % 64 == 0 {
check_crds_value_indices(&crds);
}
}
assert_eq!(num_inserts, crds.num_inserts);
assert!(num_inserts > 700);
assert!(num_overrides > 500);
assert!(crds.table.len() > 200);
assert!(num_inserts > crds.table.len());
let (num_nodes, num_votes) = check_crds_value_indices(&crds);
assert!(num_nodes * 3 < crds.table.len());
assert!(num_nodes > 100, "num nodes: {}", num_nodes);
assert!(num_votes > 100, "num votes: {}", num_votes);
// Remove values one by one and assert that nodes indices stay valid.
while !crds.table.is_empty() {
let index = rng.gen_range(0, crds.table.len());
let key = crds.table.get_index(index).unwrap().0.clone();
crds.remove(&key);
if crds.table.len() % 64 == 0 {
check_crds_value_indices(&crds);
}
}
} | rust_cleaned_test_functions.jsonl/94339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32331,
5356,
3142,
18333,
368,
341,
286,
5168,
1779,
32331,
5356,
3142,
18333,
38962,
5356,
25,
609,
16001,
5356,
8,
1464,
320,
51878,
11,
22301,
8,
341,
310,
1077,
1629,
14896,
284,
1560,
5356,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_revocable_fails_with_no_tails_file() {
let wallet_name = "test_create_revocable_fails_with_no_tails_file";
init!("ledger");
let data = r#"["address1","address2","zip","city","state"]"#.to_string();
let (schema_id, _) = ::utils::libindy::anoncreds::tests::create_and_write_test_schema(::utils::constants::DEFAULT_SCHEMA_ATTRS);
let did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap();
let rc = create_new_credentialdef("1".to_string(),
wallet_name.to_string(),
did,
schema_id,
"tag_1".to_string(),
r#"{"support_revocation":true}"#.to_string());
assert_eq!(rc.unwrap_err().kind(), VcxErrorKind::InvalidRevocationDetails);
} | rust_cleaned_test_functions.jsonl/64621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
38082,
509,
480,
761,
6209,
6615,
6536,
528,
6209,
2458,
368,
341,
286,
1077,
15085,
1269,
284,
330,
1944,
8657,
38082,
509,
480,
761,
6209,
6615,
6536,
528,
6209,
2458,
876,
286,
2930,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_my_greater_date() {
let my = Version::new("1.0.0-nightly.20180501T013059Z").unwrap();
let other = Version::new("1.0.0-nightly.20180201T013059Z").unwrap();
assert_eq!(my.partial_cmp(&other), Some(Ordering::Greater));
assert_eq!(my > other, true);
assert_eq!(my < other, false);
assert_eq!(my == other, false);
} | rust_cleaned_test_functions.jsonl/54499 | {
"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,
35686,
97994,
4164,
368,
341,
286,
1077,
847,
284,
6079,
486,
931,
445,
16,
13,
15,
13,
15,
44327,
398,
13,
17,
15,
16,
23,
15,
20,
15,
16,
51,
15,
16,
18,
15,
20,
24,
57,
1827,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_chain_id() {
// Test with mismatching expect_chain_id to exercise our check.
decode_expect_invalid(
// Taken from test_decode_basic.
"f86b8085e8d4a510008227109413978aee95f38490e9769c39b2773ed763d9cd5f872386f26fc10000801ba0eab47c1a49bf2fe5d40e01d313900e19ca485867d462fe06e139e3a536c6d4f4a014a569d327dcda4b29f74f93c0e9729d2f49ad726e703f9cd90dbb0fbf6649f1",
Some(5),
);
} | rust_cleaned_test_functions.jsonl/110002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
30583,
842,
368,
341,
286,
442,
3393,
448,
35301,
287,
1720,
30583,
842,
311,
10158,
1039,
1779,
624,
286,
16895,
68918,
31433,
1006,
310,
442,
55974,
504,
1273,
15227,
34729,
624,
310,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_redirect_policy_can_return_errors() {
let server = server! {
request: b"\
GET /loop HTTP/1.1\r\n\
user-agent: $USERAGENT\r\n\
accept: */*\r\n\
accept-encoding: gzip\r\n\
host: $HOST\r\n\
\r\n\
",
response: b"\
HTTP/1.1 302 Found\r\n\
Server: test\r\n\
Location: /loop\r\n\
Content-Length: 0\r\n\
\r\n\
"
};
let err = reqwest::get(&format!("http://{}/loop", server.addr())).unwrap_err();
assert!(err.is_redirect());
} | rust_cleaned_test_functions.jsonl/105514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30043,
22773,
27421,
12511,
20196,
368,
341,
262,
1077,
3538,
284,
3538,
0,
341,
286,
1681,
25,
293,
83383,
310,
7890,
608,
10498,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
310,
1196,
41935,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_192_data_256_kek() {
test_wrap_unwrap(
"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F",
"00112233445566778899AABBCCDDEEFF0001020304050607",
"A8F9BC1612C68B3FF6E6F4FBE30E71E4769C8B80A32CB8958CD5D17D6B254DA1",
);
} | rust_cleaned_test_functions.jsonl/16542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
24,
17,
1769,
62,
17,
20,
21,
45476,
74,
368,
341,
286,
1273,
38550,
4907,
10097,
1006,
310,
330,
15,
15,
15,
16,
15,
17,
15,
18,
15,
19,
15,
20,
15,
21,
15,
22,
15,
23,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_der_set_of() {
let empty = &b""[..];
let bytes = [
0x31, 0x0a, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x00,
];
let expected = DerObject::from_set(vec![
DerObject::from_int_slice(b"\x01\x00\x01"),
DerObject::from_int_slice(b"\x01\x00\x00"),
]);
fn parser(i: &[u8]) -> DerResult {
parse_der_set_of(parse_der_integer)(i)
}
assert_eq!(parser(&bytes), Ok((empty, expected)));
} | rust_cleaned_test_functions.jsonl/45876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
2602,
3575,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
2278,
286,
220,
15,
87,
18,
16,
11,
220,
15,
87,
15,
64,
11,
220,
15,
87,
15,
17,
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_filter_empty_gametype_list() {
let filter = Filter::new()
.appid(240)
.nand()
.map("de_dust2")
.gametype(&vec![])
.end();
assert_eq!(
filter.as_string(),
"\\appid\\240\\nand\\1\\map\\de_dust2"
);
} | rust_cleaned_test_functions.jsonl/4948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
15124,
1889,
309,
16214,
2019,
368,
341,
262,
1077,
4051,
284,
12339,
486,
931,
741,
286,
659,
58342,
7,
17,
19,
15,
340,
286,
659,
77,
437,
741,
286,
659,
2186,
445,
450,
814,
590,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_length_bytes() {
// Construct a sequence with a valid record followed by an
// So we can assert that we'll fail cleanly in that case.
// Added as part of Change-Id
// Ibd46ac7384c7c5e0d74cb344b48c88876c351b1a
// check during parsing that guaranteed that the length of the
Options::<_, DummyOptionsImpl>::parse(&[0x03, 0x03, 0x01, 0x03][..])
.expect_err("Can detect malformed length bytes");
} | rust_cleaned_test_functions.jsonl/43494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
5118,
12524,
368,
341,
310,
442,
18678,
264,
8500,
448,
264,
2697,
3255,
8110,
553,
458,
18574,
310,
442,
2055,
582,
646,
2060,
429,
582,
3278,
3690,
96875,
304,
429,
1142,
624,
3374,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_explorer_blocks_bounds() {
let (mut testkit, api) = init_testkit();
for _ in 0..5 {
create_sample_block(&mut testkit);
}
// Check `latest` param
let BlocksRange { blocks, range } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=10&skip_empty_blocks=true&latest=4")
.unwrap();
assert_eq!(blocks.len(), 1);
assert_eq!(blocks[0].block.height, Height(2));
assert_eq!(range.start, Height(0));
assert_eq!(range.end, Height(5));
// Check `earliest` param
let BlocksRange { blocks, range } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=10&earliest=3")
.unwrap();
assert_eq!(blocks.len(), 3);
assert_eq!(blocks[0].block.height, Height(5));
assert_eq!(range.start, Height(3));
assert_eq!(range.end, Height(6));
let BlocksRange { blocks, range } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=10&latest=4&earliest=3")
.unwrap();
assert_eq!(blocks.len(), 2);
assert_eq!(blocks[0].block.height, Height(4));
assert_eq!(range.start, Height(3));
assert_eq!(range.end, Height(5));
// Check that `count` takes precedence over `earliest`.
let BlocksRange { blocks, range } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=2&latest=4&earliest=1")
.unwrap();
assert_eq!(blocks.len(), 2);
assert_eq!(blocks[0].block.height, Height(4));
assert_eq!(range.start, Height(3));
assert_eq!(range.end, Height(5));
// Check `latest` param isn't exceed the height.
let BlocksRange { blocks, range } = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=2&latest=5")
.unwrap();
assert_eq!(blocks.len(), 2);
assert_eq!(blocks[0].block.height, Height(5));
assert_eq!(range.start, Height(4));
assert_eq!(range.end, Height(6));
// Check `latest` param is exceed the height.
let result: Result<BlocksRange, api::Error> = api
.public(ApiKind::Explorer)
.get("v1/blocks?count=2&latest=6");
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/55299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 933
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
25201,
36878,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
543,
262,
369,
716,
304,
220,
15,
496,
20,
341,
286,
1855,
17491,
7113,
2099,
6984,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_supports_text_extension() {
assert_eq!(true, TextIndexer.supports_extension(OsStr::new("txt")));
assert_eq!(false, TextIndexer.supports_extension(OsStr::new("png")));
} | rust_cleaned_test_functions.jsonl/44235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25827,
82,
4326,
31035,
368,
341,
286,
2060,
10714,
10297,
1866,
11,
2918,
1552,
261,
9397,
82,
31035,
19238,
82,
2580,
486,
931,
445,
8586,
17621,
286,
2060,
10714,
10297,
3849,
11,
2918,
1552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bank_hash_internal_state_verify() {
solana_logger::setup();
let (genesis_config, mint_keypair) = create_genesis_config(2_000);
let bank0 = Bank::new(&genesis_config);
let pubkey = Pubkey::new_rand();
info!("transfer 0 {} mint: {}", pubkey, mint_keypair.pubkey());
bank0.transfer(1_000, &mint_keypair, &pubkey).unwrap();
let bank0_state = bank0.hash_internal_state();
let bank0 = Arc::new(bank0);
// Checkpointing should result in a new state while freezing the parent
let bank2 = new_from_parent(&bank0);
assert_ne!(bank0_state, bank2.hash_internal_state());
// Checkpointing should modify the checkpoint's state when freezed
assert_ne!(bank0_state, bank0.hash_internal_state());
// Checkpointing should never modify the checkpoint's state once frozen
let bank0_state = bank0.hash_internal_state();
assert!(bank2.verify_hash_internal_state());
let bank3 = new_from_parent(&bank0);
assert_eq!(bank0_state, bank0.hash_internal_state());
assert!(bank2.verify_hash_internal_state());
assert!(bank3.verify_hash_internal_state());
let pubkey2 = Pubkey::new_rand();
info!("transfer 2 {}", pubkey2);
bank2.transfer(10, &mint_keypair, &pubkey2).unwrap();
assert!(bank2.verify_hash_internal_state());
assert!(bank3.verify_hash_internal_state());
} | rust_cleaned_test_functions.jsonl/42399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
8950,
23472,
4387,
35638,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
17,
62,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_capacity_zero() {
let mut ll = LinkedList::<u8>::with_capacity(0);
assert_eq!(ll.len(), 0);
assert_eq!(ll.capacity(), 0);
for _ in 0..5 {
ll.push_head(11);
}
assert_eq!(ll.len(), 5);
assert_eq!(ll.capacity(), 5);
for _ in 0..3 {
ll.pop_tail();
}
assert_eq!(ll.len(), 2);
assert_eq!(ll.capacity(), 5);
} | rust_cleaned_test_functions.jsonl/59886 | {
"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,
35603,
19359,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
4197,
35603,
7,
15,
317,
286,
2060,
10714,
10297,
654,
19406,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
654,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse() {
assert_eq!(
parse(SAMPLE).collect::<Vec<_>>(),
vec!(
PasswordValidator {
number_1: 1,
number_2: 3,
character: 'a',
password: "abcde".into()
},
PasswordValidator {
number_1: 1,
number_2: 3,
character: 'b',
password: "cdefg".into()
},
PasswordValidator {
number_1: 2,
number_2: 9,
character: 'c',
password: "ccccccccc".into()
}
)
);
} | rust_cleaned_test_functions.jsonl/64676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
3759,
18918,
568,
17384,
27638,
10050,
32399,
2452,
3148,
310,
7486,
33673,
394,
12362,
14256,
341,
503,
1372,
62,
16,
25,
220,
16,
345,
503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expect_start_object() {
assert_eq!(
Err(Error::new(
ErrorReason::Custom("expected StartObject".into()),
Some(2)
)),
expect_start_object(value_bool(2, true))
);
assert_eq!(Ok(()), expect_start_object(start_object(0)));
} | rust_cleaned_test_functions.jsonl/58152 | {
"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,
68918,
4906,
5314,
368,
341,
286,
2060,
10714,
33673,
310,
15495,
37396,
486,
931,
1006,
394,
4600,
25139,
486,
10268,
445,
7325,
5145,
1190,
3263,
18122,
14702,
394,
4329,
7,
17,
340,
310,
39290,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_domain_type_object_option() {
let ty = DomainType {
annotation: Default::default(),
id: "ty".to_string(),
r#type: Type::Object(vec![
Property {
annotation: Default::default(),
name: "string".into(),
r#type: Type::Option(Box::new(Type::String)),
},
Property {
annotation: Default::default(),
name: "integer".into(),
r#type: Type::Option(Box::new(Type::Integer)),
},
Property {
annotation: Default::default(),
name: "number".into(),
r#type: Type::Option(Box::new(Type::Number)),
},
Property {
annotation: Default::default(),
name: "boolean".into(),
r#type: Type::Option(Box::new(Type::Boolean)),
},
Property {
annotation: Default::default(),
name: "binary".into(),
r#type: Type::Option(Box::new(Type::Binary)),
},
Property {
annotation: Default::default(),
name: "any".into(),
r#type: Type::Option(Box::new(Type::Any)),
},
Property {
annotation: Default::default(),
name: "enum".into(),
r#type: Type::Option(Box::new(Type::EnumString(vec![]))),
},
Property {
annotation: Default::default(),
name: "array".into(),
r#type: Type::Option(Box::new(Type::Array(Box::new(Type::String)))),
},
Property {
annotation: Default::default(),
name: "ref".into(),
r#type: Type::Option(Box::new(Type::Ref("baz".to_string()))),
},
]),
};
let prog = Context::new_root(&Default::default())
.with_domain("foo")
.render_with(&ty);
let expect = quote! {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TyEnum {
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Ty {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "string")]
r#string: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "integer")]
r#integer: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "number")]
r#number: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "boolean")]
r#boolean: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "binary")]
r#binary: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "any")]
r#any: Option<JsonValue>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "enum")]
r#enum: Option<TyEnum>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "array")]
r#array: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "ref")]
r#ref: Box<Option<Baz>>,
}
impl Ty {
pub fn builder() -> TyBuilder {
Default::default()
}
pub fn r#string(&self) -> Option<&String> {
self.r#string.as_ref()
}
pub fn r#integer(&self) -> Option<&u32> {
self.r#integer.as_ref()
}
pub fn r#number(&self) -> Option<&f64> {
self.r#number.as_ref()
}
pub fn r#boolean(&self) -> Option<&bool> {
self.r#boolean.as_ref()
}
pub fn r#binary(&self) -> Option<&String> {
self.r#binary.as_ref()
}
pub fn r#any(&self) -> Option<&JsonValue> {
self.r#any.as_ref()
}
pub fn r#enum(&self) -> Option<&TyEnum> {
self.r#enum.as_ref()
}
pub fn r#array(&self) -> Option<&Vec<String>> {
self.r#array.as_ref()
}
pub fn r#ref(&self) -> Option<&Baz> {
(&*self.r#ref).as_ref()
}
}
#[derive(Debug, Clone)]
pub struct TyBuilder {
r#string: Option<String>,
r#integer: Option<u32>,
r#number: Option<f64>,
r#boolean: Option<bool>,
r#binary: Option<String>,
r#any: Option<JsonValue>,
r#enum: Option<TyEnum>,
r#array: Option<Vec<String>>,
r#ref: Option<Baz>,
}
impl Default for TyBuilder {
fn default() -> Self {
Self {
r#string: None as Option<String>,
r#integer: None as Option<u32>,
r#number: None as Option<f64>,
r#boolean: None as Option<bool>,
r#binary: None as Option<String>,
r#any: None as Option<JsonValue>,
r#enum: None as Option<TyEnum>,
r#array: None as Option<Vec<String>>,
r#ref: None as Option<Baz>,
}
}
}
impl TyBuilder {
pub fn r#string(&mut self, v: String) -> &mut Self {
self.r#string = Some(v);
self
}
pub fn r#integer(&mut self, v: u32) -> &mut Self {
self.r#integer = Some(v);
self
}
pub fn r#number(&mut self, v: f64) -> &mut Self {
self.r#number = Some(v);
self
}
pub fn r#boolean(&mut self, v: bool) -> &mut Self {
self.r#boolean = Some(v);
self
}
pub fn r#binary(&mut self, v: String) -> &mut Self {
self.r#binary = Some(v);
self
}
pub fn r#any(&mut self, v: JsonValue) -> &mut Self {
self.r#any = Some(v);
self
}
pub fn r#enum(&mut self, v: TyEnum) -> &mut Self {
self.r#enum = Some(v);
self
}
pub fn r#array(&mut self, v: Vec<String>) -> &mut Self {
self.r#array = Some(v);
self
}
pub fn r#ref(&mut self, v: Baz) -> &mut Self {
self.r#ref = Some(v);
self
}
pub fn build(&mut self) -> Result<Ty, &'static str> {
let r#string = self.r#string.take();
let r#integer = self.r#integer.take();
let r#number = self.r#number.take();
let r#boolean = self.r#boolean.take();
let r#binary = self.r#binary.take();
let r#any = self.r#any.take();
let r#enum = self.r#enum.take();
let r#array = self.r#array.take();
let r#ref = self.r#ref.take();
Ok(Ty {
r#string,
r#integer,
r#number,
r#boolean,
r#binary,
r#any,
r#enum,
r#array,
r#ref: Box::new(r#ref),
})
}
}
};
assert_eq(&prog, &expect);
} | rust_cleaned_test_functions.jsonl/26908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20111,
1819,
5314,
9672,
368,
341,
262,
1077,
13580,
284,
21070,
929,
341,
286,
21223,
25,
7899,
486,
2258,
3148,
286,
877,
25,
330,
1881,
3263,
983,
3904,
3148,
286,
435,
2,
1313,
25,
3990,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_conditional() {
const FORMAT_STR: &str = "($some ($none)) and ($none ($some))";
let formatter = StringFormatter::new(FORMAT_STR)
.unwrap()
.map(|var| match var {
"some" => Some(Ok("$some")),
_ => None,
});
let result = formatter.parse(None).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, "$some", None);
match_next!(result_iter, " ", None);
match_next!(result_iter, " and ", None);
match_next!(result_iter, " ", None);
match_next!(result_iter, "$some", None);
} | rust_cleaned_test_functions.jsonl/71890 | {
"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,
66279,
24433,
3005,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
699,
14689,
1711,
6697,
593,
323,
1711,
6697,
1711,
14689,
593,
3302,
286,
1077,
24814,
284,
923,
14183,
486,
931,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_attributes_ref_with_wrong_type_fails() {
let storage = PerAttributeVecPointStorage::new(TestPointType::layout());
attributes_ref!(
&attributes::INTENSITY => u32,
&attributes::GPS_TIME => f32,
&storage
);
} | rust_cleaned_test_functions.jsonl/73953 | {
"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,
18240,
7793,
6615,
75198,
1819,
761,
6209,
368,
341,
286,
1077,
5819,
284,
3616,
3907,
10050,
2609,
5793,
486,
931,
31159,
2609,
929,
486,
8399,
1423,
286,
8201,
7793,
33673,
310,
609,
12340,
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_init_epoch_reward() {
let cellbase = TransactionBuilder::default()
.witness(Bytes::default())
.build();
let epoch_ext = build_genesis_epoch_ext(
capacity_bytes!(100),
DIFF_TWO,
GENESIS_EPOCH_LENGTH,
DEFAULT_EPOCH_DURATION_TARGET,
);
let genesis = BlockBuilder::default().transaction(cellbase).build();
let consensus = ConsensusBuilder::new(genesis, epoch_ext)
.initial_primary_epoch_reward(capacity_bytes!(100))
.build();
assert_eq!(capacity_bytes!(100), consensus.initial_primary_epoch_reward);
} | rust_cleaned_test_functions.jsonl/73437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
20682,
38260,
368,
341,
286,
1077,
2779,
3152,
284,
17869,
3297,
486,
2258,
741,
310,
659,
86,
8091,
76423,
486,
2258,
2398,
310,
659,
5834,
543,
286,
1077,
16342,
9927,
284,
1936,
16322,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_precompile_addresses() {
assert_eq!(super::secp256k1::ECRecover::ADDRESS, u8_to_address(1));
assert_eq!(super::hash::SHA256::ADDRESS, u8_to_address(2));
assert_eq!(super::hash::RIPEMD160::ADDRESS, u8_to_address(3));
assert_eq!(super::identity::Identity::ADDRESS, u8_to_address(4));
assert_eq!(super::ModExp::<Byzantium>::ADDRESS, u8_to_address(5));
assert_eq!(super::Bn128Add::<Istanbul>::ADDRESS, u8_to_address(6));
assert_eq!(super::Bn128Mul::<Istanbul>::ADDRESS, u8_to_address(7));
assert_eq!(super::Bn128Pair::<Istanbul>::ADDRESS, u8_to_address(8));
assert_eq!(super::blake2::Blake2F::ADDRESS, u8_to_address(9));
} | rust_cleaned_test_functions.jsonl/17121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
20433,
59471,
368,
341,
286,
2060,
10714,
10297,
9522,
486,
325,
4672,
17,
20,
21,
74,
16,
486,
7498,
693,
3688,
486,
61005,
11,
575,
23,
2346,
6744,
7,
16,
1106,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kube_user() -> io::Result<()> {
let dir = tempfile::tempdir()?;
let filename = dir.path().join("config");
let mut file = File::create(&filename)?;
file.write_all(
b"
apiVersion: v1
clusters: []
contexts:
- context:
cluster: test_cluster
user: test_user
namespace: test_namespace
name: test_context
current-context: test_context
kind: Config
preferences: {}
users: []
",
)?;
file.sync_all()?;
let actual = ModuleRenderer::new("kubernetes")
.path(dir.path())
.env("KUBECONFIG", filename.to_string_lossy().as_ref())
.config(toml::toml! {
[kubernetes]
format = "($user)"
disabled = false
})
.collect();
let expected = Some("test_user".to_string());
assert_eq!(expected, actual);
dir.close()
} | rust_cleaned_test_functions.jsonl/41181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
3760,
3317,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5419,
284,
54819,
486,
3888,
3741,
368,
69493,
286,
1077,
3899,
284,
5419,
3875,
1005,
5987,
445,
1676,
3071,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_unescape() {
let xml = r#"<abc attr=""val""><Text&'></abc>
<![CDATA[<&>]]>
<!-- <& cmt -->
<!DOCTYPE &>
<?<&?>"#;
let mut opts = ReadOptions::default();
opts.require_decl = false;
let doc = Document::parse_str_with_opts(xml, opts).unwrap();
let abc = doc.root_element().unwrap();
assert_eq!(abc.attribute(&doc, "attr"), Some("\"val\""));
let text = &abc.children(&doc)[0];
assert!(matches!(text, Node::Text(_)));
assert_eq!(text.text_content(&doc), "<Text&'>");
let cdata = &doc.root_nodes()[1];
assert!(matches!(cdata, Node::CData(_)));
assert_eq!(cdata.text_content(&doc), "<&>");
let comment = &doc.root_nodes()[2];
if let Node::Comment(cmt) = comment {
assert_eq!(cmt, " <& cmt ");
} else {
assert!(false);
}
let doctype = &doc.root_nodes()[3];
if let Node::DocType(doc) = doctype {
assert_eq!(doc, "&");
} else {
assert!(false);
}
let pi = &doc.root_nodes()[4];
assert!(matches!(pi, Node::PI(_)));
assert_eq!(pi.text_content(&doc), "<&");
} | rust_cleaned_test_functions.jsonl/74417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12998,
368,
341,
262,
1077,
8396,
284,
435,
2,
22476,
13683,
6376,
428,
5,
13492,
26,
831,
28760,
12350,
5,
4832,
26,
1178,
27066,
8009,
30415,
8009,
5178,
11347,
13683,
397,
262,
58144,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_spec() {
assert_eq!(spec(&b"#include <foo>"[..]),
Done(&b""[..], vec!()));
assert_eq!(spec(&b"// hello\n#include <foo>"[..]),
Done(&b""[..], vec!()));
assert_eq!(spec(&b"#include <foo>\ntypedef int foo;"[..]),
Done(&b""[..], vec!(Defn::typesyn("foo", Type::Int))));
assert_eq!(spec(&br#"
/* test file */
#define foo bar
const mip = 123;
% passthrough
typedef int foo;
struct bar {
int a;
int b;
};
#include "other"
enum bop { a = 2, b = 1 };
"#[..]),
Done(&b""[..],
vec!(Defn::constant("mip", 123),
Defn::typesyn("foo", Type::Int),
Defn::typespec("bar", Type::Struct(vec!(Decl::named("a", Type::Int),
Decl::named("b", Type::Int)))),
Defn::typespec("bop", Type::Enum(vec!(EnumDefn::new("a", Some(Value::Const(2))),
EnumDefn::new("b", Some(Value::Const(1)))))))));
} | rust_cleaned_test_functions.jsonl/11379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13594,
368,
341,
262,
2060,
10714,
10297,
9535,
2099,
65,
57676,
997,
366,
7975,
9877,
95874,
17036,
2290,
27357,
2099,
65,
3014,
95874,
1125,
7486,
0,
25138,
262,
2060,
10714,
10297,
9535,
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_syntax_update() {
let cache = InMemoryCache::new();
cache.update(&RoleDelete {
guild_id: GuildId(0),
role_id: RoleId(1),
});
} | rust_cleaned_test_functions.jsonl/86439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78894,
8882,
368,
341,
286,
1077,
6500,
284,
758,
10642,
8233,
486,
931,
543,
286,
6500,
5317,
2099,
9030,
6435,
341,
310,
26411,
842,
25,
32492,
764,
7,
15,
1326,
310,
3476,
842,
25,
15404,
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 |
#[test]
fn test_merge_maturity_of_neuron() {
let (driver, mut gov, neuron) = create_mature_neuron(false);
let id = neuron.id.clone().unwrap();
let controller = neuron.controller.unwrap();
let neuron_stake_e8s = neuron.cached_neuron_stake_e8s;
let account = AccountIdentifier::new(
ic_base_types::PrincipalId::from(GOVERNANCE_CANISTER_ID),
Some(Subaccount::try_from(neuron.account.as_slice()).unwrap()),
);
let account_balance = driver
.account_balance(account)
.now_or_never()
.unwrap()
.unwrap()
.get_e8s();
assert_eq!(neuron_stake_e8s, account_balance);
{
let maturity = 25_000_000;
let neuron = gov.get_neuron_mut(&id).unwrap();
neuron.maturity_e8s_equivalent = maturity;
}
// Assert that maturity can't be merged by someone who doesn't control the
// neuron
assert!(merge_maturity(&mut gov, id.clone(), &*TEST_NEURON_2_OWNER_PRINCIPAL, 10).is_err());
assert!(merge_maturity(&mut gov, id.clone(), &controller, 0).is_err());
assert!(merge_maturity(&mut gov, id.clone(), &controller, 250).is_err());
assert_merge_maturity_executes_as_expected(
&mut gov,
id.clone(),
&controller,
10,
2_500_000,
&driver,
);
assert_merge_maturity_executes_as_expected(
&mut gov,
id.clone(),
&controller,
50,
11_250_000,
&driver,
);
assert_merge_maturity_executes_as_expected(
&mut gov,
id.clone(),
&controller,
100,
11_250_000,
&driver,
);
// Assert that merging a neuron with no maturity fails
assert!(merge_maturity(&mut gov, id, &controller, 10).is_err());
} | rust_cleaned_test_functions.jsonl/1183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 848
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
717,
37854,
3575,
13925,
36090,
368,
341,
262,
1077,
320,
12521,
11,
5206,
47625,
11,
48284,
8,
284,
1855,
717,
1568,
13925,
36090,
3576,
626,
262,
1077,
877,
284,
48284,
1764,
15997,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_guild() {
let value = Guild {
afk_channel_id: Some(ChannelId(2)),
afk_timeout: 900,
application_id: Some(ApplicationId(3)),
approximate_member_count: Some(1_200),
approximate_presence_count: Some(900),
banner: Some("banner hash".to_owned()),
channels: Vec::new(),
default_message_notifications: DefaultMessageNotificationLevel::Mentions,
description: Some("a description".to_owned()),
discovery_splash: Some("discovery splash hash".to_owned()),
emojis: Vec::new(),
explicit_content_filter: ExplicitContentFilter::MembersWithoutRole,
features: vec!["a feature".to_owned()],
icon: Some("icon hash".to_owned()),
id: GuildId(1),
joined_at: Some("timestamp".to_owned()),
large: true,
max_members: Some(25_000),
max_presences: Some(10_000),
max_video_channel_users: Some(10),
member_count: Some(12_000),
members: Vec::new(),
mfa_level: MfaLevel::Elevated,
name: "the name".to_owned(),
nsfw_level: NSFWLevel::Default,
owner_id: UserId(5),
owner: Some(false),
permissions: Some(Permissions::SEND_MESSAGES),
preferred_locale: "en-us".to_owned(),
premium_subscription_count: Some(3),
premium_tier: PremiumTier::Tier1,
presences: Vec::new(),
roles: Vec::new(),
rules_channel_id: Some(ChannelId(6)),
splash: Some("splash hash".to_owned()),
stage_instances: Vec::new(),
system_channel_flags: SystemChannelFlags::SUPPRESS_PREMIUM_SUBSCRIPTIONS,
system_channel_id: Some(ChannelId(7)),
unavailable: false,
vanity_url_code: Some("twilight".to_owned()),
verification_level: VerificationLevel::Medium,
voice_states: Vec::new(),
widget_channel_id: Some(ChannelId(8)),
widget_enabled: Some(true),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "Guild",
len: 43,
},
Token::Str("afk_channel_id"),
Token::Some,
Token::NewtypeStruct { name: "ChannelId" },
Token::Str("2"),
Token::Str("afk_timeout"),
Token::U64(900),
Token::Str("application_id"),
Token::Some,
Token::NewtypeStruct {
name: "ApplicationId",
},
Token::Str("3"),
Token::Str("approximate_member_count"),
Token::Some,
Token::U64(1_200),
Token::Str("approximate_presence_count"),
Token::Some,
Token::U64(900),
Token::Str("banner"),
Token::Some,
Token::Str("banner hash"),
Token::Str("channels"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("default_message_notifications"),
Token::U8(1),
Token::Str("description"),
Token::Some,
Token::Str("a description"),
Token::Str("discovery_splash"),
Token::Some,
Token::Str("discovery splash hash"),
Token::Str("emojis"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("explicit_content_filter"),
Token::U8(1),
Token::Str("features"),
Token::Seq { len: Some(1) },
Token::Str("a feature"),
Token::SeqEnd,
Token::Str("icon"),
Token::Some,
Token::Str("icon hash"),
Token::Str("id"),
Token::NewtypeStruct { name: "GuildId" },
Token::Str("1"),
Token::Str("joined_at"),
Token::Some,
Token::Str("timestamp"),
Token::Str("large"),
Token::Bool(true),
Token::Str("max_members"),
Token::Some,
Token::U64(25_000),
Token::Str("max_presences"),
Token::Some,
Token::U64(10_000),
Token::Str("max_video_channel_users"),
Token::Some,
Token::U64(10),
Token::Str("member_count"),
Token::Some,
Token::U64(12_000),
Token::Str("members"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("mfa_level"),
Token::U8(1),
Token::Str("name"),
Token::Str("the name"),
Token::Str("nsfw_level"),
Token::U8(0),
Token::Str("owner_id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("5"),
Token::Str("owner"),
Token::Some,
Token::Bool(false),
Token::Str("permissions"),
Token::Some,
Token::Str("2048"),
Token::Str("preferred_locale"),
Token::Str("en-us"),
Token::Str("premium_subscription_count"),
Token::Some,
Token::U64(3),
Token::Str("premium_tier"),
Token::U8(1),
Token::Str("presences"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("roles"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("rules_channel_id"),
Token::Some,
Token::NewtypeStruct { name: "ChannelId" },
Token::Str("6"),
Token::Str("splash"),
Token::Some,
Token::Str("splash hash"),
Token::Str("system_channel_flags"),
Token::U64(2),
Token::Str("system_channel_id"),
Token::Some,
Token::NewtypeStruct { name: "ChannelId" },
Token::Str("7"),
Token::Str("unavailable"),
Token::Bool(false),
Token::Str("vanity_url_code"),
Token::Some,
Token::Str("twilight"),
Token::Str("verification_level"),
Token::U8(2),
Token::Str("voice_states"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("widget_channel_id"),
Token::Some,
Token::NewtypeStruct { name: "ChannelId" },
Token::Str("8"),
Token::Str("widget_enabled"),
Token::Some,
Token::Bool(true),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/130705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
1498,
368,
341,
286,
1077,
897,
284,
32492,
341,
310,
7977,
74,
14571,
842,
25,
4329,
68420,
764,
7,
17,
6965,
310,
7977,
74,
20537,
25,
220,
24,
15,
15,
345,
310,
3766,
842,
25,
4329,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix_multiplication2() {
let matrix1x2 = Matrix1x2::new(4_i32, 5_i32);
let vector = Vector2::new(9_i32, 6_i32);
let expected = Vector1::new(66_i32);
let result = matrix1x2 * vector;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
91802,
1693,
17,
368,
341,
286,
1077,
6172,
16,
87,
17,
284,
11631,
16,
87,
17,
486,
931,
7,
19,
5318,
18,
17,
11,
220,
20,
5318,
18,
17,
317,
286,
1077,
4621,
284,
4196,
17,
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_map_range() {
let array = [(1, "a"), (5, "e"), (3, "c"), (7, "g"), (9, "i")];
let map = SgMap::from(array);
let range = 3..8;
let keys: Vec<_> = map.range(range.clone()).collect();
assert!(keys.windows(2).all(|w| w[0] < w[1]));
assert!(keys.iter().all(|(x, _)| range.contains(*x)));
} | rust_cleaned_test_functions.jsonl/18655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
9698,
368,
341,
262,
1077,
1334,
284,
17826,
16,
11,
330,
64,
3975,
320,
20,
11,
330,
68,
3975,
320,
18,
11,
330,
66,
3975,
320,
22,
11,
330,
70,
3975,
320,
24,
11,
330,
72,
899,
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_config() {
let input = r#"
(defwidget bar [arg arg2]
(foo :arg "hi"))
(defvar some_var "bla")
(defpoll stuff :interval "12s" "date")
(deflisten stuff "tail -f stuff")
(defwindow some-window
:stacking "fg"
:monitor 12
:resizable true
:geometry (geometry :width "12%" :height "20px")
:reserve (struts :side "left" :distance "30px")
(bar :arg "bla"))
"#;
let mut files = YuckFiles::new();
let (span, asts) = files.load_str("config.yuck".to_string(), input.to_string()).unwrap();
let config = Config::generate(&mut files, asts);
insta::with_settings!({sort_maps => true}, {
insta::assert_ron_snapshot!(config.unwrap());
});
} | rust_cleaned_test_functions.jsonl/75157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
368,
341,
262,
1077,
1946,
284,
435,
2,
698,
286,
320,
750,
9797,
3619,
508,
858,
1392,
17,
921,
310,
320,
7975,
549,
858,
330,
6023,
5455,
286,
320,
750,
947,
1045,
4612,
330,
64726,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_into_public_key_credential_type() {
let cbor_credential_type = cbor_text!("public-key");
let credential_type = PublicKeyCredentialType::try_from(&cbor_credential_type);
let expected_credential_type = PublicKeyCredentialType::PublicKey;
assert_eq!(credential_type, Ok(expected_credential_type));
let created_cbor: cbor::Value = credential_type.unwrap().into();
assert_eq!(created_cbor, cbor_credential_type);
let cbor_unknown_type = cbor_text!("unknown-type");
let unknown_type = PublicKeyCredentialType::try_from(&cbor_unknown_type);
let expected_unknown_type = PublicKeyCredentialType::Unknown;
assert_eq!(unknown_type, Ok(expected_unknown_type));
} | rust_cleaned_test_functions.jsonl/51444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
27074,
3097,
666,
30320,
1819,
368,
341,
286,
1077,
272,
9368,
666,
30320,
1819,
284,
272,
9368,
4326,
17223,
888,
16173,
797,
286,
1077,
40207,
1819,
284,
70280,
48265,
929,
486,
153... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_public_connection_limit() {
::libra_logger::Logger::new().environment_only(true).init();
let mut rt = Runtime::new().unwrap();
let mut seed_peers: HashMap<PeerId, Vec<NetworkAddress>> = HashMap::new();
let mut eligible_peers: HashMap<PeerId, PublicKey> = HashMap::new();
for _ in 0..MAX_TEST_CONNECTIONS + 1 {
let (peer_id, addr, key) = generate_peer_with_addr();
eligible_peers.insert(peer_id, key);
seed_peers.insert(peer_id, vec![addr]);
}
info!("Seed peers are {:?}", eligible_peers);
let network_context = NetworkContext::new(
NetworkId::vfn_network(),
RoleType::FullNode,
PeerId::random(),
);
let (mut connection_reqs_rx, mut connection_notifs_tx, mut conn_mgr_reqs_tx, mut ticker_tx) =
setup_conn_mgr_with_context(network_context, &mut rt, eligible_peers, seed_peers);
// Fake peer manager and discovery.
let f_peer_mgr = async move {
// Peer manager receives a request to connect to the other peer.
info!("Waiting to receive dial request");
expect_num_dials(
&mut connection_reqs_rx,
&mut connection_notifs_tx,
&mut conn_mgr_reqs_tx,
MAX_TEST_CONNECTIONS,
)
.await;
// Queue should be empty
let queue_size = get_dial_queue_size(&mut conn_mgr_reqs_tx).await;
assert_eq!(0, queue_size);
// Trigger connectivity check.
info!("Sending tick to trigger connectivity check");
ticker_tx.send(()).await.unwrap();
info!("Check queue size");
let queue_size = get_dial_queue_size(&mut conn_mgr_reqs_tx).await;
assert_eq!(0, queue_size);
};
rt.block_on(f_peer_mgr);
} | rust_cleaned_test_functions.jsonl/114931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 790
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
15866,
14763,
368,
341,
262,
3504,
2740,
956,
27413,
486,
7395,
486,
931,
1005,
23294,
18410,
3715,
568,
2327,
543,
262,
1077,
5206,
16677,
284,
10954,
486,
931,
1005,
15454,
543,
262,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_struct_count_newtype() {
let input = b"\x02\x12\x34";
let res = S2::parse(input);
assert_eq!(
res,
Ok((
&input[3..],
S2 {
a: 2,
b: vec![NewType(0x12), NewType(0x34)]
}
))
);
} | rust_cleaned_test_functions.jsonl/18969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
3180,
5921,
1313,
368,
341,
262,
1077,
1946,
284,
293,
11934,
87,
15,
17,
3462,
16,
17,
3462,
18,
19,
876,
262,
1077,
592,
284,
328,
17,
486,
6400,
5384,
317,
262,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_finish() {
use std::io::Write;
let mut z = setup_try_finish();
z.get_mut().set_ops(iter::repeat(PartialOp::Unlimited));
z.flush().unwrap();
let buf = match z.try_finish() {
Ok(buf) => buf.into_inner(),
Err((_z, e)) => panic!("try_finish failed with {:?}", e),
};
// Make sure the multiple try_finish calls didn't screw up the internal
// buffer and continued to produce valid compressed data.
assert_eq!(&decode_all(&buf[..]).unwrap(), b"hello", "Error decoding");
} | rust_cleaned_test_functions.jsonl/134367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
42980,
368,
341,
262,
990,
1460,
486,
815,
486,
7985,
280,
262,
1077,
5206,
1147,
284,
6505,
53283,
42980,
1428,
262,
1147,
670,
29523,
1005,
746,
21959,
27070,
486,
30624,
5304,
20894,
712... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_object_identifier_from_string() {
for val in &[
"",
"1",
"3.10",
"1.50",
"2.12.a3.4",
"a.4",
"1.a",
".2.5",
"2..5",
"2.5.",
] {
assert_eq!(ObjectIdentifier::from_string(val), None);
}
for val in &[
"2.5",
"2.5.2",
"1.2.840.113549",
"1.2.3.4",
"1.2.840.133549.1.1.5",
"2.100.3",
] {
assert!(ObjectIdentifier::from_string(val).is_some());
}
} | rust_cleaned_test_functions.jsonl/94204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
33176,
5673,
3904,
368,
341,
286,
369,
1044,
304,
609,
9640,
310,
8324,
310,
330,
16,
756,
310,
330,
18,
13,
16,
15,
756,
310,
330,
16,
13,
20,
15,
756,
310,
330,
17,
13,
16,
17,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_push_value_success() {
let size = 2;
let mut stack = super::Stack::init(size);
assert_eq!(stack.push(String::from("a")), true);
stack.push(String::from("a"));
let mut items: (Vec<String>) = Vec::with_capacity(size);
items.push(String::from("a"));
items.push(String::from("a"));
assert_eq!(stack.items, items);
} | rust_cleaned_test_functions.jsonl/70593 | {
"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,
14218,
3142,
18632,
368,
341,
262,
1077,
1379,
284,
220,
17,
280,
262,
1077,
5206,
5611,
284,
2256,
486,
4336,
486,
2327,
6856,
317,
262,
2060,
10714,
10297,
7693,
2552,
2242,
486,
1499,
445,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normalized_network() {
let dir = tempdir().unwrap();
fs::create_dir_all(dir.path().join(".shuffle")).unwrap();
let home = Home::new(dir.path()).unwrap();
home.write_default_networks_config_into_toml_if_nonexistent()
.unwrap();
let url_from_some = normalized_network_url(&home, Some("localhost".to_string())).unwrap();
let url_from_none = normalized_network_url(&home, None).unwrap();
let correct_url = Url::from_str("http://127.0.0.1:8080").unwrap();
assert_eq!(url_from_some, correct_url);
assert_eq!(url_from_none, correct_url);
} | rust_cleaned_test_functions.jsonl/39534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80006,
20966,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
8619,
486,
3182,
4334,
5705,
14161,
3875,
1005,
5987,
5680,
65355,
15197,
15454,
543,
286,
1077,
2114,
284,
5379,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hunk_header_style_with_file_no_frag() {
let config = integration_test_utils::make_config_from_args(&[
"--hunk-header-file-style",
"yellow",
"--hunk-header-style",
"file line-number red",
"--hunk-header-decoration-style",
"box",
]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK_NO_FRAG, &config);
ansi_test_utils::assert_line_has_style(&output, 5, "src/delta.rs:1: ", "yellow", &config);
let output = strip_ansi_codes(&output);
assert!(output.contains(
"
────────────────┐
src/delta.rs:1: │
────────────────┘
"
));
} | rust_cleaned_test_functions.jsonl/70086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
3122,
8757,
15117,
6615,
2458,
6536,
80817,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
9640,
310,
14482,
71,
3122,
9351,
14203,
11297,
756,
310,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitvec() {
let mut b = BitVec::from_elem(14, false);
b.set(11, true);
b.set(4, true);
b.push(true);
b.push(true);
assert_write_check_read(b, 8);
} | rust_cleaned_test_functions.jsonl/118838 | {
"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,
13996,
4083,
368,
341,
262,
1077,
5206,
293,
284,
6495,
10050,
486,
1499,
28179,
7,
16,
19,
11,
895,
317,
262,
293,
980,
7,
16,
16,
11,
830,
317,
262,
293,
980,
7,
19,
11,
830,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_panic_bad_message() {
fn f() {
panic!("an error message");
}
let expected = "foobar";
let failed_msg = "Panic did not include expected string";
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_panic: ShouldPanic::YesWithMessage(expected),
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, tx);
let (_, res, _) = rx.recv().unwrap();
assert!(res == TrFailedMsg(format!("{} '{}'", failed_msg, expected)));
} | rust_cleaned_test_functions.jsonl/3486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
620,
31270,
34199,
6462,
368,
341,
286,
5168,
282,
368,
341,
310,
21975,
17223,
276,
1465,
1943,
797,
286,
456,
286,
1077,
3601,
284,
330,
50267,
876,
286,
1077,
4641,
6483,
284,
330,
47,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_join_accept_payload() {
let bytes = &phy_join_accept_payload()[1..13];
assert!(JoinAcceptPayload::new(&bytes[1..]).is_none());
assert!(JoinAcceptPayload::new(bytes).is_some());
let ja = JoinAcceptPayload::new(bytes).unwrap();
assert_eq!(ja.c_f_list(), Vec::new());
} | rust_cleaned_test_functions.jsonl/81592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
31017,
35728,
32813,
368,
341,
262,
1077,
5820,
284,
609,
12700,
31017,
35728,
32813,
10116,
16,
496,
16,
18,
4821,
262,
2060,
10297,
12292,
16646,
29683,
486,
931,
2099,
9651,
58,
16,
496,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_username() {
assert!(username("aa"));
assert!(username("a".repeat(32)));
assert!(!username("a"));
assert!(!username("a".repeat(33)));
} | rust_cleaned_test_functions.jsonl/29960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21588,
368,
341,
286,
2060,
10297,
5113,
445,
5305,
4010,
286,
2060,
10297,
5113,
445,
64,
3263,
30624,
7,
18,
17,
22525,
286,
2060,
0,
3471,
5113,
445,
64,
4010,
286,
2060,
0,
3471,
5113,
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 |
#[test]
fn test_rewind_range_proof() {
let keychain = ExtKeychain::from_random_seed(true).unwrap();
let key_id = ExtKeychain::derive_key_id(1, 1, 0, 0, 0);
let key_id2 = ExtKeychain::derive_key_id(1, 2, 0, 0, 0);
let commit = keychain.commit(5, &key_id).unwrap();
let extra_data = [99u8; 64];
let proof = proof::create(
&keychain,
5,
&key_id,
commit,
Some(extra_data.to_vec().clone()),
)
.unwrap();
let proof_info =
proof::rewind(&keychain, commit, Some(extra_data.to_vec().clone()), proof).unwrap();
assert_eq!(proof_info.success, true);
assert_eq!(proof_info.value, 5);
assert_eq!(proof_info.message.as_bytes(), key_id.serialize_path());
// cannot rewind with a different commit
let commit2 = keychain.commit(5, &key_id2).unwrap();
let proof_info =
proof::rewind(&keychain, commit2, Some(extra_data.to_vec().clone()), proof).unwrap();
assert_eq!(proof_info.success, false);
assert_eq!(proof_info.value, 0);
assert_eq!(proof_info.message, secp::pedersen::ProofMessage::empty());
// cannot rewind with a commitment to a different value
let commit3 = keychain.commit(4, &key_id).unwrap();
let proof_info =
proof::rewind(&keychain, commit3, Some(extra_data.to_vec().clone()), proof).unwrap();
assert_eq!(proof_info.success, false);
assert_eq!(proof_info.value, 0);
// cannot rewind with wrong extra committed data
let commit3 = keychain.commit(4, &key_id).unwrap();
let wrong_extra_data = [98u8; 64];
let _should_err = proof::rewind(
&keychain,
commit3,
Some(wrong_extra_data.to_vec().clone()),
proof,
)
.unwrap();
assert_eq!(proof_info.success, false);
assert_eq!(proof_info.value, 0);
} | rust_cleaned_test_functions.jsonl/49112 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 653
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
19154,
9698,
86757,
368,
341,
10217,
1376,
8819,
284,
9447,
1592,
8819,
486,
1499,
22644,
33809,
3715,
568,
15454,
543,
10217,
1376,
842,
284,
9447,
1592,
8819,
486,
27098,
3097,
842,
7,
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_google_cert() {
Context::new(
"google",
"www.google.com",
&[
include_bytes!("testdata/cert-google.0.der"),
include_bytes!("testdata/cert-google.1.der"),
],
)
.bench(100)
} | rust_cleaned_test_functions.jsonl/806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47155,
37097,
368,
341,
262,
9608,
486,
931,
1006,
286,
330,
17485,
756,
286,
330,
2136,
5713,
905,
756,
286,
609,
9640,
310,
2924,
12524,
17223,
92425,
2899,
529,
62645,
13,
15,
75819,
4461,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builtin_functions() {
let tests = vec![
// len
("len(\"\")", Some(Object::Int(0))),
("len(\"four\")", Some(Object::Int(4))),
("len(\"hello world\")", Some(Object::Int(11))),
("len([1, 2, 3])", Some(Object::Int(3))),
(
"len(1)",
Some(Object::Error(String::from(
"argument to `len` not supported, got 1",
))),
),
(
"len(\"one\", \"two\")",
Some(Object::Error(String::from(
"wrong number of arguments. got=2, want=1",
))),
),
// first
("first([1, 2, 3])", Some(Object::Int(1))),
("first([])", Some(Object::Null)),
(
"first([], [])",
Some(Object::Error(String::from(
"wrong number of arguments. got=2, want=1",
))),
),
(
"first(\"string\")",
Some(Object::Error(String::from(
"argument to `first` must be array. got \"string\"",
))),
),
(
"first(1)",
Some(Object::Error(String::from(
"argument to `first` must be array. got 1",
))),
),
// last
("last([1, 2, 3])", Some(Object::Int(3))),
("last([])", Some(Object::Null)),
(
"last([], [])",
Some(Object::Error(String::from(
"wrong number of arguments. got=2, want=1",
))),
),
(
"last(\"string\")",
Some(Object::Error(String::from(
"argument to `last` must be array. got \"string\"",
))),
),
(
"last(1)",
Some(Object::Error(String::from(
"argument to `last` must be array. got 1",
))),
),
// rest
(
"rest([1, 2, 3, 4])",
Some(Object::Array(vec![
Object::Int(2),
Object::Int(3),
Object::Int(4),
])),
),
(
"rest([2, 3, 4])",
Some(Object::Array(vec![Object::Int(3), Object::Int(4)])),
),
("rest([4])", Some(Object::Array(vec![]))),
("rest([])", Some(Object::Null)),
(
"rest([], [])",
Some(Object::Error(String::from(
"wrong number of arguments. got=2, want=1",
))),
),
(
"rest(\"string\")",
Some(Object::Error(String::from(
"argument to `rest` must be array. got \"string\"",
))),
),
(
"rest(1)",
Some(Object::Error(String::from(
"argument to `rest` must be array. got 1",
))),
),
// push
(
"push([1, 2, 3], 4)",
Some(Object::Array(vec![
Object::Int(1),
Object::Int(2),
Object::Int(3),
Object::Int(4),
])),
),
("push([], 1)", Some(Object::Array(vec![Object::Int(1)]))),
(
"let a = [1]; push(a, 2); a",
Some(Object::Array(vec![Object::Int(1)])),
),
(
"push([], [], [])",
Some(Object::Error(String::from(
"wrong number of arguments. got=3, want=2",
))),
),
(
"push(\"string\", 1)",
Some(Object::Error(String::from(
"argument to `push` must be array. got \"string\"",
))),
),
(
"push(1, 1)",
Some(Object::Error(String::from(
"argument to `push` must be array. got 1",
))),
),
];
for (input, expect) in tests {
assert_eq!(expect, eval(input));
}
} | rust_cleaned_test_functions.jsonl/12304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73829,
31708,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
442,
2422,
198,
310,
3489,
2892,
7,
22245,
899,
497,
4329,
12526,
486,
1072,
7,
15,
41749,
310,
3489,
2892,
36014,
34024,
62705,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tabs_with_too_large_size() {
let arg = format!("--tabs={}", u128::MAX);
let expected_error = format!("tab stop is too large '{}'", u128::MAX);
new_ucmd!().arg(arg).fails().stderr_contains(expected_error);
} | rust_cleaned_test_functions.jsonl/121810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57953,
6615,
2346,
78,
45228,
2368,
368,
341,
262,
1077,
1392,
284,
3561,
17223,
313,
30993,
1165,
9545,
575,
16,
17,
23,
486,
10586,
317,
262,
1077,
3601,
4096,
284,
3561,
17223,
6192,
2936,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_games_with_not_enough_players() {
let t = TournamentBuilder::new()
.add("sylvain")
.add("sarah")
.add("mathieu")
.finalize();
let games = t.create_games();
assert_eq!(0, games.len());
} | rust_cleaned_test_functions.jsonl/109242 | {
"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,
8657,
67370,
6615,
7913,
6205,
1384,
46721,
368,
341,
286,
1077,
259,
284,
18371,
3297,
486,
931,
741,
310,
659,
718,
445,
82,
14753,
466,
1138,
310,
659,
718,
445,
82,
42418,
1138,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf16_invalid() {
// completely positive cases tested above.
// lead + eof
assert!(String::from_utf16(&[0xD800]).is_err());
// lead + lead
assert!(String::from_utf16(&[0xD800, 0xD800]).is_err());
// isolated trail
assert!(String::from_utf16(&[0x0061, 0xDC00]).is_err());
// general
assert!(String::from_utf16(&[0xD800, 0xd801, 0xdc8b, 0xD800]).is_err());
} | rust_cleaned_test_functions.jsonl/46 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
16,
21,
31433,
368,
341,
286,
442,
6587,
6785,
5048,
12510,
3403,
624,
286,
442,
2990,
488,
76760,
198,
286,
2060,
10297,
703,
486,
1499,
39453,
16,
21,
2099,
58,
15,
15764,
23,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_inner_3_() {
let mut v = ArrayVec::<[i32; 4]>::new();
v.extend(1..);
assert_eq!(v.into_inner().unwrap(), [1, 2, 3, 4]);
} | rust_cleaned_test_functions.jsonl/36780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
34345,
62,
18,
62,
368,
341,
262,
1077,
5206,
348,
284,
2910,
10050,
27638,
58,
72,
18,
17,
26,
220,
19,
60,
6831,
931,
543,
262,
348,
15831,
7,
16,
496,
317,
262,
2060,
10714,
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,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vec_list_drain() {
let mut list = VecList::new();
list.drain();
assert!(list.is_empty());
list.push_back(0);
list.push_back(1);
list.push_back(-1);
list.drain();
assert!(list.is_empty());
} | rust_cleaned_test_functions.jsonl/11517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
26680,
466,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1140,
950,
29093,
543,
286,
2060,
10297,
1607,
2079,
15124,
5231,
286,
1140,
2552,
3895,
7,
15,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_key() {
let mut test = SdlTest::new();
let ev = test.console()._context.event().unwrap();
ev.push_event(Event::Quit { timestamp: 0 }).unwrap();
assert_eq!(Key::Eof, block_on(test.console().read_key()).unwrap());
ev.push_event(key_down(Keycode::C, Mod::LCTRLMOD)).unwrap();
assert_eq!(Key::Interrupt, block_on(test.console().read_key()).unwrap());
ev.push_event(key_down(Keycode::C, Mod::RCTRLMOD)).unwrap();
assert_eq!(Key::Interrupt, block_on(test.console().read_key()).unwrap());
ev.push_event(key_down(Keycode::D, Mod::LCTRLMOD)).unwrap();
assert_eq!(Key::Eof, block_on(test.console().read_key()).unwrap());
ev.push_event(key_down(Keycode::D, Mod::RCTRLMOD)).unwrap();
assert_eq!(Key::Eof, block_on(test.console().read_key()).unwrap());
ev.push_event(key_down(Keycode::D, Mod::empty())).unwrap();
ev.push_event(key_down(Keycode::Up, Mod::empty())).unwrap();
match block_on(test.console().read_key()).unwrap() {
Key::ArrowUp => (),
Key::Char('d') => panic!("Char key not ignored as intended"),
key => panic!("Unexpected key {:?}", key),
};
// Event::TextInput events.
test.verify("sdl-empty");
} | rust_cleaned_test_functions.jsonl/15269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
3097,
368,
341,
286,
1077,
5206,
1273,
284,
328,
8736,
2271,
486,
931,
1428,
286,
1077,
3637,
284,
1273,
47802,
95071,
2147,
5773,
1005,
15454,
1428,
286,
3637,
2552,
6748,
30469,
486,
42856... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_template() {
let route = Route::GetTemplate {
template_code: TEMPLATE_CODE,
};
assert_eq!(
route.to_string(),
format!(
"guilds/templates/{template_code}",
template_code = TEMPLATE_CODE
)
);
} | rust_cleaned_test_functions.jsonl/119855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8693,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
7275,
341,
310,
3811,
4136,
25,
67387,
10020,
345,
286,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
3148,
310,
3561,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_abs() {
let vals = vec![
("10", "10"),
("-10", "10"),
];
for &(x, y) in vals.iter() {
let a = BigDecimal::from_str(x).unwrap().abs();
let b = BigDecimal::from_str(y).unwrap();
assert!(a == b, "{} == {}", a, b);
}
} | rust_cleaned_test_functions.jsonl/75820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31170,
368,
341,
286,
1077,
28356,
284,
7486,
90515,
310,
3489,
16,
15,
497,
330,
16,
15,
4461,
310,
98670,
16,
15,
497,
330,
16,
15,
4461,
286,
9747,
286,
369,
22796,
87,
11,
379,
8,
304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.